diff options
author | Hugh Graham <hugh@cvs.openbsd.org> | 2001-08-25 13:33:38 +0000 |
---|---|---|
committer | Hugh Graham <hugh@cvs.openbsd.org> | 2001-08-25 13:33:38 +0000 |
commit | 2f9f539a801e8c00430eacc3a70495465ca02e4e (patch) | |
tree | a8c95a4e7bd59da4baa2c4974425216c11ff94b4 /sys/arch/vax/qbus | |
parent | 1195029145310bb1c26d5da6e89f13372126bc9b (diff) |
Bring in some useful stuff from NetBSD. Mostly work by Matt Thomas,
and concerned with intvec counting. Also some ANSIfication.
Diffstat (limited to 'sys/arch/vax/qbus')
-rw-r--r-- | sys/arch/vax/qbus/dz.c | 158 | ||||
-rw-r--r-- | sys/arch/vax/qbus/dz_uba.c | 15 | ||||
-rw-r--r-- | sys/arch/vax/qbus/dzvar.h | 15 | ||||
-rw-r--r-- | sys/arch/vax/qbus/uba.c | 84 | ||||
-rw-r--r-- | sys/arch/vax/qbus/ubavar.h | 35 | ||||
-rw-r--r-- | sys/arch/vax/qbus/uda.c | 52 |
6 files changed, 169 insertions, 190 deletions
diff --git a/sys/arch/vax/qbus/dz.c b/sys/arch/vax/qbus/dz.c index 1beb48682de..5367934003b 100644 --- a/sys/arch/vax/qbus/dz.c +++ b/sys/arch/vax/qbus/dz.c @@ -1,5 +1,5 @@ -/* $OpenBSD: dz.c,v 1.5 2001/08/19 23:54:27 miod Exp $ */ -/* $NetBSD: dz.c,v 1.19 2000/01/24 02:40:29 matt Exp $ */ +/* $OpenBSD: dz.c,v 1.6 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: dz.c,v 1.23 2000/06/04 02:14:12 matt Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. * Copyright (c) 1992, 1993 @@ -110,10 +110,10 @@ static struct speedtab dzspeedtab[] = { -1, -1 } }; -static void dzstart __P((struct tty *)); -static int dzparam __P((struct tty *, struct termios *)); -static unsigned dzmctl __P((struct dz_softc *, int, int, int)); -static void dzscan __P((void *)); +static void dzstart(struct tty *); +static int dzparam(struct tty *, struct termios *); +static unsigned dzmctl(struct dz_softc *, int, int, int); +static void dzscan(void *); struct cfdriver dz_cd = { NULL, "dz", DV_TTY @@ -133,10 +133,9 @@ struct timeout dz_timeout; #define DZ_DZV 4 /* Q-bus DZV-11 or DZQ-11 */ void -dzattach(sc) - struct dz_softc *sc; +dzattach(struct dz_softc *sc) { - register int n; + int n; sc->sc_rxint = sc->sc_brk = 0; @@ -150,6 +149,9 @@ dzattach(sc) for (n = 0; n < sc->sc_type; n++) sc->sc_dz[n].dz_tty = ttymalloc(); + evcnt_attach(&sc->sc_dev, "rintr", &sc->sc_rintrcnt); + evcnt_attach(&sc->sc_dev, "tintr", &sc->sc_tintrcnt); + /* Alas no interrupt on modem bit changes, so we manually scan */ if (dz_timer == 0) { @@ -164,13 +166,12 @@ dzattach(sc) /* Receiver Interrupt */ void -dzrint(arg) - void *arg; +dzrint(void *arg) { struct dz_softc *sc = arg; - register struct tty *tp; - register int cc, line; - register unsigned c; + struct tty *tp; + int cc, line; + unsigned c; int overrun = 0; sc->sc_rxint++; @@ -220,13 +221,12 @@ dzrint(arg) /* Transmitter Interrupt */ void -dzxint(arg) - void *arg; +dzxint(void *arg) { - register struct dz_softc *sc = arg; - register struct tty *tp; - register struct clist *cl; - register int line, ch, csr; + struct dz_softc *sc = arg; + struct tty *tp; + struct clist *cl; + int line, ch, csr; u_char tcr; /* @@ -270,9 +270,6 @@ dzxint(arg) tcr &= ~(1 << line); DZ_WRITE_BYTE(dr_tcr, tcr); - if (sc->sc_dz[line].dz_catch) - continue; - if (tp->t_state & TS_FLUSH) tp->t_state &= ~TS_FLUSH; else @@ -286,13 +283,10 @@ dzxint(arg) } int -dzopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +dzopen(dev_t dev, int flag, int mode, struct proc *p) { - register struct tty *tp; - register int unit, line; + struct tty *tp; + int unit, line; struct dz_softc *sc; int s, error = 0; @@ -344,14 +338,11 @@ dzopen(dev, flag, mode, p) /*ARGSUSED*/ int -dzclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +dzclose(dev_t dev, int flag, int mode, struct proc *p) { struct dz_softc *sc; - register struct tty *tp; - register int unit, line; + struct tty *tp; + int unit, line; unit = DZ_I2C(minor(dev)); @@ -373,11 +364,9 @@ dzclose(dev, flag, mode, p) } int -dzread (dev, uio, flag) - dev_t dev; - struct uio *uio; +dzread(dev_t dev, struct uio *uio, int flag) { - register struct tty *tp; + struct tty *tp; struct dz_softc *sc; sc = dz_cd.cd_devs[DZ_I2C(minor(dev))]; @@ -387,11 +376,9 @@ dzread (dev, uio, flag) } int -dzwrite (dev, uio, flag) - dev_t dev; - struct uio *uio; +dzwrite(dev_t dev, struct uio *uio, int flag) { - register struct tty *tp; + struct tty *tp; struct dz_softc *sc; sc = dz_cd.cd_devs[DZ_I2C(minor(dev))]; @@ -402,16 +389,11 @@ dzwrite (dev, uio, flag) /*ARGSUSED*/ int -dzioctl (dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +dzioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) { struct dz_softc *sc; - register struct tty *tp; - register int unit, line; + struct tty *tp; + int unit, line; int error; unit = DZ_I2C(minor(dev)); @@ -467,8 +449,7 @@ dzioctl (dev, cmd, data, flag, p) } struct tty * -dztty (dev) - dev_t dev; +dztty(dev_t dev) { struct dz_softc *sc = dz_cd.cd_devs[DZ_I2C(minor(dev))]; struct tty *tp = sc->sc_dz[DZ_PORT(minor(dev))].dz_tty; @@ -478,27 +459,20 @@ dztty (dev) /*ARGSUSED*/ int -dzstop(tp, flag) - register struct tty *tp; +dzstop(struct tty *tp, int flag) { - int s; - - s = spltty(); if (tp->t_state & TS_BUSY) if (!(tp->t_state & TS_TTSTOP)) tp->t_state |= TS_FLUSH; - splx(s); - - return 0; + return(0); } void -dzstart(tp) - register struct tty *tp; +dzstart(struct tty *tp) { - register struct dz_softc *sc; - register struct clist *cl; - register int unit, line, s; + struct dz_softc *sc; + struct clist *cl; + int unit, line, s; char state; unit = DZ_I2C(minor(tp->t_dev)); @@ -530,16 +504,14 @@ dzstart(tp) } static int -dzparam(tp, t) - register struct tty *tp; - register struct termios *t; +dzparam(struct tty *tp, struct termios *t) { struct dz_softc *sc; - register int cflag = t->c_cflag; + int cflag = t->c_cflag; int unit, line; int ispeed = ttspeedtab(t->c_ispeed, dzspeedtab); int ospeed = ttspeedtab(t->c_ospeed, dzspeedtab); - register unsigned lpr; + unsigned lpr; int s; unit = DZ_I2C(minor(tp->t_dev)); @@ -592,13 +564,11 @@ dzparam(tp, t) } static unsigned -dzmctl(sc, line, bits, how) - register struct dz_softc *sc; - int line, bits, how; +dzmctl(struct dz_softc *sc, int line, int bits, int how) { - register unsigned status; - register unsigned mbits; - register unsigned bit; + unsigned status; + unsigned mbits; + unsigned bit; int s; s = spltty(); @@ -671,12 +641,11 @@ dzmctl(sc, line, bits, how) * Check to see if modem status bits have changed. */ static void -dzscan(arg) - void *arg; +dzscan(void *arg) { - register struct dz_softc *sc; - register struct tty *tp; - register int n, bit, port; + struct dz_softc *sc; + struct tty *tp; + int n, bit, port; unsigned csr; int s; @@ -728,3 +697,28 @@ dzscan(arg) timeout_add(&dz_timeout, hz); return; } + +/* + * Called after an ubareset. The DZ card is reset, but the only thing + * that must be done is to start the receiver and transmitter again. + * No DMA setup to care about. + */ +void +dzreset(struct device *dev) +{ + struct dz_softc *sc = (void *)dev; + struct tty *tp; + int i; + + for (i = 0; i < sc->sc_type; i++) { + tp = sc->sc_dz[i].dz_tty; + + if (((tp->t_state & TS_ISOPEN) == 0)) + continue; + + dzparam(tp, &tp->t_termios); + dzmctl(sc, i, DML_DTR, DMSET); + tp->t_state &= ~TS_BUSY; + dzstart(tp); /* Kick off transmitter again */ + } +} diff --git a/sys/arch/vax/qbus/dz_uba.c b/sys/arch/vax/qbus/dz_uba.c index d9595840a52..910e6fe9285 100644 --- a/sys/arch/vax/qbus/dz_uba.c +++ b/sys/arch/vax/qbus/dz_uba.c @@ -1,5 +1,5 @@ -/* $OpenBSD: dz_uba.c,v 1.1 2000/04/27 03:14:47 bjc Exp $ */ -/* $NetBSD: dz_uba.c,v 1.8 2000/01/24 02:40:29 matt Exp $ */ +/* $OpenBSD: dz_uba.c,v 1.2 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: dz_uba.c,v 1.11 2000/06/04 06:17:02 matt Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved. * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. @@ -74,7 +74,7 @@ dz_uba_match(parent, cf, aux) struct uba_attach_args *ua = aux; bus_space_tag_t iot = ua->ua_iot; bus_space_handle_t ioh = ua->ua_ioh; - register int n; + int n; iot = iot; /* Silly GCC */ /* Reset controller to initialize, enable TX interrupts */ @@ -113,7 +113,7 @@ dz_uba_attach(parent, self, aux) void *aux; { struct dz_softc *sc = (void *)self; - register struct uba_attach_args *ua = aux; + struct uba_attach_args *ua = aux; sc->sc_iot = ua->ua_iot; sc->sc_ioh = ua->ua_ioh; @@ -130,8 +130,11 @@ dz_uba_attach(parent, self, aux) sc->sc_type = DZ_DZ; /* Now register the TX & RX interrupt handlers */ - uba_intr_establish(ua->ua_icookie, ua->ua_cvec, dzxint, sc); - uba_intr_establish(ua->ua_icookie, ua->ua_cvec - 4, dzrint, sc); + uba_intr_establish(ua->ua_icookie, ua->ua_cvec, + dzxint, sc, &sc->sc_tintrcnt); + uba_intr_establish(ua->ua_icookie, ua->ua_cvec - 4, + dzrint, sc, &sc->sc_rintrcnt); + uba_reset_establish(dzreset, self); dzattach(sc); } diff --git a/sys/arch/vax/qbus/dzvar.h b/sys/arch/vax/qbus/dzvar.h index f429b085830..2ece7a31ff3 100644 --- a/sys/arch/vax/qbus/dzvar.h +++ b/sys/arch/vax/qbus/dzvar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: dzvar.h,v 1.2 2001/05/16 22:15:18 hugh Exp $ */ -/* $NetBSD: dzvar.h,v 1.6 2000/01/24 02:40:29 matt Exp $ */ +/* $OpenBSD: dzvar.h,v 1.3 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: dzvar.h,v 1.8 2000/06/04 02:14:12 matt Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. * Copyright (c) 1992, 1993 @@ -51,6 +51,8 @@ struct dz_softc { struct device sc_dev; /* Autoconf blaha */ + struct evcnt sc_rintrcnt; /* recevive interrupt counts */ + struct evcnt sc_tintrcnt; /* transmit interrupt counts */ struct dz_regs sc_dr; /* reg pointers */ bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -62,7 +64,7 @@ struct dz_softc { struct dz_softc *dz_sc; /* backpointer to softc */ int dz_line; /* sub-driver unit number */ void *dz_private; /* sub-driver data pointer */ - int (*dz_catch) __P((void *, int)); /* Fast catch recv */ + int (*dz_catch)(void *, int); /* Fast catch recv */ struct tty * dz_tty; /* what we work on */ #ifdef notyet caddr_t dz_mem; /* pointers to clist output */ @@ -71,6 +73,7 @@ struct dz_softc { } sc_dz[NDZLINE]; }; -void dzattach __P((struct dz_softc *)); -void dzrint __P((void *)); -void dzxint __P((void *)); +void dzattach(struct dz_softc *); +void dzrint(void *); +void dzxint(void *); +void dzreset(struct device *); diff --git a/sys/arch/vax/qbus/uba.c b/sys/arch/vax/qbus/uba.c index 13844d68105..cb71db90a7c 100644 --- a/sys/arch/vax/qbus/uba.c +++ b/sys/arch/vax/qbus/uba.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uba.c,v 1.1 2000/04/27 03:14:49 bjc Exp $ */ -/* $NetBSD: uba.c,v 1.49 2000/01/24 02:40:30 matt Exp $ */ +/* $OpenBSD: uba.c,v 1.2 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: uba.c,v 1.52 2000/06/04 02:14:12 matt Exp $ */ /* * Copyright (c) 1996 Jonathan Stone. * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. @@ -61,8 +61,8 @@ #include <arch/vax/qbus/ubavar.h> -static int ubasearch __P((struct device *, struct cfdata *, void *)); -static int ubaprint __P((void *, const char *)); +static int ubasearch (struct device *, struct cfdata *, void *); +static int ubaprint (void *, const char *); struct cfdriver uba_cd = { NULL, "uba", DV_DULL @@ -75,8 +75,7 @@ struct cfdriver uba_cd = { * Unibus systems, Qbus systems have more map registers than usable. */ void -uba_enqueue(uu) - struct uba_unit *uu; +uba_enqueue(struct uba_unit *uu) { struct uba_softc *uh; int s; @@ -95,8 +94,7 @@ uba_enqueue(uu) * This routine must be called at splimp. */ void -uba_done(uh) - struct uba_softc *uh; +uba_done(struct uba_softc *uh) { struct uba_unit *uu; @@ -110,24 +108,44 @@ uba_done(uh) } /* + * Each device that needs some handling if an ubareset occurs must + * register for reset first through this routine. + */ +void +uba_reset_establish(void (*reset)(struct device *), struct device *dev) +{ + struct uba_softc *uh = (void *)dev->dv_parent; + struct uba_reset *ur; + + ur = malloc(sizeof(struct uba_reset), M_DEVBUF, M_NOWAIT); + ur->ur_dev = dev; + ur->ur_reset = reset; + + SIMPLEQ_INSERT_TAIL(&uh->uh_resetq, ur, ur_resetq); +} + +/* * Generate a reset on uba number uban. Then * call each device that asked to be called during attach, * giving it a chance to clean up so as to be able to continue. */ void -ubareset(uban) - int uban; +ubareset(struct uba_softc *uh) { - register struct uba_softc *uh = uba_cd.cd_devs[uban]; - int s, i; + struct uba_reset *ur; + int s; s = splimp(); SIMPLEQ_INIT(&uh->uh_resq); printf("%s: reset", uh->uh_dev.dv_xname); (*uh->uh_ubainit)(uh); - for (i = 0; i < uh->uh_resno; i++) - (*uh->uh_reset[i])(uh->uh_resarg[i]); + ur = SIMPLEQ_FIRST(&uh->uh_resetq); + if (ur) do { + printf(" %s", ur->ur_dev->dv_xname); + (*ur->ur_reset)(ur->ur_dev); + } while ((ur = SIMPLEQ_NEXT(ur, ur_resetq))); + printf("\n"); splx(s); } @@ -137,9 +155,7 @@ ubareset(uban) * Calls the scan routine to search for uba devices. */ void -uba_attach(sc, iopagephys) - struct uba_softc *sc; - paddr_t iopagephys; +uba_attach(struct uba_softc *sc, paddr_t iopagephys) { /* @@ -149,6 +165,7 @@ uba_attach(sc, iopagephys) */ sc->uh_lastiv = 0x200; SIMPLEQ_INIT(&sc->uh_resq); + SIMPLEQ_INIT(&sc->uh_resetq); /* * Allocate place for unibus I/O space in virtual space. @@ -168,10 +185,7 @@ uba_attach(sc, iopagephys) } int -ubasearch(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +ubasearch(struct device *parent, struct cfdata *cf, void *aux) { struct uba_softc *sc = (struct uba_softc *)parent; struct uba_attach_args ua; @@ -180,7 +194,6 @@ ubasearch(parent, cf, aux) ua.ua_ioh = ubdevreg(cf->cf_loc[0]) + sc->uh_ioh; ua.ua_iot = sc->uh_iot; ua.ua_dmat = sc->uh_dmat; - ua.ua_reset = NULL; if (badaddr((caddr_t)ua.ua_ioh, 2) || (sc->uh_errchk ? (*sc->uh_errchk)(sc):0)) @@ -200,24 +213,6 @@ ubasearch(parent, cf, aux) goto fail; if (vec == 0) goto fail; - - if (ua.ua_reset) { /* device wants ubareset */ - if (sc->uh_resno == 0) { -#define RESETSIXE 128 - sc->uh_reset = malloc(sizeof(void *) * RESETSIXE, - M_DEVBUF, M_NOWAIT); - sc->uh_resarg = malloc(sizeof(void *) * RESETSIXE, - M_DEVBUF, M_NOWAIT); - } - if (sc->uh_resno < RESETSIXE) { - sc->uh_resarg[sc->uh_resno] = cf->cf_unit; - sc->uh_reset[sc->uh_resno++] = ua.ua_reset; - } else { - printf("%s: Expand reset table, skipping reset %s%d\n", - sc->uh_dev.dv_xname, cf->cf_driver->cd_name, - cf->cf_unit); - } - } ua.ua_br = br; ua.ua_cvec = vec; @@ -239,9 +234,7 @@ forgetit: * Print out some interesting info common to all unibus devices. */ int -ubaprint(aux, uba) - void *aux; - const char *uba; +ubaprint(void *aux, const char *uba) { struct uba_attach_args *ua = aux; @@ -254,11 +247,12 @@ ubaprint(aux, uba) * Move to machdep eventually */ void -uba_intr_establish(icookie, vec, ifunc, iarg) +uba_intr_establish(icookie, vec, ifunc, iarg, ev) void *icookie; int vec; void (*ifunc)(void *iarg); void *iarg; + struct evcnt *ev; { - scb_vecalloc(vec, ifunc, iarg, SCB_ISTACK); + scb_vecalloc(vec, ifunc, iarg, SCB_ISTACK, ev); } diff --git a/sys/arch/vax/qbus/ubavar.h b/sys/arch/vax/qbus/ubavar.h index 942b8eb7af7..90a086a003d 100644 --- a/sys/arch/vax/qbus/ubavar.h +++ b/sys/arch/vax/qbus/ubavar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ubavar.h,v 1.1 2000/04/27 03:14:49 bjc Exp $ */ -/* $NetBSD: ubavar.h,v 1.26 2000/01/24 02:40:30 matt Exp $ */ +/* $OpenBSD: ubavar.h,v 1.2 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: ubavar.h,v 1.29 2000/06/04 06:17:04 matt Exp $ */ /* * Copyright (c) 1982, 1986 Regents of the University of California. @@ -70,10 +70,9 @@ */ struct uba_softc { struct device uh_dev; /* Device struct, autoconfig */ + struct evcnt uh_intrcnt; /* interrupt counting */ SIMPLEQ_HEAD(, uba_unit) uh_resq; /* resource wait chain */ - void (**uh_reset) __P((int));/* UBA reset function array */ - int *uh_resarg; /* array of ubareset args */ - int uh_resno; /* Number of devices to reset */ + SIMPLEQ_HEAD(, uba_reset) uh_resetq; /* ubareset queue */ int uh_lastiv; /* last free interrupt vector */ int (*uh_errchk) __P((struct uba_softc *)); void (*uh_beforescan) __P((struct uba_softc *)); @@ -103,6 +102,16 @@ struct uba_unit { }; /* + * Reset structure. All devices that needs to be reinitialized + * after an ubareset registers with this struct. + */ +struct uba_reset { + SIMPLEQ_ENTRY(uba_reset) ur_resetq; + void (*ur_reset)(struct device *); + struct device *ur_dev; +}; + +/* * uba_attach_args is used during autoconfiguration. It is sent * from ubascan() to each (possible) device. */ @@ -111,8 +120,6 @@ struct uba_attach_args { bus_addr_t ua_ioh; /* I/O regs addr */ bus_dma_tag_t ua_dmat; void *ua_icookie; /* Cookie for interrupt establish */ - /* UBA reset routine, filled in by probe */ - void (*ua_reset) __P((int)); int ua_iaddr; /* Full CSR address of device */ int ua_br; /* IPL this dev interrupted on */ int ua_cvec; /* Vector for this device */ @@ -135,14 +142,12 @@ struct uba_attach_args { #define ubdevreg(addr) ((addr) & 017777) #ifdef _KERNEL -#define b_forw b_hash.le_next /* Nice to have when handling uba queues */ - -void uba_intr_establish __P((void *, int, void (*)(void *), void *)); -void uba_attach __P((struct uba_softc *, unsigned long)); -void uba_enqueue __P((struct uba_unit *)); -void uba_done __P((struct uba_softc *)); -void ubareset __P((int)); - +void uba_intr_establish(void *, int, void (*)(void *), void *, struct evcnt *); +void uba_reset_establish(void (*)(struct device *), struct device *); +void uba_attach(struct uba_softc *, unsigned long); +void uba_enqueue(struct uba_unit *); +void uba_done(struct uba_softc *); +void ubareset(struct uba_softc *); #endif /* _KERNEL */ #endif /* _QBUS_UBAVAR_H */ diff --git a/sys/arch/vax/qbus/uda.c b/sys/arch/vax/qbus/uda.c index ae91879ef04..791e5c03dee 100644 --- a/sys/arch/vax/qbus/uda.c +++ b/sys/arch/vax/qbus/uda.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uda.c,v 1.1 2000/04/27 03:14:49 bjc Exp $ */ -/* $NetBSD: uda.c,v 1.32 2000/01/24 02:40:30 matt Exp $ */ +/* $OpenBSD: uda.c,v 1.2 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: uda.c,v 1.36 2000/06/04 06:17:05 matt Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1988 Regents of the University of California. @@ -63,6 +63,7 @@ */ struct uda_softc { struct device sc_dev; /* Autoconfig info */ + struct evcnt sc_intrcnt; /* Interrupt counting */ struct uba_unit sc_unit; /* Struct common for UBA to communicate */ struct mscp_pack *sc_uuda; /* Unibus address of uda struct */ struct mscp_pack sc_uda; /* Struct for uda communication */ @@ -79,10 +80,8 @@ struct uda_softc { static int udamatch __P((struct device *, struct cfdata *, void *)); static void udaattach __P((struct device *, struct device *, void *)); -static void udareset __P((int)); -static void mtcreset __P((int)); -static void reset __P((struct uda_softc *)); -static void intr __P((void *)); +static void udareset(struct device *); +static void udaintr __P((void *)); int udaready __P((struct uba_unit *)); void udactlrdone __P((struct device *)); int udaprint __P((void *, const char *)); @@ -177,12 +176,6 @@ again: } /* should have interrupted by now */ - if (strcmp(cf->cf_driver->cd_name, mtc_cd.cd_name)) { - ua->ua_reset = udareset; - } else { - ua->ua_reset = mtcreset; - } - return 1; bad: if (++tries < 2) @@ -206,7 +199,10 @@ udaattach(parent, self, aux) uh->uh_lastiv -= 4; /* remove dynamic interrupt vector */ - uba_intr_establish(ua->ua_icookie, ua->ua_cvec, intr, sc); + uba_intr_establish(ua->ua_icookie, ua->ua_cvec, + udaintr, sc, &sc->sc_intrcnt); + uba_reset_establish(udareset, &sc->sc_dev); + evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt); sc->sc_iot = ua->ua_iot; sc->sc_iph = ua->ua_ioh; @@ -299,7 +295,7 @@ udago(usc, mxi) */ if (sc->sc_inq == 0) { err = bus_dmamap_load(sc->sc_dmat, mxi->mxi_dmam, - bp->b_un.b_addr, + bp->b_data, bp->b_bcount, bp->b_proc, BUS_DMA_NOWAIT); if (err == 0) { mscp_dgo(sc->sc_softc, mxi); @@ -331,7 +327,7 @@ udaready(uu) struct buf *bp = mxi->mxi_bp; int err; - err = bus_dmamap_load(sc->sc_dmat, mxi->mxi_dmam, bp->b_un.b_addr, + err = bus_dmamap_load(sc->sc_dmat, mxi->mxi_dmam, bp->b_data, bp->b_bcount, bp->b_proc, BUS_DMA_NOWAIT); if (err) return 0; @@ -396,8 +392,8 @@ udasaerror(usc, doreset) int doreset; { struct uda_softc *sc = (void *)usc; - register int code = bus_space_read_2(sc->sc_iot, sc->sc_sah, 0); - register struct saerr *e; + int code = bus_space_read_2(sc->sc_iot, sc->sc_sah, 0); + struct saerr *e; if ((code & MP_ERR) == 0) return; @@ -421,7 +417,7 @@ udasaerror(usc, doreset) * interrupts, and process responses. */ static void -intr(arg) +udaintr(arg) void *arg; { struct uda_softc *sc = arg; @@ -456,26 +452,10 @@ intr(arg) * A Unibus reset has occurred on UBA uban. Reinitialise the controller(s) * on that Unibus, and requeue outstanding I/O. */ -void -udareset(ctlr) - int ctlr; -{ - reset(uda_cd.cd_devs[ctlr]); -} - -void -mtcreset(ctlr) - int ctlr; -{ - reset(mtc_cd.cd_devs[ctlr]); -} - static void -reset(sc) - struct uda_softc *sc; +udareset(struct device *dev) { - printf(" %s", sc->sc_dev.dv_xname); - + struct uda_softc *sc = (void *)dev; /* * Our BDP (if any) is gone; our command (if any) is * flushed; the device is no longer mapped; and the |