diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -716,8 +716,8 @@ /* * Add handler to interrupt source. */ -static int -isrc_add_handler(struct intr_irqsrc *isrc, const char *name, +int +intr_add_handler(struct intr_irqsrc *isrc, const char *name, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep) { @@ -1102,7 +1102,7 @@ } else #endif { - error = isrc_add_handler(isrc, name, filt, hand, arg, flags, + error = intr_add_handler(isrc, name, filt, hand, arg, flags, cookiep); debugf("irq %u add handler error %d on %s\n", isrc->isrc_irq, error, name); } @@ -1172,21 +1172,14 @@ return (error); } +/* + * Describe an interrupt + */ int -intr_describe_irq(device_t dev, struct resource *res, void *cookie, - const char *descr) +intr_describe(struct intr_irqsrc *isrc, void *cookie, const char *descr) { int error; - struct intr_irqsrc *isrc; - u_int res_id; - KASSERT(rman_get_start(res) == rman_get_end(res), - ("%s: more interrupts in resource", __func__)); - - res_id = (u_int)rman_get_start(res); - isrc = intr_map_get_isrc(res_id); - if (isrc == NULL || isrc->isrc_handlers == 0) - return (EINVAL); #ifdef INTR_SOLO if (isrc->isrc_filter != NULL) { if (isrc != cookie) @@ -1207,6 +1200,23 @@ return (error); } +int +intr_describe_irq(device_t dev, struct resource *res, void *cookie, + const char *descr) +{ + struct intr_irqsrc *isrc; + u_int res_id; + + KASSERT(rman_get_start(res) == rman_get_end(res), + ("%s: more interrupts in resource", __func__)); + + res_id = (u_int)rman_get_start(res); + isrc = intr_map_get_isrc(res_id); + if (isrc == NULL || isrc->isrc_handlers == 0) + return (EINVAL); + return (intr_describe(isrc, cookie, descr)); +} + #ifdef SMP int intr_bind_irq(device_t dev, struct resource *res, int cpu) diff --git a/sys/sys/intr.h b/sys/sys/intr.h --- a/sys/sys/intr.h +++ b/sys/sys/intr.h @@ -101,6 +101,10 @@ int intr_isrc_register(struct intr_irqsrc *, device_t, u_int, const char *, ...) __printflike(4, 5); +int intr_add_handler(struct intr_irqsrc *, const char *, driver_filter_t, + driver_intr_t, void *, enum intr_type, void **); +int intr_describe(struct intr_irqsrc *isrc, void *cookie, const char *descr); + #ifdef SMP bool intr_isrc_init_on_cpu(struct intr_irqsrc *isrc, u_int cpu); #endif