summaryrefslogtreecommitdiff
path: root/sys/arch/arm/footbridge
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2004-08-06 19:29:11 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2004-08-06 19:29:11 +0000
commite8ff26655dcd9d545690f11d7d0c2ce15a4ef233 (patch)
tree4f6a1018b02e8d998ab43ff557d4ee6368018a6f /sys/arch/arm/footbridge
parent657b0fbb716d828d127185e64617ee1d62e20e48 (diff)
Initial support for arm interrupt counters, more fixes to come. ok miod@
Diffstat (limited to 'sys/arch/arm/footbridge')
-rw-r--r--sys/arch/arm/footbridge/footbridge_intr.h5
-rw-r--r--sys/arch/arm/footbridge/footbridge_irqhandler.c37
-rw-r--r--sys/arch/arm/footbridge/footbridge_pci.c15
-rw-r--r--sys/arch/arm/footbridge/isa/isa_machdep.c18
4 files changed, 18 insertions, 57 deletions
diff --git a/sys/arch/arm/footbridge/footbridge_intr.h b/sys/arch/arm/footbridge/footbridge_intr.h
index 2a9888e7e1b..a3923222ff9 100644
--- a/sys/arch/arm/footbridge/footbridge_intr.h
+++ b/sys/arch/arm/footbridge/footbridge_intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: footbridge_intr.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */
+/* $OpenBSD: footbridge_intr.h,v 1.2 2004/08/06 19:29:10 drahn Exp $ */
/* $NetBSD: footbridge_intr.h,v 1.4 2003/01/03 00:56:00 thorpej Exp $ */
/*
@@ -74,6 +74,7 @@
#ifndef _LOCORE
#include <arm/cpufunc.h>
+#include <sys/evcount.h>
#include <arm/footbridge/dc21285mem.h>
#include <arm/footbridge/dc21285reg.h>
@@ -193,6 +194,7 @@ void _setsoftintr(int);
struct intrhand {
TAILQ_ENTRY(intrhand) ih_list; /* link on intrq list */
+ struct evcount ih_count; /* interrupt counter */
int (*ih_func)(void *); /* handler */
void *ih_arg; /* arg for handler */
int ih_ipl; /* IPL_* */
@@ -203,7 +205,6 @@ struct intrhand {
struct intrq {
TAILQ_HEAD(, intrhand) iq_list; /* handler list */
- struct evcnt iq_ev; /* event counter */
int iq_mask; /* IRQs to mask while handling */
int iq_levels; /* IPL_*'s this IRQ has */
int iq_ist; /* share type */
diff --git a/sys/arch/arm/footbridge/footbridge_irqhandler.c b/sys/arch/arm/footbridge/footbridge_irqhandler.c
index 648e4348f30..fbe49e43551 100644
--- a/sys/arch/arm/footbridge/footbridge_irqhandler.c
+++ b/sys/arch/arm/footbridge/footbridge_irqhandler.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: footbridge_irqhandler.c,v 1.2 2004/05/19 03:17:07 drahn Exp $ */
+/* $OpenBSD: footbridge_irqhandler.c,v 1.3 2004/08/06 19:29:10 drahn Exp $ */
/* $NetBSD: footbridge_irqhandler.c,v 1.9 2003/06/16 20:00:57 thorpej Exp $ */
/*
@@ -76,8 +76,6 @@ __volatile int footbridge_ipending;
void footbridge_intr_dispatch(struct clockframe *frame);
-const struct evcnt *footbridge_pci_intr_evcnt (void *, pci_intr_handle_t);
-
void footbridge_do_pending(void);
static const uint32_t si_to_irqbit[SI_NQUEUES] =
@@ -97,21 +95,6 @@ static const int si_to_ipl[SI_NQUEUES] = {
IPL_SOFTNET, /* SI_SOFTNET */
IPL_SOFTSERIAL, /* SI_SOFTSERIAL */
};
-
-const struct evcnt *
-footbridge_pci_intr_evcnt(pcv, ih)
- void *pcv;
- pci_intr_handle_t ih;
-{
- /* XXX check range is valid */
-#if NISA > 0
- if (ih >= 0x80 && ih <= 0x8f) {
- return isa_intr_evcnt(NULL, (ih & 0x0f));
- }
-#endif
- return &footbridge_intrq[ih].iq_ev;
-}
-
static __inline void
footbridge_enable_irq(int irq)
{
@@ -329,10 +312,6 @@ footbridge_intr_init(void)
TAILQ_INIT(&iq->iq_list);
snprintf(iq->iq_name, sizeof(iq->iq_name), "irq %d", i);
-#if 0
- evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
- NULL, "footbridge", iq->iq_name);
-#endif
}
footbridge_intr_calculate_masks();
@@ -374,11 +353,8 @@ footbridge_intr_claim(int irq, int ipl, char *name, int (*func)(void *), void *a
footbridge_intr_calculate_masks();
/* detach the existing event counter and add the new name */
-#if 0
- evcnt_detach(&iq->iq_ev);
- evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
- NULL, "footbridge", name);
-#endif
+ evcount_attach(&ih->ih_count, name, (void *)&ih->ih_irq,
+ &evcount_intr);
restore_interrupts(oldirqstate);
@@ -447,14 +423,17 @@ footbridge_intr_dispatch(struct clockframe *frame)
footbridge_ipending &= ~ibit;
iq = &footbridge_intrq[irq];
- iq->iq_ev.ev_count++;
uvmexp.intrs++;
current_spl_level |= iq->iq_mask;
oldirqstate = enable_interrupts(I32_bit);
for (ih = TAILQ_FIRST(&iq->iq_list);
((ih != NULL) && (intr_rc != 1));
ih = TAILQ_NEXT(ih, ih_list)) {
- intr_rc = (*ih->ih_func)(ih->ih_arg ? ih->ih_arg : frame);
+ intr_rc = (*ih->ih_func)(ih->ih_arg ?
+ ih->ih_arg : frame);
+ if (intr_rc)
+ ih->ih_count.ec_count++;
+
}
restore_interrupts(oldirqstate);
diff --git a/sys/arch/arm/footbridge/footbridge_pci.c b/sys/arch/arm/footbridge/footbridge_pci.c
index ab60704e0ff..ab4387ea0b5 100644
--- a/sys/arch/arm/footbridge/footbridge_pci.c
+++ b/sys/arch/arm/footbridge/footbridge_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: footbridge_pci.c,v 1.2 2004/05/19 03:17:07 drahn Exp $ */
+/* $OpenBSD: footbridge_pci.c,v 1.3 2004/08/06 19:29:10 drahn Exp $ */
/* $NetBSD: footbridge_pci.c,v 1.4 2001/09/05 16:17:35 matt Exp $ */
/*
@@ -68,7 +68,6 @@ void footbridge_pci_conf_write (void *, pcitag_t, int,
int footbridge_pci_intr_map (struct pci_attach_args *,
pci_intr_handle_t *);
const char *footbridge_pci_intr_string (void *, pci_intr_handle_t);
-const struct evcnt *footbridge_pci_intr_evcnt (void *, pci_intr_handle_t);
void *footbridge_pci_intr_establish (void *, pci_intr_handle_t,
int, int (*)(void *), void *, char *);
void footbridge_pci_intr_disestablish (void *, void *);
@@ -89,7 +88,6 @@ struct arm32_pci_chipset footbridge_pci_chipset = {
NULL, /* intr_v */
footbridge_pci_intr_map,
footbridge_pci_intr_string,
- footbridge_pci_intr_evcnt,
footbridge_pci_intr_establish,
footbridge_pci_intr_disestablish
};
@@ -353,17 +351,6 @@ footbridge_pci_intr_string(pcv, ih)
return(irqstr);
}
-#if 0
-const struct evcnt *
-footbridge_pci_intr_evcnt(pcv, ih)
- void *pcv;
- pci_intr_handle_t ih;
-{
-
- /* XXX for now, no evcnt parent reported */
- return NULL;
-}
-#endif
void *
footbridge_pci_intr_establish(pcv, ih, level, func, arg, name)
diff --git a/sys/arch/arm/footbridge/isa/isa_machdep.c b/sys/arch/arm/footbridge/isa/isa_machdep.c
index 8b74eca7e45..95b2b077b19 100644
--- a/sys/arch/arm/footbridge/isa/isa_machdep.c
+++ b/sys/arch/arm/footbridge/isa/isa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.c,v 1.2 2004/05/19 03:17:07 drahn Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.3 2004/08/06 19:29:10 drahn Exp $ */
/* $NetBSD: isa_machdep.c,v 1.4 2003/06/16 20:00:57 thorpej Exp $ */
/*-
@@ -367,12 +367,6 @@ isa_intr_alloc(ic, mask, type, irq)
return (0);
}
-const struct evcnt *
-isa_intr_evcnt(isa_chipset_tag_t ic, int irq)
-{
- return &isa_intrq[irq].iq_ev;
-}
-
/*
* Set up an interrupt handler to start being called.
* XXX PRONE TO RACE CONDITIONS, UGLY, 'INTERESTING' INSERTION ALGORITHM.
@@ -436,6 +430,8 @@ isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg, name)
ih->ih_arg = ih_arg;
ih->ih_ipl = level;
ih->ih_irq = irq;
+ evcount_attach(&ih->ih_count, name, (void *)&ih->ih_irq,
+ &evcount_intr);
/* do not stop us */
oldirqstate = disable_interrupts(I32_bit);
@@ -472,6 +468,7 @@ isa_intr_disestablish(ic, arg)
restore_interrupts(oldirqstate);
+ evcount_detach(&ih->ih_count);
free(ih, M_DEVBUF);
if (TAILQ_EMPTY(&(iq->iq_list)))
@@ -500,10 +497,6 @@ isa_intr_init(void)
TAILQ_INIT(&iq->iq_list);
snprintf(iq->iq_name, sizeof(iq->iq_name), "irq %d", i);
-#if 0
- evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
- NULL, "isa", iq->iq_name);
-#endif
}
isa_icu_init();
@@ -577,10 +570,11 @@ isa_irqdispatch(arg)
irq = iack & 0x0f;
iq = &isa_intrq[irq];
- iq->iq_ev.ev_count++;
for (ih = TAILQ_FIRST(&iq->iq_list); res != 1 && ih != NULL;
ih = TAILQ_NEXT(ih, ih_list)) {
res = (*ih->ih_func)(ih->ih_arg ? ih->ih_arg : frame);
+ if (res)
+ ih->ih_count.ec_count++;
}
return res;
}