Message ID | 1582115146-28658-9-git-send-email-chee.hong.ang@intel.com |
---|---|
State | New |
Headers | show |
Series | Enable ARM Trusted Firmware for U-Boot | expand |
On 2/19/20 1:25 PM, chee.hong.ang at intel.com wrote: [...] > +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_ATF) > +int invoke_smc(u32 func_id, u64 *args, int arg_len, u64 *ret_arg, int ret_len) > +{ > + int i; > + struct pt_regs regs; > + > + memset(®s, 0, sizeof(regs)); > + > + regs.regs[0] = func_id; > + > + if (args) { > + for (i = 0; i < arg_len; i++) > + regs.regs[i + 1] = args[i]; Is this memcpy() ? > + } > + > + smc_call(®s); > + > + if (ret_arg) { > + for (i = 0; i < ret_len; i++) > + ret_arg[i] = regs.regs[i + 1]; memcpy() ?
> On 2/19/20 1:25 PM, chee.hong.ang at intel.com wrote: > [...] > > > +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_ATF) int > > +invoke_smc(u32 func_id, u64 *args, int arg_len, u64 *ret_arg, int > > +ret_len) { > > + int i; > > + struct pt_regs regs; > > + > > + memset(®s, 0, sizeof(regs)); > > + > > + regs.regs[0] = func_id; > > + > > + if (args) { > > + for (i = 0; i < arg_len; i++) > > + regs.regs[i + 1] = args[i]; > > Is this memcpy() ? Will change this. > > > + } > > + > > + smc_call(®s); > > + > > + if (ret_arg) { > > + for (i = 0; i < ret_len; i++) > > + ret_arg[i] = regs.regs[i + 1]; > > memcpy() ? Will change this too. Thanks.
diff --git a/arch/arm/mach-socfpga/include/mach/misc.h b/arch/arm/mach-socfpga/include/mach/misc.h index f6de1cc..b5625e1 100644 --- a/arch/arm/mach-socfpga/include/mach/misc.h +++ b/arch/arm/mach-socfpga/include/mach/misc.h @@ -43,4 +43,7 @@ void do_bridge_reset(int enable, unsigned int mask); void socfpga_pl310_clear(void); void socfpga_get_managers_addr(void); +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_ATF) +int invoke_smc(u32 func_id, u64 *args, int arg_len, u64 *ret_arg, int ret_len); +#endif #endif /* _SOCFPGA_MISC_H_ */ diff --git a/arch/arm/mach-socfpga/misc_s10.c b/arch/arm/mach-socfpga/misc_s10.c index a3f5b43..25c3ff6 100644 --- a/arch/arm/mach-socfpga/misc_s10.c +++ b/arch/arm/mach-socfpga/misc_s10.c @@ -164,3 +164,29 @@ void do_bridge_reset(int enable, unsigned int mask) socfpga_bridges_reset(enable); } + +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_ATF) +int invoke_smc(u32 func_id, u64 *args, int arg_len, u64 *ret_arg, int ret_len) +{ + int i; + struct pt_regs regs; + + memset(®s, 0, sizeof(regs)); + + regs.regs[0] = func_id; + + if (args) { + for (i = 0; i < arg_len; i++) + regs.regs[i + 1] = args[i]; + } + + smc_call(®s); + + if (ret_arg) { + for (i = 0; i < ret_len; i++) + ret_arg[i] = regs.regs[i + 1]; + } + + return regs.regs[0]; +} +#endif