Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/broadcom Account for the IRQ offset on the bcm2...



details:   https://anonhg.NetBSD.org/src/rev/6c7fae5fd149
branches:  trunk
changeset: 465587:6c7fae5fd149
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Nov 29 17:44:27 2019 +0000

description:
Account for the IRQ offset on the bcm2836.

diffstat:

 sys/arch/arm/broadcom/bcm2835_intr.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (64 lines):

diff -r fdefff28fd11 -r 6c7fae5fd149 sys/arch/arm/broadcom/bcm2835_intr.c
--- a/sys/arch/arm/broadcom/bcm2835_intr.c      Fri Nov 29 17:40:16 2019 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_intr.c      Fri Nov 29 17:44:27 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_intr.c,v 1.26 2019/11/28 15:35:51 thorpej Exp $        */
+/*     $NetBSD: bcm2835_intr.c,v 1.27 2019/11/29 17:44:27 thorpej Exp $        */
 
 /*-
  * Copyright (c) 2012, 2015, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.26 2019/11/28 15:35:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.27 2019/11/29 17:44:27 thorpej Exp $");
 
 #define _INTR_PRIVATE
 
@@ -467,15 +467,16 @@
        struct bcm2835icu_irq *firq;
        struct bcm2835icu_irqhandler *firqh;
        int iflags = (flags & FDT_INTR_MPSAFE) ? IST_MPSAFE : 0;
-       int irq;
+       int irq, irqidx;
 
        irq = bcm2835_icu_fdt_decode_irq(specifier);
        if (irq == -1)
                return NULL;
+       irqidx = irq - BCM2835_INT_BASE;
 
-       KASSERT(irq < BCM2835_NIRQ);
+       KASSERT(irqidx < BCM2835_NIRQ);
 
-       firq = sc->sc_irq[irq];
+       firq = sc->sc_irq[irqidx];
        if (firq == NULL) {
                firq = kmem_alloc(sizeof(*firq), KM_SLEEP);
                firq->intr_sc = sc;
@@ -496,7 +497,7 @@
                        kmem_free(firq, sizeof(*firq));
                        return NULL;
                }
-               sc->sc_irq[irq] = firq;
+               sc->sc_irq[irqidx] = firq;
        } else {
                if (firq->intr_arg == NULL || arg == NULL) {
                        device_printf(dev,
@@ -549,6 +550,7 @@
                        continue;
 
                KASSERT(firq->intr_refcnt > 0);
+               KASSERT(n == (firq->intr_irq - BCM2835_INT_BASE));
 
                /* XXX see above */
                if (firq->intr_refcnt > 1)
@@ -560,7 +562,7 @@
                TAILQ_REMOVE(&firq->intr_handlers, firqh, ih_next);
                kmem_free(firqh, sizeof(*firqh));
 
-               sc->sc_irq[firq->intr_irq] = NULL;
+               sc->sc_irq[n] = NULL;
                kmem_free(firq, sizeof(*firq));
 
                return;



Home | Main Index | Thread Index | Old Index