PERFORCE change 99599 for review
Paolo Pisati
piso at FreeBSD.org
Mon Jun 19 13:26:34 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=99599
Change 99599 by piso at piso_newluxor on 2006/06/19 13:26:07
Turn interrupt filtering execution MD code into MI code:
now i've to convert all the remaining archs.
Affected files ...
.. //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#3 edit
.. //depot/projects/soc2006/intr_filter/kern/kern_intr.c#3 edit
.. //depot/projects/soc2006/intr_filter/sys/interrupt.h#2 edit
Differences ...
==== //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#3 (text+ko) ====
@@ -170,9 +170,7 @@
{
struct thread *td;
struct intr_event *ie;
- struct intr_handler *ih;
- int error, vector, thread, ret;
- void *arg;
+ int error, vector, thread;
td = curthread;
@@ -214,44 +212,7 @@
td->td_intr_nesting_level++;
thread = 0;
critical_enter();
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- /*
- * Execute fast interrupt handlers directly.
- * To support clock handlers, if a handler registers
- * with a NULL argument, then we pass it a pointer to
- * a trapframe as its argument.
- */
- arg = ((ih->ih_argument == NULL) ? frame : ih->ih_argument);
-
- CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
- ih->ih_handler, arg, ih->ih_name);
-
- if (ih->ih_flags & IH_FAST) {
- // XXX - actually should call ih_filter()...
- ret = ((driver_filter_t *)ih->ih_handler)(arg);
- } else {
- /* old ithread handler */
- thread = 1;
- continue;
- }
-
- /* try with the next handler... */
- if (ret == FILTER_STRAY)
- continue;
-
- /* interrupt served, get out of here... */
- if (ret == FILTER_HANDLED) {
- thread = 0;
- break;
- }
-
- /* mark handler for later execution */
- if (ret == FILTER_SCHEDULE_THREAD) {
- ih->ih_need = 1;
- thread = 1;
- }
- }
-
+ thread = intr_filter_loop(ie, frame);
/*
* If there are any threaded handlers that need to run,
* mask the source as well as sending it an EOI. Otherwise,
==== //depot/projects/soc2006/intr_filter/kern/kern_intr.c#3 (text+ko) ====
@@ -764,6 +764,64 @@
}
}
+/*
+ * Main loop for interrupt filter.
+ *
+ * Some architectures (i386, amd64 and arm) require the optional frame
+ * parameter, and use it as the main argument for fast handler execution
+ * when ih_argument == NULL.
+ *
+ * Return: 0 (everything done) or 1 (schedule ithread)
+ */
+
+int
+intr_filter_loop(struct intr_event *ie, struct trapframe *frame) {
+ struct intr_handler *ih;
+ void *arg;
+ int ret, ret2 = 0;
+
+ TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
+ /*
+ * Execute fast interrupt handlers directly.
+ * To support clock handlers, if a handler registers
+ * with a NULL argument, then we pass it a pointer to
+ * a trapframe as its argument.
+ */
+ arg = ((ih->ih_argument == NULL) ? frame : ih->ih_argument);
+
+ CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
+ ih->ih_handler, arg, ih->ih_name);
+
+ if (ih->ih_flags & IH_FAST) {
+ // XXX - actually should call ih_filter()...
+ ret = ((driver_filter_t *)ih->ih_handler)(arg);
+ } else {
+ /* old ithread handler */
+ ret2 = 1;
+ continue;
+ }
+
+ /* try with the next handler... */
+ if (ret == FILTER_STRAY)
+ continue;
+
+ /* interrupt served, get out of here... */
+ if (ret == FILTER_HANDLED) {
+ ret2 = 0;
+ break;
+ }
+
+ /* mark handler for later execution */
+ if (ret == FILTER_SCHEDULE_THREAD) {
+ ih->ih_need = 1;
+ ret2 = 1;
+ }
+ }
+ return(ret2);
+}
+
+
+
#ifdef DDB
/*
* Dump details about an interrupt handler
==== //depot/projects/soc2006/intr_filter/sys/interrupt.h#2 (text+ko) ====
@@ -34,6 +34,7 @@
struct intr_event;
struct intr_thread;
+struct trapframe;
/*
* Describe a hardware interrupt handler.
@@ -111,6 +112,7 @@
#ifdef DDB
void db_dump_intr_event(struct intr_event *ie, int handlers);
#endif
+int intr_filter_loop(struct intr_event *ie, struct trapframe *frame);
u_char intr_priority(enum intr_type flags);
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,
More information about the p4-projects
mailing list