diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-07-27 12:36:35 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-07-27 12:36:35 +0000 |
commit | bb4db0fa8336704eaf9c3115ce09ecb20caccb3e (patch) | |
tree | 1349ec31ebe6a0cc6871f47627998c9aefb916b7 /sys/arch | |
parent | ff414172cbce7b80482f47a965b79ee7068987d4 (diff) |
Add per-device evcount interrupt counters; also use LIST_xxx macros in isr.c
ok aaron@, tested aoyama@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/luna88k/dev/if_le.c | 5 | ||||
-rw-r--r-- | sys/arch/luna88k/dev/sio.c | 5 | ||||
-rw-r--r-- | sys/arch/luna88k/dev/spc.c | 5 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/isr.c | 40 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/isr.h | 6 |
5 files changed, 36 insertions, 25 deletions
diff --git a/sys/arch/luna88k/dev/if_le.c b/sys/arch/luna88k/dev/if_le.c index 82ac3902059..54db089fc20 100644 --- a/sys/arch/luna88k/dev/if_le.c +++ b/sys/arch/luna88k/dev/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.2 2004/06/19 18:33:37 miod Exp $ */ +/* $OpenBSD: if_le.c,v 1.3 2004/07/27 12:36:32 miod Exp $ */ /* $NetBSD: if_le.c,v 1.33 1996/11/20 18:56:52 gwr Exp $ */ /*- @@ -162,7 +162,8 @@ le_attach(parent, self, aux) am7990_config(sc); - isrlink_autovec(am7990_intr, (void *)sc, ma->ma_ilvl, ISRPRI_NET); + isrlink_autovec(am7990_intr, (void *)sc, ma->ma_ilvl, ISRPRI_NET, + self->dv_xname); } /* diff --git a/sys/arch/luna88k/dev/sio.c b/sys/arch/luna88k/dev/sio.c index f593dc8e95c..08284263bfe 100644 --- a/sys/arch/luna88k/dev/sio.c +++ b/sys/arch/luna88k/dev/sio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio.c,v 1.1 2004/04/21 15:23:55 aoyama Exp $ */ +/* $OpenBSD: sio.c,v 1.2 2004/07/27 12:36:32 miod Exp $ */ /* $NetBSD: sio.c,v 1.1 2000/01/05 08:48:55 nisimura Exp $ */ /*- @@ -100,7 +100,8 @@ sio_attach(parent, self, aux) config_found(self, (void *)&sio_args, sio_print); } - isrlink_autovec(xsiointr, sc, ma->ma_ilvl, ISRPRI_TTYNOBUF); + isrlink_autovec(xsiointr, sc, ma->ma_ilvl, ISRPRI_TTYNOBUF, + self->dv_xname); } int diff --git a/sys/arch/luna88k/dev/spc.c b/sys/arch/luna88k/dev/spc.c index bbf1044de9d..bdd99aeaf71 100644 --- a/sys/arch/luna88k/dev/spc.c +++ b/sys/arch/luna88k/dev/spc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spc.c,v 1.1 2004/04/21 15:23:55 aoyama Exp $ */ +/* $OpenBSD: spc.c,v 1.2 2004/07/27 12:36:32 miod Exp $ */ /* $NetBSD: spc.c,v 1.4 2003/07/05 19:00:17 tsutsui Exp $ */ /*- @@ -105,7 +105,8 @@ spc_mainbus_attach(parent, self, aux) sc->sc_dma_start = NULL; sc->sc_dma_done = NULL; - isrlink_autovec(spc_intr, (void *)sc, ma->ma_ilvl, ISRPRI_BIO); + isrlink_autovec(spc_intr, (void *)sc, ma->ma_ilvl, ISRPRI_BIO, + self->dv_xname); spc_attach(sc, &spc_switch); } diff --git a/sys/arch/luna88k/luna88k/isr.c b/sys/arch/luna88k/luna88k/isr.c index 0ecaa9ba9b9..7ceabe4bf6f 100644 --- a/sys/arch/luna88k/luna88k/isr.c +++ b/sys/arch/luna88k/luna88k/isr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isr.c,v 1.1 2004/04/21 15:24:00 aoyama Exp $ */ +/* $OpenBSD: isr.c,v 1.2 2004/07/27 12:36:34 miod Exp $ */ /* $NetBSD: isr.c,v 1.5 2000/07/09 08:08:20 nisimura Exp $ */ /*- @@ -45,6 +45,7 @@ #include <sys/systm.h> #include <sys/malloc.h> #include <sys/vmmeter.h> +#include <sys/evcount.h> #include <uvm/uvm_extern.h> @@ -74,17 +75,16 @@ isrinit() * Called by driver attach functions. */ void -isrlink_autovec(func, arg, ipl, priority) - int (*func)(void *); - void *arg; - int ipl; - int priority; +isrlink_autovec(int (*func)(void *), void *arg, int ipl, int priority, + const char *name) { struct isr_autovec *newisr, *curisr; isr_autovec_list_t *list; - if ((ipl < 0) || (ipl >= NISRAUTOVEC)) +#ifdef DIAGNOSTIC + if (ipl < 0 || ipl >= NISRAUTOVEC) panic("isrlink_autovec: bad ipl %d", ipl); +#endif newisr = (struct isr_autovec *)malloc(sizeof(struct isr_autovec), M_DEVBUF, M_NOWAIT); @@ -96,6 +96,8 @@ isrlink_autovec(func, arg, ipl, priority) newisr->isr_arg = arg; newisr->isr_ipl = ipl; newisr->isr_priority = priority; + evcount_attach(&newisr->isr_count, name, (void *)&newisr->isr_ipl, + &evcount_intr); /* * Some devices are particularly sensitive to interrupt @@ -129,8 +131,8 @@ isrlink_autovec(func, arg, ipl, priority) * and place ourselves after any ISRs with our current (or * higher) priority. */ - for (curisr = list->lh_first; curisr->isr_link.le_next != NULL; - curisr = curisr->isr_link.le_next) { + for (curisr = LIST_FIRST(list); LIST_NEXT(curisr, isr_link) != NULL; + curisr = LIST_NEXT(curisr, isr_link)) { if (newisr->isr_priority > curisr->isr_priority) { LIST_INSERT_BEFORE(curisr, newisr, isr_link); return; @@ -149,16 +151,17 @@ isrlink_autovec(func, arg, ipl, priority) * assembly language autovectored interrupt routine. */ void -isrdispatch_autovec(ipl) - int ipl; +isrdispatch_autovec(int ipl) { struct isr_autovec *isr; isr_autovec_list_t *list; - int handled = 0; + int rc, handled = 0; static int straycount, unexpected; - if ((ipl < 0) || (ipl >= NISRAUTOVEC)) +#ifdef DIAGNOSTIC + if (ipl < 0 || ipl >= NISRAUTOVEC) panic("isrdispatch_autovec: bad ipl 0x%d\n", ipl); +#endif intrcnt[ipl]++; #if 0 /* XXX: already counted in machdep.c */ @@ -166,7 +169,7 @@ isrdispatch_autovec(ipl) #endif list = &isr_autovec[ipl]; - if (list->lh_first == NULL) { + if (LIST_EMPTY(list)) { printf("isrdispatch_autovec: ipl %d unexpected\n", ipl); if (++unexpected > 10) panic("too many unexpected interrupts"); @@ -174,8 +177,12 @@ isrdispatch_autovec(ipl) } /* Give all the handlers a chance. */ - for (isr = list->lh_first ; isr != NULL; isr = isr->isr_link.le_next) - handled |= (*isr->isr_func)(isr->isr_arg); + LIST_FOREACH(isr, list, isr_link) { + rc = (*isr->isr_func)(isr->isr_arg); + if (rc != 0) + isr->isr_count.ec_count++; + handled |= rc; + } if (handled) straycount = 0; @@ -200,5 +207,4 @@ netintr() #include <net/netisr_dispatch.h> #undef DONETISR - } diff --git a/sys/arch/luna88k/luna88k/isr.h b/sys/arch/luna88k/luna88k/isr.h index dafe618da6e..d24972c631f 100644 --- a/sys/arch/luna88k/luna88k/isr.h +++ b/sys/arch/luna88k/luna88k/isr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: isr.h,v 1.1 2004/04/21 15:24:00 aoyama Exp $ */ +/* $OpenBSD: isr.h,v 1.2 2004/07/27 12:36:34 miod Exp $ */ /* $NetBSD: isr.h,v 1.1 2000/01/05 08:49:04 nisimura Exp $ */ /*- @@ -37,6 +37,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/evcount.h> #include <sys/queue.h> /* @@ -53,6 +54,7 @@ struct isr_autovec { void *isr_arg; int isr_ipl; int isr_priority; + struct evcount isr_count; }; typedef LIST_HEAD(, isr_autovec) isr_autovec_list_t; @@ -66,5 +68,5 @@ typedef LIST_HEAD(, isr_autovec) isr_autovec_list_t; #define ISRPRI_TTYNOBUF 3 void isrinit(void); -void isrlink_autovec(int (*)(void *), void *, int, int); +void isrlink_autovec(int (*)(void *), void *, int, int, const char *); void isrdispatch_autovec(int); |