summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2005-01-11 18:12:31 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2005-01-11 18:12:31 +0000
commit91d09e80aa850f5e5910706d4ecf8d9b5757f1ed (patch)
tree929890856286f2791f1a02fd9d899db6fd6d5ae5
parent220740fd435b96d44ef2c059264f80464a28aaa9 (diff)
first cut at interrupt stats.
-rw-r--r--sys/arch/arm/xscale/pxa2x0_gpio.c16
-rw-r--r--sys/arch/arm/xscale/pxa2x0_intr.c30
2 files changed, 35 insertions, 11 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_gpio.c b/sys/arch/arm/xscale/pxa2x0_gpio.c
index 08e3747db4e..dd9c9875a3b 100644
--- a/sys/arch/arm/xscale/pxa2x0_gpio.c
+++ b/sys/arch/arm/xscale/pxa2x0_gpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0_gpio.c,v 1.7 2005/01/10 23:42:22 drahn Exp $ */
+/* $OpenBSD: pxa2x0_gpio.c,v 1.8 2005/01/11 18:12:30 drahn Exp $ */
/* $NetBSD: pxa2x0_gpio.c,v 1.2 2003/07/15 00:24:55 lukem Exp $ */
/*
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.2 2003/07/15 00:24:55 lukem Exp $"
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
+#include <sys/evcount.h>
#include <machine/intr.h>
#include <machine/bus.h>
@@ -61,6 +62,8 @@ struct gpio_irq_handler {
void *gh_arg;
int gh_spl;
u_int gh_gpio;
+ int gh_irq;
+ struct evcount gh_count;
};
struct pxagpio_softc {
@@ -248,6 +251,8 @@ pxa2x0_gpio_intr_establish(u_int gpio, int level, int spl, int (*func)(void *),
gh->gh_arg = arg;
gh->gh_spl = spl;
gh->gh_gpio = gpio;
+ gh->gh_irq = gpio+32;
+ evcount_attach(&gh->gh_count, name, (void *)&gh->gh_irq, &evcount_intr);
gh->gh_next = sc->sc_handlers[gpio];
sc->sc_handlers[gpio] = gh;
@@ -297,6 +302,8 @@ pxa2x0_gpio_intr_disestablish(void *cookie)
struct gpio_irq_handler *gh = cookie;
u_int32_t bit, reg;
+ evcount_detach(&gh->gh_count);
+
bit = GPIO_BIT(gh->gh_gpio);
reg = pxagpio_reg_read(sc, GPIO_REG(GPIO_GFER0, gh->gh_gpio));
@@ -366,7 +373,7 @@ static int
gpio_dispatch(struct pxagpio_softc *sc, int gpio_base)
{
struct gpio_irq_handler **ghp, *gh;
- int i, s, handled, pins;
+ int i, s, nhandled, handled, pins;
u_int32_t gedr, mask;
int bank;
@@ -419,7 +426,10 @@ gpio_dispatch(struct pxagpio_softc *sc, int gpio_base)
s = _splraise(gh->gh_spl);
do {
- handled |= (gh->gh_func)(gh->gh_arg);
+ nhandled = (gh->gh_func)(gh->gh_arg);
+ if (handled != 0)
+ gh->gh_count.ec_count++;
+ handled |= nhandled;
gh = gh->gh_next;
} while (gh != NULL);
splx(s);
diff --git a/sys/arch/arm/xscale/pxa2x0_intr.c b/sys/arch/arm/xscale/pxa2x0_intr.c
index 272e6ce5b7d..743b0a99305 100644
--- a/sys/arch/arm/xscale/pxa2x0_intr.c
+++ b/sys/arch/arm/xscale/pxa2x0_intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0_intr.c,v 1.4 2005/01/04 23:43:22 drahn Exp $ */
+/* $OpenBSD: pxa2x0_intr.c,v 1.5 2005/01/11 18:12:30 drahn Exp $ */
/* $NetBSD: pxa2x0_intr.c,v 1.5 2003/07/15 00:24:55 lukem Exp $ */
/*
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: pxa2x0_intr.c,v 1.5 2003/07/15 00:24:55 lukem Exp $"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
+#include <sys/evcount.h>
#include <uvm/uvm_extern.h>
#include <machine/bus.h>
@@ -105,6 +106,8 @@ static struct intrhandler{
void *arg; /* NULL for stackframe */
/* struct evbnt ev; */
char *name;
+ int ih_irq;
+ struct evcount ih_count;
}
handler[ICU_LEN];
@@ -216,6 +219,7 @@ pxa2x0_irq_handler(void *arg)
(* handler[irqno].func)(
handler[irqno].arg == 0
? frame : handler[irqno].arg );
+ handler[irqno].ih_count.ec_count++;
#else
/* process all handlers for this interrupt.
XXX not yet */
@@ -440,23 +444,29 @@ pxa2x0_intr_establish(int irqno, int level,
int (*func)(void *), void *arg, char *name)
{
int psw;
+ struct intrhandler *ih;
if (irqno < PXA2X0_IRQ_MIN || irqno >= ICU_LEN)
panic("intr_establish: bogus irq number %d", irqno);
psw = disable_interrupts(I32_bit);
- handler[irqno].arg = arg;
- handler[irqno].func = func;
- handler[irqno].name = name;
+ ih = &handler[irqno];
+ ih->arg = arg;
+ ih->func = func;
+ ih->name = name;
+ ih->ih_irq = irqno;
extirq_level[irqno] = level;
+
+ evcount_attach(&ih->ih_count, name, (void *)&ih->ih_irq, &evcount_intr);
+
pxa2x0_update_intr_masks(irqno, level);
intr_mask = pxa2x0_imask[current_spl_level];
restore_interrupts(psw);
- return (&handler[irqno]);
+ return (ih);
}
void
pxa2x0_intr_disestablish(void *cookie)
@@ -464,6 +474,7 @@ pxa2x0_intr_disestablish(void *cookie)
struct intrhandler *lhandler = cookie;
int irqno;
int psw;
+ struct intrhandler *ih;
irqno = lhandler - handler;
@@ -472,9 +483,12 @@ pxa2x0_intr_disestablish(void *cookie)
psw = disable_interrupts(I32_bit);
- handler[irqno].arg = (void *) irqno;
- handler[irqno].func = stray_interrupt;
- handler[irqno].name = "stray";
+ ih = &handler[irqno];
+ evcount_detach(&ih->ih_count);
+
+ ih->arg = (void *) irqno;
+ ih->func = stray_interrupt;
+ ih->name = "stray";
extirq_level[irqno] = IPL_SERIAL;
pxa2x0_update_intr_masks(irqno, IPL_SERIAL);