diff --git a/sys/x86/include/intr_machdep.h b/sys/x86/include/intr_machdep.h --- a/sys/x86/include/intr_machdep.h +++ b/sys/x86/include/intr_machdep.h @@ -138,12 +138,12 @@ #ifdef SMP void intr_add_cpu(u_int cpu); #endif -int intr_add_handler(const char *name, int vector, driver_filter_t filter, - driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep, - int domain); -int intr_config_intr(int vector, enum intr_trigger trig, +int intr_add_handler(struct intsrc *isrc, const char *name, + driver_filter_t filter, driver_intr_t handler, void *arg, + enum intr_type flags, void **cookiep, int domain); +int intr_config_intr(struct intsrc *isrc, enum intr_trigger trig, enum intr_polarity pol); -int intr_describe(u_int vector, void *ih, const char *descr); +int intr_describe(struct intsrc *isrc, void *ih, const char *descr); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); u_int intr_next_cpu(int domain); struct intsrc *intr_lookup_source(int vector); diff --git a/sys/x86/include/xen/arch-intr.h b/sys/x86/include/xen/arch-intr.h --- a/sys/x86/include/xen/arch-intr.h +++ b/sys/x86/include/xen/arch-intr.h @@ -67,7 +67,7 @@ struct xenisrc *isrc, void **cookiep) { - return (intr_add_handler(name, isrc->xi_arch.vector, filter, handler, + return (intr_add_handler(&isrc->xi_arch.intsrc, name, filter, handler, arg, flags, cookiep, 0)); } @@ -75,7 +75,7 @@ xen_arch_intr_describe(struct xenisrc *isrc, void *cookie, const char *descr) { - return (intr_describe(isrc->xi_arch.vector, cookie, descr)); + return (intr_describe(&isrc->xi_arch.intsrc, cookie, descr)); } static inline int diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c --- a/sys/x86/x86/intr_machdep.c +++ b/sys/x86/x86/intr_machdep.c @@ -255,16 +255,12 @@ } int -intr_add_handler(const char *name, int vector, driver_filter_t filter, +intr_add_handler(struct intsrc *isrc, const char *name, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep, int domain) { - struct intsrc *isrc; int error; - isrc = intr_lookup_source(vector); - if (isrc == NULL) - return (EINVAL); error = intr_event_add_handler(isrc->is_event, name, filter, handler, arg, intr_priority(flags), flags, cookiep); if (error == 0) { @@ -303,13 +299,10 @@ } int -intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol) +intr_config_intr(struct intsrc *isrc, enum intr_trigger trig, + enum intr_polarity pol) { - struct intsrc *isrc; - isrc = intr_lookup_source(vector); - if (isrc == NULL) - return (EINVAL); return (isrc->is_pic->pic_config_intr(isrc, trig, pol)); } @@ -513,14 +506,10 @@ /* Add a description to an active interrupt handler. */ int -intr_describe(u_int vector, void *ih, const char *descr) +intr_describe(struct intsrc *isrc, void *ih, const char *descr) { - struct intsrc *isrc; int error; - isrc = intr_lookup_source(vector); - if (isrc == NULL) - return (EINVAL); error = intr_event_describe_handler(isrc->is_event, ih, descr); if (error) return (error); diff --git a/sys/x86/x86/nexus.c b/sys/x86/x86/nexus.c --- a/sys/x86/x86/nexus.c +++ b/sys/x86/x86/nexus.c @@ -458,6 +458,7 @@ void *arg, void **cookiep) { int error, domain; + struct intsrc *isrc; /* somebody tried to setup an irq that failed to allocate! */ if (irq == NULL) @@ -476,8 +477,11 @@ if (bus_get_domain(child, &domain) != 0) domain = 0; - error = intr_add_handler(device_get_nameunit(child), - rman_get_start(irq), filter, ihand, arg, flags, cookiep, domain); + isrc = intr_lookup_source(rman_get_start(irq)); + if (isrc == NULL) + return (EINVAL); + error = intr_add_handler(isrc, device_get_nameunit(child), + filter, ihand, arg, flags, cookiep, domain); if (error == 0) rman_set_irq_cookie(irq, *cookiep); @@ -524,15 +528,24 @@ nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, enum intr_polarity pol) { - return (intr_config_intr(irq, trig, pol)); + struct intsrc *isrc; + + isrc = intr_lookup_source(irq); + if (isrc == NULL) + return (EINVAL); + return (intr_config_intr(isrc, trig, pol)); } static int nexus_describe_intr(device_t dev, device_t child, struct resource *irq, void *cookie, const char *descr) { + struct intsrc *isrc; - return (intr_describe(rman_get_start(irq), cookie, descr)); + isrc = intr_lookup_source(rman_get_start(irq)); + if (isrc == NULL) + return (EINVAL); + return (intr_describe(isrc, cookie, descr)); } static struct resource_list *