aboutsummaryrefslogtreecommitdiff
path: root/common/fdt_fixup.c
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2019-09-19 10:55:25 +0100
committerAndre Przywara <andre.przywara@arm.com>2019-09-25 11:45:35 +0100
commit66799507c4bbade3a58b833b55bcbe195370fd87 (patch)
treeadc356d4fc771c5522a3d6f7c8337faed6fb3e1d /common/fdt_fixup.c
parent6eaf928d66fbded8e190aaa189e1a0810ba79252 (diff)
downloadtrusted-firmware-a-66799507c4bbade3a58b833b55bcbe195370fd87.tar.gz
FDT helper functions: Respect architecture in PSCI function IDs
PSCI uses different function IDs for CPU_SUSPEND and CPU_ON, depending on the architecture used (AArch64 or AArch32). For recent PSCI versions the client will determine the right version, but for PSCI v0.1 we need to put some ID in the DT node. At the moment we always add the 64-bit IDs, which is not correct if TF-A is built for AArch32. Use the function IDs matching the TF-A build architecture, for the two IDs where this differs. This only affects legacy OSes using PSCI v0.1. On the way remove the sys_poweroff and sys_reset properties, which were never described in the official PSCI DT binding. Change-Id: If77bc6daec215faeb2dc67112e765aacafd17f33 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'common/fdt_fixup.c')
-rw-r--r--common/fdt_fixup.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/common/fdt_fixup.c b/common/fdt_fixup.c
index 48ae97512b..99d0eee982 100644
--- a/common/fdt_fixup.c
+++ b/common/fdt_fixup.c
@@ -29,6 +29,19 @@ static int append_psci_compatible(void *fdt, int offs, const char *str)
return fdt_appendprop(fdt, offs, "compatible", str, strlen(str) + 1);
}
+/*
+ * Those defines are for PSCI v0.1 legacy clients, which we expect to use
+ * the same execution state (AArch32/AArch64) as TF-A.
+ * Kernels running in AArch32 on an AArch64 TF-A should use PSCI v0.2.
+ */
+#ifdef __aarch64__
+#define PSCI_CPU_SUSPEND_FNID PSCI_CPU_SUSPEND_AARCH64
+#define PSCI_CPU_ON_FNID PSCI_CPU_ON_AARCH64
+#else
+#define PSCI_CPU_SUSPEND_FNID PSCI_CPU_SUSPEND_AARCH32
+#define PSCI_CPU_ON_FNID PSCI_CPU_ON_AARCH32
+#endif
+
/*******************************************************************************
* dt_add_psci_node() - Add a PSCI node into an existing device tree
* @fdt: pointer to the device tree blob in memory
@@ -66,15 +79,11 @@ int dt_add_psci_node(void *fdt)
return -1;
if (fdt_setprop_string(fdt, offs, "method", "smc"))
return -1;
- if (fdt_setprop_u32(fdt, offs, "cpu_suspend", PSCI_CPU_SUSPEND_AARCH64))
+ if (fdt_setprop_u32(fdt, offs, "cpu_suspend", PSCI_CPU_SUSPEND_FNID))
return -1;
if (fdt_setprop_u32(fdt, offs, "cpu_off", PSCI_CPU_OFF))
return -1;
- if (fdt_setprop_u32(fdt, offs, "cpu_on", PSCI_CPU_ON_AARCH64))
- return -1;
- if (fdt_setprop_u32(fdt, offs, "sys_poweroff", PSCI_SYSTEM_OFF))
- return -1;
- if (fdt_setprop_u32(fdt, offs, "sys_reset", PSCI_SYSTEM_RESET))
+ if (fdt_setprop_u32(fdt, offs, "cpu_on", PSCI_CPU_ON_FNID))
return -1;
return 0;
}