diff options
author | Ye Li <ye.li@nxp.com> | 2017-11-30 01:29:54 -0600 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2017-11-30 03:09:06 -0600 |
commit | bca4e251b6083476e987d92c428136a1c81bcb0b (patch) | |
tree | d2e68631507a61dc955915a2ba618532d867720a | |
parent | abcc95393ac65023f0eb09424aec27d5505818bb (diff) |
MLK-17044-2 HAB: Add SIP call for ARM64 platform
When current EL is not EL3, the direct calling to HAB will fail because
CAAM/SNVS can't initialize at non-secure mode. In this case, we use
SIP call to run the HAB in ATF.
Signed-off-by: Ye Li <ye.li@nxp.com>
-rw-r--r-- | arch/arm/imx-common/hab.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/imx-common/hab.c b/arch/arm/imx-common/hab.c index c4680f189b..d646b8ae91 100644 --- a/arch/arm/imx-common/hab.c +++ b/arch/arm/imx-common/hab.c @@ -123,6 +123,13 @@ DECLARE_GLOBAL_DATA_PTR; * +------------+ + CSF_PAD_SIZE */ #ifdef CONFIG_ARM64 +#define FSL_SIP_HAB 0xC2000007 +#define FSL_SIP_HAB_AUTHENTICATE 0x00 +#define FSL_SIP_HAB_ENTRY 0x01 +#define FSL_SIP_HAB_EXIT 0x02 +#define FSL_SIP_HAB_REPORT_EVENT 0x03 +#define FSL_SIP_HAB_REPORT_STATUS 0x04 + static volatile gd_t *gd_save; #endif @@ -153,6 +160,15 @@ enum hab_status hab_rvt_report_event(enum hab_status status, uint32_t index, hab_rvt_report_event_t *hab_rvt_report_event_func; hab_rvt_report_event_func = hab_rvt_report_event_p; +#if defined(CONFIG_ARM64) + if (current_el() != 3) { + /* call sip */ + ret = (enum hab_status)call_imx_sip(FSL_SIP_HAB, FSL_SIP_HAB_REPORT_EVENT, (unsigned long)index, + (unsigned long)event, (unsigned long)bytes); + return ret; + } +#endif + save_gd(); ret = hab_rvt_report_event_func(status, index, event, bytes); restore_gd(); @@ -168,6 +184,15 @@ enum hab_status hab_rvt_report_status(enum hab_config *config, hab_rvt_report_status_t *hab_rvt_report_status_func; hab_rvt_report_status_func = hab_rvt_report_status_p; +#if defined(CONFIG_ARM64) + if (current_el() != 3) { + /* call sip */ + ret = (enum hab_status)call_imx_sip(FSL_SIP_HAB, FSL_SIP_HAB_REPORT_STATUS, + (unsigned long)config, (unsigned long)state, 0); + return ret; + } +#endif + save_gd(); ret = hab_rvt_report_status_func(config, state); restore_gd(); @@ -181,6 +206,14 @@ enum hab_status hab_rvt_entry(void) hab_rvt_entry_t *hab_rvt_entry_func; hab_rvt_entry_func = hab_rvt_entry_p; +#if defined(CONFIG_ARM64) + if (current_el() != 3) { + /* call sip */ + ret = (enum hab_status)call_imx_sip(FSL_SIP_HAB, FSL_SIP_HAB_ENTRY, 0, 0, 0); + return ret; + } +#endif + save_gd(); ret = hab_rvt_entry_func(); restore_gd(); @@ -194,6 +227,14 @@ enum hab_status hab_rvt_exit(void) hab_rvt_exit_t *hab_rvt_exit_func; hab_rvt_exit_func = hab_rvt_exit_p; +#if defined(CONFIG_ARM64) + if (current_el() != 3) { + /* call sip */ + ret = (enum hab_status)call_imx_sip(FSL_SIP_HAB, FSL_SIP_HAB_EXIT, 0, 0, 0); + return ret; + } +#endif + save_gd(); ret = hab_rvt_exit_func(); restore_gd(); @@ -208,6 +249,15 @@ void *hab_rvt_authenticate_image(uint8_t cid, ptrdiff_t ivt_offset, hab_rvt_authenticate_image_t *hab_rvt_authenticate_image_func; hab_rvt_authenticate_image_func = hab_rvt_authenticate_image_p; +#if defined(CONFIG_ARM64) + if (current_el() != 3) { + /* call sip */ + ret = (void *)call_imx_sip(FSL_SIP_HAB, FSL_SIP_HAB_AUTHENTICATE, (unsigned long)ivt_offset, + (unsigned long)start, (unsigned long)bytes); + return ret; + } +#endif + save_gd(); ret = hab_rvt_authenticate_image_func(cid, ivt_offset, start, bytes, loader); restore_gd(); |