diff --git a/plat/imx/imx8ulp/imx8ulp_bl31_setup.c b/plat/imx/imx8ulp/imx8ulp_bl31_setup.c index af4a4e8db..e64ae6bfc 100644 --- a/plat/imx/imx8ulp/imx8ulp_bl31_setup.c +++ b/plat/imx/imx8ulp/imx8ulp_bl31_setup.c @@ -30,7 +30,7 @@ MAP_REGION_FLAT(BL31_BASE, BL31_LIMIT - BL31_BASE, MT_MEMORY | MT_RW | MT_SECURE) #define MAP_BL31_RO \ MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE, MT_MEMORY | MT_RO | MT_SECURE) - +#define MAP_BL32_TOTAL MAP_REGION_FLAT(BL32_BASE, BL32_SIZE, MT_MEMORY | MT_RW) #define MAP_COHERENT_MEM \ MAP_REGION_FLAT(BL_COHERENT_RAM_BASE, (BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE), \ MT_DEVICE | MT_RW | MT_SECURE) @@ -85,6 +85,23 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, bl33_image_ep_info.pc = PLAT_NS_IMAGE_OFFSET; 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) + /* 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); + bl32_image_ep_info.pc = BL32_BASE; + bl32_image_ep_info.spsr = 0; + + /* Pass TEE base and size to bl33 */ + bl33_image_ep_info.args.arg1 = BL32_BASE; + bl33_image_ep_info.args.arg2 = BL32_SIZE; + + /* 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 } void bl31_plat_arch_setup(void) @@ -94,6 +111,9 @@ void bl31_plat_arch_setup(void) MAP_BL31_RO, #if USE_COHERENT_MEM MAP_COHERENT_MEM, +#endif +#if (defined(SPD_opteed) + MAP_BL32_TOTAL, #endif {0}, }; diff --git a/plat/imx/imx8ulp/include/platform_def.h b/plat/imx/imx8ulp/include/platform_def.h index e8e72e59a..fc646cb3b 100644 --- a/plat/imx/imx8ulp/include/platform_def.h +++ b/plat/imx/imx8ulp/include/platform_def.h @@ -97,6 +97,8 @@ #define BL31_RWDATA_BASE 0x2006d000 #define BL31_RWDATA_LIMIT 0x20070000 +#define BL32_FDT_OVERLAY_ADDR 0x9d000000 + /* 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)