Module Name:    src
Committed By:   aymeric
Date:           Fri Nov  2 18:13:11 UTC 2018

Modified Files:
        src/sys/arch/arm/altera: cycv_platform.c

Log Message:
Adapt secondary CPU bootstrapping to the new generic startup code.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/altera/cycv_platform.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/arm/altera/cycv_platform.c
diff -u src/sys/arch/arm/altera/cycv_platform.c:1.8 src/sys/arch/arm/altera/cycv_platform.c:1.9
--- src/sys/arch/arm/altera/cycv_platform.c:1.8	Fri Nov  2 18:11:24 2018
+++ src/sys/arch/arm/altera/cycv_platform.c	Fri Nov  2 18:13:11 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_platform.c,v 1.8 2018/11/02 18:11:24 aymeric Exp $ */
+/* $NetBSD: cycv_platform.c,v 1.9 2018/11/02 18:13:11 aymeric Exp $ */
 
 /* This file is in the public domain. */
 
@@ -7,7 +7,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.8 2018/11/02 18:11:24 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.9 2018/11/02 18:13:11 aymeric Exp $");
 
 #define	_ARM32_BUS_DMA_PRIVATE
 #include <sys/param.h>
@@ -72,6 +72,8 @@ cycv_platform_bootstrap(void)
 #if NARML2CC > 0
 	arml2cc_init(bst, bsh_l2c, 0);
 #endif
+
+	arm_fdt_cpu_bootstrap();
 }
 
 static void
@@ -103,11 +105,16 @@ cycv_mpstart(void)
 	    htole32(0xea000000 | ((startfunc - 8 - 0x0) >> 2));
 	pmap_unmap_chunk(kernel_l1pt.pv_va, CYCV_SDRAM_VBASE, L1_S_SIZE);
 
-	arm_cpu_max = 2;
-
 	bus_space_write_4(bst, bsh_rst, CYCV_RSTMGR_MPUMODRST,
 		bus_space_read_4(bst, bsh_rst, CYCV_RSTMGR_MPUMODRST) &
 			~CYCV_RSTMGR_MPUMODRST_CPU1);
+
+	/* Wait for secondary processor to start */
+	for (int i = 0x10000000; i > 0; i--) {
+		membar_consumer();
+		if (arm_cpu_hatched == (1 << 1))
+			break;
+	}
 }
 
 static void

Reply via email to