]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: psci: Add API to check for support of specific PSCI function
authorVaradarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>
Wed, 21 Jan 2026 06:39:16 +0000 (12:09 +0530)
committerCasey Connolly <casey.connolly@linaro.org>
Mon, 27 Apr 2026 10:38:44 +0000 (12:38 +0200)
Add an API to check if a specific PSCI function is supported or not.
This is based on the psci_features() function present in Linux kernel
(drivers/firmware/psci/psci.c).

Reviewed-by: Casey Connolly <casey.connolly@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Varadarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>
Link: https://patch.msgid.link/20260121063920.1500293-2-varadarajan.narayanan@oss.qualcomm.com
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
arch/arm/cpu/armv8/fwcall.c
arch/arm/include/asm/system.h

index 87de09979b18d3e5a85efcbb18e7323d4dc06ae0..f834d770dd685687b3883be68535938f699b2d81 100644 (file)
@@ -129,3 +129,18 @@ void __noreturn psci_system_off(void)
        while (1)
                ;
 }
+
+int psci_features(u32 psci_func_id)
+{
+       struct pt_regs regs;
+
+       regs.regs[0] = ARM_PSCI_1_0_FN_PSCI_FEATURES;
+       regs.regs[1] = psci_func_id;
+
+       if (use_smc_for_psci)
+               smc_call(&regs);
+       else
+               hvc_call(&regs);
+
+       return regs.regs[0];
+}
index 9e3ad57073d5d0516c0863c1d05d7a64f2fc1dd0..5ed6833c155cbe1278d79b00140b56429d0f4d1c 100644 (file)
@@ -342,6 +342,7 @@ void smc_call(struct pt_regs *args);
 void __noreturn psci_system_reset(void);
 void __noreturn psci_system_reset2(u32 reset_level, u32 cookie);
 void __noreturn psci_system_off(void);
+int psci_features(u32 psci_func_id);
 
 #ifdef CONFIG_ARMV8_PSCI
 extern char __secure_start[];