Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/isa My 16 port boca seems to fail to update the inte...



details:   https://anonhg.NetBSD.org/src/rev/758189090261
branches:  trunk
changeset: 495424:758189090261
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Jul 27 20:08:47 2000 +0000

description:
My 16 port boca seems to fail to update the interrupt bit in it's interrupt
register for a port under high load. The effect is that the port is wedged
waiting for an interrupt that will never come.
Add a callout-based watchdog which periodically (hz/10) scan trough the ports
for missed interrupts.
Problem also noted by Chris Jones, and this fix also helped him.

diffstat:

 sys/dev/isa/boca.c |  37 +++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 4 deletions(-)

diffs (84 lines):

diff -r 163fd4e83f7a -r 758189090261 sys/dev/isa/boca.c
--- a/sys/dev/isa/boca.c        Thu Jul 27 19:16:09 2000 +0000
+++ b/sys/dev/isa/boca.c        Thu Jul 27 20:08:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boca.c,v 1.33 2000/05/20 18:25:41 thorpej Exp $        */
+/*     $NetBSD: boca.c,v 1.34 2000/07/27 20:08:47 bouyer Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -37,6 +37,8 @@
 #include <sys/systm.h>
 #include <sys/device.h>
 #include <sys/termios.h>
+#include <sys/kernel.h>
+#include <sys/callout.h>
 
 #include <machine/bus.h>
 #include <machine/intr.h>
@@ -59,11 +61,13 @@
        int sc_alive;                   /* mask of slave units attached */
        void *sc_slaves[NSLAVES];       /* com device unit numbers */
        bus_space_handle_t sc_slaveioh[NSLAVES];
+       struct callout fixup;
 };
 
 int bocaprobe __P((struct device *, struct cfdata *, void *));
 void bocaattach __P((struct device *, struct device *, void *));
 int bocaintr __P((void *));
+void boca_fixup __P((void *));
 int bocaprint __P((void *, const char *));
 
 struct cfattach boca_ca = {
@@ -181,6 +185,8 @@
 
        sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
            IPL_SERIAL, bocaintr, sc);
+       callout_init(&sc->fixup);
+       callout_reset(&sc->fixup, hz/10, boca_fixup, sc);
 }
 
 int
@@ -198,8 +204,12 @@
 
        for (;;) {
 #define        TRY(n) \
-               if (bits & (1 << (n))) \
-                       comintr(sc->sc_slaves[n]);
+               if (bits & (1 << (n))) { \
+                       if (comintr(sc->sc_slaves[n]) == 0) { \
+                               printf("%s: bogus intr for port %d\n", \
+                                   sc->sc_dev.dv_xname, n); \
+                       } \
+               }
                TRY(0);
                TRY(1);
                TRY(2);
@@ -211,7 +221,26 @@
 #undef TRY
                bits = bus_space_read_1(iot, sc->sc_slaveioh[0],
                    com_scratch) & alive;
-               if (bits == 0)
+               if (bits == 0) {
                        return (1);
+               }
        }
 }
+
+void
+boca_fixup(v)
+       void *v;
+{
+       struct boca_softc *sc = v;
+       int alive = sc->sc_alive;
+       int i, s;
+
+       s = splserial();
+
+       for (i = 0; i < 8; i++) {
+               if (alive & (1 << (i)))
+                       comintr(sc->sc_slaves[i]);
+       }
+       callout_reset(&sc->fixup, hz/10, boca_fixup, sc);
+       splx(s);
+}



Home | Main Index | Thread Index | Old Index