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 Use PIC_IRQBASE_ALLOC for all pic_add ...



details:   https://anonhg.NetBSD.org/src/rev/59e1252e0425
branches:  trunk
changeset: 967885:59e1252e0425
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Dec 26 11:09:11 2019 +0000

description:
Use PIC_IRQBASE_ALLOC for all pic_add calls and track/use each cpu irqbase

diffstat:

 sys/arch/arm/broadcom/bcm2835_intr.c |  21 ++++++++++-----------
 sys/arch/arm/broadcom/bcm2835reg.h   |   7 +------
 2 files changed, 11 insertions(+), 17 deletions(-)

diffs (80 lines):

diff -r 8884ac0312bd -r 59e1252e0425 sys/arch/arm/broadcom/bcm2835_intr.c
--- a/sys/arch/arm/broadcom/bcm2835_intr.c      Thu Dec 26 08:52:38 2019 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_intr.c      Thu Dec 26 11:09:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_intr.c,v 1.28 2019/12/25 10:49:29 skrll Exp $  */
+/*     $NetBSD: bcm2835_intr.c,v 1.29 2019/12/26 11:09:11 skrll 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.28 2019/12/25 10:49:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.29 2019/12/26 11:09:11 skrll Exp $");
 
 #define _INTR_PRIVATE
 
@@ -99,7 +99,10 @@
 static void bcm2835_icu_attach(device_t, device_t, void *);
 
 static int bcm2835_int_base;
-static int bcm2836mp_int_base;
+static int bcm2836mp_int_base[BCM2836_NCPUS];
+
+#define        BCM2835_INT_BASE                bcm2835_int_base
+#define        BCM2836_INT_BASECPUN(n)         bcm2836mp_int_base[(n)]
 
 static void
 bcm2835_set_priority(struct pic_softc *pic, int ipl)
@@ -710,9 +713,9 @@
            BCM2836_LOCAL_INTC_IRQPENDINGN(cpuid));
 
        lpending &= ~BCM2836_INTBIT_GPUPENDING;
-       if (lpending & BCM2836MP_ALL_IRQS) {
-               ipl |= pic_mark_pending_sources(pic, 0 /* BCM2836_INT_LOCALBASE */,
-                   lpending & BCM2836MP_ALL_IRQS);
+       const uint32_t allirqs = lpending & BCM2836MP_ALL_IRQS;
+       if (allirqs) {
+               ipl |= pic_mark_pending_sources(pic, 0, allirqs);
        }
 
        return ipl;
@@ -830,11 +833,7 @@
        snprintf(suffix, sizeof(suffix), "#%lu", cpuid);
        strlcat(pic->pic_name, suffix, sizeof(pic->pic_name));
 #endif
-       if (cpuid == 0) {
-               bcm2836mp_int_base = pic_add(pic, PIC_IRQBASE_ALLOC);
-       } else {
-               pic_add(pic, BCM2836_INT_BASECPUN(cpuid));
-       }
+       bcm2836mp_int_base[cpuid] = pic_add(pic, PIC_IRQBASE_ALLOC);
 
 #if defined(MULTIPROCESSOR)
        intr_establish(BCM2836_INT_MAILBOX0_CPUN(cpuid), IPL_HIGH,
diff -r 8884ac0312bd -r 59e1252e0425 sys/arch/arm/broadcom/bcm2835reg.h
--- a/sys/arch/arm/broadcom/bcm2835reg.h        Thu Dec 26 08:52:38 2019 +0000
+++ b/sys/arch/arm/broadcom/bcm2835reg.h        Thu Dec 26 11:09:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835reg.h,v 1.27 2019/12/26 08:27:43 skrll Exp $    */
+/*     $NetBSD: bcm2835reg.h,v 1.28 2019/12/26 11:09:11 skrll Exp $    */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -139,14 +139,9 @@
 #define        BCM2835_INTC_ENABLEBASE         (BCM2835_INTC_BASE + 0x10)
 #define        BCM2835_INTC_DISABLEBASE        (BCM2835_INTC_BASE + 0x1c)
 
-#define BCM2835_INT_BASE               bcm2835_int_base
-
 #define        BCM2836_NCPUS                   4
 #define        BCM2836_NIRQPERCPU              32
 
-#define        BCM2836_INT_LOCALBASE           bcm2836mp_int_base
-#define        BCM2836_INT_BASECPUN(n)         (BCM2836_INT_LOCALBASE + ((n) * BCM2836_NIRQPERCPU))
-
 #define        BCM2836_INT_CNTPSIRQ            0
 #define        BCM2836_INT_CNTPNSIRQ           1
 #define        BCM2836_INT_CNTHPIRQ            2



Home | Main Index | Thread Index | Old Index