Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Oct 2006 15:39:24 GMT
From:      Paolo Pisati <piso@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 107899 for review
Message-ID:  <200610141539.k9EFdOXC035274@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=107899

Change 107899 by piso@piso_newluxor on 2006/10/14 15:38:37

	filter-ize fxp.

Affected files ...

.. //depot/projects/soc2006/intr_filter/dev/fxp/if_fxp.c#4 edit

Differences ...

==== //depot/projects/soc2006/intr_filter/dev/fxp/if_fxp.c#4 (text+ko) ====

@@ -211,7 +211,9 @@
 static int		fxp_shutdown(device_t dev);
 static int		fxp_suspend(device_t dev);
 static int		fxp_resume(device_t dev);
-
+#ifdef INTR_FILTER
+static int		fxp_filter(void *xsc);
+#endif
 static void		fxp_intr(void *xsc);
 static void		fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp,
 			    uint8_t statack, int count);
@@ -804,8 +806,14 @@
 	/* 
 	 * Hook our interrupt after all initialization is complete.
 	 */
+
+#ifdef INTR_FILTER
+	error = bus_setup_intr(dev, sc->fxp_res[1], INTR_TYPE_NET | INTR_MPSAFE,
+			       fxp_filter, fxp_intr, sc, &sc->ih);
+#else
 	error = bus_setup_intr(dev, sc->fxp_res[1], INTR_TYPE_NET | INTR_MPSAFE,
 			       NULL, fxp_intr, sc, &sc->ih);
+#endif
 	if (error) {
 		device_printf(dev, "could not setup irq\n");
 		ether_ifdetach(sc->ifp);
@@ -1482,6 +1490,23 @@
 }
 #endif /* DEVICE_POLLING */
 
+#ifdef INTR_FILTER
+static int
+fxp_filter(void *xsc)
+{
+	struct fxp_softc *sc = xsc;
+	uint8_t statack;
+
+	statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK);
+	if (statack == 0xff || statack == 0)
+		return (FILTER_STRAY);
+
+	/* disable interrupts */
+	CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE);	
+	return (FILTER_HANDLED|FILTER_SCHEDULE_THREAD);
+}
+#endif
+
 /*
  * Process interface interrupts.
  */
@@ -1522,6 +1547,10 @@
 		CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack);
 		fxp_intr_body(sc, ifp, statack, -1);
 	}
+#ifdef INTR_FILTER
+	/* enable interrupts */
+	CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, 0);
+#endif
 	FXP_UNLOCK(sc);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610141539.k9EFdOXC035274>