Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/fdt Return the real interrupt handle from gic_f...
details: https://anonhg.NetBSD.org/src/rev/e434ee9a8bec
branches: trunk
changeset: 324672:e434ee9a8bec
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Jul 15 13:34:43 2018 +0000
description:
Return the real interrupt handle from gic_fdt_establish
diffstat:
sys/arch/arm/fdt/gic_fdt.c | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diffs (74 lines):
diff -r 7585847c6ab2 -r e434ee9a8bec sys/arch/arm/fdt/gic_fdt.c
--- a/sys/arch/arm/fdt/gic_fdt.c Sun Jul 15 13:24:05 2018 +0000
+++ b/sys/arch/arm/fdt/gic_fdt.c Sun Jul 15 13:34:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.11 2018/07/03 12:12:03 jmcneill Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.12 2018/07/15 13:34:43 jmcneill Exp $ */
/*-
* Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.11 2018/07/03 12:12:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.12 2018/07/15 13:34:43 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -37,6 +37,7 @@
#include <sys/kernel.h>
#include <sys/lwp.h>
#include <sys/kmem.h>
+#include <sys/queue.h>
#include <arm/cortex/gic_intr.h>
#include <arm/cortex/mpcore_var.h>
@@ -238,28 +239,36 @@
firqh->ih_arg = arg;
TAILQ_INSERT_TAIL(&firq->intr_handlers, firqh, ih_next);
- return firqh;
+ return firq->intr_ih;
}
static void
gic_fdt_disestablish(device_t dev, void *ih)
{
struct gic_fdt_softc * const sc = device_private(dev);
- struct gic_fdt_irqhandler *firqh = ih;
- struct gic_fdt_irq *firq = firqh->ih_irq;
- const int irq = firq->intr_irq;
-
- KASSERT(firq->intr_refcnt > 0);
+ struct gic_fdt_irqhandler *firqh;
+ struct gic_fdt_irq *firq;
+ u_int n;
- TAILQ_REMOVE(&firq->intr_handlers, firqh, ih_next);
- kmem_free(firqh, sizeof(*firqh));
+ for (n = 0; n < GIC_MAXIRQ; n++) {
+ firq = sc->sc_irq[n];
+ if (firq->intr_ih != ih)
+ continue;
- firq->intr_refcnt--;
- if (firq->intr_refcnt == 0) {
+ KASSERT(firq->intr_refcnt > 0);
+
+ if (firq->intr_refcnt > 1)
+ panic("%s: cannot disestablish shared irq", __func__);
+
+ firqh = TAILQ_FIRST(&firq->intr_handlers);
+ kmem_free(firqh, sizeof(*firqh));
intr_disestablish(firq->intr_ih);
kmem_free(firq, sizeof(*firq));
- sc->sc_irq[irq] = NULL;
+ sc->sc_irq[n] = NULL;
+ return;
}
+
+ panic("%s: interrupt not established", __func__);
}
static int
Home |
Main Index |
Thread Index |
Old Index