============================================= (cd /usr/src && patch -p6) < diff_to_current ============================================= --- //depot/vendor/freebsd/src/sys/dev/pccbb/pccbb.c 2007/05/16 19:58:45 +++ //depot/user/simokawa/firewire/sys/dev/pccbb/pccbb.c 2007/05/21 12:08:58 @@ -176,6 +176,7 @@ device_t child); static void cbb_cardbus_power_disable_socket(device_t brdev, device_t child); +static int cbb_func_filt(void *arg); static void cbb_func_intr(void *arg); static void @@ -365,18 +366,11 @@ struct cbb_softc *sc = device_get_softc(dev); int err; - /* - * Well, this is no longer strictly true. You can have multiple - * FAST ISRs, but can't mix fast and slow, so we have to assume - * 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->filt = filt; ih->intr = intr; ih->arg = arg; ih->sc = sc; @@ -385,7 +379,9 @@ * 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); + (filt == NULL) ? NULL : cbb_func_filt, + (intr == NULL) ? NULL : cbb_func_intr, + ih, &ih->cookie); if (err != 0) { free(ih, M_DEVBUF); return (err); @@ -634,6 +630,24 @@ */ (*ih->intr)(ih->arg); } +static int +cbb_func_filt(void *arg) +{ + struct cbb_intrhand *ih = (struct cbb_intrhand *)arg; + struct cbb_softc *sc = ih->sc; + + /* + * Make sure that the card is really there. + */ + if ((sc->flags & CBB_CARD_OK) == 0) + return (FILTER_STRAY); + if (!CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) { + sc->flags &= ~CBB_CARD_OK; + return (FILTER_STRAY); + } + + return ((*ih->filt)(ih->arg)); +} /************************************************************************/ /* Generic Power functions */ --- //depot/vendor/freebsd/src/sys/dev/pccbb/pccbbvar.h 2007/02/23 12:24:01 +++ //depot/user/simokawa/firewire/sys/dev/pccbb/pccbbvar.h 2007/03/22 13:16:58 @@ -32,6 +32,7 @@ */ struct cbb_intrhand { + driver_filter_t *filt; driver_intr_t *intr; void *arg; struct cbb_softc *sc;