Subject: Re: 8-port Boca boards
To: Chris Jones <chris@cjones.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: current-users
Date: 07/26/2000 17:49:53
On Tue, Jul 25, 2000 at 02:14:47PM -0600, Chris Jones wrote:
> I'm trying to use an 8-port BocaBoard in 1.5_ALPHA on i386, and I'm
> not having much luck.  I was wondering if anybody else had had any
> success with these.  I think my next step is to downgrade to 1.4 and
> see if that works.

I have a 16-ports one working, which uses the same driver as the 8-port one:
boca0 at isa0 port 0x100-0x13f irq 11
com2 at boca0 slave 0: ns16550a, working fifo
com3 at boca0 slave 1: ns16550a, working fifo
com4 at boca0 slave 2: ns16550a, working fifo
com5 at boca0 slave 3: ns16550a, working fifo
com6 at boca0 slave 4: ns16550a, working fifo
com7 at boca0 slave 5: ns16550a, working fifo
com8 at boca0 slave 6: ns16550a, working fifo
com9 at boca0 slave 7: ns16550a, working fifo
boca1 at isa0 port 0x140-0x17f irq 11
com10 at boca1 slave 0: ns16550a, working fifo
com11 at boca1 slave 1: ns16550a, working fifo
com12 at boca1 slave 2: ns16550a, working fifo
com13 at boca1 slave 3: ns16550a, working fifo
com14 at boca1 slave 4: ns16550a, working fifo
com15 at boca1 slave 5: ns16550a, working fifo
com16 at boca1 slave 6: ns16550a, working fifo
com17 at boca1 slave 7: ns16550a, working fifo

I use it for servers serial consoles.
However I've had problems related to interrupts: it seems that from time to
time, the interruopt status register of the boca isn't updated to reflect
an interrupt-pending condition for a serial port. The affected serial port
appears wedged, as it's waiting for an interrupt and bocaintr will never
call it. Other ports of the board keep running properly, until they're hit
by the problem too.
I implemented a workaround, which is to periodically call comintr() for each
serial port; this seems to have prevented the hangs that would otherwise
make the board unusable.

Index: boca.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/isa/boca.c,v
retrieving revision 1.33
diff -u -r1.33 boca.c
--- boca.c	2000/05/20 18:25:41	1.33
+++ boca.c	2000/07/26 15:47:45
@@ -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);
 }

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--