Subject: Re: kern/29903 (register data)
To: None <gnats-bugs@netbsd.org>
From: Steve Woodford <scw@netbsd.org>
List: netbsd-bugs
Date: 04/25/2005 08:44:41
--Boundary-00=_p/JbCvR7Vx8V9K4
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Saturday 23 April 2005 11:18, Arto Selonen wrote:

>  On Fri, 22 Apr 2005, Steve Woodford wrote:
>  > 2) If the wm(4) card is sharing a PCI interrupt line with some
>  > other device then wm_intr() will be called regardless.
>
>  Not sure if you're talking about something else, but just in case:
>
>  % dmesg | fgrep interrupt
[snip no sign of interrupt sharing]

I've come up with what should be a cleaner fix for this problem; one 
which doesn't add extra code to critical paths.

Please try the attached patch and let me know how it goes.

Cheers, Steve

--Boundary-00=_p/JbCvR7Vx8V9K4
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="if_wm.c.patch2"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="if_wm.c.patch2"

Index: if_wm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
retrieving revision 1.101
diff -u -r1.101 if_wm.c
--- if_wm.c	19 Mar 2005 11:58:03 -0000	1.101
+++ if_wm.c	25 Apr 2005 07:42:02 -0000
@@ -2840,6 +2840,15 @@
 	CSR_WRITE(sc, WMREG_TCTL, 0);
 	CSR_WRITE(sc, WMREG_RCTL, 0);
 
+	/*
+	 * Clear the interrupt mask to ensure the device cannot assert its
+	 * interrupt line.
+	 * Clear sc->sc_icr to ensure wm_intr() makes no attempt to service
+	 * any currently pending or shared interrupt.
+	 */
+	CSR_WRITE(sc, WMREG_IMC, 0xffffffffU);
+	sc->sc_icr = 0;
+
 	/* Release any queued transmit buffers. */
 	for (i = 0; i < WM_TXQUEUELEN(sc); i++) {
 		txs = &sc->sc_txsoft[i];

--Boundary-00=_p/JbCvR7Vx8V9K4--