diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-06-30 21:01:09 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-06-30 21:01:09 +0000 |
commit | afab9191944ed020777fb2ac87f5d8f61fbb4a6b (patch) | |
tree | a9b1cd1cfcc01cea1a4ccf9ca9e9adcb3a6248d5 /sys/arch | |
parent | 9095d24e25ae9b1bea3241e0550cf29b324d6dda (diff) |
use evconuts for device interrupts counting
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hppa/hppa/intr.c | 42 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/locore.S | 68 | ||||
-rw-r--r-- | sys/arch/hppa/include/types.h | 3 |
3 files changed, 53 insertions, 60 deletions
diff --git a/sys/arch/hppa/hppa/intr.c b/sys/arch/hppa/hppa/intr.c index 7976cdce5e9..1878d02629c 100644 --- a/sys/arch/hppa/hppa/intr.c +++ b/sys/arch/hppa/hppa/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.19 2004/06/30 15:24:12 mickey Exp $ */ +/* $OpenBSD: intr.c,v 1.20 2004/06/30 21:01:08 mickey Exp $ */ /* * Copyright (c) 2002-2004 Michael Shalayeff @@ -30,6 +30,8 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/device.h> +#include <sys/evcount.h> +#include <sys/malloc.h> #include <net/netisr.h> @@ -50,14 +52,13 @@ struct hppa_iv { int pad2; int (*handler)(void *); void *arg; - struct hppa_iv *next; - struct hppa_iv *share; u_int bit; - int *cnt; + struct hppa_iv *share; + struct hppa_iv *next; + struct evcount *cnt; } __packed; register_t kpsw = PSL_Q | PSL_P | PSL_C | PSL_D; -extern int intrcnt[]; volatile int cpu_inintr, cpl = IPL_NESTED; u_long cpu_mask; struct hppa_iv intr_store[8*2*CPU_NINTS] __attribute__ ((aligned(32))), @@ -158,15 +159,21 @@ cpu_intr_map(void *v, int pri, int irq, int (*handler)(void *), void *arg, const char *name) { struct hppa_iv *iv, *pv = v, *ivb = pv->next; + struct evcount *cnt; if (irq < 0 || irq >= CPU_NINTS) return (NULL); + MALLOC(cnt, struct evcount *, sizeof *cnt, M_DEVBUF, M_NOWAIT); + if (!cnt) + return (NULL); + iv = &ivb[irq]; if (iv->handler) { - if (!pv->share) + if (!pv->share) { + FREE(cnt, M_DEVBUF); return (NULL); - else { + } else { iv = pv->share; pv->share = iv->share; iv->share = ivb[irq].share; @@ -174,12 +181,13 @@ cpu_intr_map(void *v, int pri, int irq, int (*handler)(void *), void *arg, } } + evcount_attach(cnt, name, NULL, &evcount_intr); iv->pri = pri; iv->irq = irq; iv->flags = 0; iv->handler = handler; iv->arg = arg; - iv->cnt = &intrcnt[pri]; + iv->cnt = cnt; iv->next = intr_list; intr_list = iv; @@ -191,10 +199,15 @@ cpu_intr_establish(int pri, int irq, int (*handler)(void *), void *arg, const char *name) { struct hppa_iv *iv, *ev; + struct evcount *cnt; if (irq < 0 || irq >= CPU_NINTS || intr_table[irq].handler) return (NULL); + MALLOC(cnt, struct evcount *, sizeof *cnt, M_DEVBUF, M_NOWAIT); + if (!cnt) + return (NULL); + cpu_mask |= (1 << irq); imask[pri] |= (1 << irq); @@ -205,7 +218,7 @@ cpu_intr_establish(int pri, int irq, int (*handler)(void *), void *arg, iv->flags = 0; iv->handler = handler; iv->arg = arg; - iv->cnt = &intrcnt[pri]; + iv->cnt = cnt; iv->next = NULL; iv->share = NULL; @@ -215,7 +228,10 @@ cpu_intr_establish(int pri, int irq, int (*handler)(void *), void *arg, intr_more += 2 * CPU_NINTS; for (ev = iv->next + CPU_NINTS; ev < intr_more; ev++) ev->share = iv->share, iv->share = ev; - } + FREE(cnt, M_DEVBUF); + iv->cnt = NULL; + } else + evcount_attach(cnt, name, NULL, &evcount_intr); return (iv); } @@ -277,7 +293,11 @@ cpu_intr(void *v) for (r = iv->flags & HPPA_IV_SOFT; iv && iv->handler; iv = iv->next) /* no arg means pass the frame */ - r |= (iv->handler)(iv->arg? iv->arg : v) == 1; + if ((iv->handler)(iv->arg? iv->arg : v) == 1) { + if (iv->cnt) + iv->cnt->ec_count++; + r |= 1; + } #if 0 /* XXX this does not work, lasi gives us double ints */ if (!r) { cpl = 0; diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S index 2d0f2a225fa..51f020c8e3a 100644 --- a/sys/arch/hppa/hppa/locore.S +++ b/sys/arch/hppa/hppa/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.135 2004/06/30 18:18:54 mickey Exp $ */ +/* $OpenBSD: locore.S,v 1.136 2004/06/30 21:01:08 mickey Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -107,32 +107,6 @@ $trap_tmp_save .block TF_PHYS - .globl intrcnt, eintrcnt, intrnames, eintrnames - .export intrcnt, data -intrcnt - .block 16 * 4 - .export eintrcnt, data -eintrcnt - .export intrnames, data -intrnames - .asciz "spur" - .asciz "lev1" - .asciz "lev2" - .asciz "lev3" - .asciz "lev4" - .asciz "lev5" - .asciz "lev6" - .asciz "lev7" - .asciz "lev8" - .asciz "clock" - .asciz "lev10" - .asciz "lev11" - .asciz "lev12" - .asciz "lev13" - .asciz "lev14" - .asciz "lev15" - .export eintrnames, data -eintrnames .export netisr, data .align 16 netisr @@ -163,6 +137,17 @@ cpu_itmr /* itmr value at the most recent clk int */ .export hppa_vtop, data BSS(hppa_vtop, 4) /* a vtop translation table addr (pa=va) */ + .export intrcnt, data + .export eintrcnt, data + .export intrnames, data + .export eintrnames, data +intrcnt + .word 0 +eintrcnt +intrnames + .word 0 +eintrnames + .text .import $kernel_setup, entry @@ -1988,17 +1973,12 @@ $intr_ffs ldw 3*4(r1), r9 /* arg: ioreg */ mtctl r1, tr7 bv r0(r16) - ldw 4*4(r1), r1 /* next: sub-intr_table */ + ldw 6*4(r1), r1 /* next: sub-intr_table */ $intr_nocall - ldw 6*4(r1), r17 /* bit */ - ldw 7*4(r1), r25 /* &intrcnt[pri] */ + ldw 4*4(r1), r17 /* bit */ or r17, r24, r24 /* ipending */ - ldw 0(r25), r9 - addi 1, r9, r9 - stw r9, 0(r25) - /* also return from nested handlers */ $intr_cont comb,<>,n r0, r8, $intr_ffs @@ -2047,15 +2027,11 @@ $gsc_ffs ldo -32(r1), r9 $gsc_share - ldw 6*4(r9), r17 /* bit */ - ldw 7*4(r9), r25 /* &intrcnt[pri] */ - or r17, r24, r24 /* ipending */ - - ldw 0(r25), r17 + ldw 4*4(r9), r17 /* bit */ ldw 5*4(r9), r9 /* share */ - addi 1, r17, r17 + comb,<> r0, r9, $gsc_share - stw r17, 0(r25) + or r17, r24, r24 /* ipending */ b,n $gsc_intr_loop EXIT(gsc_intr) @@ -2075,15 +2051,11 @@ $dino_ffs ldo -32(r1), r9 $dino_share - ldw 6*4(r9), r17 /* bit */ - ldw 7*4(r9), r25 /* &intrcnt[pri] */ - or r17, r24, r24 /* ipending */ - - ldw 0(r25), r17 + ldw 4*4(r9), r17 /* bit */ ldw 5*4(r9), r9 /* share */ - addi 1, r17, r17 + comb,<> r0, r9, $dino_share - stw r17, 0(r25) + or r17, r24, r24 /* ipending */ b,n $dino_intr_loop EXIT(dino_intr) diff --git a/sys/arch/hppa/include/types.h b/sys/arch/hppa/include/types.h index 708d4d64703..f287ba9f068 100644 --- a/sys/arch/hppa/include/types.h +++ b/sys/arch/hppa/include/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.9 2003/06/02 23:27:46 millert Exp $ */ +/* $OpenBSD: types.h,v 1.10 2004/06/30 21:01:08 mickey Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -83,5 +83,6 @@ typedef unsigned long uint64_t; typedef int32_t register_t; #define __HAVE_DEVICE_REGISTER +#define __HAVE_EVCOUNT #endif /* _MACHINE_TYPES_H_ */ |