From owner-p4-projects@FreeBSD.ORG Tue Dec 19 00:06:18 2006 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 09F4916A40F; Tue, 19 Dec 2006 00:06:18 +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 C47A316A403 for ; Tue, 19 Dec 2006 00:06:17 +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 7965A43C9F for ; Tue, 19 Dec 2006 00:06:17 +0000 (GMT) (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 kBJ06HDE083490 for ; Tue, 19 Dec 2006 00:06:17 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kBJ06Ho2083479 for perforce@freebsd.org; Tue, 19 Dec 2006 00:06:17 GMT (envelope-from piso@freebsd.org) Date: Tue, 19 Dec 2006 00:06:17 GMT Message-Id: <200612190006.kBJ06Ho2083479@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 111914 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: Tue, 19 Dec 2006 00:06:18 -0000 http://perforce.freebsd.org/chv.cgi?CH=111914 Change 111914 by piso@piso_newluxor on 2006/12/19 00:06:12 Teach pccard how to handle filters. Affected files ... .. //depot/projects/soc2006/intr_filter/dev/pccard/pccard.c#4 edit .. //depot/projects/soc2006/intr_filter/dev/pccard/pccardvarp.h#2 edit Differences ... ==== //depot/projects/soc2006/intr_filter/dev/pccard/pccard.c#4 (text+ko) ==== @@ -118,6 +118,7 @@ static int pccard_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); static void pccard_child_detached(device_t parent, device_t dev); +static int pccard_filter(void *arg); static void pccard_intr(void *arg); static int pccard_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, @@ -1173,8 +1174,8 @@ pccard_function_disable(pf); } -static void -pccard_intr(void *arg) +static int +pccard_filter(void *arg) { struct pccard_function *pf = (struct pccard_function*) arg; int reg; @@ -1204,8 +1205,21 @@ else doisr = 0; } - if (pf->intr_handler != NULL && doisr) - pf->intr_handler(pf->intr_handler_arg); + if (pf->intr_handler != NULL && doisr) { + if (pf->intr_filter != NULL) + return (pf->intr_filter(pf->intr_handler_arg)); + else + return (FILTER_HANDLED | FILTER_SCHEDULE_THREAD); + } + return (FILTER_STRAY); +} + +static void +pccard_intr(void *arg) +{ + struct pccard_function *pf = (struct pccard_function*) arg; + + pf->intr_handler(pf->intr_handler_arg); } static int @@ -1220,13 +1234,11 @@ if (pf->intr_handler != NULL) panic("Only one interrupt handler per function allowed"); - err = bus_generic_setup_intr(dev, child, irq, flags, filter, pccard_intr, + err = bus_generic_setup_intr(dev, child, irq, flags, pccard_filter, pccard_intr, pf, cookiep); if (err != 0) return (err); - /* - * XXX_FILTER this code doesn't take care of filters. - */ + pf->intr_filter = filter; pf->intr_handler = intr; pf->intr_handler_arg = arg; pf->intr_handler_cookie = *cookiep; ==== //depot/projects/soc2006/intr_filter/dev/pccard/pccardvarp.h#2 (text+ko) ==== @@ -112,6 +112,7 @@ bus_addr_t pf_mfc_iobase; bus_addr_t pf_mfc_iomax; int pf_flags; + driver_filter_t *intr_filter; driver_intr_t *intr_handler; void *intr_handler_arg; void *intr_handler_cookie;