diff options
author | Peng Fan <peng.fan@nxp.com> | 2020-07-10 14:18:01 +0800 |
---|---|---|
committer | Peng Fan <van.freenix@gmail.com> | 2020-07-22 10:27:36 +0000 |
commit | 4a0ac3e38e51cb05217d1feef1816fc3738074be (patch) | |
tree | c6b0be8b2318152543e5b050abd78710a1e434e7 /plat/imx/common | |
parent | d95c3de34747906f203bbe9cbbb805a06b207ada (diff) | |
download | trusted-firmware-a-4a0ac3e38e51cb05217d1feef1816fc3738074be.tar.gz |
plat: imx: common: implement IMX_SIP_AARCH32
Implement IMX_SIP_AARCH32 to let AArch64 Bootloader could issue
SIP call to switch to AArch32 mode to run OS.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Change-Id: I38b04ef909a6dbfba5ded12a7bb6e799a3935a66
Diffstat (limited to 'plat/imx/common')
-rw-r--r-- | plat/imx/common/imx_sip_handler.c | 36 | ||||
-rw-r--r-- | plat/imx/common/imx_sip_svc.c | 3 | ||||
-rw-r--r-- | plat/imx/common/include/imx_sip_svc.h | 5 |
3 files changed, 44 insertions, 0 deletions
diff --git a/plat/imx/common/imx_sip_handler.c b/plat/imx/common/imx_sip_handler.c index 62048b6963..f9f5577c41 100644 --- a/plat/imx/common/imx_sip_handler.c +++ b/plat/imx/common/imx_sip_handler.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include <arch.h> #include <stdlib.h> #include <stdint.h> #include <services/std_svc.h> @@ -12,6 +13,7 @@ #include <common/debug.h> #include <common/runtime_svc.h> #include <imx_sip_svc.h> +#include <lib/el3_runtime/context_mgmt.h> #include <sci/sci.h> #if defined(PLAT_imx8qm) || defined(PLAT_imx8qx) @@ -185,3 +187,37 @@ uint64_t imx_buildinfo_handler(uint32_t smc_fid, return ret; } + +int imx_kernel_entry_handler(uint32_t smc_fid, + u_register_t x1, + u_register_t x2, + u_register_t x3, + u_register_t x4) +{ + static entry_point_info_t bl33_image_ep_info; + entry_point_info_t *next_image_info; + unsigned int mode; + + if (x1 < (PLAT_NS_IMAGE_OFFSET & 0xF0000000)) + return SMC_UNK; + + mode = MODE32_svc; + + next_image_info = &bl33_image_ep_info; + + next_image_info->pc = x1; + + next_image_info->spsr = SPSR_MODE32(mode, SPSR_T_ARM, SPSR_E_LITTLE, + (DAIF_FIQ_BIT | DAIF_IRQ_BIT | DAIF_ABT_BIT)); + + next_image_info->args.arg0 = 0; + next_image_info->args.arg1 = 0; + next_image_info->args.arg2 = x3; + + SET_SECURITY_STATE(next_image_info->h.attr, NON_SECURE); + + cm_init_my_context(next_image_info); + cm_prepare_el3_exit(NON_SECURE); + + return 0; +} diff --git a/plat/imx/common/imx_sip_svc.c b/plat/imx/common/imx_sip_svc.c index 4893b9fa53..20e1479fbf 100644 --- a/plat/imx/common/imx_sip_svc.c +++ b/plat/imx/common/imx_sip_svc.c @@ -26,6 +26,9 @@ static uintptr_t imx_sip_handler(unsigned int smc_fid, u_register_t flags) { switch (smc_fid) { + case IMX_SIP_AARCH32: + SMC_RET1(handle, imx_kernel_entry_handler(smc_fid, x1, x2, x3, x4)); + break; #if defined(PLAT_imx8mq) case IMX_SIP_GET_SOC_INFO: SMC_RET1(handle, imx_soc_info_handler(smc_fid, x1, x2, x3)); diff --git a/plat/imx/common/include/imx_sip_svc.h b/plat/imx/common/include/imx_sip_svc.h index 5898f7a81e..0a2d750f90 100644 --- a/plat/imx/common/include/imx_sip_svc.h +++ b/plat/imx/common/include/imx_sip_svc.h @@ -28,6 +28,11 @@ #define IMX_SIP_MISC_SET_TEMP 0xC200000C +#define IMX_SIP_AARCH32 0xC20000FD + +int imx_kernel_entry_handler(uint32_t smc_fid, u_register_t x1, + u_register_t x2, u_register_t x3, + u_register_t x4); #if defined(PLAT_imx8mq) int imx_soc_info_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2, u_register_t x3); |