From owner-p4-projects@FreeBSD.ORG Mon Jun 19 13:26:34 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 85D6B16A47C; Mon, 19 Jun 2006 13:26:34 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 49DAA16A47A for ; Mon, 19 Jun 2006 13:26:34 +0000 (UTC) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C490C43D58 for ; Mon, 19 Jun 2006 13:26:28 +0000 (GMT) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5JDQSi2069436 for ; Mon, 19 Jun 2006 13:26:28 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5JDQSKI069433 for perforce@freebsd.org; Mon, 19 Jun 2006 13:26:28 GMT (envelope-from piso@freebsd.org) Date: Mon, 19 Jun 2006 13:26:28 GMT Message-Id: <200606191326.k5JDQSKI069433@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to piso@freebsd.org using -f From: Paolo Pisati To: Perforce Change Reviews Cc: Subject: PERFORCE change 99599 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jun 2006 13:26:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=99599 Change 99599 by piso@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,