Subject: Re: pciide lost interrupt - losing access to the file system
To: Brett Lymn <blymn@baea.com.au>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: current-users
Date: 10/19/1999 20:41:20
On Sun, Oct 17, 1999 at 05:19:36PM +0930, Brett Lymn wrote:
> This is why I asked - I too had no problems having the disk spin down
> & spin up again on access mainly to extend the battery life on my
> laptop.  It worked fine with a -current that was just prior to the 1.4
> release but now it does not.
> 
> I hope this gives Manuel a few clues as to what may be going wrong...

Well, maybe. I've found a situation where the driver could be erroneously 
switched to "not waiting for IRQ" state. The patch below should solve this.
Could those of you who can reproduce the 'missing untimeout' message test it ?

However this reveal another problem here, which is that we are getting an
interrupt before the drive is ready. This can happen when the irq is shared
with another device but this is not the common case.

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

Index: wdc.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wdc.c,v
retrieving revision 1.74
diff -u -r1.74 wdc.c
--- wdc.c	1999/09/23 11:04:32	1.74
+++ wdc.c	1999/10/19 18:32:45
@@ -646,6 +646,7 @@
 {
 	struct channel_softc *chp = arg;
 	struct wdc_xfer *xfer;
+	int ret;
 
 	if ((chp->ch_flags & WDCF_IRQ_WAIT) == 0) {
 		WDCDEBUG_PRINT(("wdcintr: inactive controller\n"), DEBUG_INTR);
@@ -655,7 +656,10 @@
 	WDCDEBUG_PRINT(("wdcintr\n"), DEBUG_INTR);
 	chp->ch_flags &= ~WDCF_IRQ_WAIT;
 	xfer = chp->ch_queue->sc_xfer.tqh_first;
-	return xfer->c_intr(chp, xfer, 1);
+	ret = xfer->c_intr(chp, xfer, 1);
+	if (ret == 0) /* irq was not for us, still waiting for irq */
+		chp->ch_flags |= WDCF_IRQ_WAIT;
+	return (ret);
 }
 
 /* Put all disk in RESET state */