Module Name:    src
Committed By:   skrll
Date:           Sat Nov 28 14:33:57 UTC 2020

Modified Files:
        src/sys/arch/evbarm/bcm53xx: bcm53xx_machdep.c
        src/sys/arch/evbarm/gumstix: gumstix_machdep.c
        src/sys/arch/evbarm/zynq: zynq_machdep.c

Log Message:
Build fixes and make BP startup detection consistent


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/zynq/zynq_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c
diff -u src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c:1.24 src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c:1.25
--- src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c:1.24	Fri Oct 30 18:54:37 2020
+++ src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c	Sat Nov 28 14:33:56 2020
@@ -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 @@ bcm53xx_mpstart(void)
 	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);
-		}
-	}
-
-	VPRINTF(" (%u cpu%s, hatched %#x)",
-	    arm_cpu_max, arm_cpu_max ? "s" : "",
-	    arm_cpu_hatched);
+	/* 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;
+                }
+
+                if (i == 0) {
+                        ret++;
+                        aprint_error("cpu%d: WARNING: AP failed to start\n",
+                            cpuindex);
+                }
+        }
 #endif /* MULTIPROCESSOR */
 }
 

Index: src/sys/arch/evbarm/gumstix/gumstix_machdep.c
diff -u src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.69 src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.70
--- src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.69	Fri Oct 30 18:54:37 2020
+++ src/sys/arch/evbarm/gumstix/gumstix_machdep.c	Sat Nov 28 14:33:56 2020
@@ -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 @@ gumstix_mpstart(void)
 	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
 }
 

Index: src/sys/arch/evbarm/zynq/zynq_machdep.c
diff -u src/sys/arch/evbarm/zynq/zynq_machdep.c:1.14 src/sys/arch/evbarm/zynq/zynq_machdep.c:1.15
--- src/sys/arch/evbarm/zynq/zynq_machdep.c:1.14	Fri Oct 30 18:54:37 2020
+++ src/sys/arch/evbarm/zynq/zynq_machdep.c	Sat Nov 28 14:33:57 2020
@@ -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 @@ zynq_mpstart(void)
 	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);
-		}
+
+	if (i == 0) {
+		ret++;
+		aprint_error("cpu%d: WARNING: AP failed to start\n",
+		    cpuindex);
 	}
 
-	VPRINTF(" (%u cpu%s, hatched %#x)",
-	    arm_cpu_max, arm_cpu_max ? "s" : "",
-	    arm_cpu_hatched);
 #endif /* MULTIPROCESSOR */
 	return ret;
 }

Reply via email to