Date: Tue, 19 Dec 2006 00:06:17 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 111914 for review Message-ID: <200612190006.kBJ06Ho2083479@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612190006.kBJ06Ho2083479>