@@ -220,6 +220,15 @@ static unsigned long psci_migrate_info_up_cpu(void)
0, 0, 0);
}
+int psci_system_reset2(const u32 reset_type, const unsigned long cookie)
+{
+ if (!psci_system_reset2_supported)
+ return -EOPNOTSUPP;
+ return invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), reset_type,
+ cookie, 0);
+}
+EXPORT_SYMBOL_GPL(psci_system_reset2);
+
static void set_conduit(enum arm_smccc_conduit conduit)
{
switch (conduit) {
@@ -267,7 +276,12 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd)
* reset_type[30:0] = 0 (SYSTEM_WARM_RESET)
* cookie = 0 (ignored by the implementation)
*/
- invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0);
+ psci_system_reset2(
+ PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET |
+ (PSCI_1_1_SYSTEM_RESET2_TYPE_ARCHITECTURE <<
+ PSCI_1_1_SYSTEM_RESET2_SHIFT),
+ 0
+ );
} else {
invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
}
@@ -41,8 +41,11 @@ extern struct psci_operations psci_ops;
#if defined(CONFIG_ARM_PSCI_FW)
int __init psci_dt_init(void);
+int psci_system_reset2(const u32 reset_type, const unsigned long cookie);
#else
static inline int psci_dt_init(void) { return 0; }
+static inline int psci_system_reset2(const u32 reset_type,
+ const unsigned long cookie) { return -ENODEV; }
#endif
#if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
@@ -72,6 +72,14 @@
#define PSCI_1_0_EXT_POWER_STATE_TYPE_MASK \
(0x1 << PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT)
+/* PSCI SYSTEM_RESET2 reset_type argument */
+#define PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET 0x0
+#define PSCI_1_1_SYSTEM_RESET2_TYPE_VENDOR 1
+#define PSCI_1_1_SYSTEM_RESET2_TYPE_ARCHITECTURE 0
+#define PSCI_1_1_SYSTEM_RESET2_TYPE_SHIFT 30
+#define PSCI_1_1_SYSTEM_RESET2_TYPE_MASK \
+ (0x1 << PSCI_1_1_SYSTEM_RESET2_TYPE_SHIFT)
+
/* PSCI v0.2 affinity level state returned by AFFINITY_INFO */
#define PSCI_0_2_AFFINITY_LEVEL_ON 0
#define PSCI_0_2_AFFINITY_LEVEL_OFF 1
Make SYSTEM_RESET2 command part of its own function which client drivers may also invoke to support vendor-specific reset types. Signed-off-by: Elliot Berman <eberman@codeaurora.org> --- drivers/firmware/psci/psci.c | 16 +++++++++++++++- include/linux/psci.h | 3 +++ include/uapi/linux/psci.h | 8 ++++++++ 3 files changed, 26 insertions(+), 1 deletion(-)