Date: Thu, 4 Jan 2007 14:34:16 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 112480 for review Message-ID: <200701041434.l04EYG6M018182@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=112480 Change 112480 by piso@piso_newluxor on 2007/01/04 14:33:55 Throw away the old stuff and start from Marcel's latest version. Affected files ... .. //depot/projects/soc2006/intr_filter/powerpc/powerpc/intr_machdep.c#15 edit Differences ... ==== //depot/projects/soc2006/intr_filter/powerpc/powerpc/intr_machdep.c#15 (text+ko) ==== @@ -66,13 +66,7 @@ #include <sys/queue.h> #include <sys/bus.h> #include <sys/interrupt.h> ->>>> ORIGINAL intr_machdep.c#8 -==== THEIRS intr_machdep.c#9 #include <sys/ktr.h> -==== YOURS intr_machdep.c -#include <sys/ktr.h> -#include <sys/limits.h> -<<<< #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mutex.h> @@ -89,65 +83,20 @@ MALLOC_DEFINE(M_INTR, "intr", "interrupt handler data"); ->>>> ORIGINAL intr_machdep.c#8 -static int intr_initialized = 0; - -==== THEIRS intr_machdep.c#9 struct ppc_intr { struct intr_event *event; long *cntp; int cntidx; }; -==== YOURS intr_machdep.c -<<<< ->>>> ORIGINAL intr_machdep.c#8 -static u_int intr_nirq; -static struct ppc_intr_handler *intr_handlers; -==== THEIRS intr_machdep.c#9 static struct mtx ppc_intrs_lock; static struct ppc_intr **ppc_intrs; static u_int ppc_nintrs; -==== YOURS intr_machdep.c -static u_int intr_nirq; -static struct ppc_intr_handler *intr_handlers = NULL; -<<<< static int intrcnt_index; -extern struct callout stray_callout_handle; - -void intr_callout_reset(void); - ->>>> ORIGINAL intr_machdep.c#8 -extern int extint, extsize; -extern u_long extint_call; - -static int intrcnt_index; -static ih_func_t intr_stray_handler; -static ih_func_t sched_ithd; - -static void (*irq_enable)(uintptr_t); -static void (*irq_disable)(uintptr_t); - -static void intrcnt_setname(const char *name, int index); -static void intrcnt_updatename(struct ppc_intr_handler *ih); -==== THEIRS intr_machdep.c#9 static void (*irq_enable)(uintptr_t); -==== YOURS intr_machdep.c -extern int extint, extsize; -extern u_long extint_call; - -static int intrcnt_index; -static ih_func_t intr_stray_handler; -static void (*irq_enable)(uintptr_t); -static void (*irq_disable)(uintptr_t); - -static void intrcnt_setname(const char *name, int index); -static void intrcnt_updatename(struct ppc_intr_handler *ih); -<<<< - static void intrcnt_setname(const char *name, int index) { @@ -161,51 +110,18 @@ { uint32_t msr; ->>>> ORIGINAL intr_machdep.c#8 - if (intr_initialized != 0) - panic("intr_init: interrupts intialized twice\n"); -==== THEIRS intr_machdep.c#9 if (ppc_intrs != NULL) panic("intr_init: interrupts initialized twice\n"); -==== YOURS intr_machdep.c - if (intr_handlers != NULL) - panic("intr_init: interrupts intialized twice\n"); -<<<< - ->>>> ORIGINAL intr_machdep.c#8 - intr_initialized++; - intr_nirq = nirq; - intr_handlers = malloc(nirq * sizeof(struct ppc_intr_handler), M_INTR, -==== THEIRS intr_machdep.c#9 ppc_nintrs = nirq; ppc_intrs = malloc(nirq * sizeof(struct ppc_intr *), M_INTR, -==== YOURS intr_machdep.c - intr_nirq = nirq; - intr_handlers = malloc(nirq * sizeof(struct ppc_intr_handler), M_INTR, -<<<< M_NOWAIT|M_ZERO); if (ppc_intrs == NULL) panic("intr_init: unable to allocate interrupt handler array"); ->>>> ORIGINAL intr_machdep.c#8 - for (i = 0; i < nirq; i++) { - intr_handlers[i].ih_func = intr_stray_handler; - intr_handlers[i].ih_arg = &intr_handlers[i]; - intr_handlers[i].ih_irq = i; - intr_handlers[i].ih_flags = 0; - /* mux all initial stray irqs onto same count... */ - intr_handlers[i].ih_straycount = &intrcnt[0]; - } -==== THEIRS intr_machdep.c#9 mtx_init(&ppc_intrs_lock, "intr table", NULL, MTX_SPIN); irq_enable = irq_e; -==== YOURS intr_machdep.c - /* mux all initial stray irqs onto same count... */ - for (i = 0; i < nirq; i++) - intr_handlers[i].ih_straycount = &intrcnt[0]; -<<<< intrcnt_setname("???", 0); intrcnt_index = 1; @@ -213,66 +129,16 @@ msr = mfmsr(); mtmsr(msr & ~PSL_EE); ext_intr_install(handler); ->>>> ORIGINAL intr_machdep.c#8 - - mtmsr(msr); - - irq_enable = irq_e; - irq_disable = irq_d; - - mtx_init(&intr_table_lock, "intr table", NULL, MTX_SPIN); -} - -void -intr_setup(u_int irq, ih_func_t *ihf, void *iha, u_int flags) -{ - u_int32_t msr; - - msr = mfmsr(); - mtmsr(msr & ~PSL_EE); - - intr_handlers[irq].ih_func = ihf; - intr_handlers[irq].ih_arg = iha; - intr_handlers[irq].ih_irq = irq; - intr_handlers[irq].ih_flags = flags; - - mtmsr(msr); -} - -==== THEIRS intr_machdep.c#9 - mtmsr(msr); -} - -==== YOURS intr_machdep.c - mtmsr(msr); - - irq_enable = irq_e; - irq_disable = irq_d; - - mtx_init(&intr_table_lock, "intr table", NULL, MTX_SPIN); - callout_init_mtx(&stray_callout_handle, &intr_table_lock, 0); } -<<<< int -inthand_add(const char *name, u_int irq, int (*filter)(void *), - void (*handler)(void *), void *arg, int flags, void **cookiep) +inthand_add(const char *name, u_int irq, void (*handler)(void *), void *arg, + int flags, void **cookiep) { ->>>> ORIGINAL intr_machdep.c#8 - struct ppc_intr_handler *ih; - struct intr_event *event, *orphan; - int error = 0; - int created_event = 0; -==== THEIRS intr_machdep.c#9 struct ppc_intr *i, *orphan; u_int idx; int error; -==== YOURS intr_machdep.c - struct ppc_intr_handler *ih; - struct intr_event *event, *orphan; - int error = 0; -<<<< /* * Work around a race where more than one CPU may be registering @@ -287,7 +153,7 @@ if (i == NULL) return (ENOMEM); error = intr_event_create(&i->event, (void *)irq, 0, - (void (*)(void *))irq_enable, NULL, "irq%d:", irq); + (void (*)(void *))irq_enable, "irq%d:", irq); if (error) { free(i, M_INTR); return (error); @@ -299,19 +165,8 @@ i = ppc_intrs[irq]; mtx_unlock_spin(&ppc_intrs_lock); ->>>> ORIGINAL intr_machdep.c#8 - if (ih->ih_event == NULL) { - ih->ih_event = event; - created_event++; - mtx_unlock_spin(&intr_table_lock); -==== THEIRS intr_machdep.c#9 intr_event_destroy(orphan->event); free(orphan, M_INTR); -==== YOURS intr_machdep.c - if (ih->ih_event == NULL) { - ih->ih_event = event; - mtx_unlock_spin(&intr_table_lock); -<<<< } else { ppc_intrs[irq] = i; idx = intrcnt_index++; @@ -323,44 +178,11 @@ } } ->>>> ORIGINAL intr_machdep.c#8 - /* XXX: Should probably fix support for multiple FAST. */ - if (flags & INTR_FAST) - flags |= INTR_EXCL; - error = intr_event_add_handler(event, name, handler, arg, -==== THEIRS intr_machdep.c#9 error = intr_event_add_handler(i->event, name, handler, arg, -==== YOURS intr_machdep.c - error = intr_event_add_handler(event, name, filter, handler, arg, -<<<< intr_priority(flags), flags, cookiep); ->>>> ORIGINAL intr_machdep.c#8 - - if ((flags & INTR_FAST) == 0 || error) - intr_setup(irq, sched_ithd, ih, flags); - - if (error) - return (error); - - if (flags & INTR_FAST) - intr_setup(irq, handler, arg, flags); - - intrcnt_register(ih); - - return (0); -==== THEIRS intr_machdep.c#9 if (!error) intrcnt_setname(i->event->ie_fullname, i->cntidx); return (error); -==== YOURS intr_machdep.c - - if (error) - return (error); - - intrcnt_register(ih); - - return (0); -<<<< } int @@ -369,126 +191,24 @@ return (intr_event_remove_handler(cookie)); } ->>>> ORIGINAL intr_machdep.c#8 - - if (error == 0) { - ih = &intr_handlers[irq]; - - mtx_lock_spin(&intr_table_lock); - - if (ih->ih_event == NULL) { - intr_setup(irq, intr_stray_handler, ih, 0); - } else { - intr_setup(irq, sched_ithd, ih, 0); - } - - mtx_unlock_spin(&intr_table_lock); - } - - return (error); -} -==== THEIRS intr_machdep.c#9 -==== YOURS intr_machdep.c - -/* Stray detection MD code */ -static struct intr_event * -walk_intr_ppc(void) -{ - struct ppc_intr_handler *ppc; - static int i = 0; - - for (; i < intr_nirq; ) { - int j = i++; - ppc = &intr_handlers[j]; - if (ppc != NULL && ppc->ih_event != NULL) - return (ppc->ih_event); - } - i = 0; - return (NULL); -} void -intr_callout_reset(void) -{ - - mtx_lock_spin(&intr_table_lock); - callout_reset(&stray_callout_handle, hz, - &stray_detection, &walk_intr_ppc); - mtx_unlock_spin(&intr_table_lock); -} -<<<< - -void intr_handle(u_int irq) { ->>>> ORIGINAL intr_machdep.c#8 - atomic_add_long(intr_handlers[irq].ih_count, 1); - intr_handlers[irq].ih_func(intr_handlers[irq].ih_arg); -==== THEIRS intr_machdep.c#9 struct ppc_intr *i; struct intr_event *ie; struct intr_handler *ih; int error, sched; -==== YOURS intr_machdep.c - struct ppc_intr_handler *ppc_ih = &intr_handlers[irq]; - struct intr_event *ie = ppc_ih->ih_event; - int res; -<<<< ->>>> ORIGINAL intr_machdep.c#8 - /* XXX wrong thing when using pre-emption ? */ - if ((intr_handlers[irq].ih_flags & INTR_FAST) != 0) - irq_enable(irq); -} -==== THEIRS intr_machdep.c#9 i = ppc_intrs[irq]; if (i == NULL) goto stray; -==== YOURS intr_machdep.c - res = mi_handle_intr(ie, NULL, intr_eoi_src_stub, - intr_disab_eoi_src_stub, NULL); - switch (res) { - case 0: - /* FALLTHROUGH */ - case ECHILD: - atomic_add_long(ppc_ih->ih_count, 1); - break; - case EFAULT: - atomic_add_long(ppc_ih->ih_count, 1); - /* FALLTHROUGH */ - case EINVAL: - intr_stray_handler(ppc_ih); - break; - default: - printf("Ouch! Return code from mi_handle_intr()" - "not expected.\n"); - } -} -<<<< ->>>> ORIGINAL intr_machdep.c#8 -static void -intr_stray_handler(void *cookie) -{ - struct ppc_intr_handler *ih; -==== THEIRS intr_machdep.c#9 atomic_add_long(i->cntp, 1); -==== YOURS intr_machdep.c -static void -intr_stray_handler(void *cookie) -{ - struct ppc_intr_handler *ih = cookie; -<<<< ->>>> ORIGINAL intr_machdep.c#8 - ih = (struct ppc_intr_handler *)cookie; - -==== THEIRS intr_machdep.c#9 ie = i->event; KASSERT(ie != NULL, ("%s: interrupt without an event", __func__)); -==== YOURS intr_machdep.c -<<<< if (TAILQ_EMPTY(&ie->ie_handlers)) goto stray; @@ -509,21 +229,6 @@ } critical_exit(); ->>>> ORIGINAL intr_machdep.c#8 -static void -sched_ithd(void *cookie) -{ - struct ppc_intr_handler *ih; - int error; - - ih = (struct ppc_intr_handler *)cookie; - - error = intr_event_schedule_thread(ih->ih_event); - - if (error == EINVAL) - intr_stray_handler(ih); -} -==== THEIRS intr_machdep.c#9 if (sched) { error = intr_event_schedule_thread(ie); KASSERT(error == 0, ("%s: impossible stray interrupt", @@ -542,5 +247,3 @@ } } } -==== YOURS intr_machdep.c -<<<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701041434.l04EYG6M018182>