PERFORCE change 115280 for review

Paolo Pisati piso at FreeBSD.org
Sat Mar 3 17:00:00 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=115280

Change 115280 by piso at piso_newluxor on 2007/03/03 16:59:42

	Make pccbb able to handle filter+ithread handlers.

Affected files ...

.. //depot/projects/soc2006/intr_filter/dev/pccbb/pccbb.c#11 edit
.. //depot/projects/soc2006/intr_filter/dev/pccbb/pccbbvar.h#8 edit

Differences ...

==== //depot/projects/soc2006/intr_filter/dev/pccbb/pccbb.c#11 (text+ko) ====

@@ -177,7 +177,8 @@
 		    device_t child);
 static void	cbb_cardbus_power_disable_socket(device_t brdev,
 		    device_t child);
-static int	cbb_func_intr(void *arg);
+static int	cbb_func_filt(void *arg);
+static void	cbb_func_intr(void *arg);
 
 static void
 cbb_remove_res(struct cbb_softc *sc, struct resource *res)
@@ -372,13 +373,12 @@
 	 * least common denominator until the base system supports mixing
 	 * and matching better.
 	 */
-	if (filt != NULL)
-		return (EINVAL);
 	ih = malloc(sizeof(struct cbb_intrhand), M_DEVBUF, M_NOWAIT);
 	if (ih == NULL)
 		return (ENOMEM);
 	*cookiep = ih;
-	ih->intr = filt;
+	ih->filt = filt;
+	ih->intr = intr;
 	ih->arg = arg;
 	ih->sc = sc;
 	/*
@@ -386,7 +386,7 @@
 	 * XXX for now that's all we need to do.
 	 */
 	err = BUS_SETUP_INTR(device_get_parent(dev), child, irq, flags,
-	    NULL, cbb_func_intr, ih, &ih->cookie);
+	    cbb_func_filt, cbb_func_intr, ih, &ih->cookie);
 	if (err != 0) {
 		free(ih, M_DEVBUF);
 		return (err);
@@ -613,7 +613,7 @@
  * CD changes were clear there, then we'd know the card was gone.
  */
 static int
-cbb_func_intr(void *arg)
+cbb_func_filt(void *arg)
 {
 	struct cbb_intrhand *ih = (struct cbb_intrhand *)arg;
 	struct cbb_softc *sc = ih->sc;
@@ -622,17 +622,31 @@
 	 * Make sure that the card is really there.
 	 */
 	if ((sc->flags & CBB_CARD_OK) == 0)
-		return (FILTER_HANDLED);
+		return (FILTER_STRAY);
 	if (!CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) {
 		sc->flags &= ~CBB_CARD_OK;
-		return (FILTER_HANDLED);
+		return (FILTER_STRAY);
 	}
 
 	/*
 	 * nb: don't have to check for giant or not, since that's done
 	 * in the ISR dispatch
 	 */
-	return ((*ih->intr)(ih->arg));
+	if (ih->filt != NULL)
+		return ((*ih->filt)(ih->arg));
+
+	if (ih->intr != NULL)
+		return (FILTER_HANDLED | FILTER_SCHEDULE_THREAD);
+	else
+		return (FILTER_STRAY);
+}
+
+static void
+cbb_func_intr(void *arg)
+{
+	struct cbb_intrhand *ih = (struct cbb_intrhand *)arg;
+
+	ih->intr(ih->arg);
 }
 
 /************************************************************************/

==== //depot/projects/soc2006/intr_filter/dev/pccbb/pccbbvar.h#8 (text+ko) ====

@@ -32,7 +32,8 @@
  */
 
 struct cbb_intrhand {
-	driver_filter_t	*intr;
+	driver_filter_t	*filt;
+	driver_intr_t	*intr;
 	void 		*arg;
 	struct cbb_softc *sc;
 	void		*cookie;


More information about the p4-projects mailing list