summaryrefslogtreecommitdiff
path: root/sys/arch/octeon/dev/octeon_intr.c
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2016-12-03 05:39:26 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2016-12-03 05:39:26 +0000
commitbf60038ac0230a128bdca0a78356193352cdf704 (patch)
tree254638aef338d180dc8344788998b5cc96bd6bd2 /sys/arch/octeon/dev/octeon_intr.c
parentbadf643c00cec7a3ae1cc2ede14576b2f40a6f51 (diff)
Implement octeon_intr_disestablish().
Diffstat (limited to 'sys/arch/octeon/dev/octeon_intr.c')
-rw-r--r--sys/arch/octeon/dev/octeon_intr.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/sys/arch/octeon/dev/octeon_intr.c b/sys/arch/octeon/dev/octeon_intr.c
index 5e4e9ad685b..2bf035ea2c8 100644
--- a/sys/arch/octeon/dev/octeon_intr.c
+++ b/sys/arch/octeon/dev/octeon_intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: octeon_intr.c,v 1.16 2016/12/02 15:05:05 visa Exp $ */
+/* $OpenBSD: octeon_intr.c,v 1.17 2016/12/03 05:39:25 visa Exp $ */
/*
* Copyright (c) 2000-2004 Opsycon AB (www.opsycon.se)
@@ -130,10 +130,38 @@ octeon_intr_establish(int irq, int level,
}
void
-octeon_intr_disestablish(void *ih)
+octeon_intr_disestablish(void *_ih)
{
- /* XXX */
- panic("%s not implemented", __func__);
+ struct intrhand *ih = _ih;
+ struct intrhand *p;
+ unsigned int irq = ih->ih_irq;
+ int cpuid = cpu_number();
+ int s;
+
+ KASSERT(irq < OCTEON_NINTS);
+
+ s = splhigh();
+
+ if (ih == octeon_intrhand[irq]) {
+ octeon_intrhand[irq] = ih->ih_next;
+
+ if (octeon_intrhand[irq] == NULL)
+ octeon_intem[cpuid] &= ~(1ull << irq);
+ } else {
+ for (p = octeon_intrhand[irq]; p != NULL; p = p->ih_next) {
+ if (p->ih_next == ih) {
+ p->ih_next = ih->ih_next;
+ break;
+ }
+ }
+ if (p == NULL)
+ panic("%s: intrhand %p has not been registered",
+ __func__, ih);
+ }
+ free(ih, M_DEVBUF, sizeof(*ih));
+
+ octeon_intr_makemasks();
+ splx(s); /* causes hw mask update */
}
void