Commented out some bus_dma code, until I can fix.

(bus_dma.c needs sync with alpha port!)
Continued progress on scsi driver.
A couple of other compiler warning level of tweaks.
This commit is contained in:
dbj 1998-07-19 21:41:16 +00:00
parent b4b261bbb0
commit 84676442e2
9 changed files with 200 additions and 87 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.2 1998/07/17 21:10:01 thorpej Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 1998/07/19 21:41:16 dbj Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -40,7 +40,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
#if 0
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.2 1998/07/17 21:10:01 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.3 1998/07/19 21:41:16 dbj Exp $");
#endif
#include <sys/param.h>
@ -337,6 +337,7 @@ _bus_dmamap_load_uio_direct(t, map, uio, flags)
struct uio *uio;
int flags;
{
#if 0
vm_offset_t lastaddr;
int seg, i, error, first;
bus_size_t minlen, resid;
@ -383,7 +384,8 @@ _bus_dmamap_load_uio_direct(t, map, uio, flags)
addr = (caddr_t)iov[i].iov_base + offset;
error = _bus_dmamap_load_buffer_direct_common(map, addr,
minlen, p, flags, &lastaddr, &seg, first);
minlen, p, flags,
&lastaddr, &seg, first);
first = 0;
offset = 0;
@ -394,6 +396,16 @@ _bus_dmamap_load_uio_direct(t, map, uio, flags)
map->dm_nsegs = seg + 1;
}
return (error);
#else
/* @@@ This needs to be re-synced with the
* arch/alpha/common/bus_dma.c driver. (and probably
* that should be moved to MI code. Unfortunately,
* the above addition won't compile until this is updated.
* Hopefully, I will get to this shortly.
* Darrin B. Jewell <dbj@netbsd.org> Sun Jul 19 17:28:16 1998
*/
panic("_bus_dmamap_load_uio_direct: not implemented");
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp.c,v 1.2 1998/07/13 04:01:39 dbj Exp $ */
/* $NetBSD: esp.c,v 1.3 1998/07/19 21:41:16 dbj Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -151,8 +151,6 @@ bus_dmamap_t esp_dmacb_continue __P((void *arg));
void esp_dmacb_completed __P((bus_dmamap_t map, void *arg));
void esp_dmacb_shutdown __P((void *arg));
void espattach __P((struct esp_softc *));
/* Linkup to the rest of the kernel */
struct cfattach esp_ca = {
sizeof(struct esp_softc), espmatch_intio, espattach_intio
@ -208,8 +206,12 @@ espmatch_intio(parent, cf, aux)
/* should probably probe here */
/* Should also probably set up data from config */
#if 1
/* this code isn't working yet, don't match on it */
return(0);
#else
return(1);
#endif
}
void
@ -223,58 +225,13 @@ espattach_intio(parent, self, aux)
esc->sc_bst = NEXT68K_INTIO_BUS_SPACE;
if (bus_space_map(esc->sc_bst, NEXT_P_SCSI,
ESP_DEVICE_SIZE, 0, &esc->sc_bsh)) {
panic("\n%s: can't map ncr53c90 registers\n",
panic("\n%s: can't map ncr53c90 registers",
sc->sc_dev.dv_xname);
}
sc->sc_id = 7;
sc->sc_freq = 20; /* Mhz */
/* @@@ Some ESP_DCTL bits probably need setting */
/* Set up SCSI DMA */
{
esc->sc_scsi_dma.nd_bst = NEXT68K_INTIO_BUS_SPACE;
if (bus_space_map(esc->sc_scsi_dma.nd_bst, NEXT_P_SCSI_CSR,
sizeof(struct dma_dev),0, &esc->sc_scsi_dma.nd_bsh)) {
panic("\n%s: can't map scsi DMA registers\n",
sc->sc_dev.dv_xname);
}
esc->sc_scsi_dma.nd_intr = NEXT_I_SCSI_DMA;
esc->sc_scsi_dma.nd_chaining_flag = 0;
esc->sc_scsi_dma.nd_shutdown_cb = &esp_dmacb_shutdown;
esc->sc_scsi_dma.nd_continue_cb = &esp_dmacb_continue;
esc->sc_scsi_dma.nd_completed_cb = &esp_dmacb_completed;
esc->sc_scsi_dma.nd_cb_arg = sc;
nextdma_config(&esc->sc_scsi_dma);
nextdma_init(&esc->sc_scsi_dma);
/* @@@ maxxfer is not set yet here */
{
int error;
if ((error = bus_dmamap_create(esc->sc_scsi_dma.nd_dmat,
sc->sc_maxxfer, 1, sc->sc_maxxfer,
0, BUS_DMA_ALLOCNOW, &esc->sc_dmamap)) != 0) {
panic("%s: can't create i/o DMA map, error = %d\n",
sc->sc_dev.dv_xname,error);
}
}
espattach(esc);
}
}
/*
* Attach this instance, and then all the sub-devices
*/
void
espattach(esc)
struct esp_softc *esc;
{
struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x;
/*
* Set up glue for MI code early; we use some of it here.
*/
@ -358,10 +315,42 @@ espattach(esc)
break;
}
/* Establish interrupt channel */
isrlink_autovec((int(*)__P((void*)))ncr53c9x_intr, sc,
NEXT_I_IPL(NEXT_I_SCSI), 0);
INTR_ENABLE(NEXT_I_SCSI);
/* @@@ Some ESP_DCTL bits probably need setting */
NCR_WRITE_REG(sc, ESP_DCTL,
ESPDCTL_20MHZ | ESPDCTL_INTENB | ESPDCTL_RESET);
DELAY(10);
NCR_WRITE_REG(sc, ESP_DCTL, ESPDCTL_20MHZ | ESPDCTL_INTENB);
DELAY(10);
/* Set up SCSI DMA */
{
esc->sc_scsi_dma.nd_bst = NEXT68K_INTIO_BUS_SPACE;
if (bus_space_map(esc->sc_scsi_dma.nd_bst, NEXT_P_SCSI_CSR,
sizeof(struct dma_dev),0, &esc->sc_scsi_dma.nd_bsh)) {
panic("\n%s: can't map scsi DMA registers",
sc->sc_dev.dv_xname);
}
esc->sc_scsi_dma.nd_intr = NEXT_I_SCSI_DMA;
esc->sc_scsi_dma.nd_chaining_flag = 0;
esc->sc_scsi_dma.nd_shutdown_cb = &esp_dmacb_shutdown;
esc->sc_scsi_dma.nd_continue_cb = &esp_dmacb_continue;
esc->sc_scsi_dma.nd_completed_cb = &esp_dmacb_completed;
esc->sc_scsi_dma.nd_cb_arg = sc;
nextdma_config(&esc->sc_scsi_dma);
nextdma_init(&esc->sc_scsi_dma);
{
int error;
if ((error = bus_dmamap_create(esc->sc_scsi_dma.nd_dmat,
sc->sc_maxxfer, 1, sc->sc_maxxfer,
0, BUS_DMA_ALLOCNOW, &esc->sc_dmamap)) != 0) {
panic("%s: can't create i/o DMA map, error = %d",
sc->sc_dev.dv_xname,error);
}
}
}
/* register interrupt stats */
evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt);
@ -372,10 +361,20 @@ espattach(esc)
#if 0
/* Turn on target selection using the `dma' method */
ncr53c9x_dmaselect = 1;
bootpath_store(1, NULL);
#else
ncr53c9x_dmaselect = 0;
#endif
esc->sc_slop_bgn_addr = 0;
esc->sc_slop_bgn_size = 0;
esc->sc_slop_end_addr = 0;
esc->sc_slop_end_size = 0;
esc->sc_datain = -1;
/* Establish interrupt channel */
isrlink_autovec((int(*)__P((void*)))ncr53c9x_intr, sc,
NEXT_I_IPL(NEXT_I_SCSI), 0);
INTR_ENABLE(NEXT_I_SCSI);
}
/*
@ -415,7 +414,18 @@ esp_dma_reset(sc)
struct ncr53c9x_softc *sc;
{
struct esp_softc *esc = (struct esp_softc *)sc;
if (esc->sc_dmamap->dm_mapsize != 0) {
bus_dmamap_unload(esc->sc_scsi_dma.nd_dmat, esc->sc_dmamap);
}
nextdma_reset(&esc->sc_scsi_dma);
esc->sc_slop_bgn_addr = 0;
esc->sc_slop_bgn_size = 0;
esc->sc_slop_end_addr = 0;
esc->sc_slop_end_size = 0;
esc->sc_datain = -1;
}
int
@ -439,19 +449,69 @@ esp_dma_setup(sc, addr, len, datain, dmasize)
struct esp_softc *esc = (struct esp_softc *)sc;
#ifdef DIAGNOSTIC
if (esc->sc_datain != -1) {
panic("%s: map already loaded in esp_dma_setup, datain = %d",
sc->sc_dev.dv_xname,esc->sc_datain);
if ((esc->sc_datain != -1) ||
(esc->sc_dmamap->dm_mapsize != 0)) {
panic("%s: map already loaded in esp_dma_setup\n"
"\tdatain = %d\n\tmapsize=%d",
sc->sc_dev.dv_xname,esc->sc_datain,esc->sc_dmamap->dm_mapsize);
}
#endif
/* Deal with DMA alignment issues, by stuffing the FIFO.
* This assumes that if bus_dmamap_load is given an aligned
* buffer, then it will generate aligned hardware addresses
* to give to the device. Perhaps that is not a good assumption,
* but it is probably true. [dbj@netbsd.org:19980719.0135EDT]
*/
{
int error;
error = bus_dmamap_load(esc->sc_scsi_dma.nd_dmat,
esc->sc_dmamap, *addr, *dmasize, NULL, BUS_DMA_NOWAIT);
if (error) {
panic("%s: can't start DMA\n");
int slop_bgn_size; /* # bytes to be fifo'd at beginning */
int slop_end_size; /* # bytes to be fifo'd at end */
{
u_long bgn = (u_long)(*addr);
u_long end = (u_long)(*addr+*dmasize);
slop_bgn_size = DMA_BEGINALIGNMENT-(bgn % DMA_BEGINALIGNMENT);
slop_end_size = end % DMA_ENDALIGNMENT;
}
/* Check to make sure we haven't counted the slop twice
* as would happen for a very short dma buffer */
if (slop_bgn_size+slop_end_size > *dmasize) {
#if defined(DIAGNOSTIC)
if ((slop_bgn_size != *dmasize) ||
(slop_end_size != *dmasize)) {
printf("slop_bgn_size %d",slop_bgn_size);
printf("slop_end_size %d",slop_bgn_size);
panic("%s: confused alignment calculation\n"
"\tslop_bgn_size %d\n\tslop_end_size %d\n\tdmasize %d",
sc->sc_dev.dv_xname,slop_bgn_size,slop_end_size,*dmasize);
}
#endif
slop_end_size = 0;
}
if (slop_bgn_size+slop_end_size < *dmasize) {
int error;
error = bus_dmamap_load(esc->sc_scsi_dma.nd_dmat,
esc->sc_dmamap,
*addr+slop_bgn_size,
*dmasize-(slop_bgn_size+slop_end_size),
NULL, BUS_DMA_NOWAIT);
if (error) {
panic("%s: can't load dma map. error = %d",error);
}
} else {
/* If there's no DMA, then coalesce the fifo buffers */
slop_bgn_size += slop_end_size;
slop_end_size = 0;
}
esc->sc_slop_bgn_addr = *addr;
esc->sc_slop_bgn_size = slop_bgn_size;
esc->sc_slop_end_addr = (*addr+*dmasize)-slop_end_size;
esc->sc_slop_end_size = slop_end_size;
}
esc->sc_datain = datain;
@ -464,8 +524,23 @@ esp_dma_go(sc)
struct ncr53c9x_softc *sc;
{
struct esp_softc *esc = (struct esp_softc *)sc;
nextdma_start(&esc->sc_scsi_dma,
(esc->sc_datain ? DMACSR_READ : DMACSR_WRITE));
/* @@@ Stuff the bgn slop into fifo */
if (esc->sc_dmamap->dm_mapsize != 0) {
nextdma_start(&esc->sc_scsi_dma,
(esc->sc_datain ? DMACSR_READ : DMACSR_WRITE));
} else {
#if defined(DIAGNOSTIC)
/* @@@ verify that end slop is 0, since the shutdown
* callback will not be called.
*/
#endif
esc->sc_slop_bgn_addr = 0;
esc->sc_slop_bgn_size = 0;
esc->sc_slop_end_addr = 0;
esc->sc_slop_end_size = 0;
}
}
void
@ -545,5 +620,12 @@ esp_dmacb_shutdown(arg)
#endif
bus_dmamap_unload(esc->sc_scsi_dma.nd_dmat, esc->sc_dmamap);
/* @@@ Stuff the end slop into fifo */
esc->sc_datain = -1;
esc->sc_slop_bgn_addr = 0;
esc->sc_slop_bgn_size = 0;
esc->sc_slop_end_addr = 0;
esc->sc_slop_end_size = 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: espvar.h,v 1.2 1998/07/13 04:01:39 dbj Exp $ */
/* $NetBSD: espvar.h,v 1.3 1998/07/19 21:41:16 dbj Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -44,4 +44,8 @@ struct esp_softc {
bus_space_handle_t sc_bsh; /* the device registers */
bus_dmamap_t sc_dmamap; /* i/o dma map */
int sc_datain; /* dma direction for map */
caddr_t sc_slop_bgn_addr; /* bytes to be fifo'd at beginning */
caddr_t sc_slop_end_addr; /* bytes to be fifo'd at end */
int sc_slop_bgn_size; /* # bytes to be fifo'd at beginning */
int sc_slop_end_size; /* # bytes to be fifo'd at end */
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb8795.c,v 1.6 1998/07/11 07:06:16 dbj Exp $ */
/* $NetBSD: mb8795.c,v 1.7 1998/07/19 21:41:16 dbj Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@ -240,7 +240,7 @@ mb8795_config(sc)
/****************************************************************/
#if 0
#define XCHR(x) "0123456789abcdef"[(x) & 0xf]
static void
hex_dump(unsigned char *pkt, size_t len)
@ -260,7 +260,7 @@ hex_dump(unsigned char *pkt, size_t len)
}
printf("\n");
}
#endif
/*
* Controller receive interrupt.
@ -854,7 +854,6 @@ mb8795_txdma_completed(map, arg)
void *arg;
{
struct mb8795_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
DPRINTF(("%s: mb8795_txdma_completed()\n",sc->sc_dev.dv_xname));

View File

@ -1,4 +1,4 @@
/* $NetBSD: nextdma.c,v 1.2 1998/07/01 22:14:44 dbj Exp $ */
/* $NetBSD: nextdma.c,v 1.3 1998/07/19 21:41:17 dbj Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@ -185,7 +185,8 @@ next_dmamap_sync(t, map, offset, len, ops)
{
/* flush/purge the cache.
* assumes pointers are aligned
* should probably be fixed to use offset and len
* @@@ should probably be fixed to use offset and len args.
* should also optimize this to work on pages for larger regions?
*/
if (ops & BUS_DMASYNC_PREWRITE) {
int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nextdmareg.h,v 1.1.1.1 1998/06/09 07:53:05 dbj Exp $ */
/* $NetBSD: nextdmareg.h,v 1.2 1998/07/19 21:41:17 dbj Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@ -29,6 +29,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* I think the chip can handle 64k per chain, but I don't
* know how much per segment for sure. We might try
* experimenting with this value. Can we cross page boundaries?
*/
#define MAX_DMASIZE 8192
/* from nextdev/dma.h */

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.5 1998/07/04 22:18:34 jonathan Exp $ */
/* $NetBSD: machdep.c,v 1.6 1998/07/19 21:41:17 dbj Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -174,6 +174,15 @@ next68k_init()
{
int i;
#if 0
/* @@@ Since the boot rom doesn't know how to pass in
* these parameters yet, I manually set them here while debugging
* the scsi driver.
* Darrin B. Jewell <dbj@netbsd.org> Sun Jul 19 06:14:52 1998
*/
boothowto = RB_KDB | RB_ASKNAME;
#endif
/* Initialize the interrupt handlers. */
isrinit();
@ -228,13 +237,11 @@ consinit()
cninit();
#ifdef DDB
#ifdef DEBUG
#if 0
printf("This kernel was compiled with DEBUG: entering debugger\n");
Debugger();
#endif
#endif
if (boothowto & RB_KDB) {
Debugger();
}
#endif
init = 1;
}
else

View File

@ -1,4 +1,4 @@
/* $NetBSD: nextrom.c,v 1.4 1998/07/11 07:06:17 dbj Exp $ */
/* $NetBSD: nextrom.c,v 1.5 1998/07/19 21:41:17 dbj Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@ -114,6 +114,11 @@ next68k_bootargs(args)
msize4 = 0x200000;
msize1 = 0x80000; /* ? */
ROM_PUTS("Looks like a NeXT_WARP9C\r\n");
} else if (MONRELOC(char,MG_machine_type) == NeXT_WARP9) {
msize16 = 0x1000000;
msize4 = 0x400000;
msize1 = 0x100000;
ROM_PUTS("Looks like a NeXT_WARP9\r\n");
} else {
msize16 = 0x100000;
msize4 = 0x100000;

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.2 1998/07/07 00:16:34 dbj Exp $
# $NetBSD: Makefile,v 1.3 1998/07/19 21:41:17 dbj Exp $
S= ${.CURDIR}/../../../..
@ -24,8 +24,7 @@ RELOC= 4380000
INCLUDES+= -I${.CURDIR} -I${.CURDIR}/obj.${MACHINE} -I${S}/arch -I${S} -I${S}/lib/libsa -I${S}/lib/libkern
DEFS+= -D_STANDALONE -DMC68040 -DSUPPORT_BOOTP -DSUPPORT_DHCP -DDEBUG # -DEN_DEBUG -DNETIF_DEBUG # -DSD_DEBUG -DSCSI_DEBUG
SAMISCCPPFLAGS= -DSUPPORT_DHCP -DSUPPORT_BOOTP -DINSECURE # -DBOOTP_DEBUG -DETHER_DEBUG -DNET_DEBUG # -DNETIF_DEBUG -DNFS_DEBUG -DARP_DEBUG
#COPTS+= -Wall -Wno-main
COPTS+= -Wall
COPTS+= -Wall -Wno-main
CFLAGS+= -nostdinc ${INCLUDES} ${DEFS}
LIBCRT0=