diff options
-rw-r--r-- | sys/arch/macppc/dev/macintr.c | 13 | ||||
-rw-r--r-- | sys/arch/macppc/dev/openpic.c | 14 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/clock.c | 17 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/locore.S | 54 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 33 | ||||
-rw-r--r-- | sys/arch/powerpc/include/intr.h | 20 | ||||
-rw-r--r-- | sys/arch/powerpc/include/types.h | 4 |
7 files changed, 47 insertions, 108 deletions
diff --git a/sys/arch/macppc/dev/macintr.c b/sys/arch/macppc/dev/macintr.c index 70699daa86a..d4418f77830 100644 --- a/sys/arch/macppc/dev/macintr.c +++ b/sys/arch/macppc/dev/macintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macintr.c,v 1.22 2003/12/20 22:40:26 miod Exp $ */ +/* $OpenBSD: macintr.c,v 1.23 2004/06/28 02:49:10 aaron Exp $ */ /*- * Copyright (c) 1995 Per Fogelstrom @@ -215,8 +215,6 @@ fakeintr(void *arg) return 0; } -void nameinterrupt( int replace, char *newstr); - /* * Register an interrupt handler. */ @@ -234,7 +232,6 @@ macintr_establish(void * lcv, int irq, int type, int level, printf("macintr_establish, hI %d L %d ", irq, type); printf("addr reg0 %x\n", INT_STATE_REG0); #endif - nameinterrupt(irq, name); irq = mapirq(irq); #if 0 printf("vI %d ", irq); @@ -287,10 +284,10 @@ printf("vI %d ", irq); */ ih->ih_fun = ih_fun; ih->ih_arg = ih_arg; - ih->ih_count = 0; ih->ih_next = NULL; ih->ih_level = level; ih->ih_irq = irq; + evcount_attach(&ih->ih_count, name, (void *)&ih->ih_irq, &evcount_intr); *p = ih; return (ih); @@ -319,6 +316,8 @@ macintr_disestablish(void *lcp, void *arg) *p = q->ih_next; else panic("intr_disestablish: handler not registered"); + + evcount_detach(&ih->ih_count); free((void *)ih, M_DEVBUF); intr_calculatemasks(); @@ -511,7 +510,6 @@ mac_ext_intr() start: irq = 31 - cntlzw(int_state); - intrcnt[m_hwirq[irq]]++; o_imen = imen_m; r_imen = 1 << irq; @@ -525,7 +523,8 @@ start: ih = m_intrhand[irq]; while (ih) { - (*ih->ih_fun)(ih->ih_arg); + if ((*ih->ih_fun)(ih->ih_arg)) + ih->ih_count.ec_count++; ih = ih->ih_next; } diff --git a/sys/arch/macppc/dev/openpic.c b/sys/arch/macppc/dev/openpic.c index 09d45d2963f..591054441d5 100644 --- a/sys/arch/macppc/dev/openpic.c +++ b/sys/arch/macppc/dev/openpic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openpic.c,v 1.26 2004/05/08 22:10:12 miod Exp $ */ +/* $OpenBSD: openpic.c,v 1.27 2004/06/28 02:49:10 aaron Exp $ */ /*- * Copyright (c) 1995 Per Fogelstrom @@ -190,9 +190,6 @@ fakeintr(void *arg) return 0; } -void nameinterrupt( int replace, char *newstr); - - /* * Register an interrupt handler. */ @@ -210,7 +207,6 @@ openpic_intr_establish(void *lcv, int irq, int type, int level, printf("mac_intr_establish, hI %d L %d ", irq, type); #endif - nameinterrupt(irq, name); irq = mapirq(irq); #if 0 printf("vI %d ", irq); @@ -263,10 +259,10 @@ printf("vI %d ", irq); */ ih->ih_fun = ih_fun; ih->ih_arg = ih_arg; - ih->ih_count = 0; ih->ih_next = NULL; ih->ih_level = level; ih->ih_irq = irq; + evcount_attach(&ih->ih_count, name, (void *)&ih->ih_irq, &evcount_intr); *p = ih; return (ih); @@ -295,6 +291,8 @@ openpic_intr_disestablish(void *lcp, void *arg) *p = q->ih_next; else panic("intr_disestablish: handler not registered"); + + evcount_detach(&ih->ih_count); free((void *)ih, M_DEVBUF); intr_calculatemasks(); @@ -597,7 +595,6 @@ ext_intr_openpic() while (realirq != 255) { irq = o_virq[realirq]; - intrcnt[realirq]++; /* XXX check range */ @@ -616,7 +613,8 @@ ext_intr_openpic() while (ih) { ppc_intr_enable(1); - (*ih->ih_fun)(ih->ih_arg); + if ((*ih->ih_fun)(ih->ih_arg)) + ih->ih_count.ec_count++; (void)ppc_intr_disable(); ih = ih->ih_next; diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c index 2cce4ebe461..c71737311d7 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.13 2004/01/04 21:07:43 drahn Exp $ */ +/* $OpenBSD: clock.c,v 1.14 2004/06/28 02:49:10 aaron Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -35,6 +35,7 @@ #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> +#include <sys/evcount.h> #include <machine/autoconf.h> #include <machine/pio.h> @@ -86,6 +87,11 @@ int statint; u_int32_t statvar; u_int32_t statmin; +static struct evcount clk_count; +static struct evcount stat_count; +static int clk_irq = PPC_CLK_IRQ; +static int stat_irq = PPC_STAT_IRQ; + /* * For now we let the machine run with boot time, not changing the clock * at inittodr at all. @@ -245,7 +251,7 @@ decr_intr(struct clockframe *frame) } /* only count timer ticks for CLK_IRQ */ - intrcnt[PPC_STAT_IRQ] += nstats; + stat_count.ec_count += nstats; if (nexttimerevent < nextstatevent) nextevent = nexttimerevent; @@ -279,7 +285,7 @@ decr_intr(struct clockframe *frame) while (lasttb < prevtb - ticks_per_intr) { /* sync lasttb with hardclock */ lasttb += ticks_per_intr; - intrcnt[PPC_CLK_IRQ] ++; + clk_count.ec_count++; hardclock(frame); } @@ -287,7 +293,7 @@ decr_intr(struct clockframe *frame) while (lasttb < prevtb) { /* sync lasttb with hardclock */ lasttb += ticks_per_intr; - intrcnt[PPC_CLK_IRQ] ++; + clk_count.ec_count++; hardclock(frame); } @@ -339,6 +345,9 @@ cpu_initclocks() else nextevent = nextstatevent; + evcount_attach(&clk_count, "clock", (void *)&clk_irq, &evcount_intr); + evcount_attach(&stat_count, "stat", (void *)&stat_irq, &evcount_intr); + ppc_mtdec(nextevent-lasttb); ppc_intr_enable(intrstate); } diff --git a/sys/arch/macppc/macppc/locore.S b/sys/arch/macppc/macppc/locore.S index 3e8247f1a61..ef05c217959 100644 --- a/sys/arch/macppc/macppc/locore.S +++ b/sys/arch/macppc/macppc/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.17 2004/06/24 22:35:56 drahn Exp $ */ +/* $OpenBSD: locore.S,v 1.18 2004/06/28 02:49:10 aaron Exp $ */ /* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */ /* @@ -1157,57 +1157,17 @@ _C_LABEL(esigcode): .data - .globl _C_LABEL(intrnames) - .type _C_LABEL(intrnames),@object - .globl _C_LABEL(eintrnames) - .type _C_LABEL(eintrnames),@object +/* Some bogus data, to keep vmstat happy, for now. */ + .globl _C_LABEL(intrnames), _C_LABEL(eintrnames) + .globl _C_LABEL(intrcnt), _C_LABEL(eintrcnt) _C_LABEL(intrnames): - .string "irq0" "irq1" "irq2" "irq3" - .string "irq4" "irq5" "irq6" "irq7" - .string "irq8" "irq9" "irq10" "irq11" - .string "irq12" "irq13" "irq14" "irq15" - .string "irq16" "irq17" "irq18" "irq19" - .string "irq20" "irq21" "irq22" "irq23" - .string "irq24" "irq25" "irq26" "irq27" - .string "irq28" "irq29" "irq30" "irq31" - .string "irq32" "irq33" "irq34" "irq35" - .string "irq36" "irq37" "irq38" "irq39" - .string "irq40" "irq41" "irq42" "irq43" - .string "irq44" "irq45" "irq46" "irq47" - .string "irq48" "irq49" "irq50" "irq51" - .string "irq52" "irq53" "irq54" "irq55" - .string "irq56" "irq57" "irq58" "irq59" - .string "irq60" "irq61" "irq62" "irq63" - .string "clock" - .string "stat" - .space 512 + .long 0 _C_LABEL(eintrnames): - .align 4 - .globl _C_LABEL(intrcnt) - .type _C_LABEL(intrcnt),@object - .globl _C_LABEL(eintrcnt) - .type _C_LABEL(eintrcnt),@object _C_LABEL(intrcnt): - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0 - .long 0 + .long 0 _C_LABEL(eintrcnt): + #ifdef DDB /* * Deliberate entry to ddbtrap diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index 645685b1387..f8e124926bb 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.67 2004/06/24 22:35:56 drahn Exp $ */ +/* $OpenBSD: machdep.c,v 1.68 2004/06/28 02:49:10 aaron Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -154,7 +154,6 @@ void dumpsys(void); void systype(char *name); int lcsplx(int ipl); /* called from LCore */ int power4e_get_eth_addr(void); -void nameinterrupt(int replace, char *newstr); void ppc_intr_setup(intr_establish_t *establish, intr_disestablish_t *disestablish); void *ppc_intr_establish(void *lcv, pci_intr_handle_t ih, int type, @@ -1385,33 +1384,3 @@ kcopy(const void *from, void *to, size_t size) return 0; } - -void -nameinterrupt(int replace, char *newstr) -{ -#define NENTRIES 66 - char intrname[NENTRIES][30]; - char *p, *src; - int i; - extern char intrnames[]; - extern char eintrnames[]; - - if (replace >= NENTRIES) { - return; - } - src = intrnames; - - for (i = 0; i < NENTRIES; i++) { - src += strlcpy(intrname[i], src, 30); - src+=1; /* skip the NUL */ - } - - strlcat(intrname[replace], "/", sizeof intrname[replace]); - strlcat(intrname[replace], newstr, sizeof intrname[replace]); - - p = intrnames; - for (i = 0; i < NENTRIES; i++) { - p += strlcpy(p, intrname[i], eintrnames - p); - p += 1; /* skip the NUL */ - } -} diff --git a/sys/arch/powerpc/include/intr.h b/sys/arch/powerpc/include/intr.h index eb01f4de93e..ef503b63a68 100644 --- a/sys/arch/powerpc/include/intr.h +++ b/sys/arch/powerpc/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.25 2003/10/31 03:04:16 drahn Exp $ */ +/* $OpenBSD: intr.h,v 1.26 2004/06/28 02:49:10 aaron Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. @@ -50,7 +50,9 @@ #define IST_EDGE 2 #define IST_LEVEL 3 -#ifndef _LOCORE +#if defined(_KERNEL) && !defined(_LOCORE) + +#include <sys/evcount.h> #define PPC_NIRQ 66 #define PPC_CLK_IRQ 64 @@ -158,13 +160,13 @@ set_sint(int pending) */ struct intrhand { - struct intrhand *ih_next; - int (*ih_fun)(void *); - void *ih_arg; - u_long ih_count; - int ih_level; - int ih_irq; - char *ih_what; + struct intrhand *ih_next; + int (*ih_fun)(void *); + void *ih_arg; + struct evcount ih_count; + int ih_level; + int ih_irq; + char *ih_what; }; extern int ppc_configed_intr_cnt; #define MAX_PRECONF_INTR 16 diff --git a/sys/arch/powerpc/include/types.h b/sys/arch/powerpc/include/types.h index 73f270b6aa2..d92e17ddbe3 100644 --- a/sys/arch/powerpc/include/types.h +++ b/sys/arch/powerpc/include/types.h @@ -1,5 +1,5 @@ /* $NetBSD: types.h,v 1.1 1996/09/30 16:34:36 ws Exp $ */ -/* $OpenBSD: types.h,v 1.12 2002/09/15 09:01:59 deraadt Exp $ */ +/* $OpenBSD: types.h,v 1.13 2004/06/28 02:49:10 aaron Exp $ */ /*- * Copyright (C) 1995 Wolfgang Solfrank. @@ -67,4 +67,6 @@ typedef struct label_t { #define __BROKEN_INDIRECT_CONFIG +#define __HAVE_EVCOUNT + #endif /* _POWERPC_TYPES_H_ */ |