Module Name:    src
Committed By:   thorpej
Date:           Fri Mar  5 01:33:33 UTC 2021

Modified Files:
        src/sys/arch/ofppc/ofppc: machdep.c
        src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
Move ofppc-specific CPU spinup code to ofppc/machdep.c


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/ofppc/ofppc/machdep.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/oea/ofwoea_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/ofppc/ofppc/machdep.c
diff -u src/sys/arch/ofppc/ofppc/machdep.c:1.118 src/sys/arch/ofppc/ofppc/machdep.c:1.119
--- src/sys/arch/ofppc/ofppc/machdep.c:1.118	Sat Feb 27 02:52:49 2021
+++ src/sys/arch/ofppc/ofppc/machdep.c	Fri Mar  5 01:33:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.118 2021/02/27 02:52:49 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.119 2021/03/05 01:33:33 thorpej Exp $	*/
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.118 2021/02/27 02:52:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.119 2021/03/05 01:33:33 thorpej Exp $");
 
 #include "opt_ofwoea.h"
 
@@ -159,6 +159,30 @@ initppc(u_int startkernel, u_int endkern
 		}
 	}
 
+#if defined(MULTIPROCESSOR)
+	int l;
+	char cpupath[32];
+
+	extern void cpu_spinstart(u_int);
+	extern volatile u_int cpu_spinstart_ack;
+
+	for (i = 1; i < CPU_MAXNUM; i++) {
+		snprintf(cpupath, sizeof(cpupath), "/cpus/@%x", i);
+		node = OF_finddevice(cpupath);
+		if (node <= 0)
+			continue;
+		aprint_verbose("Starting up CPU %d %s\n", i, cpupath);
+		OF_start_cpu(node, (u_int)cpu_spinstart, i);
+		for (l = 0; l < 100000000; l++) {
+			if (cpu_spinstart_ack == i) {
+				aprint_verbose("CPU %d spun up.\n", i);
+				break;
+			}
+			__asm volatile ("sync");
+		}
+	}
+#endif /* MULTIPROCESSOR */
+
 	ofwoea_initppc(startkernel, endkernel, args);
 }
 

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.56 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.57
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.56	Sat Feb 27 02:52:48 2021
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Mar  5 01:33:33 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.56 2021/02/27 02:52:48 thorpej Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.57 2021/03/05 01:33:33 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.56 2021/02/27 02:52:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.57 2021/03/05 01:33:33 thorpej Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -139,9 +139,6 @@ extern uint32_t ticks_per_intr;
 static void restore_ofmap(void);
 static void set_timebase(void);
 
-extern void cpu_spinstart(u_int);
-extern volatile u_int cpu_spinstart_ack;
-
 void
 ofwoea_initppc(u_int startkernel, u_int endkernel, char *args)
 {
@@ -156,35 +153,6 @@ ofwoea_initppc(u_int startkernel, u_int 
 	    startsym = endsym = NULL;
 #endif
 
-	/* Initialize bus_space */
-	ofwoea_bus_space_init();
-
-	ofwoea_consinit();
-
-	if (ofw_quiesce)
-		OF_quiesce();
-
-#if defined(MULTIPROCESSOR) && defined(ofppc)
-	char cpupath[32];
-	int i, l, node;
-
-	for (i = 1; i < CPU_MAXNUM; i++) {
-		snprintf(cpupath, sizeof(cpupath), "/cpus/@%x", i);
-		node = OF_finddevice(cpupath);
-		if (node <= 0)
-			continue;
-		aprint_verbose("Starting up CPU %d %s\n", i, cpupath);
-		OF_start_cpu(node, (u_int)cpu_spinstart, i);
-		for (l = 0; l < 100000000; l++) {
-			if (cpu_spinstart_ack == i) {
-				aprint_verbose("CPU %d spun up.\n", i);
-				break;
-			}
-			__asm volatile ("sync");
-		}
-	}
-#endif
-
 	/* Parse the args string */
 	if (args) {
 		strcpy(bootpath, args);
@@ -204,6 +172,14 @@ ofwoea_initppc(u_int startkernel, u_int 
 			bootpath[len] = 0;
 	}
 
+	/* Initialize bus_space */
+	ofwoea_bus_space_init();
+
+	ofwoea_consinit();
+
+	if (ofw_quiesce)
+		OF_quiesce();
+
 	oea_init(pic_ext_intr);
 
 	/*

Reply via email to