diff --git a/common/spl/spl.c b/common/spl/spl.c index 982d7fe35c..9e2fe27f1d 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -455,6 +455,16 @@ void board_init_r(gd_t *dummy1, ulong dummy2) #endif memset(&spl_image, '\0', sizeof(spl_image)); + +#if CONFIG_IS_ENABLED(ATF) + /* + * Bl32 ep is optional, initial it as an invalid value. + * BL33 ep is mandatory, but initial it as a default value is better. + */ + spl_image.entry_point_bl32 = -1; + spl_image.entry_point_bl33 = CONFIG_SYS_TEXT_BASE; +#endif + #ifdef CONFIG_SYS_SPL_ARGS_ADDR spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR; #endif diff --git a/common/spl/spl_atf.c b/common/spl/spl_atf.c index 45f3de2a8f..a98a4e99a9 100644 --- a/common/spl/spl_atf.c +++ b/common/spl/spl_atf.c @@ -152,15 +152,22 @@ uintptr_t spl_fit_images_get_entry(void *blob, int node) void spl_invoke_atf(struct spl_image_info *spl_image) { - uintptr_t bl32_entry = -1; - uintptr_t bl33_entry = CONFIG_SYS_TEXT_BASE; + uintptr_t bl32_entry, bl33_entry; void *blob = spl_image->fdt_addr; uintptr_t platform_param = (uintptr_t)blob; int node; + /* + * Find the OP-TEE binary (in /fit-images) load address or + * entry point (if different) and pass it as the BL3-2 entry + * point, this is optional. + * This will need to be extended to support Falcon mode. + */ node = spl_fit_images_find(blob, IH_OS_OP_TEE); if (node >= 0) bl32_entry = spl_fit_images_get_entry(blob, node); + else + bl32_entry = spl_image->entry_point_bl32; /* optional */ /* * Find the U-Boot binary (in /fit-images) load addreess or @@ -168,10 +175,11 @@ void spl_invoke_atf(struct spl_image_info *spl_image) * point. * This will need to be extended to support Falcon mode. */ - node = spl_fit_images_find(blob, IH_OS_U_BOOT); if (node >= 0) bl33_entry = spl_fit_images_get_entry(blob, node); + else + bl33_entry = spl_image->entry_point_bl33; /* * If ATF_NO_PLATFORM_PARAM is set, we override the platform diff --git a/include/spl.h b/include/spl.h index f714e051fe..9135e320e7 100644 --- a/include/spl.h +++ b/include/spl.h @@ -24,7 +24,11 @@ struct spl_image_info { const char *name; u8 os; uintptr_t load_addr; - uintptr_t entry_point; + uintptr_t entry_point; /* Next stage entry point */ +#if CONFIG_IS_ENABLED(ATF) + uintptr_t entry_point_bl32; + uintptr_t entry_point_bl33; +#endif #if CONFIG_IS_ENABLED(LOAD_FIT) void *fdt_addr; #endif