diff --git a/sys/amd64/amd64/intr_machdep.c b/sys/amd64/amd64/intr_machdep.c index a160822a2a0c..0d95928ec894 100644 --- a/sys/amd64/amd64/intr_machdep.c +++ b/sys/amd64/amd64/intr_machdep.c @@ -77,12 +77,6 @@ static struct sx intr_table_lock; static struct mtx intrcnt_lock; static STAILQ_HEAD(, pic) pics; -#ifdef INTR_FILTER -static void intr_eoi_src(void *arg); -static void intr_disab_eoi_src(void *arg); -static void intr_event_stray(void *cookie); -#endif - #ifdef SMP static int assign_cpu; @@ -90,6 +84,10 @@ static void intr_assign_next_cpu(struct intsrc *isrc); #endif static int intr_assign_cpu(void *arg, u_char cpu); +static void intr_disable_src(void *arg); +#ifdef INTR_FILTER +static void intr_event_stray(void *cookie); +#endif static void intr_init(void *__dummy); static int intr_pic_registered(struct pic *pic); static void intrcnt_setname(const char *name, int index); @@ -144,16 +142,10 @@ intr_register_source(struct intsrc *isrc) vector = isrc->is_pic->pic_vector(isrc); if (interrupt_sources[vector] != NULL) return (EEXIST); -#ifdef INTR_FILTER error = intr_event_create(&isrc->is_event, isrc, 0, - (mask_fn)isrc->is_pic->pic_enable_source, - intr_eoi_src, intr_disab_eoi_src, intr_assign_cpu, "irq%d:", + intr_disable_src, (mask_fn)isrc->is_pic->pic_enable_source, + (mask_fn)isrc->is_pic->pic_eoi_source, intr_assign_cpu, "irq%d:", vector); -#else - error = intr_event_create(&isrc->is_event, isrc, 0, - (mask_fn)isrc->is_pic->pic_enable_source, intr_assign_cpu, "irq%d:", - vector); -#endif if (error) return (error); sx_xlock(&intr_table_lock); @@ -237,6 +229,15 @@ intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol) return (isrc->is_pic->pic_config_intr(isrc, trig, pol)); } +static void +intr_disable_src(void *arg) +{ + struct intsrc *isrc; + + isrc = arg; + isrc->is_pic->pic_disable_source(isrc, PIC_EOI); +} + #ifdef INTR_FILTER void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame) @@ -289,24 +290,6 @@ intr_event_stray(void *cookie) "too many stray irq %d's: not logging anymore\n", isrc->is_pic->pic_vector(isrc)); } - -static void -intr_eoi_src(void *arg) -{ - struct intsrc *isrc; - - isrc = arg; - isrc->is_pic->pic_eoi_source(isrc); -} - -static void -intr_disab_eoi_src(void *arg) -{ - struct intsrc *isrc; - - isrc = arg; - isrc->is_pic->pic_disable_source(isrc, PIC_EOI); -} #else void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame) diff --git a/sys/arm/arm/intr.c b/sys/arm/arm/intr.c index fbaa96cce402..ecc97701d0e0 100644 --- a/sys/arm/arm/intr.c +++ b/sys/arm/arm/intr.c @@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$"); #include #include +typedef void (*mask_fn)(void *); + static struct intr_event *intr_events[NIRQ]; static int intrcnt_tab[NIRQ]; static int intrcnt_index = 0; @@ -57,27 +59,6 @@ static int last_printed = 0; void arm_handler_execute(struct trapframe *, int); -#ifdef INTR_FILTER -static void -intr_disab_eoi_src(void *arg) -{ - uintptr_t nb; - - nb = (uintptr_t)arg; - arm_mask_irq(nb); -} - -static void -intr_eoi_src(void *arg) -{ - uintptr_t nb; - - nb = (uintptr_t)arg; - arm_unmask_irq(nb); -} - -#endif - void arm_setup_irqhandler(const char *name, driver_filter_t *filt, void (*hand)(void*), void *arg, int irq, int flags, void **cookiep) @@ -89,14 +70,9 @@ arm_setup_irqhandler(const char *name, driver_filter_t *filt, return; event = intr_events[irq]; if (event == NULL) { -#ifdef INTR_FILTER error = intr_event_create(&event, (void *)irq, 0, - (void (*)(void *))arm_unmask_irq, intr_eoi_src, - intr_disab_eoi_src, NULL, "intr%d:", irq); -#else - error = intr_event_create(&event, (void *)irq, 0, - (void (*)(void *))arm_unmask_irq, NULL, "intr%d:", irq); -#endif + (mask_fn)arm_mask_irq, (mask_fn)arm_unmask_irq, + (mask_fn)arm_unmask_irq, NULL, "intr%d:", irq); if (error) return; intr_events[irq] = event; diff --git a/sys/i386/i386/intr_machdep.c b/sys/i386/i386/intr_machdep.c index 035faf4bcc30..89f247cdc6bc 100644 --- a/sys/i386/i386/intr_machdep.c +++ b/sys/i386/i386/intr_machdep.c @@ -68,12 +68,6 @@ static struct sx intr_table_lock; static struct mtx intrcnt_lock; static STAILQ_HEAD(, pic) pics; -#ifdef INTR_FILTER -static void intr_eoi_src(void *arg); -static void intr_disab_eoi_src(void *arg); -static void intr_event_stray(void *cookie); -#endif - #ifdef SMP static int assign_cpu; @@ -81,6 +75,10 @@ static void intr_assign_next_cpu(struct intsrc *isrc); #endif static int intr_assign_cpu(void *arg, u_char cpu); +static void intr_disable_src(void *arg); +#ifdef INTR_FILTER +static void intr_event_stray(void *cookie); +#endif static void intr_init(void *__dummy); static int intr_pic_registered(struct pic *pic); static void intrcnt_setname(const char *name, int index); @@ -135,16 +133,10 @@ intr_register_source(struct intsrc *isrc) vector = isrc->is_pic->pic_vector(isrc); if (interrupt_sources[vector] != NULL) return (EEXIST); -#ifdef INTR_FILTER error = intr_event_create(&isrc->is_event, isrc, 0, - (mask_fn)isrc->is_pic->pic_enable_source, - intr_eoi_src, intr_disab_eoi_src, intr_assign_cpu, "irq%d:", + intr_disable_src, (mask_fn)isrc->is_pic->pic_enable_source, + (mask_fn)isrc->is_pic->pic_eoi_source, intr_assign_cpu, "irq%d:", vector); -#else - error = intr_event_create(&isrc->is_event, isrc, 0, - (mask_fn)isrc->is_pic->pic_enable_source, intr_assign_cpu, "irq%d:", - vector); -#endif if (error) return (error); sx_xlock(&intr_table_lock); @@ -228,6 +220,15 @@ intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol) return (isrc->is_pic->pic_config_intr(isrc, trig, pol)); } +static void +intr_disable_src(void *arg) +{ + struct intsrc *isrc; + + isrc = arg; + isrc->is_pic->pic_disable_source(isrc, PIC_EOI); +} + #ifdef INTR_FILTER void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame) @@ -280,24 +281,6 @@ intr_event_stray(void *cookie) "too many stray irq %d's: not logging anymore\n", isrc->is_pic->pic_vector(isrc)); } - -static void -intr_eoi_src(void *arg) -{ - struct intsrc *isrc; - - isrc = arg; - isrc->is_pic->pic_eoi_source(isrc); -} - -static void -intr_disab_eoi_src(void *arg) -{ - struct intsrc *isrc; - - isrc = arg; - isrc->is_pic->pic_disable_source(isrc, PIC_EOI); -} #else void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame) diff --git a/sys/ia64/ia64/interrupt.c b/sys/ia64/ia64/interrupt.c index d832dd81871b..720e5f93165c 100644 --- a/sys/ia64/ia64/interrupt.c +++ b/sys/ia64/ia64/interrupt.c @@ -340,10 +340,7 @@ ia64_setup_intr(const char *name, int irq, driver_filter_t filter, return (ENOMEM); error = intr_event_create(&i->event, (void *)(uintptr_t)vector, - 0, ia64_intr_unmask, -#ifdef INTR_FILTER - ia64_intr_eoi, ia64_intr_mask, -#endif + 0, ia64_intr_mask, ia64_intr_unmask, ia64_intr_eoi, NULL, "irq%u:", irq); if (error) { free(i, M_DEVBUF); diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 911443056fff..b66e5f9e993c 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -238,43 +238,9 @@ intr_event_update(struct intr_event *ie) CTR2(KTR_INTR, "%s: updated %s", __func__, ie->ie_fullname); } -#ifndef INTR_FILTER int -intr_event_create(struct intr_event **event, void *source, int flags, - void (*enable)(void *), int (*assign_cpu)(void *, u_char), const char *fmt, - ...) -{ - struct intr_event *ie; - va_list ap; - - /* The only valid flag during creation is IE_SOFT. */ - if ((flags & ~IE_SOFT) != 0) - return (EINVAL); - ie = malloc(sizeof(struct intr_event), M_ITHREAD, M_WAITOK | M_ZERO); - ie->ie_source = source; - ie->ie_enable = enable; - ie->ie_assign_cpu = assign_cpu; - ie->ie_flags = flags; - ie->ie_cpu = NOCPU; - TAILQ_INIT(&ie->ie_handlers); - mtx_init(&ie->ie_lock, "intr event", NULL, MTX_DEF); - - va_start(ap, fmt); - vsnprintf(ie->ie_name, sizeof(ie->ie_name), fmt, ap); - va_end(ap); - strlcpy(ie->ie_fullname, ie->ie_name, sizeof(ie->ie_fullname)); - mtx_pool_lock(mtxpool_sleep, &event_list); - TAILQ_INSERT_TAIL(&event_list, ie, ie_list); - mtx_pool_unlock(mtxpool_sleep, &event_list); - if (event != NULL) - *event = ie; - CTR2(KTR_INTR, "%s: created %s", __func__, ie->ie_name); - return (0); -} -#else -int -intr_event_create(struct intr_event **event, void *source, int flags, - void (*enable)(void *), void (*eoi)(void *), void (*disab)(void *), +intr_event_create(struct intr_event **event, void *source,int flags, + void (*disable)(void *), void (*enable)(void *), void (*eoi)(void *), int (*assign_cpu)(void *, u_char), const char *fmt, ...) { struct intr_event *ie; @@ -285,10 +251,10 @@ intr_event_create(struct intr_event **event, void *source, int flags, return (EINVAL); ie = malloc(sizeof(struct intr_event), M_ITHREAD, M_WAITOK | M_ZERO); ie->ie_source = source; + ie->ie_disable = disable; ie->ie_enable = enable; - ie->ie_assign_cpu = assign_cpu; ie->ie_eoi = eoi; - ie->ie_disab = disab; + ie->ie_assign_cpu = assign_cpu; ie->ie_flags = flags; ie->ie_cpu = NOCPU; TAILQ_INIT(&ie->ie_handlers); @@ -306,7 +272,6 @@ intr_event_create(struct intr_event **event, void *source, int flags, CTR2(KTR_INTR, "%s: created %s", __func__, ie->ie_name); return (0); } -#endif /* * Bind an interrupt event to the specified CPU. Note that not all @@ -943,13 +908,8 @@ swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, if (!(ie->ie_flags & IE_SOFT)) return (EINVAL); } else { -#ifdef INTR_FILTER error = intr_event_create(&ie, NULL, IE_SOFT, NULL, NULL, NULL, NULL, "swi%d:", pri); -#else - error = intr_event_create(&ie, NULL, IE_SOFT, - NULL, NULL, "swi%d:", pri); -#endif if (error) return (error); if (eventp != NULL) @@ -1405,8 +1365,8 @@ intr_event_handle(struct intr_event *ie, struct trapframe *frame) if (ie->ie_eoi != NULL) ie->ie_eoi(ie->ie_source); } else { - if (ie->ie_disab != NULL) - ie->ie_disab(ie->ie_source); + if (ie->ie_disable != NULL) + ie->ie_disable(ie->ie_source); } critical_exit(); diff --git a/sys/powerpc/powerpc/intr_machdep.c b/sys/powerpc/powerpc/intr_machdep.c index e05195fedb15..990ba514396e 100644 --- a/sys/powerpc/powerpc/intr_machdep.c +++ b/sys/powerpc/powerpc/intr_machdep.c @@ -161,7 +161,6 @@ intr_lookup(u_int irq) return (i); } -#ifdef INTR_FILTER static void powerpc_intr_eoi(void *arg) { @@ -177,7 +176,6 @@ powerpc_intr_mask(void *arg) PIC_MASK(pic, irq); } -#endif static void powerpc_intr_unmask(void *arg) @@ -229,10 +227,7 @@ powerpc_setup_intr(const char *name, u_int irq, driver_filter_t filter, if (i->event == NULL) { error = intr_event_create(&i->event, (void *)irq, 0, - powerpc_intr_unmask, -#ifdef INTR_FILTER - powerpc_intr_eoi, powerpc_intr_mask, -#endif + powerpc_intr_mask, powerpc_intr_unmask, powerpc_intr_eoi, NULL, "irq%u:", irq); if (error) return (error); diff --git a/sys/sparc64/sparc64/intr_machdep.c b/sys/sparc64/sparc64/intr_machdep.c index 091ed90754bb..115d4867da85 100644 --- a/sys/sparc64/sparc64/intr_machdep.c +++ b/sys/sparc64/sparc64/intr_machdep.c @@ -329,12 +329,8 @@ intr_controller_register(int vec, const struct intr_controller *ic, * CPU as long as the source of a level sensitive interrupt is * not cleared. */ - error = intr_event_create(&ie, iv, 0, intr_enable_eoi, -#ifdef INTR_FILTER - ic->ic_eoi, ic->ic_disable, NULL, "vec%d:", vec); -#else - NULL, "vec%d:", vec); -#endif + error = intr_event_create(&ie, iv, 0, ic->ic_disable, intr_enable_eoi, + ic->ic_eoi, NULL, "vec%d:", vec); if (error != 0) return (error); mtx_lock_spin(&intr_table_lock); diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h index 54cd0e4362a9..319c49c44e92 100644 --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -72,12 +72,10 @@ struct intr_event { struct mtx ie_lock; void *ie_source; /* Cookie used by MD code. */ struct intr_thread *ie_thread; /* Thread we are connected to. */ + void (*ie_disable)(void *); void (*ie_enable)(void *); - int (*ie_assign_cpu)(void *, u_char); -#ifdef INTR_FILTER void (*ie_eoi)(void *); - void (*ie_disab)(void *); -#endif + int (*ie_assign_cpu)(void *, u_char); int ie_flags; int ie_count; /* Loop counter. */ int ie_warncnt; /* Rate-check interrupt storm warns. */ @@ -130,18 +128,11 @@ int intr_event_add_handler(struct intr_event *ie, const char *name, driver_filter_t filter, driver_intr_t handler, void *arg, u_char pri, enum intr_type flags, void **cookiep); int intr_event_bind(struct intr_event *ie, u_char cpu); -#ifndef INTR_FILTER int intr_event_create(struct intr_event **event, void *source, - int flags, void (*enable)(void *), - int (*assign_cpu)(void *, u_char), const char *fmt, ...) - __printflike(6, 7); -#else -int intr_event_create(struct intr_event **event, void *source, - int flags, void (*enable)(void *), void (*eoi)(void *), - void (*disab)(void *), int (*assign_cpu)(void *, u_char), + int flags, void (*disable)(void *), void (*enable)(void *), + void (*eoi)(void *), int (*assign_cpu)(void *, u_char), const char *fmt, ...) __printflike(8, 9); -#endif int intr_event_destroy(struct intr_event *ie); int intr_event_remove_handler(void *cookie); #ifndef INTR_FILTER