Subject: Re: port-i386/12860
To: None <netbsd-bugs@netbsd.org>
From: Jason Wright <jason@thought.net>
List: netbsd-bugs
Date: 07/17/2001 00:32:25
I just ported the driver in question (addcom) to OpenBSD and saw the
same lock ups reported here (the card was new in box, so I don't
suspect that being the problem).  The behavior I see is that when
the card interrupts, the bits read back from the status port
are all ones (they are -always- all ones), so the loop in the
interrupt handler never exits.

The solution I took was to trust the slave devices for interrupt
status and it appears to work just fine here.  The diff below
hasn't been tested under NetBSD (or even compiled there), but
reflects the changes when I brought the driver over to OpenBSD.

comments?

--Jason L. Wright

--- addcom_isa.c.orig	Tue Jul 17 00:17:35 2001
+++ addcom_isa.c	Tue Jul 17 00:17:25 2001
@@ -230,29 +230,11 @@
 addcomintr(void *arg)
 {
 	struct addcom_softc *sc = arg;
-	bus_space_tag_t iot = sc->sc_iot;
-	int alive = sc->sc_alive;
-	int bits;
+	int i, r = 0;
 
-	bits = bus_space_read_1(iot, sc->sc_statusioh, 0) & alive;
-	if (bits == 0)
-		return (0);
+	for (i = 0; i < NSLAVES; i++)
+		if (sc->sc_alive & (1 << i))
+			r |= comintr(sc->sc_slaves[i]);
 
-	for (;;) {
-#define	TRY(n) \
-		if (bits & (1 << (n))) \
-			comintr(sc->sc_slaves[n]);
-		TRY(0);
-		TRY(1);
-		TRY(2);
-		TRY(3);
-		TRY(4);
-		TRY(5);
-		TRY(6);
-		TRY(7);
-#undef TRY
-		bits = bus_space_read_1(iot, sc->sc_statusioh, 0) & alive;
-		if (bits == 0)
-			return (1);
- 	}
+	return (r);
 }