arm: socfpga: smc: Add function to get usercode
Subsystems (3)
PATCH 1/1 arm: socfpga: smc: Add function to get usercode
Add function to send mailbox command via SMC to get usercode from SDM.
--- arch/arm/mach-socfpga/include/mach/smc_api.h | 1 + arch/arm/mach-socfpga/smc_api.c | 17 +++++++++++++++++ include/linux/intel-smc.h | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+)
arch/arm/mach-socfpga/include/mach/smc_api.h +1 -0
@@ -9,5 +9,6 @@int invoke_smc (u32 func_id,u64 *args,int arg_len,u64 *ret_arg,int ret_len);int smc_send_mailbox (u32 cmd,u32 len,u32 *arg,u8 urgent,u32 *resp_buf_len,u32 *resp_buf); +int smc_get_usercode (u32 *usercode);#endif /* _SMC_API_H_ */
arch/arm/mach-socfpga/smc_api.c +17 -0
@@ -54,3 +54,20 @@ int smc_send_mailbox(u32 cmd, u32 len, u32 *arg, u8 urgent, u32 *resp_buf_len,return (int )resp[0 ]; } + +int smc_get_usercode (u32 *usercode) +{ +int ret; +u64 resp; + +if (!usercode) +return -EINVAL ; + + ret =invoke_smc (INTEL_SIP_SMC_GET_USERCODE ,NULL ,0 , + &resp,1 ); + +if (ret ==INTEL_SIP_SMC_STATUS_OK ) + *usercode = (u32 )resp; + +return ret; +}
include/linux/intel-smc.h +18 -0
@@ -518,4 +518,22 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)#define INTEL_SIP_SMC_MBOX_SEND_CMD \ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_MBOX_SEND_CMD) +/* +* Request INTEL_SIP_SMC_GET_USERCODE +* +* Send mailbox command to get usercode from SDM +* +* Call register usage: +* a0 INTEL_SIP_SMC_GET_USERCODE +* a1-7 not used. +* +* Return status +* a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_STATUS_ERROR +* a1 User code +* a2-3 not used. +*/ +#define INTEL_SIP_SMC_FUNCID_GET_USERCODE 61 +#define INTEL_SIP_SMC_GET_USERCODE \ + INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_GET_USERCODE) +#endif
Signature · 1 line
2.13.0
Tan
PATCH 1/1 arm: socfpga: smc: Add function to get usercode
Quoted 92 lines
-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Thursday, March 25, 2021 2:08 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [PATCH] arm: socfpga: smc: Add function to get usercodeAdd function to send mailbox command via SMC to get usercode from SDM.
Signed-off-by Siew Chin Lim <[email protected]>--- arch/arm/mach-socfpga/include/mach/smc_api.h | 1 + arch/arm/mach-socfpga/smc_api.c | 17 +++++++++++++++++ include/linux/intel-smc.h | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+)arch/arm/mach-socfpga/include/mach/smc_api.h +0
-0@@ -9,5 +9,6 @@int invoke_smc (u32 func_id,u64 *args,int arg_len,u64 *ret_arg,int ret_len);int smc_send_mailbox(u32 cmd, u32 len, u32 *arg, u8 urgent, u32
*resp_buf_len,arch/arm/mach-socfpga/include/mach/smc_api.h +1
-0u32 *resp_buf); +int smc_get_usercode (u32 *usercode);#endif /* _SMC_API_H_ */ arch/arm/mach- renamed from arch/arm/mach-socfpga/smc_api.c +0
-0
socfpga/smc_api.cindex085daba162..8ffc7a472b100644arch/arm/mach-socfpga/smc_api.c +17
-0@@ -54,3 +54,20 @@ int smc_send_mailbox(u32 cmd, u32 len, u32 *arg, u8 urgent, u32 *resp_buf_len, return (int)resp[0]; } + +int smc_get_usercode (u32 *usercode) +{ +int ret; +u64 resp; + +if (!usercode) +return -EINVAL ; + + ret =invoke_smc (INTEL_SIP_SMC_GET_USERCODE ,NULL ,0 , + &resp,1 ); + +if (ret ==INTEL_SIP_SMC_STATUS_OK ) + *usercode = (u32 )resp; + +return ret; +}include/linux/intel-smc.h index renamed from include/linux/intel-smc.h +0
-0
68d62be417..a54eff43ad100644include/linux/intel-smc.h +0
-0@@ -518,4 +518,22 @@
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_ COMPLETED_WRITE)
#defineINTEL_SIP_SMC_MBOX_SEND_CMD\INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_MBOX_
SEND_CMD)include/linux/intel-smc.h +17
-0+/* +* Request INTEL_SIP_SMC_GET_USERCODE +* +* Send mailbox command to get usercode from SDM +* +* Call register usage: +* a0 INTEL_SIP_SMC_GET_USERCODE +* a1-7 not used. +* +* Return status +* a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_STATUS_ERROR +* a1 User code +* a2-3 not used. +*/ +#define INTEL_SIP_SMC_FUNCID_GET_USERCODE 61 +#define INTEL_SIP_SMC_GET_USERCODE \ +
Quoted 6 lines
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_GET_US
ERCODE)
+
#endif
--
2.13.0