summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-05-01 21:59:40 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-05-01 21:59:40 +0000
commit384943ec70a5daad085968af685b7b93ef022a3e (patch)
tree59ec5523fe5d94caff05af0e879c19bdcd9234a6 /sys/arch/hppa/dev
parent88e44c216436c9e3b1e82f9353ec39701d5ddb34 (diff)
Fix counting of interrupts for devices that attach to elroy(4). Shared
interrupts would be counted double, once for the interrupting device and once for the device at the head of the chain. The handlers would run properly though. Avoid this by giving each device its own interrupt counter instead of using the counter provided by the generic interrupt handling code for the head of the chain.
Diffstat (limited to 'sys/arch/hppa/dev')
-rw-r--r--sys/arch/hppa/dev/apic.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sys/arch/hppa/dev/apic.c b/sys/arch/hppa/dev/apic.c
index 0c58d0fd445..0b88d7740f9 100644
--- a/sys/arch/hppa/dev/apic.c
+++ b/sys/arch/hppa/dev/apic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apic.c,v 1.13 2011/04/23 22:20:22 kettenis Exp $ */
+/* $OpenBSD: apic.c,v 1.14 2011/05/01 21:59:39 kettenis Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -175,29 +175,30 @@ apic_intr_establish(void *v, pci_intr_handle_t ih,
return NULL;
}
+ cnt = malloc(sizeof(struct evcount), M_DEVBUF, M_NOWAIT);
+ if (!cnt) {
+ free(aiv, M_DEVBUF);
+ return (NULL);
+ }
+
aiv->sc = sc;
aiv->ih = ih;
aiv->handler = handler;
aiv->arg = arg;
aiv->next = NULL;
- aiv->cnt = NULL;
- if (apic_intr_list[irq]) {
- cnt = malloc(sizeof(struct evcount), M_DEVBUF, M_NOWAIT);
- if (!cnt) {
- free(aiv, M_DEVBUF);
- return (NULL);
- }
+ aiv->cnt = cnt;
+
+ evcount_attach(cnt, name, NULL);
- evcount_attach(cnt, name, NULL);
+ if (apic_intr_list[irq]) {
biv = apic_intr_list[irq];
while (biv->next)
biv = biv->next;
biv->next = aiv;
- aiv->cnt = cnt;
return (arg);
}
- if ((iv = cpu_intr_establish(pri, irq, apic_intr, aiv, name))) {
+ if ((iv = cpu_intr_establish(pri, irq, apic_intr, aiv, NULL))) {
ent0 = (31 - irq) & APIC_ENT0_VEC;
ent0 |= apic_get_int_ent0(sc, line);
#if 0