feat(imx8ulp): add trusty support

Support trusty on imx8ulp.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I7ada2557023e271a721d50bfe7fd20b5f01cb128
This commit is contained in:
Ji Luo 2021-06-18 09:54:31 +08:00 committed by Jacky Bai
parent e7b82a7d2f
commit e853041920
3 changed files with 26 additions and 2 deletions

View file

@ -35,6 +35,8 @@
MAP_REGION_FLAT(BL_COHERENT_RAM_BASE, (BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE), \
MT_DEVICE | MT_RW | MT_SECURE)
#define TRUSTY_PARAMS_LEN_BYTES (4096*2)
static const mmap_region_t imx_mmap[] = {
DEVICE0_MAP, DEVICE1_MAP, ELE_MAP,
SEC_SIM_MAP, SRAM0_MAP,
@ -86,7 +88,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
bl33_image_ep_info.spsr = plat_get_spsr_for_bl33_entry();
SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
#if defined(SPD_opteed)
#if defined(SPD_opteed) || defined(SPD_trusty)
/* Populate entry point information for BL32 */
SET_PARAM_HEAD(&bl32_image_ep_info, PARAM_EP, VERSION_1, 0);
SET_SECURITY_STATE(bl32_image_ep_info.h.attr, SECURE);
@ -97,11 +99,16 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
bl33_image_ep_info.args.arg1 = BL32_BASE;
bl33_image_ep_info.args.arg2 = BL32_SIZE;
#ifdef SPD_trusty
bl32_image_ep_info.args.arg0 = BL32_SIZE;
bl32_image_ep_info.args.arg1 = BL32_BASE;
#else
/* Make sure memory is clean */
mmio_write_32(BL32_FDT_OVERLAY_ADDR, 0);
bl33_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR;
bl32_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR;
#endif
#endif
}
void bl31_plat_arch_setup(void)
@ -112,7 +119,7 @@ void bl31_plat_arch_setup(void)
#if USE_COHERENT_MEM
MAP_COHERENT_MEM,
#endif
#if (defined(SPD_opteed)
#if defined(SPD_opteed) || defined(SPD_trusty)
MAP_BL32_TOTAL,
#endif
{0},
@ -165,3 +172,12 @@ unsigned int plat_get_syscnt_freq2(void)
void bl31_plat_runtime_setup(void)
{
}
#ifdef SPD_trusty
void plat_trusty_set_boot_args(aapcs64_params_t *args)
{
args->arg0 = BL32_SIZE;
args->arg1 = BL32_BASE;
args->arg2 = TRUSTY_PARAMS_LEN_BYTES;
}
#endif

View file

@ -99,6 +99,10 @@
#define BL32_FDT_OVERLAY_ADDR 0x9d000000
#ifdef SPD_trusty
#define IMX_TRUSTY_STACK_SIZE 0x100
#endif
/* system memory map define */
#define DEVICE0_MAP MAP_REGION_FLAT(DEVICE0_BASE, DEVICE0_SIZE, MT_DEVICE | MT_RW)
#define DEVICE1_MAP MAP_REGION_FLAT(DEVICE1_BASE, DEVICE1_SIZE, MT_DEVICE | MT_RW)

View file

@ -62,3 +62,7 @@ BL32_BASE ?= 0xa6000000
BL32_SIZE ?= 0x2000000
$(eval $(call add_define,BL32_BASE))
$(eval $(call add_define,BL32_SIZE))
ifeq (${SPD},trusty)
BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1
endif