Subject: bge interrupt patch
To: None <port-amd64@netbsd.org, tech-net@netbsd.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-net
Date: 05/21/2006 17:42:38
--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

If you've got a bge device that seems to be missing interrupts, or
generating too many, I'd appreciate it if you could try the attached
patch and let me know if it makes any difference.

-- 
  Thor Lancelot Simon	                                     tls@rek.tjls.com

  "We cannot usually in social life pursue a single value or a single moral
   aim, untroubled by the need to compromise with others."      - H.L.A. Hart

--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bge-intr.diff"

Index: if_bge.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.87.2.4
diff -u -r1.87.2.4 if_bge.c
--- if_bge.c	22 Nov 2005 20:44:22 -0000	1.87.2.4
+++ if_bge.c	21 May 2006 21:39:35 -0000
@@ -2974,12 +2974,17 @@
 
 	sc = xsc;
 	ifp = &sc->ethercom.ec_if;
+	struct pci_attach_args  *pa = &(sc->bge_pa);
 
 #ifdef notdef
 	/* Avoid this for now -- checking this register is expensive. */
 	/* Make sure this is really our interrupt. */
 	if (!(CSR_READ_4(sc, BGE_MISC_LOCAL_CTL) & BGE_MLC_INTR_STATE))
 		return (0);
+#else
+	if(pci_conf_read(pa->pa_pc, pa->pa_tag, BGE_PCI_PCISTATE) &
+	    BGE_PCISTATE_INTR_STATE)
+		return (0);
 #endif
 	/* Ack interrupt and stop others from occuring. */
 	CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1);

--X1bOJ3K7DJ5YkBrT--