Source-Changes-HG archive

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

[src/trunk]: src/sys/arch on RPI2, fix compile failure without options MULTIP...



details:   https://anonhg.NetBSD.org/src/rev/7b15ce80b566
branches:  trunk
changeset: 827661:7b15ce80b566
user:      ryo <ryo%NetBSD.org@localhost>
date:      Tue Nov 07 09:05:05 2017 +0000

description:
on RPI2, fix compile failure without options MULTIPROCESSOR.

diffstat:

 sys/arch/arm/broadcom/bcm2835_intr.c |  11 ++++++-----
 sys/arch/evbarm/rpi/rpi_machdep.c    |  35 +++++++++++++++++++++++------------
 2 files changed, 29 insertions(+), 17 deletions(-)

diffs (134 lines):

diff -r a009f5f19d86 -r 7b15ce80b566 sys/arch/arm/broadcom/bcm2835_intr.c
--- a/sys/arch/arm/broadcom/bcm2835_intr.c      Tue Nov 07 07:21:13 2017 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_intr.c      Tue Nov 07 09:05:05 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_intr.c,v 1.13 2017/10/15 09:33:25 skrll Exp $  */
+/*     $NetBSD: bcm2835_intr.c,v 1.14 2017/11/07 09:05:05 ryo Exp $    */
 
 /*-
  * Copyright (c) 2012, 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.13 2017/10/15 09:33:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.14 2017/11/07 09:05:05 ryo Exp $");
 
 #define _INTR_PRIVATE
 
@@ -204,10 +204,11 @@
 #if defined(BCM2836)
 #if defined(MULTIPROCESSOR)
        aprint_normal(": Multiprocessor");
+       bcm2836mp_intr_init(curcpu());
+#else
+       pic_add(&bcm2836mp_pic[0], BCM2836_INT_BASECPUN(0));
 #endif
-
-       bcm2836mp_intr_init(curcpu());
-#endif
+#endif /* BCM2836 */
        pic_add(sc->sc_pic, BCM2835_INT_BASE);
 
        aprint_normal("\n");
diff -r a009f5f19d86 -r 7b15ce80b566 sys/arch/evbarm/rpi/rpi_machdep.c
--- a/sys/arch/evbarm/rpi/rpi_machdep.c Tue Nov 07 07:21:13 2017 +0000
+++ b/sys/arch/evbarm/rpi/rpi_machdep.c Tue Nov 07 09:05:05 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpi_machdep.c,v 1.81 2017/11/04 14:47:06 jmcneill Exp $        */
+/*     $NetBSD: rpi_machdep.c,v 1.82 2017/11/07 09:05:05 ryo Exp $     */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.81 2017/11/04 14:47:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.82 2017/11/07 09:05:05 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -38,6 +38,7 @@
 #include "opt_ddb.h"
 #include "opt_evbarm_boardtype.h"
 #include "opt_kgdb.h"
+#include "opt_multiprocessor.h"
 #include "opt_rpi.h"
 #include "opt_vcprop.h"
 
@@ -448,7 +449,7 @@
 
 /*
  * Return true if this model Raspberry Pi has Bluetooth/Wi-Fi support
- */ 
+ */
 static bool
 rpi_rev_has_btwifi(uint32_t rev)
 {
@@ -584,7 +585,7 @@
                size_t n = vcprop_tag_resplen(&vptp_mem->tag) /
                    sizeof(struct vcprop_memory);
 
-               bootconfig.dramblocks = 0;
+               bootconfig.dramblocks = 0;
 
                for (int i = 0; i < n && i < DRAM_BLOCKS; i++) {
                        bootconfig.dram[i].address = vptp_mem->mem[i].base;
@@ -626,22 +627,30 @@
 static void
 rpi_bootstrap(void)
 {
-#if defined(BCM2836)
-       arm_cpu_max = 4;
+#ifdef BCM2836
+#define RPI_CPU_MAX    4
+
+#ifdef MULTIPROCESSOR
        extern int cortex_mmuinfo;
 
+       arm_cpu_max = RPI_CPU_MAX;
+       cortex_mmuinfo = armreg_ttbr_read();
+
 #ifdef VERBOSE_INIT_ARM
        printf("%s: %d cpus present\n", __func__, arm_cpu_max);
-#endif
-
-       cortex_mmuinfo = armreg_ttbr_read();
-#ifdef VERBOSE_INIT_ARM
        printf("%s: cortex_mmuinfo %x\n", __func__, cortex_mmuinfo);
 #endif
+#endif /* MULTIPROCESSOR */
 
+       /*
+        * Even if no options MULTIPROCESSOR,
+        * It is need to initialize the secondary CPU,
+        * and go into wfi loop (cortex_mpstart),
+        * otherwise system would be freeze...
+        */
        extern void cortex_mpstart(void);
 
-       for (size_t i = 1; i < arm_cpu_max; i++) {
+       for (size_t i = 1; i < RPI_CPU_MAX; i++) {
                bus_space_tag_t iot = &bcm2835_bs_tag;
                bus_space_handle_t ioh = BCM2836_ARM_LOCAL_VBASE;
 
@@ -659,7 +668,9 @@
                                break;
                }
        }
+#endif /* BCM2836 */
 
+#ifdef MULTIPROCESSOR
        /* Wake up APs in case firmware has placed them in WFE state */
        __asm __volatile("sev");
 
@@ -675,7 +686,7 @@
                            __func__, i);
                }
        }
-#endif
+#endif /* MULTIPROCESSOR */
 }
 
 /*



Home | Main Index | Thread Index | Old Index