diff options
author | piso <piso@FreeBSD.org> | 2007-02-23 12:19:07 +0000 |
---|---|---|
committer | piso <piso@FreeBSD.org> | 2007-02-23 12:19:07 +0000 |
commit | 6a2ffa86e5b748ba71e36d37462a936eb9101be7 (patch) | |
tree | 10833d4edb6c0d0a5efcf7762d842a4c378404b0 /sys/kern | |
parent | 7b48c9d78377cdb9fc6e8bcc5406e28819aef6e3 (diff) | |
download | FreeBSD-src-6a2ffa86e5b748ba71e36d37462a936eb9101be7.zip FreeBSD-src-6a2ffa86e5b748ba71e36d37462a936eb9101be7.tar.gz |
o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()
o add an int return code to all fast handlers
o retire INTR_FAST/IH_FAST
For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current
Reviewed by: many
Approved by: re@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/bus_if.m | 1 | ||||
-rw-r--r-- | sys/kern/kern_intr.c | 25 | ||||
-rw-r--r-- | sys/kern/subr_bus.c | 21 |
3 files changed, 23 insertions, 24 deletions
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index 529b506..59838db 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -326,6 +326,7 @@ METHOD int setup_intr { device_t _child; struct resource *_irq; int _flags; + driver_filter_t *_filter; driver_intr_t *_intr; void *_arg; void **_cookiep; diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 5560a3f..96bdd4e 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -324,25 +324,24 @@ ithread_destroy(struct intr_thread *ithread) int intr_event_add_handler(struct intr_event *ie, const char *name, - driver_intr_t handler, void *arg, u_char pri, enum intr_type flags, - void **cookiep) + driver_filter_t filter, driver_intr_t handler, void *arg, u_char pri, + enum intr_type flags, void **cookiep) { struct intr_handler *ih, *temp_ih; struct intr_thread *it; - if (ie == NULL || name == NULL || handler == NULL) + if (ie == NULL || name == NULL || (handler == NULL && filter == NULL)) return (EINVAL); /* Allocate and populate an interrupt handler structure. */ ih = malloc(sizeof(struct intr_handler), M_ITHREAD, M_WAITOK | M_ZERO); + ih->ih_filter = filter; ih->ih_handler = handler; ih->ih_argument = arg; ih->ih_name = name; ih->ih_event = ie; ih->ih_pri = pri; - if (flags & INTR_FAST) - ih->ih_flags = IH_FAST; - else if (flags & INTR_EXCL) + if (flags & INTR_EXCL) ih->ih_flags = IH_EXCLUSIVE; if (flags & INTR_MPSAFE) ih->ih_flags |= IH_MPSAFE; @@ -372,7 +371,7 @@ intr_event_add_handler(struct intr_event *ie, const char *name, intr_event_update(ie); /* Create a thread if we need one. */ - while (ie->ie_thread == NULL && !(flags & INTR_FAST)) { + while (ie->ie_thread == NULL && handler != NULL) { if (ie->ie_flags & IE_ADDING_THREAD) msleep(ie, &ie->ie_lock, 0, "ithread", 0); else { @@ -589,7 +588,7 @@ swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, if (eventp != NULL) *eventp = ie; } - return (intr_event_add_handler(ie, name, handler, arg, + return (intr_event_add_handler(ie, name, NULL, handler, arg, (pri * RQ_PPQ) + PI_SOFT, flags, cookiep)); /* XXKSE.. think of a better way to get separate queues */ } @@ -669,10 +668,6 @@ ithread_execute_handlers(struct proc *p, struct intr_event *ie) atomic_store_rel_int(&ih->ih_need, 0); } - /* Fast handlers are handled in primary interrupt context. */ - if (ih->ih_flags & IH_FAST) - continue; - /* Execute this handler. */ CTR6(KTR_INTR, "%s: pid %d exec %p(%p) for %s flg=%x", __func__, p->p_pid, (void *)ih->ih_handler, ih->ih_argument, @@ -828,14 +823,10 @@ db_dump_intrhand(struct intr_handler *ih) db_printsym((uintptr_t)ih->ih_handler, DB_STGY_PROC); db_printf("(%p)", ih->ih_argument); if (ih->ih_need || - (ih->ih_flags & (IH_FAST | IH_EXCLUSIVE | IH_ENTROPY | IH_DEAD | + (ih->ih_flags & (IH_EXCLUSIVE | IH_ENTROPY | IH_DEAD | IH_MPSAFE)) != 0) { db_printf(" {"); comma = 0; - if (ih->ih_flags & IH_FAST) { - db_printf("FAST"); - comma = 1; - } if (ih->ih_flags & IH_EXCLUSIVE) { if (comma) db_printf(", "); diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 75b179d..e8c00b9 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/uio.h> #include <sys/bus.h> +#include <sys/interrupt.h> #include <machine/stdarg.h> @@ -3095,12 +3096,13 @@ bus_generic_driver_added(device_t dev, driver_t *driver) */ int bus_generic_setup_intr(device_t dev, device_t child, struct resource *irq, - int flags, driver_intr_t *intr, void *arg, void **cookiep) + int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, + void **cookiep) { /* Propagate up the bus hierarchy until someone handles it. */ if (dev->parent) return (BUS_SETUP_INTR(dev->parent, child, irq, flags, - intr, arg, cookiep)); + filter, intr, arg, cookiep)); return (EINVAL); } @@ -3457,7 +3459,7 @@ bus_release_resource(device_t dev, int type, int rid, struct resource *r) */ int bus_setup_intr(device_t dev, struct resource *r, int flags, - driver_intr_t handler, void *arg, void **cookiep) + driver_filter_t filter, driver_intr_t handler, void *arg, void **cookiep) { int error; @@ -3466,14 +3468,19 @@ bus_setup_intr(device_t dev, struct resource *r, int flags, !debug_mpsafenet) flags &= ~INTR_MPSAFE; error = BUS_SETUP_INTR(dev->parent, dev, r, flags, - handler, arg, cookiep); + filter, handler, arg, cookiep); if (error == 0) { - if (!(flags & (INTR_MPSAFE | INTR_FAST))) + if (handler != NULL && !(flags & INTR_MPSAFE)) device_printf(dev, "[GIANT-LOCKED]\n"); if (bootverbose && (flags & INTR_MPSAFE)) device_printf(dev, "[MPSAFE]\n"); - if (flags & INTR_FAST) - device_printf(dev, "[FAST]\n"); + if (filter != NULL) { + if (handler == NULL) + device_printf(dev, "[FILTER]\n"); + else + device_printf(dev, "[FILTER+ITHREAD]\n"); + } else + device_printf(dev, "[ITHREAD]\n"); } } else error = EINVAL; |