Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/qbus Change to use new ubareset() functionality.



details:   https://anonhg.NetBSD.org/src/rev/dc0f29e00c89
branches:  trunk
changeset: 485522:dc0f29e00c89
user:      ragge <ragge%NetBSD.org@localhost>
date:      Sun Apr 30 11:46:49 2000 +0000

description:
Change to use new ubareset() functionality.

diffstat:

 sys/dev/qbus/dz.c     |  89 +++++++++++++++++++++++++-------------------------
 sys/dev/qbus/dz_uba.c |   3 +-
 sys/dev/qbus/dzvar.h  |  11 +++--
 sys/dev/qbus/rl.c     |  27 ++++++++++++++-
 sys/dev/qbus/uda.c    |  35 +++----------------
 5 files changed, 84 insertions(+), 81 deletions(-)

diffs (truncated from 374 to 300 lines):

diff -r 3a5352287d81 -r dc0f29e00c89 sys/dev/qbus/dz.c
--- a/sys/dev/qbus/dz.c Sun Apr 30 11:46:03 2000 +0000
+++ b/sys/dev/qbus/dz.c Sun Apr 30 11:46:49 2000 +0000
@@ -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 @@
   {      -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 @@
 #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 @@
 /* Receiver Interrupt */
 
 void
-dzrint(arg)
-       void *arg;
+dzrint(void *arg)
 {
        struct dz_softc *sc = arg;
        struct tty *tp;
@@ -216,8 +214,7 @@
 /* Transmitter Interrupt */
 
 void
-dzxint(arg)
-       void *arg;
+dzxint(void *arg)
 {
        struct dz_softc *sc = arg;
        struct tty *tp;
@@ -279,10 +276,7 @@
 }
 
 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 @@
 
 /*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 @@
 }
 
 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 @@
 }
 
 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 @@
 
 /*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 @@
 }
 
 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 @@
 
 /*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 @@
 }
 
 void
-dzstart(tp)
-       struct tty *tp;
+dzstart(struct tty *tp)
 {
        struct dz_softc *sc;
        struct clist *cl;
@@ -519,9 +498,7 @@
 }
 
 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 @@
 }
 
 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 @@
  * 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 @@
        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 */
+       }
+}
diff -r 3a5352287d81 -r dc0f29e00c89 sys/dev/qbus/dz_uba.c
--- a/sys/dev/qbus/dz_uba.c     Sun Apr 30 11:46:03 2000 +0000
+++ b/sys/dev/qbus/dz_uba.c     Sun Apr 30 11:46:49 2000 +0000
@@ -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 @@
        /* 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);
 }
diff -r 3a5352287d81 -r dc0f29e00c89 sys/dev/qbus/dzvar.h
--- a/sys/dev/qbus/dzvar.h      Sun Apr 30 11:46:03 2000 +0000
+++ b/sys/dev/qbus/dzvar.h      Sun Apr 30 11:46:49 2000 +0000
@@ -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 @@
        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 @@
        } 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 -r 3a5352287d81 -r dc0f29e00c89 sys/dev/qbus/rl.c
--- a/sys/dev/qbus/rl.c Sun Apr 30 11:46:03 2000 +0000
+++ b/sys/dev/qbus/rl.c Sun Apr 30 11:46:49 2000 +0000
@@ -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 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 @@
        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 @@
        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);



Home | Main Index | Thread Index | Old Index