Module Name: src Committed By: jmcneill Date: Sat Jul 7 15:11:07 UTC 2018
Modified Files: src/sys/arch/arm/fdt: psci_fdt.c Log Message: Switch to PSCI 0.1 mode only if the first compatible string listed on /psci is "arm,psci" To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/arch/arm/fdt/psci_fdt.c:1.6 --- src/sys/arch/arm/fdt/psci_fdt.c:1.5 Fri Jun 15 16:03:59 2018 +++ src/sys/arch/arm/fdt/psci_fdt.c Sat Jul 7 15:11:07 2018 @@ -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 <jmcne...@invisible.ca> @@ -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 @@ psci_fdt_attach(device_t parent, device_ 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 @@ psci_fdt_init(const int phandle) 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);