Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/newsmips Use software interrupt.



details:   https://anonhg.NetBSD.org/src/rev/4e461cf5b660
branches:  trunk
changeset: 479900:4e461cf5b660
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Sun Dec 26 09:05:38 1999 +0000

description:
Use software interrupt.

diffstat:

 sys/arch/newsmips/apbus/zs_ap.c      |  69 ++---------------------------
 sys/arch/newsmips/dev/zs.c           |  82 +++++++++++++++++++++++++++++++++++-
 sys/arch/newsmips/dev/zs_hb.c        |  72 +++----------------------------
 sys/arch/newsmips/newsmips/machdep.c |  22 ++++++++-
 4 files changed, 113 insertions(+), 132 deletions(-)

diffs (truncated from 402 to 300 lines):

diff -r 14cea5cc39bf -r 4e461cf5b660 sys/arch/newsmips/apbus/zs_ap.c
--- a/sys/arch/newsmips/apbus/zs_ap.c   Sun Dec 26 05:51:25 1999 +0000
+++ b/sys/arch/newsmips/apbus/zs_ap.c   Sun Dec 26 09:05:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zs_ap.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
+/*     $NetBSD: zs_ap.c,v 1.3 1999/12/26 09:05:38 tsubai Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -138,10 +138,10 @@
 
 static struct zschan * zs_get_chan_addr __P((int, int));
 static void zs_ap_delay __P((void));
-static void zshard __P((void *));
-static void zssoft __P((void *));
+static void zshard_ap __P((void *));
 static int zs_getc __P((void *));
 static void zs_putc __P((void *, int));
+int zshard __P((void *));
 int zs_get_speed __P((struct zs_chanstate *));
 
 struct zschan *
@@ -183,8 +183,6 @@
        sizeof(struct zsc_softc), zs_ap_match, zs_ap_attach
 };
 
-extern struct cfdriver zsc_cd;
-
 /*
  * Is the zs chip present?
  */
@@ -317,7 +315,7 @@
                apbus_intr_establish(1, /* interrupt level ( 0 or 1 ) */
                                     NEWS5000_INT1_SCC,
                                     0, /* priority */
-                                    zshard, zsc,
+                                    zshard_ap, zsc,
                                     apa->apa_name, apa->apa_ctlnum);
        }
        /* XXX; evcnt_attach() ? */
@@ -349,70 +347,15 @@
        splx(s);
 }
 
-static volatile int zssoftpending;
-
 /*
  * Our ZS chips all share a common, autovectored interrupt,
  * so we have to look at all of them on each interrupt.
  */
 static void
-zshard(arg)
+zshard_ap(arg)
        void *arg;
 {
-       register struct zsc_softc *zsc;
-       register int unit, rval, softreq;
-
-       rval = softreq = 0;
-       for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
-               zsc = zsc_cd.cd_devs[unit];
-               if (zsc == NULL)
-                       continue;
-               rval |= zsc_intr_hard(zsc);
-               softreq |= zsc->zsc_cs[0]->cs_softreq;
-               softreq |= zsc->zsc_cs[1]->cs_softreq;
-       }
-
-       /* We are at splzs here, so no need to lock. */
-       if (softreq && (zssoftpending == 0)) {
-               zssoftpending = 1;
-               zssoft(arg);    /*isr_soft_request(ZSSOFT_PRI);*/
-       }
-}
-
-/*
- * Similar scheme as for zshard (look at all of them)
- */
-static void
-zssoft(arg)
-       void *arg;
-{
-       register struct zsc_softc *zsc;
-       register int s, unit;
-
-       /* This is not the only ISR on this IPL. */
-       if (zssoftpending == 0)
-               return;
-
-       /*
-        * The soft intr. bit will be set by zshard only if
-        * the variable zssoftpending is zero.  The order of
-        * these next two statements prevents our clearing
-        * the soft intr bit just after zshard has set it.
-        */
-       /*isr_soft_clear(ZSSOFT_PRI);*/
-       /*zssoftpending = 0;*/
-
-       /* Make sure we call the tty layer at spltty. */
-       s = spltty();
-       for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
-               zsc = zsc_cd.cd_devs[unit];
-               if (zsc == NULL)
-                       continue;
-               (void) zsc_intr_soft(zsc);
-       }
-       splx(s);
-       zssoftpending = 0;
-       return;
+       zshard(arg);
 }
 
 /*
diff -r 14cea5cc39bf -r 4e461cf5b660 sys/arch/newsmips/dev/zs.c
--- a/sys/arch/newsmips/dev/zs.c        Sun Dec 26 05:51:25 1999 +0000
+++ b/sys/arch/newsmips/dev/zs.c        Sun Dec 26 09:05:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zs.c,v 1.10 1999/12/22 05:55:25 tsubai Exp $   */
+/*     $NetBSD: zs.c,v 1.11 1999/12/26 09:05:39 tsubai Exp $   */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -60,10 +60,14 @@
 #define ZS_DELAY() (*zs_delay)()
 
 int zs_print __P((void *, const char *name));
+int zshard __P((void *));
+void zssoft __P((void *));
 int zs_get_speed __P((struct zs_chanstate *));
 void Debugger __P((void));
 void (*zs_delay) __P((void));
 
+extern struct cfdriver zsc_cd;
+
 /*
  * Some warts needed by z8530tty.c -
  * The default parity REALLY needs to be the same as the PROM uses,
@@ -88,6 +92,82 @@
        return UNCONF;
 }
 
+static volatile int zssoftpending;
+
+#define setsoftserial()                        \
+{                                      \
+       int s;                          \
+       extern int softisr;             \
+                                       \
+       s = splhigh();                  \
+       softisr |= SOFTISR_ZS;          \
+       splx(s);                        \
+}
+
+/*
+ * Our ZS chips all share a common, autovectored interrupt,
+ * so we have to look at all of them on each interrupt.
+ */
+int
+zshard(arg)
+       void *arg;
+{
+       register struct zsc_softc *zsc;
+       register int unit, rval, softreq;
+
+       rval = softreq = 0;
+       for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
+               zsc = zsc_cd.cd_devs[unit];
+               if (zsc == NULL)
+                       continue;
+               rval |= zsc_intr_hard(zsc);
+               softreq |= zsc->zsc_cs[0]->cs_softreq;
+               softreq |= zsc->zsc_cs[1]->cs_softreq;
+       }
+
+       /* We are at splzs here, so no need to lock. */
+       if (softreq && (zssoftpending == 0)) {
+               zssoftpending = 1;
+               setsoftserial();
+       }
+
+       return rval;
+}
+
+/*
+ * Similar scheme as for zshard (look at all of them)
+ */
+void
+zssoft(arg)
+       void *arg;
+{
+       register struct zsc_softc *zsc;
+       register int s, unit;
+
+       /* This is not the only ISR on this IPL. */
+       if (zssoftpending == 0)
+               return;
+
+       /*
+        * The soft intr. bit will be set by zshard only if
+        * the variable zssoftpending is zero.  The order of
+        * these next two statements prevents our clearing
+        * the soft intr bit just after zshard has set it.
+        */
+       /* clearsoftnet(); */
+       zssoftpending = 0;
+
+       /* Make sure we call the tty layer at spltty. */
+       s = spltty();
+       for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
+               zsc = zsc_cd.cd_devs[unit];
+               if (zsc == NULL)
+                       continue;
+               (void)zsc_intr_soft(zsc);
+       }
+       splx(s);
+}
+
 /*
  * Compute the current baud rate given a ZS channel.
  */
diff -r 14cea5cc39bf -r 4e461cf5b660 sys/arch/newsmips/dev/zs_hb.c
--- a/sys/arch/newsmips/dev/zs_hb.c     Sun Dec 26 05:51:25 1999 +0000
+++ b/sys/arch/newsmips/dev/zs_hb.c     Sun Dec 26 09:05:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zs_hb.c,v 1.1 1999/12/22 05:55:25 tsubai Exp $ */
+/*     $NetBSD: zs_hb.c,v 1.2 1999/12/26 09:05:39 tsubai Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -122,13 +122,13 @@
 
 static struct zschan * zs_get_chan_addr __P((int, int));
 static void zs_hb_delay __P((void));
-static int zshard __P((void *));
-static void zssoft __P((void *));
+static int zshard_hb __P((void *));
 static int zs_getc __P((void *));
 static void zs_putc __P((void *, int));
+int zshard __P((void *));
 int zs_get_speed __P((struct zs_chanstate *));
 
-static struct zschan *
+struct zschan *
 zs_get_chan_addr(zs_unit, channel)
        int zs_unit, channel;
 {
@@ -167,8 +167,6 @@
        sizeof(struct zsc_softc), zs_hb_match, zs_hb_attach
 };
 
-extern struct cfdriver zsc_cd;
-
 /*
  * Is the zs chip present?
  */
@@ -297,7 +295,7 @@
        if (!didintr) {
                didintr = 1;
 
-               hb_intr_establish(intlevel, IPL_SERIAL, zshard, NULL);
+               hb_intr_establish(intlevel, IPL_SERIAL, zshard_hb, NULL);
        }
        /* XXX; evcnt_attach() ? */
 
@@ -314,73 +312,17 @@
        splx(s);
 }
 
-static volatile int zssoftpending;
-
 /*
  * Our ZS chips all share a common, autovectored interrupt,
  * so we have to look at all of them on each interrupt.
  */
 static int
-zshard(arg)
+zshard_hb(arg)
        void *arg;
 {
-       register struct zsc_softc *zsc;
-       register int unit, rval, softreq;
-
        (void) *(volatile u_char *)SCCVECT;
 
-       rval = softreq = 0;
-       for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
-               zsc = zsc_cd.cd_devs[unit];
-               if (zsc == NULL)
-                       continue;
-               rval |= zsc_intr_hard(zsc);
-               softreq |= zsc->zsc_cs[0]->cs_softreq;
-               softreq |= zsc->zsc_cs[1]->cs_softreq;
-       }
-
-       /* We are at splzs here, so no need to lock. */
-       if (softreq && (zssoftpending == 0)) {
-               zssoftpending = 1;
-               zssoft(arg);    /*isr_soft_request(ZSSOFT_PRI);*/
-       }
-       return rval;



Home | Main Index | Thread Index | Old Index