summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2005-01-17 04:27:21 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2005-01-17 04:27:21 +0000
commitc2c8fbbff82de6abf4a9a73c535963a58cd01aff (patch)
treee06e7484e27bdc3b5fbd3aee560856cb5c60e6c9 /sys/arch
parent12cf284ae53a53ee3fd7ca89175078d4cafe3ff0 (diff)
Interrupts which are handled by the second level interrupt handler gpio
should not have two counters triggered for each interrupt. add a flag, name == NULL to pxa_intr to indicate that the event counter should not be register for such interrupts. In gpio, register its interrupts with this indication, however it should count the gpio0 and gpio1 interrupts which are registered. requested deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/arm/xscale/pxa2x0_gpio.c20
-rw-r--r--sys/arch/arm/xscale/pxa2x0_intr.c9
2 files changed, 20 insertions, 9 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_gpio.c b/sys/arch/arm/xscale/pxa2x0_gpio.c
index 8a5766894d4..dc41d76d7d2 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.10 2005/01/13 20:46:28 drahn Exp $ */
+/* $OpenBSD: pxa2x0_gpio.c,v 1.11 2005/01/17 04:27:20 drahn Exp $ */
/* $NetBSD: pxa2x0_gpio.c,v 1.2 2003/07/15 00:24:55 lukem Exp $ */
/*
@@ -191,7 +191,7 @@ pxagpio_attach(struct device *parent, struct device *self, void *aux)
#ifdef PXAGPIO_HAS_GPION_INTRS
sc->sc_irqcookie[2] = pxa2x0_intr_establish(PXA2X0_INT_GPION, IPL_BIO,
- gpio_intrN, sc, sc->sc_dev.dv_xname);
+ gpio_intrN, sc, NULL);
if (sc->sc_irqcookie[2] == NULL) {
printf("%s: failed to hook main GPIO interrupt\n",
sc->sc_dev.dv_xname);
@@ -260,13 +260,13 @@ pxa2x0_gpio_intr_establish(u_int gpio, int level, int spl, int (*func)(void *),
if (gpio == 0) {
KDASSERT(sc->sc_irqcookie[0] == NULL);
sc->sc_irqcookie[0] = pxa2x0_intr_establish(PXA2X0_INT_GPIO0,
- spl, gpio_intr0, sc, sc->sc_dev.dv_xname);
+ spl, gpio_intr0, sc, NULL);
KDASSERT(sc->sc_irqcookie[0]);
} else
if (gpio == 1) {
KDASSERT(sc->sc_irqcookie[1] == NULL);
sc->sc_irqcookie[1] = pxa2x0_intr_establish(PXA2X0_INT_GPIO1,
- spl, gpio_intr1, sc, sc->sc_dev.dv_xname);
+ spl, gpio_intr1, sc, NULL);
KDASSERT(sc->sc_irqcookie[1]);
}
@@ -334,6 +334,7 @@ static int
gpio_intr0(void *arg)
{
struct pxagpio_softc *sc = arg;
+ int ret;
#ifdef DIAGNOSTIC
if (sc->sc_handlers[0] == NULL) {
@@ -346,13 +347,17 @@ gpio_intr0(void *arg)
bus_space_write_4(sc->sc_bust, sc->sc_bush, GPIO_REG(GPIO_GEDR0, 0),
GPIO_BIT(0));
- return ((sc->sc_handlers[0]->gh_func)(sc->sc_handlers[0]->gh_arg));
+ ret = (sc->sc_handlers[0]->gh_func)(sc->sc_handlers[0]->gh_arg);
+ if (ret != 0)
+ sc->sc_handlers[0]->gh_count.ec_count++;
+ return ret;
}
static int
gpio_intr1(void *arg)
{
struct pxagpio_softc *sc = arg;
+ int ret;
#ifdef DIAGNOSTIC
if (sc->sc_handlers[1] == NULL) {
@@ -365,7 +370,10 @@ gpio_intr1(void *arg)
bus_space_write_4(sc->sc_bust, sc->sc_bush, GPIO_REG(GPIO_GEDR0, 1),
GPIO_BIT(1));
- return ((sc->sc_handlers[1]->gh_func)(sc->sc_handlers[1]->gh_arg));
+ ret = (sc->sc_handlers[1]->gh_func)(sc->sc_handlers[1]->gh_arg);
+ if (ret != 0)
+ sc->sc_handlers[0]->gh_count.ec_count++;
+ return ret;
}
#ifdef PXAGPIO_HAS_GPION_INTRS
diff --git a/sys/arch/arm/xscale/pxa2x0_intr.c b/sys/arch/arm/xscale/pxa2x0_intr.c
index c9b80f5304f..c6adc81061a 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.6 2005/01/13 17:59:32 drahn Exp $ */
+/* $OpenBSD: pxa2x0_intr.c,v 1.7 2005/01/17 04:27:20 drahn Exp $ */
/* $NetBSD: pxa2x0_intr.c,v 1.5 2003/07/15 00:24:55 lukem Exp $ */
/*
@@ -452,7 +452,9 @@ pxa2x0_intr_establish(int irqno, int level,
ih->ih_irq = irqno;
extirq_level[irqno] = level;
- evcount_attach(&ih->ih_count, name, (void *)&ih->ih_irq, &evcount_intr);
+ if (name != NULL)
+ evcount_attach(&ih->ih_count, name, (void *)&ih->ih_irq,
+ &evcount_intr);
pxa2x0_update_intr_masks(irqno, level);
@@ -478,7 +480,8 @@ pxa2x0_intr_disestablish(void *cookie)
psw = disable_interrupts(I32_bit);
ih = &handler[irqno];
- evcount_detach(&ih->ih_count);
+ if (ih->name != NULL)
+ evcount_detach(&ih->ih_count);
ih->arg = (void *) irqno;
ih->func = pxa2x0_stray_interrupt;