Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/fdt If an enable-method property is present on ...
details: https://anonhg.NetBSD.org/src/rev/313414b51643
branches: trunk
changeset: 450431:313414b51643
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Apr 13 19:15:25 2019 +0000
description:
If an enable-method property is present on the cpu node and not supported
by the kernel, try to use the enable-method from the cpus node instead.
diffstat:
sys/arch/arm/fdt/cpu_fdt.c | 45 +++++++++++++++++++++++++++++----------------
1 files changed, 29 insertions(+), 16 deletions(-)
diffs (86 lines):
diff -r 04088caca002 -r 313414b51643 sys/arch/arm/fdt/cpu_fdt.c
--- a/sys/arch/arm/fdt/cpu_fdt.c Sat Apr 13 18:04:23 2019 +0000
+++ b/sys/arch/arm/fdt/cpu_fdt.c Sat Apr 13 19:15:25 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.24 2019/04/13 17:34:38 jmcneill Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.25 2019/04/13 19:15:25 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
#include "psci_fdt.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.24 2019/04/13 17:34:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.25 2019/04/13 19:15:25 jmcneill Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -234,16 +234,29 @@
}
#ifdef MULTIPROCESSOR
-static int
-arm_fdt_cpu_enable(int phandle, const char *method)
+static struct arm_cpu_method *
+arm_fdt_cpu_enable_method(int phandle)
{
+ const char *method;
+
+ method = fdtbus_get_string(phandle, "enable-method");
+ if (method == NULL)
+ return NULL;
+
__link_set_decl(arm_cpu_methods, struct arm_cpu_method);
- struct arm_cpu_method * const *acm;
- __link_set_foreach(acm, arm_cpu_methods) {
- if (strcmp(method, (*acm)->acm_compat) == 0)
- return (*acm)->acm_enable(phandle);
+ struct arm_cpu_method * const *acmp;
+ __link_set_foreach(acmp, arm_cpu_methods) {
+ if (strcmp(method, (*acmp)->acm_compat) == 0)
+ return *acmp;
}
- return ENOSYS;
+
+ return NULL;
+}
+
+static int
+arm_fdt_cpu_enable(int phandle, struct arm_cpu_method *acm)
+{
+ return acm->acm_enable(phandle);
}
#endif
@@ -255,7 +268,7 @@
uint64_t mpidr, bp_mpidr;
u_int cpuindex, i;
int child, error;
- const char *method;
+ struct arm_cpu_method *acm;
const int cpus = OF_finddevice("/cpus");
if (cpus == -1) {
@@ -278,15 +291,15 @@
if (mpidr == bp_mpidr)
continue; /* BP already started */
- method = fdtbus_get_string(child, "enable-method");
- if (method == NULL)
- method = fdtbus_get_string(cpus, "enable-method");
- if (method == NULL)
+ acm = arm_fdt_cpu_enable_method(child);
+ if (acm == NULL)
+ acm = arm_fdt_cpu_enable_method(cpus);
+ if (acm == NULL)
continue;
- error = arm_fdt_cpu_enable(child, method);
+ error = arm_fdt_cpu_enable(child, acm);
if (error != 0) {
- aprint_error("%s: %s: unsupported enable-method\n", __func__, method);
+ aprint_error("%s: failed to enable CPU %#" PRIx64 "\n", __func__, mpidr);
continue;
}
Home |
Main Index |
Thread Index |
Old Index