summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2006-11-08 21:06:58 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2006-11-08 21:06:58 +0000
commitc98bab58186ee6b559c6a13559f66a06f523ee7f (patch)
tree86d426c34f998adc7720ba6400db467853d2dcc2 /sys
parentf9fae29da41573ba989fc6426fb0a60e058892e0 (diff)
Implement interrupt counters (better)
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/landisk/landisk/intr.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/sys/arch/landisk/landisk/intr.c b/sys/arch/landisk/landisk/intr.c
index dc90430df12..2b72315bb38 100644
--- a/sys/arch/landisk/landisk/intr.c
+++ b/sys/arch/landisk/landisk/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.1 2006/10/06 21:16:15 miod Exp $ */
+/* $OpenBSD: intr.c,v 1.2 2006/11/08 21:06:57 drahn Exp $ */
/* $NetBSD: intr.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
/*-
@@ -50,7 +50,8 @@ struct intrhand {
int ih_enable;
int ih_level;
int ih_irq;
- struct evcount ih_cnt;
+ struct evcount ih_count;
+ const char *ih_name;
};
struct extintr_handler {
@@ -93,14 +94,16 @@ intc_intr(int ssr, int spc, int ssp)
if (level < ssr)
level = ssr;
(void)_cpu_intr_resume(level);
- (*ih->ih_func)(ih->ih_arg);
+ if ((*ih->ih_func)(ih->ih_arg) != 0)
+ ih->ih_count.ec_count++;
_reg_write_1(LANDISK_INTEN, inten);
break;
}
#endif
default:
(void)_cpu_intr_resume(ih->ih_level);
- (*ih->ih_func)(ih->ih_arg);
+ if ((*ih->ih_func)(ih->ih_arg) != 0)
+ ih->ih_count.ec_count++;
break;
case SH_INTEVT_TMU0_TUNI0:
@@ -108,7 +111,8 @@ intc_intr(int ssr, int spc, int ssp)
cf.spc = spc;
cf.ssr = ssr;
cf.ssp = ssp;
- (*ih->ih_func)(&cf);
+ if ((*ih->ih_func)(&cf) != 0)
+ ih->ih_count.ec_count++;
break;
case SH_INTEVT_NMI:
@@ -157,7 +161,7 @@ extintr_establish(int irq, int level, int (*ih_fun)(void *), void *ih_arg,
if (eih->eih_func == NULL) {
evtcode = 0x200 + (irq << 5);
eih->eih_func = intc_intr_establish(evtcode, IST_LEVEL, level,
- extintr_intr_handler, eih, ih_name);
+ extintr_intr_handler, eih, NULL);
}
/*
@@ -186,10 +190,11 @@ extintr_establish(int irq, int level, int (*ih_fun)(void *), void *ih_arg,
ih->ih_enable = 1;
ih->ih_level = level;
ih->ih_irq = irq - 5;
-#if 0
- evcnt_attach_dynamic(&ih->ih_evcnt, EVCNT_TYPE_INTR,
- NULL, "ext", name);
-#endif
+ ih->ih_name = ih_name;
+
+ if (ih_name != NULL)
+ evcount_attach(&ih->ih_count, ih_name, (void *)&ih->ih_irq,
+ &evcount_intr);
*p = ih;
if (++eih->eih_nih == 1) {
@@ -230,7 +235,8 @@ extintr_disestablish(void *aux)
*p = q->ih_next;
#if 0
- evcnt_detach(&ih->ih_evcnt);
+ if (ih->ih_name != NULL)
+ evcount_detach(&ih->ih_count);
#endif
free((void *)ih, M_DEVBUF);
@@ -354,7 +360,7 @@ extintr_intr_handler(void *arg)
if (__predict_true(ih->ih_enable)) {
r = (*ih->ih_fun)(ih->ih_arg);
if (__predict_true(r != 0)) {
- ih->ih_cnt.ec_count++;
+ ih->ih_count.ec_count++;
}
}
}