From owner-p4-projects@FreeBSD.ORG Sat Mar 3 16:59:59 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B528516A405; Sat, 3 Mar 2007 16:59:59 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8981716A403 for ; Sat, 3 Mar 2007 16:59:59 +0000 (UTC) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 7E55813C49D for ; Sat, 3 Mar 2007 16:59:59 +0000 (UTC) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l23GxxJp032154 for ; Sat, 3 Mar 2007 16:59:59 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l23Gxwbr032151 for perforce@freebsd.org; Sat, 3 Mar 2007 16:59:58 GMT (envelope-from piso@freebsd.org) Date: Sat, 3 Mar 2007 16:59:58 GMT Message-Id: <200703031659.l23Gxwbr032151@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to piso@freebsd.org using -f From: Paolo Pisati To: Perforce Change Reviews Cc: Subject: PERFORCE change 115280 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Mar 2007 17:00:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=115280 Change 115280 by piso@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;