From: niklas Date: Sun, 8 Dec 1996 01:03:02 +0000 (+0000) Subject: Merge to NetBSD 961107, i.e. mostly new bus.h X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=016fa7cdb8966b427555e42dba460f41a1de86ff;p=openbsd Merge to NetBSD 961107, i.e. mostly new bus.h --- diff --git a/sys/dev/tc/asc.c b/sys/dev/tc/asc.c index 16086da694a..d43a317b199 100644 --- a/sys/dev/tc/asc.c +++ b/sys/dev/tc/asc.c @@ -1,4 +1,4 @@ -/* $NetBSD: asc.c,v 1.19.2.4 1996/07/17 20:04:38 jtc Exp $ */ +/* $NetBSD: asc.c,v 1.31 1996/10/13 01:38:35 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -128,6 +128,7 @@ #include #include #include +#include #include #include @@ -148,12 +149,10 @@ #include #include -#include /*#define readback(a) { register int foo; wbflush(); foo = (a); }*/ #define readback(a) { register int foo; foo = (a); } -extern int pmax_boardtype; /* * In 4ns ticks. @@ -194,10 +193,8 @@ int asc_to_scsi_period[] = { }; /* - * Internal forward declarations. + * Debugging log of SCSI operations. */ -static void asc_reset(); -static void asc_startcmd(); #ifdef DEBUG int asc_debug = 1; @@ -217,6 +214,14 @@ struct asc_log { void asc_DumpLog __P((char *str)); #endif + +/* + * Script, scsi state, and device softc structure declarations. + * script pointers occur in both scsi state and the softc, + * so they are defined first. + */ + + /* * Scripts are entries in a state machine table. * A script has four parts: a pre-condition, an action, a command to the chip, @@ -230,32 +235,49 @@ void asc_DumpLog __P((char *str)); * script proceeds if the action routine returns TRUE. * See asc_intr() for how and where this is all done. */ +struct asc_softc; typedef struct script { int condition; /* expected state at interrupt time */ - int (*action)(); /* extra operations */ + + int (*action) /* extra operations */ + __P((register struct asc_softc *asc, register int status, + register int ss, register int ir)); int command; /* command to the chip */ struct script *next; /* index into asc_scripts for next state */ } script_t; + +/* + * script definitions + */ + /* Matching on the condition value */ #define SCRIPT_MATCH(ir, csr) ((ir) | (((csr) & 0x67) << 8)) +/* + * A typedef for a script function, to use in forward declarations. + */ +typedef int +script_fn_t __P((register struct asc_softc *asc, register int status, + register int ss, register int ir)); + + /* forward decls of script actions */ -static int script_nop(); /* when nothing needed */ -static int asc_end(); /* all come to an end */ -static int asc_get_status(); /* get status from target */ -static int asc_dma_in(); /* start reading data from target */ -static int asc_last_dma_in(); /* cleanup after all data is read */ -static int asc_resume_in(); /* resume data in after a message */ -static int asc_resume_dma_in(); /* resume DMA after a disconnect */ -static int asc_dma_out(); /* send data to target via dma */ -static int asc_last_dma_out(); /* cleanup after all data is written */ -static int asc_resume_out(); /* resume data out after a message */ -static int asc_resume_dma_out(); /* resume DMA after a disconnect */ -static int asc_sendsync(); /* negotiate sync xfer */ -static int asc_replysync(); /* negotiate sync xfer */ -static int asc_msg_in(); /* process a message byte */ -static int asc_disconnect(); /* process an expected disconnect */ +static script_fn_t script_nop; /* when nothing needed */ +static script_fn_t asc_end; /* all come to an end */ +static script_fn_t asc_get_status; /* get status from target */ +static script_fn_t asc_dma_in; /* start reading data from target */ +static script_fn_t asc_last_dma_in; /* cleanup after all data is read */ +static script_fn_t asc_resume_in; /* resume data in after a message */ +static script_fn_t asc_resume_dma_in; /* resume DMA after a disconnect */ +static script_fn_t asc_dma_out; /* send data to target via dma */ +static script_fn_t asc_last_dma_out; /* cleanup after all data is written */ +static script_fn_t asc_resume_out; /* resume data out after a message */ +static script_fn_t asc_resume_dma_out; /* resume DMA after a disconnect */ +static script_fn_t asc_sendsync; /* negotiate sync xfer */ +static script_fn_t asc_replysync; /* negotiate sync xfer */ +static script_fn_t asc_msg_in; /* process a message byte */ +static script_fn_t asc_disconnect; /* process an expected disconnect */ /* Define the index into asc_scripts for various state transitions */ #define SCRIPT_DATA_IN 0 @@ -379,93 +401,15 @@ script_t asc_scripts[] = { &asc_scripts[SCRIPT_GET_STATUS]}, }; -/* - * State kept for each active SCSI device. - */ -typedef struct scsi_state { - script_t *script; /* saved script while processing error */ - int statusByte; /* status byte returned during STATUS_PHASE */ - int error; /* errno to pass back to device driver */ - u_char *dmaBufAddr; /* DMA buffer address */ - u_int dmaBufSize; /* DMA buffer size */ - int dmalen; /* amount to transfer in this chunk */ - int dmaresid; /* amount not transfered if chunk suspended */ - int buflen; /* total remaining amount of data to transfer */ - char *buf; /* current pointer within scsicmd->buf */ - int flags; /* see below */ - int msglen; /* number of message bytes to read */ - int msgcnt; /* number of message bytes received */ - u_char sync_period; /* DMA synchronous period */ - u_char sync_offset; /* DMA synchronous xfer offset or 0 if async */ - u_char msg_out; /* next MSG_OUT byte to send */ - u_char msg_in[16]; /* buffer for multibyte messages */ -} State; - -/* state flags */ -#define DISCONN 0x001 /* true if currently disconnected from bus */ -#define DMA_IN_PROGRESS 0x002 /* true if data DMA started */ -#define DMA_IN 0x004 /* true if reading from SCSI device */ -#define DMA_OUT 0x010 /* true if writing to SCSI device */ -#define DID_SYNC 0x020 /* true if synchronous offset was negotiated */ -#define TRY_SYNC 0x040 /* true if try neg. synchronous offset */ -#define PARITY_ERR 0x080 /* true if parity error seen */ -#define CHECK_SENSE 0x100 /* true if doing sense command */ - -/* - * State kept for each active SCSI host interface (53C94). - */ -struct asc_softc { - struct device sc_dev; /* us as a device */ - asc_regmap_t *regs; /* chip address */ - volatile int *dmar; /* DMA address register address */ - u_char *buff; /* RAM buffer address (uncached) */ - int sc_id; /* SCSI ID of this interface */ - int myidmask; /* ~(1 << myid) */ - int state; /* current SCSI connection state */ - int target; /* target SCSI ID if busy */ - script_t *script; /* next expected interrupt & action */ - ScsiCmd *cmd[ASC_NCMD]; /* active command indexed by SCSI ID */ - State st[ASC_NCMD]; /* state info for each active command */ - void (*dma_start)(); /* Start dma routine */ - void (*dma_end)(); /* End dma routine */ - u_char *dma_next; - int dma_xfer; /* Dma len still to go */ - int min_period; /* Min transfer period clk/byte */ - int max_period; /* Max transfer period clk/byte */ - int ccf; /* CCF, whatever that really is? */ - int timeout_250; /* 250ms timeout */ - int tb_ticks; /* 4ns. ticks/tb channel ticks */ -#ifdef USE_NEW_SCSI - struct scsi_link sc_link; /* scsi link struct */ -#endif -}; - -#define ASC_STATE_IDLE 0 /* idle state */ -#define ASC_STATE_BUSY 1 /* selecting or currently connected */ -#define ASC_STATE_TARGET 2 /* currently selected as target */ -#define ASC_STATE_RESEL 3 /* currently waiting for reselect */ -typedef struct asc_softc *asc_softc_t; +#include /* - * Dma operations. - */ -#define ASCDMA_READ 1 -#define ASCDMA_WRITE 2 -static void tb_dma_start(), tb_dma_end(), asic_dma_start(), asic_dma_end(); -extern u_long asc_iomem; - - -/* - * Autoconfiguration data for config. + * Internal forward declarations. */ -int ascmatch __P((struct device * parent, void *cfdata, void *aux)); -void ascattach __P((struct device *parent, struct device *self, void *aux)); -int ascprint(void*, const char*); - -struct cfattach asc_ca = { - sizeof(struct asc_softc), ascmatch, ascattach -}; +static void asc_reset __P((asc_softc_t asc, asc_regmap_t *regs)); +static void asc_startcmd __P((asc_softc_t asc, int target)); +static void asc_timeout __P((void *arg)); extern struct cfdriver asc_cd; struct cfdriver asc_cd = { @@ -493,112 +437,51 @@ struct scsi_device asc_dev = { /* * Definition of the controller for the old auto-configuration program. */ -void asc_start(); +void asc_start __P((register ScsiCmd *scsicmd)); int asc_intr __P ((void *asc)); struct pmax_driver ascdriver = { "asc", NULL, asc_start, 0, asc_intr, }; +void asc_minphys __P((struct buf *bp)); -extern struct cfdriver ioasic_cd; /* XXX */ /* - * Match driver based on name + * bus-parent shared attach function */ -int -ascmatch(parent, match, aux) - struct device *parent; - void *match; - void *aux; -{ - struct ioasicdev_attach_args *d = aux; - struct tc_attach_args *t = aux; - void *ascaddr; - - /*if (parent->dv_cfdata->cf_driver == &ioasic_cd) */ - if (strncmp(d->iada_modname, "asc", TC_ROM_LLEN) && - strncmp(d->iada_modname, "PMAZ-AA ", TC_ROM_LLEN)) - return (0); - - if (parent->dv_cfdata->cf_driver == &ioasic_cd) - ascaddr = (void*)d->iada_addr; - else - ascaddr = (void*)t->ta_addr; - - if (badaddr(ascaddr + ASC_OFFSET_53C94, 4)) - return (0); - - return (1); -} - void -ascattach(parent, self, aux) - struct device *parent; - struct device *self; - void *aux; +ascattach(asc, dmabufsize, bus_speed) + register asc_softc_t asc; + int dmabufsize; { - register struct ioasicdev_attach_args *d = aux; - register struct tc_attach_args *t = aux; - register asc_softc_t asc = (asc_softc_t) self; register asc_regmap_t *regs; int id, s, i; - int bufsiz; - void *ascaddr; int unit; - if (asc->sc_dev.dv_parent->dv_cfdata->cf_driver == &ioasic_cd) { - ascaddr = (void*)MACH_PHYS_TO_UNCACHED(d->iada_addr); - } else { - ascaddr = (void*)MACH_PHYS_TO_UNCACHED(t->ta_addr); - } unit = asc->sc_dev.dv_unit; - /* - * Initialize hw descriptor, cache some pointers - */ - asc->regs = (asc_regmap_t *)(ascaddr + ASC_OFFSET_53C94); - /* * Set up machine dependencies. - * (1) how to do dma - * (2) timing based on turbochannel frequency + * (1) timing based on turbochannel frequency */ - if (asc->sc_dev.dv_parent->dv_cfdata->cf_driver == &ioasic_cd) { - asc->buff = (u_char *)MACH_PHYS_TO_UNCACHED(asc_iomem); - bufsiz = 8192; - *((volatile int *)IOASIC_REG_SCSI_DMAPTR(ioasic_base)) = -1; - *((volatile int *)IOASIC_REG_SCSI_DMANPTR(ioasic_base)) = -1; - *((volatile int *)IOASIC_REG_SCSI_SCR(ioasic_base)) = 0; - asc->dma_start = asic_dma_start; - asc->dma_end = asic_dma_end; - } else - { - /* - * Fall through for turbochannel option. - */ - asc->dmar = (volatile int *)(ascaddr + ASC_OFFSET_DMAR); - asc->buff = (u_char *)(ascaddr + ASC_OFFSET_RAM); - bufsiz = PER_TGT_DMA_SIZE; - asc->dma_start = tb_dma_start; - asc->dma_end = tb_dma_end; - }; + /* dma setup done in parent-specific attach code */ + /* * Now for timing. The 3max has a 25Mhz tb whereas the 3min and * maxine are 12.5Mhz. */ - switch (pmax_boardtype) { - case DS_3MAX: - case DS_3MAXPLUS: + switch (bus_speed) { + case ASC_SPEED_25_MHZ: asc->min_period = ASC_MIN_PERIOD25; asc->max_period = ASC_MAX_PERIOD25; asc->ccf = ASC_CCF(25); asc->timeout_250 = ASC_TIMEOUT_250(25, asc->ccf); asc->tb_ticks = 10; break; - case DS_3MIN: - case DS_MAXINE: + + case ASC_SPEED_12_5_MHZ: default: asc->min_period = ASC_MIN_PERIOD12; asc->max_period = ASC_MAX_PERIOD12; @@ -650,21 +533,13 @@ ascattach(parent, self, aux) * We may want to try ping ponging buffers later. */ for (i = 0; i < ASC_NCMD; i++) { - asc->st[i].dmaBufAddr = asc->buff + bufsiz * i; - asc->st[i].dmaBufSize = bufsiz; + asc->st[i].dmaBufAddr = asc->buff + dmabufsize * i; + asc->st[i].dmaBufSize = dmabufsize; } /* Hack for old-sytle SCSI-device probe */ (void) pmax_add_scsi(&ascdriver, unit); - /* tie pseudo-slot to device */ - if (asc->sc_dev.dv_parent->dv_cfdata->cf_driver == &ioasic_cd) - ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_BIO, - asc_intr, asc); - else - tc_intr_establish(parent, t->ta_cookie, TC_IPL_BIO, - asc_intr, asc); - printf(": target %d\n", id); @@ -672,6 +547,7 @@ ascattach(parent, self, aux) /* * fill in the prototype scsi_link. */ + asc->sc_link.channel = SCSI_CHANNEL_ONLY_ONE; asc->sc_link.adapter_softc = asc; asc->sc_link.adapter_target = asc->sc_id; asc->sc_link.adapter = &asc_switch; @@ -681,21 +557,11 @@ ascattach(parent, self, aux) /* * Now try to attach all the sub-devices. */ - config_found(self, &asc->sc_link, ascprint); + config_found(self, &asc->sc_link, scsiprint); #endif /* USE_NEW_SCSI */ } -/* - * Does anyone actually use this, and what for ? - */ -int -ascprint(aux, name) - void *aux; - const char *name; -{ - return -1; -} /* * Per Fogelstrom's SCSI Driver breaks down request transfer size. */ @@ -734,6 +600,12 @@ asc_start(scsicmd) splx(s); } asc->cmd[sdp->sd_drive] = scsicmd; + /* + * Kludge: use a 60 second timeout if data is being transfered, + * otherwise use a 30 minute timeout. + */ + timeout(asc_timeout, scsicmd, hz * (scsicmd->buflen == 0 ? + 1800 : 60)); asc_startcmd(asc, sdp->sd_drive); splx(s); } @@ -775,17 +647,17 @@ asc_reset(asc, regs) * Reset chip and wait till done */ regs->asc_cmd = ASC_CMD_RESET; - wbflush(); DELAY(25); + tc_syncbus(); DELAY(25); /* spec says this is needed after reset */ regs->asc_cmd = ASC_CMD_NOP; - wbflush(); DELAY(25); + tc_syncbus(); DELAY(25); /* * Set up various chip parameters */ regs->asc_ccf = asc->ccf; - wbflush(); DELAY(25); + tc_syncbus(); DELAY(25); regs->asc_sel_timo = asc->timeout_250; /* restore our ID */ regs->asc_cnfg1 = asc->sc_id | ASC_CNFG1_P_CHECK; @@ -796,7 +668,7 @@ asc_reset(asc, regs) ASC_TC_PUT(regs, 0); regs->asc_syn_p = asc->min_period; regs->asc_syn_o = 0; /* async for now */ - wbflush(); + tc_mb(); } /* @@ -838,8 +710,8 @@ asc_startcmd(asc, target) #ifdef DEBUG if (asc_debug > 1) { printf("asc_startcmd: %s target %d cmd %x len %d\n", - scsicmd->sd->sd_driver->d_name, target, - scsicmd->cmd[0], scsicmd->buflen); + scsicmd->sd->sd_driver->d_name, target, + scsicmd->cmd[0], scsicmd->buflen); } #endif @@ -905,7 +777,7 @@ asc_startcmd(asc, target) /* preload the FIFO with the message to be sent */ regs->asc_fifo = SCSI_DIS_REC_IDENTIFY; - wbflush(); + tc_mb(); /* initialize the DMA */ (*asc->dma_start)(asc, state, state->dmaBufAddr, ASCDMA_WRITE); @@ -1061,7 +933,7 @@ again: ASC_TC_GET(regs, len); fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT; printf("asc_intr: ignoring strange interrupt"); - printf(" tc %d fifo residue\n", len, fifo); + printf(" tc %d fifo residue %d\n", len, fifo); goto done; } /* FALLTHROUGH */ @@ -1123,7 +995,7 @@ again: printf("asc_intr: dmalen %d len %d fifo %d\n", state->dmalen, len, fifo); /* XXX */ regs->asc_cmd = ASC_CMD_FLUSH; - wbflush(); + tc_mb(); readback(regs->asc_cmd); DELAY(2); } @@ -1352,7 +1224,7 @@ again: */ done: - wbflush(); + tc_mb(); /* watch out for HW race conditions and setup & hold time violations */ ir = regs->asc_status; while (ir != (status = regs->asc_status)) @@ -1368,7 +1240,7 @@ abort: #if 0 panic("asc_intr"); #else - boot(4); /* XXX */ + boot(4, NULL); /* XXX */ #endif } @@ -1451,6 +1323,7 @@ asc_end(asc, status, ss, ir) scsicmd = asc->cmd[target]; asc->cmd[target] = (ScsiCmd *)0; state = &asc->st[target]; + untimeout(asc_timeout, scsicmd); #ifdef DEBUG if (asc_debug > 1) { @@ -1544,13 +1417,36 @@ asc_dma_in(asc, status, ss, ir) state->buflen -= len; } -#ifdef DEBUG if (!(state->flags & DMA_IN_PROGRESS) && (regs->asc_flags & ASC_FLAGS_FIFO_CNT) != 0) { - printf("asc_dma_in: FIFO count %x flags %x\n", - regs->asc_flags, state->flags); + volatile int async_fifo_junk = 0; + + /* + * If the target is asynchronous, the FIFO contains + * a byte of garbage. (see the Mach mk84 53c94 driver, + * where this occurs on tk-50s and exabytes.) + * It also occurs on asynch disks like SCSI-1 disks. + * Recover by reading the byte of junk from the fifo if, + * and only if, the target is async. If the target is + * synch, there is no junk, and reading the fifo + * deadlocks our SCSI state machine. + */ + if (state->sync_offset == 0) + async_fifo_junk = regs->asc_fifo; +#ifdef DEBUG + printf("%s: asc_dma_in: FIFO count %x flags %x sync_offset %d", + asc->sc_dev.dv_xname, regs->asc_flags, + state->flags, state->sync_offset); + if (state->sync_offset != 0) + printf("\n"); + else + printf(" unexpected fifo data %x\n", async_fifo_junk); +#ifdef DIAGNOSTIC + asc_DumpLog("asc_dma_in"); +#endif /* DIAGNOSTIC */ +#endif /* DEBUG */ + } -#endif /* setup to start reading the next chunk */ len = state->buflen; #ifdef DEBUG @@ -1884,13 +1780,13 @@ asc_sendsync(asc, status, ss, ir) /* send the extended synchronous negotiation message */ regs->asc_fifo = SCSI_EXTENDED_MSG; - wbflush(); + tc_mb(); regs->asc_fifo = 3; - wbflush(); + tc_mb(); regs->asc_fifo = SCSI_SYNCHRONOUS_XFER; - wbflush(); + tc_mb(); regs->asc_fifo = SCSI_MIN_PERIOD; - wbflush(); + tc_mb(); regs->asc_fifo = ASC_MAX_OFFSET; /* state to resume after we see the sync reply message */ state->script = asc->script + 2; @@ -1915,13 +1811,13 @@ asc_replysync(asc, status, ss, ir) #endif /* send synchronous transfer in response to a request */ regs->asc_fifo = SCSI_EXTENDED_MSG; - wbflush(); + tc_mb(); regs->asc_fifo = 3; - wbflush(); + tc_mb(); regs->asc_fifo = SCSI_SYNCHRONOUS_XFER; - wbflush(); + tc_mb(); regs->asc_fifo = asc_to_scsi_period[state->sync_period] * asc->tb_ticks; - wbflush(); + tc_mb(); regs->asc_fifo = state->sync_offset; regs->asc_cmd = ASC_CMD_XFER_INFO; readback(regs->asc_cmd); @@ -2146,131 +2042,25 @@ asc_disconnect(asc, status, ss, ir) return (1); } -/* - * DMA handling routines. For a turbochannel device, just set the dmar. - * For the I/O ASIC, handle the actual DMA interface. - */ -static void -tb_dma_start(asc, state, cp, flag) - asc_softc_t asc; - State *state; - caddr_t cp; - int flag; -{ - - if (flag == ASCDMA_WRITE) - *asc->dmar = ASC_DMAR_WRITE | ASC_DMA_ADDR(cp); - else - *asc->dmar = ASC_DMA_ADDR(cp); -} - -static void -tb_dma_end(asc, state, flag) - asc_softc_t asc; - State *state; - int flag; -{ - -} -static void -asic_dma_start(asc, state, cp, flag) - asc_softc_t asc; - State *state; - caddr_t cp; - int flag; +void +asc_timeout(arg) + void *arg; { - register volatile u_int *ssr = (volatile u_int *) - IOASIC_REG_CSR(ioasic_base); - u_int phys, nphys; - - /* stop DMA engine first */ - *ssr &= ~IOASIC_CSR_DMAEN_SCSI; - *((volatile int *)IOASIC_REG_SCSI_SCR(ioasic_base)) = 0; - - phys = MACH_CACHED_TO_PHYS(cp); - cp = (caddr_t)mips_trunc_page(cp + NBPG); - nphys = MACH_CACHED_TO_PHYS(cp); - - asc->dma_next = cp; - asc->dma_xfer = state->dmalen - (nphys - phys); - - *(volatile int *)IOASIC_REG_SCSI_DMAPTR(ioasic_base) = - IOASIC_DMA_ADDR(phys); - *(volatile int *)IOASIC_REG_SCSI_DMANPTR(ioasic_base) = - IOASIC_DMA_ADDR(nphys); - if (flag == ASCDMA_READ) - *ssr |= IOASIC_CSR_SCSI_DIR | IOASIC_CSR_DMAEN_SCSI; - else - *ssr = (*ssr & ~IOASIC_CSR_SCSI_DIR) | IOASIC_CSR_DMAEN_SCSI; - wbflush(); -} + int s = splbio(); + ScsiCmd *scsicmd = (ScsiCmd *) arg; -static void -asic_dma_end(asc, state, flag) - asc_softc_t asc; - State *state; - int flag; -{ - register volatile u_int *ssr = (volatile u_int *) - IOASIC_REG_CSR(ioasic_base); - register volatile u_int *dmap = (volatile u_int *) - IOASIC_REG_SCSI_DMAPTR(ioasic_base); - register u_short *to; - register int w; - int nb; - - *ssr &= ~IOASIC_CSR_DMAEN_SCSI; - to = (u_short *)MACH_PHYS_TO_CACHED(*dmap >> 3); - *dmap = -1; - *((volatile int *)IOASIC_REG_SCSI_DMANPTR(ioasic_base)) = -1; - wbflush(); - - if (flag == ASCDMA_READ) { - MachFlushDCache(MACH_PHYS_TO_CACHED( - MACH_UNCACHED_TO_PHYS(state->dmaBufAddr)), state->dmalen); - if ( (nb = *((int *)IOASIC_REG_SCSI_SCR(ioasic_base))) != 0) { - /* pick up last upto6 bytes, sigh. */ - - /* Last byte really xferred is.. */ - w = *(int *)IOASIC_REG_SCSI_SDR0(ioasic_base); - *to++ = w; - if (--nb > 0) { - w >>= 16; - *to++ = w; - } - if (--nb > 0) { - w = *(int *)IOASIC_REG_SCSI_SDR1(ioasic_base); - *to++ = w; - } - } - } + printf("asc_timeout: cmd %p drive %d\n", scsicmd, scsicmd->sd->sd_drive); +#ifdef DEBUG + asc_DumpLog("asc_timeout"); +#endif +#if 0 + panic("asc_timeout"); +#else + boot(4, NULL); /* XXX */ +#endif } -#ifdef notdef -/* - * Called by asic_intr() for scsi dma pointer update interrupts. - */ -void -asc_dma_intr() -{ - asc_softc_t asc = &asc_cd.cd_devs[0]; /*XXX*/ - u_int next_phys; - - asc->dma_xfer -= NBPG; - if (asc->dma_xfer <= -NBPG) { - volatile u_int *ssr = (volatile u_int *) - IOASIC_REG_CSR(ioasic_base); - *ssr &= ~IOASIC_CSR_DMAEN_SCSI; - } else { - asc->dma_next += NBPG; - next_phys = MACH_CACHED_TO_PHYS(asc->dma_next); - } - *(volatile int *)IOASIC_REG_SCSI_DMANPTR(ioasic_base) = - IOASIC_DMA_ADDR(next_phys); - wbflush(); -} -#endif /*notdef*/ #ifdef DEBUG void diff --git a/sys/dev/tc/devlist2h.awk b/sys/dev/tc/devlist2h.awk index c0b69a79943..9164d87ac26 100644 --- a/sys/dev/tc/devlist2h.awk +++ b/sys/dev/tc/devlist2h.awk @@ -1,6 +1,6 @@ #! /usr/bin/awk -f -# $OpenBSD: devlist2h.awk,v 1.2 1996/06/10 07:34:58 deraadt Exp $ -# $NetBSD: devlist2h.awk,v 1.2.4.1 1996/06/05 18:34:36 cgd Exp $ +# $OpenBSD: devlist2h.awk,v 1.3 1996/12/08 01:03:03 niklas Exp $ +# $NetBSD: devlist2h.awk,v 1.3 1996/06/05 18:32:19 cgd Exp $ # # Copyright (c) 1995, 1996 Christopher G. Demetriou # All rights reserved. diff --git a/sys/dev/tc/if_fta.c b/sys/dev/tc/if_fta.c index 74686143530..d0307372127 100644 --- a/sys/dev/tc/if_fta.c +++ b/sys/dev/tc/if_fta.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_fta.c,v 1.4 1996/05/20 15:53:09 thorpej Exp $ */ +/* $NetBSD: if_fta.c,v 1.7 1996/10/22 21:37:26 cgd Exp $ */ /*- * Copyright (c) 1996 Matt Thomas @@ -86,18 +86,22 @@ pdq_tc_attach( pdq_softc_t * const sc = (pdq_softc_t *) self; struct tc_attach_args * const ta = (struct tc_attach_args *) aux; - sc->sc_bc = ta->ta_bc; + /* + * NOTE: sc_bc is an alias for sc_csrtag and sc_membase is an + * alias for sc_csrhandle. sc_iobase is not used in this front-end. + */ + sc->sc_csrtag = ta->ta_memt; bcopy(sc->sc_dev.dv_xname, sc->sc_if.if_xname, IFNAMSIZ); sc->sc_if.if_flags = 0; sc->sc_if.if_softc = sc; - if (bus_mem_map(sc->sc_bc, ta->ta_addr + PDQ_TC_CSR_OFFSET, - PDQ_TC_CSR_SPACE, 0, &sc->sc_membase)) { + if (bus_space_map(sc->sc_csrtag, ta->ta_addr + PDQ_TC_CSR_OFFSET, + PDQ_TC_CSR_SPACE, 0, &sc->sc_csrhandle)) { printf("\n%s: can't map card memory!\n", sc->sc_dev.dv_xname); return; } - sc->sc_pdq = pdq_initialize(sc->sc_bc, sc->sc_membase, + sc->sc_pdq = pdq_initialize(sc->sc_csrtag, sc->sc_csrhandle, sc->sc_if.if_xname, 0, (void *) sc, PDQ_DEFTA); if (sc->sc_pdq == NULL) { diff --git a/sys/dev/tc/if_le_dec.c b/sys/dev/tc/if_le_dec.c index 5e2093849f9..50094f17fdb 100644 --- a/sys/dev/tc/if_le_dec.c +++ b/sys/dev/tc/if_le_dec.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_dec.c,v 1.1 1996/05/07 02:24:55 thorpej Exp $ */ +/* $NetBSD: if_le_dec.c,v 1.3 1996/10/13 01:38:38 christos Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. diff --git a/sys/dev/tc/tc.c b/sys/dev/tc/tc.c index dc1d61f37eb..0caaeab2c2e 100644 --- a/sys/dev/tc/tc.c +++ b/sys/dev/tc/tc.c @@ -1,5 +1,5 @@ -/* $OpenBSD: tc.c,v 1.8 1996/11/23 21:47:10 kstailey Exp $ */ -/* $NetBSD: tc.c,v 1.16 1996/05/17 23:39:19 cgd Exp $ */ +/* $OpenBSD: tc.c,v 1.9 1996/12/08 01:03:05 niklas Exp $ */ +/* $NetBSD: tc.c,v 1.20 1996/10/22 21:37:29 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -132,7 +132,7 @@ tcattach(parent, self, aux) */ strncpy(ta.ta_modname, builtin->tcb_modname, TC_ROM_LLEN); #ifdef __alpha__ /* XXX */ - ta.ta_bc = tba->tba_bc; + ta.ta_memt = tba->tba_memt; #endif ta.ta_modname[TC_ROM_LLEN] = '\0'; ta.ta_slot = builtin->tcb_slot; diff --git a/sys/dev/tc/tcdevs b/sys/dev/tc/tcdevs index bd7b087c711..3882417d4f6 100644 --- a/sys/dev/tc/tcdevs +++ b/sys/dev/tc/tcdevs @@ -1,5 +1,5 @@ -$OpenBSD: tcdevs,v 1.2 1996/05/26 00:27:54 deraadt Exp $ -/* $NetBSD: tcdevs,v 1.3 1996/03/05 23:15:59 cgd Exp $ */ +$OpenBSD: tcdevs,v 1.3 1996/12/08 01:03:05 niklas Exp $ +/* $NetBSD: tcdevs,v 1.6 1996/08/26 23:39:34 cgd Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou @@ -32,22 +32,24 @@ $OpenBSD: tcdevs,v 1.2 1996/05/26 00:27:54 deraadt Exp $ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +device DGLTA-FA otto DGLTA ATM +device FORE_ATM fa Fore TCA-100 ATM device KZTSA-AA tza TZA FWD SCSI +device OTTO otto DEC SRC \"OTTO\" ATM device PMAD-AA le LANCE Ethernet -device PMAF-AA fza DEFZA FDDI Controller -device PMAF-F fta DEFTA FDDI Controller +device PMAF-AA fza DEFZA FDDI +device PMAF-F fta DEFTA FDDI device PMAG-AA mfb Monochrome Frame Buffer device PMAG-BA cfb Color Frame Buffer -device PMAG-CA ga 2D Graphic Board -device PMAG-DA gq 3D Graphic Board (LM) -device PMAG-FA gq 3D Graphic Board (HE) +device PMAG-CA ga 2D Graphics +device PMAG-DA gq 3D Graphics (LM) # the following entry may be incorrect device PMAG-DV xcfb Maxine Color Frame Buffer +device PMAG-FA gq 3D Graphics (HE) device PMAGB-BA sfb Smart Frame Buffer device PMAGD sfbp Smart Frame Buffer Plus, unknown bpp device PMAGD-AA sfbp Smart Frame Buffer Plus, 8bpp device PMAGD-BA sfbp Smart Frame Buffer Plus, 32bpp device PMAZ-AA asc 53c94 SCSI -device T3PKT tt DECWRL Turbochannel T3 device T1D4PKT ds DECWRL Turbochannel T1 -device FORE_ATM fa Fore TCA-100 ATM +device T3PKT tt DECWRL Turbochannel T3 diff --git a/sys/dev/tc/tcdevs.h b/sys/dev/tc/tcdevs.h index c0a1fe831a3..6ff7b15427b 100644 --- a/sys/dev/tc/tcdevs.h +++ b/sys/dev/tc/tcdevs.h @@ -2,9 +2,9 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD + * OpenBSD: tcdevs,v 1.2 1996/05/26 00:27:54 deraadt Exp */ -/* $NetBSD: tcdevs,v 1.3 1996/03/05 23:15:59 cgd Exp $ */ +/* $NetBSD: tcdevs,v 1.6 1996/08/26 23:39:34 cgd Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou @@ -37,17 +37,26 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define TC_DEVICE_DGLTA_FA "otto" +#define TC_DESCRIPTION_DGLTA_FA "DGLTA ATM" + +#define TC_DEVICE_FORE_ATM "fa" +#define TC_DESCRIPTION_FORE_ATM "Fore TCA-100 ATM" + #define TC_DEVICE_KZTSA_AA "tza" #define TC_DESCRIPTION_KZTSA_AA "TZA FWD SCSI" +#define TC_DEVICE_OTTO "otto" +#define TC_DESCRIPTION_OTTO "DEC SRC \"OTTO\" ATM" + #define TC_DEVICE_PMAD_AA "le" #define TC_DESCRIPTION_PMAD_AA "LANCE Ethernet" #define TC_DEVICE_PMAF_AA "fza" -#define TC_DESCRIPTION_PMAF_AA "DEFZA FDDI Controller" +#define TC_DESCRIPTION_PMAF_AA "DEFZA FDDI" #define TC_DEVICE_PMAF_F "fta" -#define TC_DESCRIPTION_PMAF_F "DEFTA FDDI Controller" +#define TC_DESCRIPTION_PMAF_F "DEFTA FDDI" #define TC_DEVICE_PMAG_AA "mfb" #define TC_DESCRIPTION_PMAG_AA "Monochrome Frame Buffer" @@ -56,17 +65,17 @@ #define TC_DESCRIPTION_PMAG_BA "Color Frame Buffer" #define TC_DEVICE_PMAG_CA "ga" -#define TC_DESCRIPTION_PMAG_CA "2D Graphic Board" +#define TC_DESCRIPTION_PMAG_CA "2D Graphics" #define TC_DEVICE_PMAG_DA "gq" -#define TC_DESCRIPTION_PMAG_DA "3D Graphic Board (LM)" - -#define TC_DEVICE_PMAG_FA "gq" -#define TC_DESCRIPTION_PMAG_FA "3D Graphic Board (HE)" +#define TC_DESCRIPTION_PMAG_DA "3D Graphics (LM)" #define TC_DEVICE_PMAG_DV "xcfb" #define TC_DESCRIPTION_PMAG_DV "Maxine Color Frame Buffer" +#define TC_DEVICE_PMAG_FA "gq" +#define TC_DESCRIPTION_PMAG_FA "3D Graphics (HE)" + #define TC_DEVICE_PMAGB_BA "sfb" #define TC_DESCRIPTION_PMAGB_BA "Smart Frame Buffer" @@ -82,11 +91,8 @@ #define TC_DEVICE_PMAZ_AA "asc" #define TC_DESCRIPTION_PMAZ_AA "53c94 SCSI" -#define TC_DEVICE_T3PKT "tt" -#define TC_DESCRIPTION_T3PKT "DECWRL Turbochannel T3" - #define TC_DEVICE_T1D4PKT "ds" #define TC_DESCRIPTION_T1D4PKT "DECWRL Turbochannel T1" -#define TC_DEVICE_FORE_ATM "fa" -#define TC_DESCRIPTION_FORE_ATM "Fore TCA-100 ATM" +#define TC_DEVICE_T3PKT "tt" +#define TC_DESCRIPTION_T3PKT "DECWRL Turbochannel T3" diff --git a/sys/dev/tc/tcdevs_data.h b/sys/dev/tc/tcdevs_data.h index 1da4880df85..13f9a6df0ce 100644 --- a/sys/dev/tc/tcdevs_data.h +++ b/sys/dev/tc/tcdevs_data.h @@ -2,9 +2,9 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD + * OpenBSD: tcdevs,v 1.2 1996/05/26 00:27:54 deraadt Exp */ -/* $NetBSD: tcdevs,v 1.3 1996/03/05 23:15:59 cgd Exp $ */ +/* $NetBSD: tcdevs,v 1.6 1996/08/26 23:39:34 cgd Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou @@ -38,11 +38,26 @@ */ struct tc_knowndev tc_knowndevs[] = { + { + "DGLTA-FA", + TC_DEVICE_DGLTA_FA, + TC_DESCRIPTION_DGLTA_FA, + }, + { + "FORE_ATM", + TC_DEVICE_FORE_ATM, + TC_DESCRIPTION_FORE_ATM, + }, { "KZTSA-AA", TC_DEVICE_KZTSA_AA, TC_DESCRIPTION_KZTSA_AA, }, + { + "OTTO ", + TC_DEVICE_OTTO, + TC_DESCRIPTION_OTTO, + }, { "PMAD-AA ", TC_DEVICE_PMAD_AA, @@ -78,16 +93,16 @@ struct tc_knowndev tc_knowndevs[] = { TC_DEVICE_PMAG_DA, TC_DESCRIPTION_PMAG_DA, }, - { - "PMAG-FA ", - TC_DEVICE_PMAG_FA, - TC_DESCRIPTION_PMAG_FA, - }, { "PMAG-DV ", TC_DEVICE_PMAG_DV, TC_DESCRIPTION_PMAG_DV, }, + { + "PMAG-FA ", + TC_DEVICE_PMAG_FA, + TC_DESCRIPTION_PMAG_FA, + }, { "PMAGB-BA", TC_DEVICE_PMAGB_BA, @@ -113,20 +128,15 @@ struct tc_knowndev tc_knowndevs[] = { TC_DEVICE_PMAZ_AA, TC_DESCRIPTION_PMAZ_AA, }, - { - "T3PKT ", - TC_DEVICE_T3PKT, - TC_DESCRIPTION_T3PKT, - }, { "T1D4PKT ", TC_DEVICE_T1D4PKT, TC_DESCRIPTION_T1D4PKT, }, { - "FORE_ATM", - TC_DEVICE_FORE_ATM, - TC_DESCRIPTION_FORE_ATM, + "T3PKT ", + TC_DEVICE_T3PKT, + TC_DESCRIPTION_T3PKT, }, { NULL, NULL, NULL, } }; diff --git a/sys/dev/tc/tcvar.h b/sys/dev/tc/tcvar.h index 487e25b3c1b..3be4d7677c8 100644 --- a/sys/dev/tc/tcvar.h +++ b/sys/dev/tc/tcvar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: tcvar.h,v 1.5 1996/11/12 20:31:02 niklas Exp $ */ -/* $NetBSD: tcvar.h,v 1.5 1996/05/17 23:38:16 cgd Exp $ */ +/* $OpenBSD: tcvar.h,v 1.6 1996/12/08 01:03:07 niklas Exp $ */ +/* $NetBSD: tcvar.h,v 1.7 1996/10/22 21:37:31 cgd Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. @@ -35,8 +35,8 @@ * Definitions for TurboChannel autoconfiguration. */ -#ifdef __alpha__ /* XXX pmax does not yet have machine/bus.old.h */ -#include +#ifdef __alpha__ /* XXX pmax does not yet have machine/bus.h */ +#include #endif #include @@ -60,7 +60,7 @@ ERROR: COMPILING FOR UNSUPPORTED MACHINE, OR MORE THAN ONE. * by the pmax port, and not the new definitions provided by the * alpha port. */ -#ifdef __alpha_ +#ifdef __alpha__ /* * On the alpha, map the new definitions to the old. */ @@ -93,7 +93,7 @@ typedef enum { struct tcbus_attach_args { char *tba_busname; /* XXX should be common */ #ifdef __alpha__ /* XXX */ - bus_chipset_tag_t tba_bc; /* XXX should be common */ + bus_space_tag_t tba_memt; #endif /* Bus information */ @@ -115,7 +115,7 @@ struct tcbus_attach_args { */ struct tc_attach_args { #ifdef __alpha__ /* XXX */ - bus_chipset_tag_t ta_bc; + bus_space_tag_t ta_memt; #endif char ta_modname[TC_ROM_LLEN+1];