Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm Build fixes and make BP startup detection co...



details:   https://anonhg.NetBSD.org/src/rev/aa4328201913
branches:  trunk
changeset: 946458:aa4328201913
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Nov 28 14:33:56 2020 +0000

description:
Build fixes and make BP startup detection consistent

diffstat:

 sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c |  35 +++++++++++++-----------------
 sys/arch/evbarm/gumstix/gumstix_machdep.c |  25 +++++++---------------
 sys/arch/evbarm/zynq/zynq_machdep.c       |  32 ++++++++++-----------------
 3 files changed, 35 insertions(+), 57 deletions(-)

diffs (155 lines):

diff -r bb47fae56d03 -r aa4328201913 sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c
--- a/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c Sat Nov 28 14:29:31 2020 +0000
+++ b/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c Sat Nov 28 14:33:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm53xx_machdep.c,v 1.24 2020/10/30 18:54:37 skrll Exp $       */
+/*     $NetBSD: bcm53xx_machdep.c,v 1.25 2020/11/28 14:33:56 skrll Exp $       */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define IDM_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm53xx_machdep.c,v 1.24 2020/10/30 18:54:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm53xx_machdep.c,v 1.25 2020/11/28 14:33:56 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -245,25 +245,20 @@
        dsb(sy);
        __asm __volatile("sev" ::: "memory");
 
-       for (int loop = 0; loop < 16; loop++) {
-               VPRINTF("%u hatched %#x\n", loop, arm_cpu_hatched);
-               if (arm_cpu_hatched == __BITS(arm_cpu_max - 1, 1))
-                       break;
-               int timo = 1500000;
-               while (arm_cpu_hatched != __BITS(arm_cpu_max - 1, 1))
-                       if (--timo == 0)
-                               break;
-       }
-       for (size_t i = 1; i < arm_cpu_max; i++) {
-               if (cpu_hatched_p(i)) {)
-                       printf("%s: warning: cpu%zu failed to hatch\n",
-                           __func__, i);
-               }
-       }
+       /* Bitmask of CPUs (non-BP) to start */
+       for (u_int cpuindex = 1; cpuindex < arm_cpu_max; cpuindex++) {
+               u_int i ;
+               for (i = 1500000; i > 0; i--) {
+                        if (cpu_hatched_p(cpuindex))
+                                break;
+                }
 
-       VPRINTF(" (%u cpu%s, hatched %#x)",
-           arm_cpu_max, arm_cpu_max ? "s" : "",
-           arm_cpu_hatched);
+                if (i == 0) {
+                        ret++;
+                        aprint_error("cpu%d: WARNING: AP failed to start\n",
+                            cpuindex);
+                }
+        }
 #endif /* MULTIPROCESSOR */
 }
 
diff -r bb47fae56d03 -r aa4328201913 sys/arch/evbarm/gumstix/gumstix_machdep.c
--- a/sys/arch/evbarm/gumstix/gumstix_machdep.c Sat Nov 28 14:29:31 2020 +0000
+++ b/sys/arch/evbarm/gumstix/gumstix_machdep.c Sat Nov 28 14:33:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gumstix_machdep.c,v 1.69 2020/10/30 18:54:37 skrll Exp $ */
+/*     $NetBSD: gumstix_machdep.c,v 1.70 2020/11/28 14:33:56 skrll Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007  WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -540,25 +540,16 @@
        dsb(sy);
        __asm __volatile("sev" ::: "memory");
 
-       for (int loop = 0; loop < 16; loop++) {
-               VPRINTF("%u hatched %#x\n", loop, arm_cpu_hatched);
-               if (arm_cpu_hatched == __BITS(arm_cpu_max - 1, 1))
+       u_int i;
+       for (i = 0x10000000; i > 0; i--) {
+               if (cpu_hatched_p(cpuindex))
                        break;
-               int timo = 1500000;
-               while (arm_cpu_hatched != __BITS(arm_cpu_max - 1, 1))
-                       if (--timo == 0)
-                               break;
-       }
-       for (size_t i = 1; i < arm_cpu_max; i++) {
-               if (cpu_hatched_p(i)) {
-                       printf("%s: warning: cpu%zu failed to hatch\n",
-                           __func__, i);
-               }
        }
 
-       VPRINTF(" (%u cpu%s, hatched %#x)",
-           arm_cpu_max, arm_cpu_max ? "s" : "",
-           arm_cpu_hatched);
+       if (i == 0) {
+               aprint_error("cpu%d: WARNING: AP failed to start\n",
+                   cpuindex);
+       }
 #endif
 }
 
diff -r bb47fae56d03 -r aa4328201913 sys/arch/evbarm/zynq/zynq_machdep.c
--- a/sys/arch/evbarm/zynq/zynq_machdep.c       Sat Nov 28 14:29:31 2020 +0000
+++ b/sys/arch/evbarm/zynq/zynq_machdep.c       Sat Nov 28 14:33:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zynq_machdep.c,v 1.14 2020/10/30 18:54:37 skrll Exp $  */
+/*     $NetBSD: zynq_machdep.c,v 1.15 2020/11/28 14:33:57 skrll Exp $  */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zynq_machdep.c,v 1.14 2020/10/30 18:54:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zynq_machdep.c,v 1.15 2020/11/28 14:33:57 skrll Exp $");
 
 #include "opt_evbarm_boardtype.h"
 #include "opt_arm_debug.h"
@@ -223,27 +223,19 @@
        dsb(sy);
        __asm __volatile("sev" ::: "memory");
 
-
-       for (int loop = 0; loop < 16; loop++) {
-               VPRINTF("%u hatched %#x\n", loop, arm_cpu_hatched);
-               if (arm_cpu_hatched == __BITS(arm_cpu_max - 1, 1))
+       u_int cpuindex = 1;
+       u_int i;
+       for (i = 0x10000000; i > 0; i--) {
+               if (cpu_hatched_p(cpuindex))
                        break;
-               int timo = 1500000;
-               while (arm_cpu_hatched != __BITS(arm_cpu_max - 1, 1))
-                       if (--timo == 0)
-                               break;
-       }
-       for (size_t i = 1; i < arm_cpu_max; i++) {
-               if (cpu_hatched_p(i)) {
-                       ret++;
-                       printf("%s: warning: cpu%zu failed to hatch\n",
-                           __func__, i);
-               }
        }
 
-       VPRINTF(" (%u cpu%s, hatched %#x)",
-           arm_cpu_max, arm_cpu_max ? "s" : "",
-           arm_cpu_hatched);
+       if (i == 0) {
+               ret++;
+               aprint_error("cpu%d: WARNING: AP failed to start\n",
+                   cpuindex);
+       }
+
 #endif /* MULTIPROCESSOR */
        return ret;
 }



Home | Main Index | Thread Index | Old Index