Module Name:    src
Committed By:   jmcneill
Date:           Sun Sep  9 21:16:05 UTC 2018

Modified Files:
        src/sys/arch/arm/fdt: psci_fdt.c

Log Message:
Boot APs with status "disabled" if they have an enable-method property


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/fdt/psci_fdt.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/fdt/psci_fdt.c
diff -u src/sys/arch/arm/fdt/psci_fdt.c:1.16 src/sys/arch/arm/fdt/psci_fdt.c:1.17
--- src/sys/arch/arm/fdt/psci_fdt.c:1.16	Sun Sep  9 13:32:26 2018
+++ src/sys/arch/arm/fdt/psci_fdt.c	Sun Sep  9 21:16:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: psci_fdt.c,v 1.16 2018/09/09 13:32:26 jmcneill Exp $ */
+/* $NetBSD: psci_fdt.c,v 1.17 2018/09/09 21:16:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <[email protected]>
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.16 2018/09/09 13:32:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.17 2018/09/09 21:16:05 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -169,6 +169,27 @@ psci_fdt_mpstart_pa(void)
 }
 #endif
 
+static bool
+psci_fdt_cpu_okay(const int child)
+{
+	const char *s;
+
+	s = fdtbus_get_string(child, "device_type");
+	if (!s || strcmp(s, "cpu") != 0)
+		return false;
+
+	s = fdtbus_get_string(child, "status");
+	if (s) {
+		if (strcmp(s, "okay") == 0)
+			return false;
+		if (strcmp(s, "disabled") == 0)
+			return of_hasprop(child, "enable-method");
+		return false;
+	} else {
+		return true;
+	}
+}
+
 void
 psci_fdt_bootstrap(void)
 {
@@ -202,7 +223,7 @@ psci_fdt_bootstrap(void)
 	/* Boot APs */
 	cpuindex = 1;
 	for (child = OF_child(cpus); child; child = OF_peer(child)) {
-		if (!fdtbus_status_okay(child))
+		if (!psci_fdt_cpu_okay(child))
 			continue;
 		if (fdtbus_get_reg64(child, 0, &mpidr, NULL) != 0)
 			continue;

Reply via email to