Source-Changes-HG archive

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

[src/thorpej-devvp]: src/sys/dev Work around some evil, like directly calling...



details:   https://anonhg.NetBSD.org/src/rev/25fa5c2c37aa
branches:  thorpej-devvp
changeset: 514630:25fa5c2c37aa
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Thu Oct 11 12:33:57 2001 +0000

description:
Work around some evil, like directly calling interrupt functions
from the attach path, which devvp didn't like because of incompletely
inited tty structs.

All the struct tty init stuff should really be deferred to the first
open for all drivers; the structures are idle before then and
shouldn't be referenced.

diffstat:

 sys/dev/ic/z8530sc.c  |  11 ++++++-----
 sys/dev/ic/z8530sc.h  |   4 ++--
 sys/dev/ic/z8530tty.c |  37 +++++++++++++++++++++++++++----------
 sys/dev/sun/kbd_zs.c  |   7 ++++---
 sys/dev/sun/ms_zs.c   |   7 ++++---
 5 files changed, 43 insertions(+), 23 deletions(-)

diffs (238 lines):

diff -r 35d1159f80c0 -r 25fa5c2c37aa sys/dev/ic/z8530sc.c
--- a/sys/dev/ic/z8530sc.c      Thu Oct 11 00:01:39 2001 +0000
+++ b/sys/dev/ic/z8530sc.c      Thu Oct 11 12:33:57 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: z8530sc.c,v 1.15 2001/07/07 15:53:22 thorpej Exp $     */
+/*     $NetBSD: z8530sc.c,v 1.15.4.1 2001/10/11 12:33:57 fvdl Exp $    */
 
 /*
  * Copyright (c) 1994 Gordon W. Ross
@@ -255,7 +255,7 @@
                if (rr3 & ZSRR3_IP_A_RX)
                        (*cs->cs_ops->zsop_rxint)(cs);
                if (rr3 & ZSRR3_IP_A_STAT)
-                       (*cs->cs_ops->zsop_stint)(cs, 0);
+                       (*cs->cs_ops->zsop_stint)(cs, 0, NODEV);
                if (rr3 & ZSRR3_IP_A_TX)
                        (*cs->cs_ops->zsop_txint)(cs);
        }
@@ -267,7 +267,7 @@
                if (rr3 & ZSRR3_IP_B_RX)
                        (*cs->cs_ops->zsop_rxint)(cs);
                if (rr3 & ZSRR3_IP_B_STAT)
-                       (*cs->cs_ops->zsop_stint)(cs, 0);
+                       (*cs->cs_ops->zsop_stint)(cs, 0, NODEV);
                if (rr3 & ZSRR3_IP_B_TX)
                        (*cs->cs_ops->zsop_txint)(cs);
        }
@@ -311,7 +311,7 @@
  */
 
 static void zsnull_rxint   __P((struct zs_chanstate *));
-static void zsnull_stint   __P((struct zs_chanstate *, int));
+static void zsnull_stint   __P((struct zs_chanstate *, int, dev_t));
 static void zsnull_txint   __P((struct zs_chanstate *));
 static void zsnull_softint __P((struct zs_chanstate *));
 
@@ -324,9 +324,10 @@
 }
 
 static void
-zsnull_stint(cs, force)
+zsnull_stint(cs, force, dev)
        struct zs_chanstate *cs;
        int force;
+       dev_t dev;
 {
        /* Ask for softint() call. */
        cs->cs_softreq = 1;
diff -r 35d1159f80c0 -r 25fa5c2c37aa sys/dev/ic/z8530sc.h
--- a/sys/dev/ic/z8530sc.h      Thu Oct 11 00:01:39 2001 +0000
+++ b/sys/dev/ic/z8530sc.h      Thu Oct 11 12:33:57 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: z8530sc.h,v 1.15 2001/05/11 01:40:48 thorpej Exp $     */
+/*     $NetBSD: z8530sc.h,v 1.15.4.1 2001/10/11 12:33:57 fvdl Exp $    */
 
 /*
  * Copyright (c) 1994 Gordon W. Ross
@@ -53,7 +53,7 @@
 struct zsops {
        void    (*zsop_rxint) __P((struct zs_chanstate *));
                                        /* receive char available */
-       void    (*zsop_stint) __P((struct zs_chanstate *, int));
+       void    (*zsop_stint) __P((struct zs_chanstate *, int, dev_t));
                                        /* external/status */
        void    (*zsop_txint) __P((struct zs_chanstate *));
                                        /* xmit buffer empty */
diff -r 35d1159f80c0 -r 25fa5c2c37aa sys/dev/ic/z8530tty.c
--- a/sys/dev/ic/z8530tty.c     Thu Oct 11 00:01:39 2001 +0000
+++ b/sys/dev/ic/z8530tty.c     Thu Oct 11 12:33:57 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: z8530tty.c,v 1.77.4.4 2001/10/11 00:02:06 fvdl Exp $   */
+/*     $NetBSD: z8530tty.c,v 1.77.4.5 2001/10/11 12:33:57 fvdl Exp $   */
 
 /*-
  * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@@ -230,6 +230,7 @@
 static void zs_shutdown __P((struct zstty_softc *));
 static void    zsstart __P((struct tty *));
 static int     zsparam __P((struct tty *, struct termios *));
+static int     cold_zsparam __P((struct tty *, struct termios *, dev_t));
 static void zs_modem __P((struct zstty_softc *, int));
 static void tiocm_to_zs __P((struct zstty_softc *, u_long, int));
 static int  zs_to_tiocm __P((struct zstty_softc *));
@@ -239,7 +240,7 @@
 
 /* Low-level routines. */
 static void zstty_rxint   __P((struct zs_chanstate *));
-static void zstty_stint   __P((struct zs_chanstate *, int));
+static void zstty_stint   __P((struct zs_chanstate *, int, dev_t));
 static void zstty_txint   __P((struct zs_chanstate *));
 static void zstty_softint __P((struct zs_chanstate *));
 
@@ -394,7 +395,7 @@
 
                /* Make sure zsparam will see changes. */
                tp->t_ospeed = 0;
-               (void) zsparam(tp, &t);
+               (void) cold_zsparam(tp, &t, dev);
 
                s = splzs();
 
@@ -1039,18 +1040,28 @@
  * XXX - Should just copy the whole termios after
  * making sure all the changes could be done.
  */
+
 static int
 zsparam(tp, t)
        struct tty *tp;
        struct termios *t;
 {
+       return cold_zsparam(tp, t, vdev_rdev(tp->t_devvp));
+}
+
+static int
+cold_zsparam(tp, t, dev)
+       struct tty *tp;
+       struct termios *t;
+       dev_t dev;
+{
        struct zstty_softc *zst;
        struct zs_chanstate *cs;
        int ospeed, cflag;
        u_char tmp3, tmp4, tmp5;
        int s, error;
 
-       zst = vdev_privdata(tp->t_devvp);
+       zst = device_lookup(&zstty_cd, ZSUNIT(dev));
 
        cs = zst->zst_cs;
 
@@ -1197,7 +1208,7 @@
         * Force a recheck of the hardware carrier and flow control status,
         * since we may have changed which bits we're looking at.
         */
-       zstty_stint(cs, 1);
+       zstty_stint(cs, 1, dev);
 
        splx(s);
 
@@ -1544,26 +1555,32 @@
  * status change interrupt.  (splzs)
  */
 static void
-zstty_stint(cs, force)
+zstty_stint(cs, force, dev)
        struct zs_chanstate *cs;
        int force;
+       dev_t dev;
 {
        struct zstty_softc *zst = cs->cs_private;
        u_char rr0, delta;
+       dev_t rdev;
 
        rr0 = zs_read_csr(cs);
        zs_write_csr(cs, ZSWR0_RESET_STATUS);
 
-       if (zst->zst_tty->t_devvp->v_type == VBAD)
-               return;
+       if (force)
+               rdev = dev;
+       else {
+               if (zst->zst_tty->t_devvp->v_type == VBAD)
+                       return;
+               rdev = vdev_rdev(zst->zst_tty->t_devvp);
+       }
 
        /*
         * Check here for console break, so that we can abort
         * even when interrupts are locking up the machine.
         */
        if (ISSET(rr0, ZSRR0_BREAK))
-               cn_check_magic(zst->zst_tty->t_devvp->v_rdev, CNC_BREAK,
-                   zstty_cnm_state);
+               cn_check_magic(rdev, CNC_BREAK, zstty_cnm_state);
 
        if (!force)
                delta = rr0 ^ cs->cs_rr0;
diff -r 35d1159f80c0 -r 25fa5c2c37aa sys/dev/sun/kbd_zs.c
--- a/sys/dev/sun/kbd_zs.c      Thu Oct 11 00:01:39 2001 +0000
+++ b/sys/dev/sun/kbd_zs.c      Thu Oct 11 12:33:57 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kbd_zs.c,v 1.7.4.1 2001/10/01 12:46:24 fvdl Exp $      */
+/*     $NetBSD: kbd_zs.c,v 1.7.4.2 2001/10/11 12:33:58 fvdl Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -83,7 +83,7 @@
  ****************************************************************/
 
 static void kbd_zs_rxint __P((struct zs_chanstate *));
-static void kbd_zs_stint __P((struct zs_chanstate *, int));
+static void kbd_zs_stint __P((struct zs_chanstate *, int, dev_t));
 static void kbd_zs_txint __P((struct zs_chanstate *));
 static void kbd_zs_softint __P((struct zs_chanstate *));
 
@@ -295,9 +295,10 @@
 
 
 static void
-kbd_zs_stint(cs, force)
+kbd_zs_stint(cs, force, dev)
        struct zs_chanstate *cs;
        int force;
+       dev_t dev;
 {
        struct kbd_softc *k;
        int rr0;
diff -r 35d1159f80c0 -r 25fa5c2c37aa sys/dev/sun/ms_zs.c
--- a/sys/dev/sun/ms_zs.c       Thu Oct 11 00:01:39 2001 +0000
+++ b/sys/dev/sun/ms_zs.c       Thu Oct 11 12:33:57 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ms_zs.c,v 1.3.10.1 2001/10/01 12:46:24 fvdl Exp $      */
+/*     $NetBSD: ms_zs.c,v 1.3.10.2 2001/10/11 12:33:58 fvdl Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -76,7 +76,7 @@
 #include <dev/sun/msvar.h>
 
 static void ms_zs_rxint __P((struct zs_chanstate *));
-static void ms_zs_stint __P((struct zs_chanstate *, int));
+static void ms_zs_stint __P((struct zs_chanstate *, int, dev_t));
 static void ms_zs_txint __P((struct zs_chanstate *));
 static void ms_zs_softint __P((struct zs_chanstate *));
 
@@ -221,9 +221,10 @@
 }
 
 static void
-ms_zs_stint(cs, force)
+ms_zs_stint(cs, force, dev)
        struct zs_chanstate *cs;
        int force;
+       dev_t dev;
 {
        struct ms_softc *ms;
        int rr0;



Home | Main Index | Thread Index | Old Index