Change to use new ubareset() functionality.
This commit is contained in:
parent
6758522763
commit
6f6bea9eed
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dz.c,v 1.21 2000/03/30 12:45:37 augustss Exp $ */
|
||||
/* $NetBSD: dz.c,v 1.22 2000/04/30 11:46:49 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -113,10 +113,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 *);
|
||||
cdev_decl(dz);
|
||||
|
||||
/*
|
||||
|
@ -130,8 +130,7 @@ struct callout dzscan_ch;
|
|||
#define DZ_DZV 4 /* Q-bus DZV-11 or DZQ-11 */
|
||||
|
||||
void
|
||||
dzattach(sc)
|
||||
struct dz_softc *sc;
|
||||
dzattach(struct dz_softc *sc)
|
||||
{
|
||||
int n;
|
||||
|
||||
|
@ -161,8 +160,7 @@ dzattach(sc)
|
|||
/* Receiver Interrupt */
|
||||
|
||||
void
|
||||
dzrint(arg)
|
||||
void *arg;
|
||||
dzrint(void *arg)
|
||||
{
|
||||
struct dz_softc *sc = arg;
|
||||
struct tty *tp;
|
||||
|
@ -216,8 +214,7 @@ dzrint(arg)
|
|||
/* Transmitter Interrupt */
|
||||
|
||||
void
|
||||
dzxint(arg)
|
||||
void *arg;
|
||||
dzxint(void *arg)
|
||||
{
|
||||
struct dz_softc *sc = arg;
|
||||
struct tty *tp;
|
||||
|
@ -279,10 +276,7 @@ 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)
|
||||
{
|
||||
struct tty *tp;
|
||||
int unit, line;
|
||||
|
@ -339,10 +333,7 @@ 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;
|
||||
struct tty *tp;
|
||||
|
@ -368,9 +359,7 @@ 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)
|
||||
{
|
||||
struct tty *tp;
|
||||
struct dz_softc *sc;
|
||||
|
@ -382,9 +371,7 @@ dzread (dev, uio, flag)
|
|||
}
|
||||
|
||||
int
|
||||
dzwrite (dev, uio, flag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
dzwrite(dev_t dev, struct uio *uio, int flag)
|
||||
{
|
||||
struct tty *tp;
|
||||
struct dz_softc *sc;
|
||||
|
@ -397,12 +384,7 @@ 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;
|
||||
struct tty *tp;
|
||||
|
@ -462,8 +444,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;
|
||||
|
@ -473,8 +454,7 @@ dztty (dev)
|
|||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dzstop(tp, flag)
|
||||
struct tty *tp;
|
||||
dzstop(struct tty *tp, int flag)
|
||||
{
|
||||
if (tp->t_state & TS_BUSY)
|
||||
if (!(tp->t_state & TS_TTSTOP))
|
||||
|
@ -482,8 +462,7 @@ dzstop(tp, flag)
|
|||
}
|
||||
|
||||
void
|
||||
dzstart(tp)
|
||||
struct tty *tp;
|
||||
dzstart(struct tty *tp)
|
||||
{
|
||||
struct dz_softc *sc;
|
||||
struct clist *cl;
|
||||
|
@ -519,9 +498,7 @@ dzstart(tp)
|
|||
}
|
||||
|
||||
static int
|
||||
dzparam(tp, t)
|
||||
struct tty *tp;
|
||||
struct termios *t;
|
||||
dzparam(struct tty *tp, struct termios *t)
|
||||
{
|
||||
struct dz_softc *sc;
|
||||
int cflag = t->c_cflag;
|
||||
|
@ -581,9 +558,7 @@ dzparam(tp, t)
|
|||
}
|
||||
|
||||
static unsigned
|
||||
dzmctl(sc, line, bits, how)
|
||||
struct dz_softc *sc;
|
||||
int line, bits, how;
|
||||
dzmctl(struct dz_softc *sc, int line, int bits, int how)
|
||||
{
|
||||
unsigned status;
|
||||
unsigned mbits;
|
||||
|
@ -660,8 +635,7 @@ dzmctl(sc, line, bits, how)
|
|||
* Check to see if modem status bits have changed.
|
||||
*/
|
||||
static void
|
||||
dzscan(arg)
|
||||
void *arg;
|
||||
dzscan(void *arg)
|
||||
{
|
||||
struct dz_softc *sc;
|
||||
struct tty *tp;
|
||||
|
@ -717,3 +691,28 @@ dzscan(arg)
|
|||
callout_reset(&dzscan_ch, hz, dzscan, NULL);
|
||||
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) || (tp->t_wopen == 0))
|
||||
continue;
|
||||
|
||||
dzparam(tp, &tp->t_termios);
|
||||
dzmctl(sc, i, DML_DTR, DMSET);
|
||||
tp->t_state &= ~TS_BUSY;
|
||||
dzstart(tp); /* Kick off transmitter again */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dz_uba.c,v 1.9 2000/03/30 12:45:37 augustss Exp $ */
|
||||
/* $NetBSD: dz_uba.c,v 1.10 2000/04/30 11:46:49 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved.
|
||||
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
|
||||
|
@ -133,6 +133,7 @@ dz_uba_attach(parent, self, aux)
|
|||
/* 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_reset_establish(dzreset, self);
|
||||
|
||||
dzattach(sc);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dzvar.h,v 1.6 2000/01/24 02:40:29 matt Exp $ */
|
||||
/* $NetBSD: dzvar.h,v 1.7 2000/04/30 11:46:49 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -57,7 +57,7 @@ struct dz_softc {
|
|||
int sc_rxint; /* Receive interrupt count XXX */
|
||||
u_char sc_brk; /* Break asserted on some lines */
|
||||
u_char sc_dsr; /* DSR set bits if no mdm ctrl */
|
||||
int (*sc_catch) __P((int, int)); /* Fast catch recv */
|
||||
int (*sc_catch)(int, int); /* Fast catch recv */
|
||||
struct {
|
||||
struct tty * dz_tty; /* what we work on */
|
||||
#ifdef notyet
|
||||
|
@ -67,6 +67,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 *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rl.c,v 1.1 2000/04/22 16:46:46 ragge Exp $ */
|
||||
/* $NetBSD: rl.c,v 1.2 2000/04/30 11:46:49 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
|
||||
|
@ -94,6 +94,7 @@ static int rlmatch(struct device *, struct cfdata *, void *);
|
|||
static void rlattach(struct device *, struct device *, void *);
|
||||
static void rlcstart(struct rlc_softc *, struct buf *);
|
||||
static void waitcrdy(struct rlc_softc *);
|
||||
static void rlreset(struct device *);
|
||||
cdev_decl(rl);
|
||||
bdev_decl(rl);
|
||||
|
||||
|
@ -222,6 +223,8 @@ rlattach(struct device *parent, struct device *self, void *aux)
|
|||
struct rlc_attach_args *ra = aux;
|
||||
struct disklabel *dl;
|
||||
|
||||
uba_reset_establish(rlreset, self);
|
||||
|
||||
rc->rc_hwid = ra->hwid;
|
||||
rc->rc_disk.dk_name = rc->rc_dev.dv_xname;
|
||||
disk_attach(&rc->rc_disk);
|
||||
|
@ -568,3 +571,25 @@ rlcstart(struct rlc_softc *sc, struct buf *ob)
|
|||
else
|
||||
RL_WREG(RL_CS, RLCS_IE|RLCS_WD|(rc->rc_hwid << RLCS_USHFT));
|
||||
}
|
||||
|
||||
void
|
||||
rlreset(struct device *dev)
|
||||
{
|
||||
struct rl_softc *rc = (struct rl_softc *)dev;
|
||||
struct rlc_softc *sc = (struct rlc_softc *)rc->rc_dev.dv_parent;
|
||||
u_int16_t mp;
|
||||
|
||||
if (rc->rc_state != DK_OPEN)
|
||||
return;
|
||||
RL_WREG(RL_CS, RLCS_RHDR|(rc->rc_hwid << RLCS_USHFT));
|
||||
waitcrdy(sc);
|
||||
mp = RL_RREG(RL_MP);
|
||||
rc->rc_head = ((mp & RLMP_HS) == RLMP_HS);
|
||||
rc->rc_cyl = (mp >> 7) & 0777;
|
||||
if (sc->sc_active == 0)
|
||||
return;
|
||||
|
||||
BUFQ_INSERT_HEAD(&sc->sc_q, sc->sc_active);
|
||||
sc->sc_active = 0;
|
||||
rlcstart(sc, 0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uda.c,v 1.33 2000/03/30 12:45:39 augustss Exp $ */
|
||||
/* $NetBSD: uda.c,v 1.34 2000/04/30 11:46:49 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
|
||||
* Copyright (c) 1988 Regents of the University of California.
|
||||
|
@ -82,9 +82,7 @@ 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 reset(struct device *);
|
||||
static void intr __P((void *));
|
||||
int udaready __P((struct uba_unit *));
|
||||
void udactlrdone __P((struct device *));
|
||||
|
@ -172,12 +170,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)
|
||||
|
@ -202,6 +194,7 @@ udaattach(parent, self, aux)
|
|||
uh->uh_lastiv -= 4; /* remove dynamic interrupt vector */
|
||||
|
||||
uba_intr_establish(ua->ua_icookie, ua->ua_cvec, intr, sc);
|
||||
uba_reset_establish(reset, &sc->sc_dev);
|
||||
|
||||
sc->sc_iot = ua->ua_iot;
|
||||
sc->sc_iph = ua->ua_ioh;
|
||||
|
@ -452,26 +445,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;
|
||||
reset(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
|
||||
|
|
Loading…
Reference in New Issue