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 Switch to PSCI 0.1 mode only if the first c...



details:   https://anonhg.NetBSD.org/src/rev/0f2ecfe1450b
branches:  trunk
changeset: 323900:0f2ecfe1450b
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jul 07 15:11:07 2018 +0000

description:
Switch to PSCI 0.1 mode only if the first compatible string listed on /psci is "arm,psci"

diffstat:

 sys/arch/arm/fdt/psci_fdt.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (52 lines):

diff -r 66e06d506da8 -r 0f2ecfe1450b sys/arch/arm/fdt/psci_fdt.c
--- a/sys/arch/arm/fdt/psci_fdt.c       Fri Jul 06 14:58:22 2018 +0000
+++ b/sys/arch/arm/fdt/psci_fdt.c       Sat Jul 07 15:11:07 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psci_fdt.c,v 1.5 2018/06/15 16:03:59 jakllsch Exp $ */
+/* $NetBSD: psci_fdt.c,v 1.6 2018/07/07 15:11:07 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.5 2018/06/15 16:03:59 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.6 2018/07/07 15:11:07 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -108,15 +108,16 @@
 static int
 psci_fdt_init(const int phandle)
 {
-       char method[4];
+       const char *method, *psciver;
        uint32_t val;
 
-       if (!of_hasprop(phandle, "method")) {
-               aprint_error("PSCI: missing 'method' property\n");
+       method = fdtbus_get_string(phandle, "method");
+       psciver = fdtbus_get_string(phandle, "compatible");
+       if (method == NULL || psciver == NULL) {
+               aprint_error("PSCI: missing required property on /psci\n");
                return EINVAL;
        }
 
-       OF_getprop(phandle, "method", method, sizeof(method));
        if (strcmp(method, "smc") == 0)
                psci_init(psci_call_smc);
        else if (strcmp(method, "hvc") == 0)
@@ -126,7 +127,11 @@
                return EINVAL;
        }
 
-       if (of_match_compatible(phandle, compatible) == 1) {
+       /*
+        * If the first compatible string is "arm,psci" then we
+        * are dealing with PSCI 0.1
+        */
+       if (strcmp(psciver, "arm,psci") == 0) {
                psci_clearfunc();
                if (of_getprop_uint32(phandle, "cpu_on", &val) == 0)
                        psci_setfunc(PSCI_FUNC_CPU_ON, val);



Home | Main Index | Thread Index | Old Index