--- p4_head/sys/sun4v/include/intr_machdep.h Sun Jan 21 15:20:47 2007 +++ p4_head_intr/sys/sun4v/include/intr_machdep.h Fri Jan 26 13:54:09 2007 @@ -79,8 +79,8 @@ void intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf, void *iva); -int inthand_add(const char *name, int vec, void (*handler)(void *), - void *arg, int flags, void **cookiep); +int inthand_add(const char *name, int vec, int (*filt)(void *), + void (*handler)(void *), void *arg, int flags, void **cookiep); int inthand_remove(int vec, void *cookie); void cpu_intrq_init(void); --- p4_head/sys/sun4v/sun4v/hvcons.c Sun Jan 21 15:20:49 2007 +++ p4_head_intr/sys/sun4v/sun4v/hvcons.c Fri Jan 26 13:54:09 2007 @@ -390,7 +390,7 @@ goto fail; } - error = bus_setup_intr(dev, hvcn_irq, INTR_TYPE_TTY, hvcn_intr, hvcn_tp, + error = bus_setup_intr(dev, hvcn_irq, INTR_TYPE_TTY, NULL, hvcn_intr, hvcn_tp, hvcn_intrhand); if (error) --- p4_head/sys/sun4v/sun4v/intr_machdep.c Sun Jan 21 15:20:49 2007 +++ p4_head_intr/sys/sun4v/sun4v/intr_machdep.c Fri Jan 26 13:54:09 2007 @@ -144,7 +144,7 @@ static void intr_execute_handlers(void *); static void intr_stray_level(struct trapframe *); -static void intr_stray_vector(void *); +static void intr_stray_vector(void *); static int intrcnt_setname(const char *, int); static void intrcnt_updatename(int, const char *, int); static void cpu_intrq_alloc(void); @@ -292,14 +292,14 @@ thread = 0; TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) { - if (!(ih->ih_flags & IH_FAST)) { + if (ih->ih_filter == NULL) { thread = 1; continue; } - MPASS(ih->ih_flags & IH_FAST && ih->ih_argument != NULL); + MPASS(ih->ih_filter == NULL && ih->ih_argument != NULL); CTR3(KTR_INTR, "%s: executing handler %p(%p)", __func__, - ih->ih_handler, ih->ih_argument); - ih->ih_handler(ih->ih_argument); + ih->ih_filter, ih->ih_argument); + ih->ih_filter(ih->ih_argument); } /* Schedule a heavyweight interrupt process. */ @@ -313,7 +313,7 @@ } } -static void +static int ithread_wrapper(void *arg) { struct ithread_vector_handler *ivh = (struct ithread_vector_handler *)arg; @@ -321,12 +321,12 @@ ivh->ivh_handler(ivh->ivh_arg); /* re-enable interrupt */ hv_intr_setstate(ivh->ivh_vec, HV_INTR_IDLE_STATE); - + return (FILTER_HANDLED); } int -inthand_add(const char *name, int vec, void (*handler)(void *), void *arg, - int flags, void **cookiep) +inthand_add(const char *name, int vec, driver_filter_t *filt, + void (*handler)(void *), void *arg, int flags, void **cookiep) { struct intr_vector *iv; struct intr_event *ie; /* descriptor for the IRQ */ @@ -334,6 +334,8 @@ struct ithread_vector_handler *ivh; int errcode, pil; + if (filt != NULL && handler != NULL) + return (EINVAL); /* * Work around a race where more than one CPU may be registering * handlers on the same IRQ at the same time. @@ -359,17 +361,17 @@ } } - if (!(flags & INTR_FAST)) { + if (filt != NULL) { ivh = (struct ithread_vector_handler *) malloc(sizeof(struct ithread_vector_handler), M_DEVBUF, M_WAITOK); - ivh->ivh_handler = handler; + ivh->ivh_handler = (driver_intr_t *)filt; ivh->ivh_arg = arg; ivh->ivh_vec = vec; - errcode = intr_event_add_handler(ie, name, ithread_wrapper, ivh, + errcode = intr_event_add_handler(ie, name, ithread_wrapper, NULL, ivh, intr_priority(flags), flags, cookiep); } else { ivh = NULL; - errcode = intr_event_add_handler(ie, name, handler, arg, + errcode = intr_event_add_handler(ie, name, NULL, handler, arg, intr_priority(flags), flags, cookiep); } @@ -379,7 +381,7 @@ free(ivh, M_DEVBUF); return (errcode); } - pil = (flags & INTR_FAST) ? PIL_FAST : PIL_ITHREAD; + pil = (filt != NULL) ? PIL_FAST : PIL_ITHREAD; intr_setup(pil, intr_fast, vec, intr_execute_handlers, iv); --- p4_head/sys/sun4v/sun4v/nexus.c Sun Jan 21 15:20:49 2007 +++ p4_head_intr/sys/sun4v/sun4v/nexus.c Fri Jan 26 13:54:09 2007 @@ -306,7 +306,7 @@ static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, - driver_intr_t *intr, void *arg, void **cookiep) + driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { struct nexus_devinfo *ndi; device_t ichild; @@ -346,7 +346,7 @@ goto fail; error = inthand_add(device_get_nameunit(child), ihdl, - intr, arg, flags, cookiep); + filt, intr, arg, flags, cookiep); cpuid = 0; if (hv_intr_settarget(ihdl, cpuid) != H_EOK) { --- p4_head/sys/sun4v/sun4v/vnex.c Sun Jan 21 15:20:50 2007 +++ p4_head_intr/sys/sun4v/sun4v/vnex.c Fri Jan 26 13:54:09 2007 @@ -249,7 +249,7 @@ static int vnex_setup_intr(device_t dev, device_t child, struct resource *res, int flags, - driver_intr_t *intr, void *arg, void **cookiep) + driver_filter_t *filt,driver_intr_t *intr, void *arg, void **cookiep) { uint64_t reg, nreg; @@ -298,7 +298,7 @@ goto fail; error = inthand_add(device_get_nameunit(child), ihdl, - intr, arg, flags, cookiep); + filt, intr, arg, flags, cookiep); printf("inthandler added\n"); fail: