1b4315306SDan Handley /* 28187b95eSJayanth Dodderi Chidanand * Copyright (c) 2015-2025, Arm Limited and Contributors. All rights reserved. 3b4315306SDan Handley * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 5b4315306SDan Handley */ 6b4315306SDan Handley 7a8aa7fecSYatharth Kochar #include <assert.h> 8b4315306SDan Handley #include <string.h> 909d40e0eSAntonio Nino Diaz 1009d40e0eSAntonio Nino Diaz #include <platform_def.h> 1109d40e0eSAntonio Nino Diaz 12deb4b3a6SZelalem Aweke #include <arch_features.h> 1309d40e0eSAntonio Nino Diaz #include <arch_helpers.h> 1409d40e0eSAntonio Nino Diaz #include <common/bl_common.h> 1509d40e0eSAntonio Nino Diaz #include <common/debug.h> 1609d40e0eSAntonio Nino Diaz #include <common/desc_image_load.h> 1709d40e0eSAntonio Nino Diaz #include <drivers/generic_delay_timer.h> 18ef1daa42SManish V Badarkhe #include <drivers/partition/partition.h> 199814bfc1SLouis Mayencourt #include <lib/fconf/fconf.h> 2082869675SManish V Badarkhe #include <lib/fconf/fconf_dyn_cfg_getter.h> 21f19dc624Sjohpow01 #include <lib/gpt_rme/gpt_rme.h> 22a5566f65SHarrison Mutai #if TRANSFER_LIST 23b5d0740eSHarrison Mutai #include <transfer_list.h> 24a5566f65SHarrison Mutai #endif 2509d40e0eSAntonio Nino Diaz #ifdef SPD_opteed 2609d40e0eSAntonio Nino Diaz #include <lib/optee_utils.h> 2709d40e0eSAntonio Nino Diaz #endif 2809d40e0eSAntonio Nino Diaz #include <lib/utils.h> 29bd9344f6SAntonio Nino Diaz #include <plat/arm/common/plat_arm.h> 3009d40e0eSAntonio Nino Diaz #include <plat/common/platform.h> 3109d40e0eSAntonio Nino Diaz 32b4315306SDan Handley /* Data structure which holds the extents of the trusted SRAM for BL2 */ 33b4315306SDan Handley static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE); 34b4315306SDan Handley 35a07c101aSManish V Badarkhe /* Base address of fw_config received from BL1 */ 369c11ed7eSHarrison Mutai static uintptr_t config_base __unused; 37a07c101aSManish V Badarkhe 38fe3299d1SXialin Liu #if ARM_GPT_SUPPORT 39fe3299d1SXialin Liu // FIXME: should be removed once the transfer list version is updated 40fe3299d1SXialin Liu #define TL_TAG_GPT_ERROR_INFO 0x109 41fe3299d1SXialin Liu 42fe3299d1SXialin Liu /* 43fe3299d1SXialin Liu * Inform the GPT corruption to BL32. 44fe3299d1SXialin Liu */ 45fe3299d1SXialin Liu static void arm_set_gpt_corruption(uintptr_t gpt_corrupted_info_ptr, uint8_t flags) 46fe3299d1SXialin Liu { 47fe3299d1SXialin Liu *(uint8_t *)gpt_corrupted_info_ptr |= flags; 48fe3299d1SXialin Liu } 49fe3299d1SXialin Liu 50fe3299d1SXialin Liu static void arm_get_gpt_corruption(uintptr_t log_address, uint8_t gpt_corrupted_info) 51fe3299d1SXialin Liu { 52fe3299d1SXialin Liu #if TRANSFER_LIST 53fe3299d1SXialin Liu /* Convey this information to BL2 via its TL. */ 54fe3299d1SXialin Liu struct transfer_list_entry *te = transfer_list_add( 55fe3299d1SXialin Liu (struct transfer_list_header *)log_address, 56fe3299d1SXialin Liu TL_TAG_GPT_ERROR_INFO, 57fe3299d1SXialin Liu sizeof(gpt_corrupted_info), 58fe3299d1SXialin Liu (void *)&gpt_corrupted_info); 59fe3299d1SXialin Liu if (te == NULL) { 60fe3299d1SXialin Liu ERROR("Failed to log GPT corruption info in transfer list\n"); 61fe3299d1SXialin Liu } 62fe3299d1SXialin Liu #endif /* TRANSFER_LIST */ 63fe3299d1SXialin Liu } 64fe3299d1SXialin Liu 65fe3299d1SXialin Liu static struct plat_log_gpt_corrupted arm_log_gpt_corruption = { 66fe3299d1SXialin Liu .gpt_corrupted_info = 0U, 67fe3299d1SXialin Liu .plat_set_gpt_corruption = arm_set_gpt_corruption, 68fe3299d1SXialin Liu .plat_log_gpt_corruption = arm_get_gpt_corruption, 69fe3299d1SXialin Liu }; 70fe3299d1SXialin Liu #endif /* ARM_GPT_SUPPORT */ 71fe3299d1SXialin Liu 72caf4eca1SSoby Mathew /* 7304e06973SManish V Badarkhe * Check that BL2_BASE is above ARM_FW_CONFIG_LIMIT. This reserved page is 74c099cd39SSoby Mathew * for `meminfo_t` data structure and fw_configs passed from BL1. 75caf4eca1SSoby Mathew */ 769c11ed7eSHarrison Mutai #if TRANSFER_LIST 779c11ed7eSHarrison Mutai CASSERT(BL2_BASE >= PLAT_ARM_EL3_FW_HANDOFF_BASE + PLAT_ARM_FW_HANDOFF_SIZE, 789c11ed7eSHarrison Mutai assert_bl2_base_overflows); 798d5c7627SDivin Raj #elif !RESET_TO_BL2 8004e06973SManish V Badarkhe CASSERT(BL2_BASE >= ARM_FW_CONFIG_LIMIT, assert_bl2_base_overflows); 819c11ed7eSHarrison Mutai #endif /* TRANSFER_LIST */ 82caf4eca1SSoby Mathew 83a8aa7fecSYatharth Kochar /* Weak definitions may be overridden in specific ARM standard platform */ 840c306cc0SSoby Mathew #pragma weak bl2_early_platform_setup2 85a8aa7fecSYatharth Kochar #pragma weak bl2_platform_setup 86a8aa7fecSYatharth Kochar #pragma weak bl2_plat_arch_setup 87a8aa7fecSYatharth Kochar #pragma weak bl2_plat_sec_mem_layout 88a8aa7fecSYatharth Kochar 894bb72c47SZelalem Aweke #define MAP_BL2_TOTAL MAP_REGION_FLAT( \ 904bb72c47SZelalem Aweke bl2_tzram_layout.total_base, \ 914bb72c47SZelalem Aweke bl2_tzram_layout.total_size, \ 92875423deSOlivier Deprez MT_MEMORY | MT_RW | EL3_PAS) 934a581b06SDimitris Papastamos 94490eeb04SDaniel Boulby #pragma weak arm_bl2_plat_handle_post_image_load 954a581b06SDimitris Papastamos 96d5705719SHarrison Mutai struct transfer_list_header *secure_tl __unused; 97a5566f65SHarrison Mutai 98b4315306SDan Handley /******************************************************************************* 99b4315306SDan Handley * BL1 has passed the extents of the trusted SRAM that should be visible to BL2 100b4315306SDan Handley * in x0. This memory layout is sitting at the base of the free trusted SRAM. 101b4315306SDan Handley * Copy it to a safe location before its reclaimed by later BL2 functionality. 102b4315306SDan Handley ******************************************************************************/ 1038187b95eSJayanth Dodderi Chidanand void arm_bl2_early_platform_setup(u_register_t arg0, u_register_t arg1, 1048187b95eSJayanth Dodderi Chidanand u_register_t arg2, u_register_t arg3) 105b4315306SDan Handley { 1069c11ed7eSHarrison Mutai struct transfer_list_entry *te __unused; 10708ec77c7SGovindraj Raja int __maybe_unused ret; 10808ec77c7SGovindraj Raja 109b4315306SDan Handley /* Initialize the console to provide early debug support */ 11088a0523eSAntonio Nino Diaz arm_console_boot_init(); 111b4315306SDan Handley 1129c11ed7eSHarrison Mutai #if TRANSFER_LIST 1138187b95eSJayanth Dodderi Chidanand secure_tl = (struct transfer_list_header *)arg3; 1149c11ed7eSHarrison Mutai 115abdb953bSHarrison Mutai te = transfer_list_find(secure_tl, TL_TAG_SRAM_LAYOUT); 1169c11ed7eSHarrison Mutai assert(te != NULL); 1179c11ed7eSHarrison Mutai 1189c11ed7eSHarrison Mutai bl2_tzram_layout = *(meminfo_t *)transfer_list_entry_data(te); 1199c11ed7eSHarrison Mutai transfer_list_rem(secure_tl, te); 1209c11ed7eSHarrison Mutai #else 1218187b95eSJayanth Dodderi Chidanand config_base = (uintptr_t)arg0; 1229c11ed7eSHarrison Mutai 123b4315306SDan Handley /* Setup the BL2 memory layout */ 1248187b95eSJayanth Dodderi Chidanand bl2_tzram_layout = *(meminfo_t *)arg1; 1258187b95eSJayanth Dodderi Chidanand #endif /* TRANSFER_LIST */ 1269814bfc1SLouis Mayencourt 127b4315306SDan Handley /* Initialise the IO layer and register platform IO devices */ 128b4315306SDan Handley plat_arm_io_setup(); 129ef1daa42SManish V Badarkhe 130ef1daa42SManish V Badarkhe /* Load partition table */ 131ef1daa42SManish V Badarkhe #if ARM_GPT_SUPPORT 132fe3299d1SXialin Liu plat_setup_log_gpt_corrupted(&arm_log_gpt_corruption); 133fe3299d1SXialin Liu 13408ec77c7SGovindraj Raja ret = gpt_partition_init(); 13508ec77c7SGovindraj Raja if (ret != 0) { 13608ec77c7SGovindraj Raja ERROR("GPT partition initialisation failed!\n"); 13708ec77c7SGovindraj Raja panic(); 13808ec77c7SGovindraj Raja } 139ef1daa42SManish V Badarkhe 140fe3299d1SXialin Liu #if TRANSFER_LIST 141fe3299d1SXialin Liu plat_log_gpt_ptr->plat_log_gpt_corruption((uintptr_t)secure_tl, 142fe3299d1SXialin Liu plat_log_gpt_ptr->gpt_corrupted_info); 143fe3299d1SXialin Liu #endif /* TRANSFER_LIST */ 144fe3299d1SXialin Liu 14508ec77c7SGovindraj Raja #endif /* ARM_GPT_SUPPORT */ 146b4315306SDan Handley } 147b4315306SDan Handley 1488187b95eSJayanth Dodderi Chidanand void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, 1498187b95eSJayanth Dodderi Chidanand u_register_t arg2, u_register_t arg3) 150b4315306SDan Handley { 1518187b95eSJayanth Dodderi Chidanand arm_bl2_early_platform_setup(arg0, arg1, arg2, arg3); 152cab0b5b0SSoby Mathew 15318e279ebSSoby Mathew generic_delay_timer_init(); 154b4315306SDan Handley } 155b4315306SDan Handley 156b4315306SDan Handley /* 1576e79f9fdSSoby Mathew * Perform BL2 preload setup. Currently we initialise the dynamic 1586e79f9fdSSoby Mathew * configuration here. 159b4315306SDan Handley */ 1606e79f9fdSSoby Mathew void bl2_plat_preload_setup(void) 161b4315306SDan Handley { 162*67574733SAhmed Azeem #if ARM_GPT_SUPPORT && !PSA_FWU_SUPPORT 163*67574733SAhmed Azeem /* 164*67574733SAhmed Azeem * Find FIP in GPT before FW Config load. 165*67574733SAhmed Azeem * Always use the FIP from bank 0 166*67574733SAhmed Azeem */ 167*67574733SAhmed Azeem arm_set_fip_addr(0U); 168*67574733SAhmed Azeem #endif /* ARM_GPT_SUPPORT && !PSA_FWU_SUPPORT */ 169*67574733SAhmed Azeem 170a5566f65SHarrison Mutai #if TRANSFER_LIST 171f019c801SHarrison Mutai /* Assume the secure TL hasn't been initialised if BL2 is running at EL3. */ 172f019c801SHarrison Mutai #if RESET_TO_BL2 173d5705719SHarrison Mutai secure_tl = transfer_list_ensure((void *)PLAT_ARM_EL3_FW_HANDOFF_BASE, 174f019c801SHarrison Mutai PLAT_ARM_FW_HANDOFF_SIZE); 175f019c801SHarrison Mutai 176f019c801SHarrison Mutai if (secure_tl == NULL) { 177f019c801SHarrison Mutai ERROR("Secure transfer list initialisation failed!\n"); 178f019c801SHarrison Mutai panic(); 179f019c801SHarrison Mutai } 180f019c801SHarrison Mutai #endif 181a5566f65SHarrison Mutai arm_transfer_list_dyn_cfg_init(secure_tl); 182a5566f65SHarrison Mutai #else 183973e0b7fSDivin Raj #if ARM_FW_CONFIG_LOAD_ENABLE 184973e0b7fSDivin Raj arm_bl2_el3_plat_config_load(); 185973e0b7fSDivin Raj #endif /* ARM_FW_CONFIG_LOAD_ENABLE */ 186cab0b5b0SSoby Mathew arm_bl2_dyn_cfg_init(); 187a5566f65SHarrison Mutai #endif 188ef1daa42SManish V Badarkhe 1896e79f9fdSSoby Mathew } 190cab0b5b0SSoby Mathew 1916e79f9fdSSoby Mathew /* 1926e79f9fdSSoby Mathew * Perform ARM standard platform setup. 1936e79f9fdSSoby Mathew */ 1946e79f9fdSSoby Mathew void arm_bl2_platform_setup(void) 1956e79f9fdSSoby Mathew { 196deb4b3a6SZelalem Aweke #if !ENABLE_RME 197b4315306SDan Handley /* Initialize the secure environment */ 198b4315306SDan Handley plat_arm_security_setup(); 199deb4b3a6SZelalem Aweke #endif 200f145403cSRoberto Vargas 201f145403cSRoberto Vargas #if defined(PLAT_ARM_MEM_PROT_ADDR) 202638b034cSRoberto Vargas arm_nor_psci_do_static_mem_protect(); 203f145403cSRoberto Vargas #endif 204b4315306SDan Handley } 205b4315306SDan Handley 206b4315306SDan Handley void bl2_platform_setup(void) 207b4315306SDan Handley { 208b4315306SDan Handley arm_bl2_platform_setup(); 209b4315306SDan Handley } 210b4315306SDan Handley 211b4315306SDan Handley /******************************************************************************* 212deb4b3a6SZelalem Aweke * Perform the very early platform specific architectural setup here. 213deb4b3a6SZelalem Aweke * When RME is enabled the secure environment is initialised before 214deb4b3a6SZelalem Aweke * initialising and enabling Granule Protection. 215deb4b3a6SZelalem Aweke * This function initialises the MMU in a quick and dirty way. 216b4315306SDan Handley ******************************************************************************/ 217b4315306SDan Handley void arm_bl2_plat_arch_setup(void) 218b4315306SDan Handley { 219b65dfe40SSandrine Bailleux #if USE_COHERENT_MEM 220b65dfe40SSandrine Bailleux /* Ensure ARM platforms don't use coherent memory in BL2. */ 221d323af9eSDaniel Boulby assert((BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE) == 0U); 222b4315306SDan Handley #endif 223d323af9eSDaniel Boulby 224d323af9eSDaniel Boulby const mmap_region_t bl_regions[] = { 225d323af9eSDaniel Boulby MAP_BL2_TOTAL, 2262ecaafd2SDaniel Boulby ARM_MAP_BL_RO, 2271eb735d7SRoberto Vargas #if USE_ROMLIB 2281eb735d7SRoberto Vargas ARM_MAP_ROMLIB_CODE, 2291eb735d7SRoberto Vargas ARM_MAP_ROMLIB_DATA, 2301eb735d7SRoberto Vargas #endif 2319c11ed7eSHarrison Mutai #if !TRANSFER_LIST 232a07c101aSManish V Badarkhe ARM_MAP_BL_CONFIG_REGION, 2339c11ed7eSHarrison Mutai #endif /* TRANSFER_LIST */ 234c8720729SZelalem Aweke #if ENABLE_RME 235c8720729SZelalem Aweke ARM_MAP_L0_GPT_REGION, 236c8720729SZelalem Aweke #endif 237d323af9eSDaniel Boulby { 0 } 238d323af9eSDaniel Boulby }; 239d323af9eSDaniel Boulby 240deb4b3a6SZelalem Aweke #if ENABLE_RME 241deb4b3a6SZelalem Aweke /* Initialise the secure environment */ 242deb4b3a6SZelalem Aweke plat_arm_security_setup(); 243deb4b3a6SZelalem Aweke #endif 2440916c38dSRoberto Vargas setup_page_tables(bl_regions, plat_arm_get_mmap()); 2456fe8aa2fSYatharth Kochar 246402b3cf8SJulius Werner #ifdef __aarch64__ 247deb4b3a6SZelalem Aweke #if ENABLE_RME 248deb4b3a6SZelalem Aweke /* BL2 runs in EL3 when RME enabled. */ 249aaaf2cc3SSona Mathew assert(is_feat_rme_present()); 250deb4b3a6SZelalem Aweke enable_mmu_el3(0); 251f19dc624Sjohpow01 252f19dc624Sjohpow01 /* Initialise and enable granule protection after MMU. */ 253341df6afSRohit Mathew arm_gpt_setup(); 254deb4b3a6SZelalem Aweke #else 255b5fa6563SSandrine Bailleux enable_mmu_el1(0); 256deb4b3a6SZelalem Aweke #endif 257402b3cf8SJulius Werner #else 258402b3cf8SJulius Werner enable_mmu_svc_mon(0); 2596fe8aa2fSYatharth Kochar #endif 2601eb735d7SRoberto Vargas 2611eb735d7SRoberto Vargas arm_setup_romlib(); 262b4315306SDan Handley } 263b4315306SDan Handley 264b4315306SDan Handley void bl2_plat_arch_setup(void) 265b4315306SDan Handley { 2669c11ed7eSHarrison Mutai const struct dyn_cfg_dtb_info_t *tb_fw_config_info __unused; 2679c11ed7eSHarrison Mutai struct transfer_list_entry *te __unused; 268b4315306SDan Handley arm_bl2_plat_arch_setup(); 269a07c101aSManish V Badarkhe 2709c11ed7eSHarrison Mutai #if TRANSFER_LIST 271ada4e59dSHarrison Mutai #if CRYPTO_SUPPORT 272ada4e59dSHarrison Mutai te = arm_transfer_list_set_heap_info(secure_tl); 2739c11ed7eSHarrison Mutai transfer_list_rem(secure_tl, te); 274ada4e59dSHarrison Mutai #endif /* CRYPTO_SUPPORT */ 2759c11ed7eSHarrison Mutai #else 276a07c101aSManish V Badarkhe /* Fill the properties struct with the info from the config dtb */ 277d74c6b83SJimmy Brisson fconf_populate("FW_CONFIG", config_base); 278a07c101aSManish V Badarkhe 279a07c101aSManish V Badarkhe /* TB_FW_CONFIG was also loaded by BL1 */ 280a07c101aSManish V Badarkhe tb_fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, TB_FW_CONFIG_ID); 281a07c101aSManish V Badarkhe assert(tb_fw_config_info != NULL); 282a07c101aSManish V Badarkhe 283a07c101aSManish V Badarkhe fconf_populate("TB_FW", tb_fw_config_info->config_addr); 284ada4e59dSHarrison Mutai #endif /* TRANSFER_LIST */ 285b4315306SDan Handley } 286b4315306SDan Handley 28707570d59SYatharth Kochar int arm_bl2_handle_post_image_load(unsigned int image_id) 288a8aa7fecSYatharth Kochar { 289a8aa7fecSYatharth Kochar int err = 0; 290a8aa7fecSYatharth Kochar bl_mem_params_node_t *bl_mem_params = get_bl_mem_params_node(image_id); 29154661cd2SSummer Qin #ifdef SPD_opteed 29254661cd2SSummer Qin bl_mem_params_node_t *pager_mem_params = NULL; 29354661cd2SSummer Qin bl_mem_params_node_t *paged_mem_params = NULL; 29454661cd2SSummer Qin #endif 295466bb285SZelalem assert(bl_mem_params != NULL); 296a8aa7fecSYatharth Kochar 297a8aa7fecSYatharth Kochar switch (image_id) { 298402b3cf8SJulius Werner #ifdef __aarch64__ 299a8aa7fecSYatharth Kochar case BL32_IMAGE_ID: 30054661cd2SSummer Qin #ifdef SPD_opteed 30154661cd2SSummer Qin pager_mem_params = get_bl_mem_params_node(BL32_EXTRA1_IMAGE_ID); 30254661cd2SSummer Qin assert(pager_mem_params); 30354661cd2SSummer Qin 30454661cd2SSummer Qin paged_mem_params = get_bl_mem_params_node(BL32_EXTRA2_IMAGE_ID); 30554661cd2SSummer Qin assert(paged_mem_params); 30654661cd2SSummer Qin 30754661cd2SSummer Qin err = parse_optee_header(&bl_mem_params->ep_info, 30854661cd2SSummer Qin &pager_mem_params->image_info, 30954661cd2SSummer Qin &paged_mem_params->image_info); 31054661cd2SSummer Qin if (err != 0) { 31154661cd2SSummer Qin WARN("OPTEE header parse error.\n"); 31254661cd2SSummer Qin } 31354661cd2SSummer Qin #endif 31401907f3fSHarrison Mutai bl_mem_params->ep_info.spsr = arm_get_spsr(BL32_IMAGE_ID); 315a8aa7fecSYatharth Kochar break; 3166fe8aa2fSYatharth Kochar #endif 317a8aa7fecSYatharth Kochar 318a8aa7fecSYatharth Kochar case BL33_IMAGE_ID: 3198946bb03SHarrison Mutai #if !USE_KERNEL_DT_CONVENTION 320a8aa7fecSYatharth Kochar /* BL33 expects to receive the primary CPU MPID (through r0) */ 321a8aa7fecSYatharth Kochar bl_mem_params->ep_info.args.arg0 = 0xffff & read_mpidr(); 3228946bb03SHarrison Mutai #endif /* !USE_KERNEL_DT_CONVENTION */ 32301907f3fSHarrison Mutai bl_mem_params->ep_info.spsr = arm_get_spsr(BL33_IMAGE_ID); 324a8aa7fecSYatharth Kochar break; 325a8aa7fecSYatharth Kochar 326a8aa7fecSYatharth Kochar #ifdef SCP_BL2_BASE 327a8aa7fecSYatharth Kochar case SCP_BL2_IMAGE_ID: 328a8aa7fecSYatharth Kochar /* The subsequent handling of SCP_BL2 is platform specific */ 329a8aa7fecSYatharth Kochar err = plat_arm_bl2_handle_scp_bl2(&bl_mem_params->image_info); 330a8aa7fecSYatharth Kochar if (err) { 331a8aa7fecSYatharth Kochar WARN("Failure in platform-specific handling of SCP_BL2 image.\n"); 332a8aa7fecSYatharth Kochar } 333a8aa7fecSYatharth Kochar break; 334a8aa7fecSYatharth Kochar #endif 335649c48f5SJonathan Wright default: 336649c48f5SJonathan Wright /* Do nothing in default case */ 337649c48f5SJonathan Wright break; 338a8aa7fecSYatharth Kochar } 339a8aa7fecSYatharth Kochar 340a8aa7fecSYatharth Kochar return err; 341a8aa7fecSYatharth Kochar } 342a8aa7fecSYatharth Kochar 34307570d59SYatharth Kochar /******************************************************************************* 34407570d59SYatharth Kochar * This function can be used by the platforms to update/use image 34507570d59SYatharth Kochar * information for given `image_id`. 34607570d59SYatharth Kochar ******************************************************************************/ 347490eeb04SDaniel Boulby int arm_bl2_plat_handle_post_image_load(unsigned int image_id) 34807570d59SYatharth Kochar { 34946789a7cSBalint Dobszay #if defined(SPD_spmd) && BL2_ENABLE_SP_LOAD 350cb3b5344SManish Pandey /* For Secure Partitions we don't need post processing */ 351cb3b5344SManish Pandey if ((image_id >= (MAX_NUMBER_IDS - MAX_SP_IDS)) && 352cb3b5344SManish Pandey (image_id < MAX_NUMBER_IDS)) { 353cb3b5344SManish Pandey return 0; 354cb3b5344SManish Pandey } 355cb3b5344SManish Pandey #endif 356a5566f65SHarrison Mutai 357a5566f65SHarrison Mutai #if TRANSFER_LIST 35800c353c4SYeoreum Yun if (image_id == HW_CONFIG_ID || image_id == TOS_FW_CONFIG_ID) { 35900c353c4SYeoreum Yun /* 36000c353c4SYeoreum Yun * Refresh the now stale checksum following loading of 36100c353c4SYeoreum Yun * HW_CONFIG or TOS_FW_CONFIG into the TL. 36200c353c4SYeoreum Yun */ 363fe94a21aSHarrison Mutai transfer_list_update_checksum(secure_tl); 364a5566f65SHarrison Mutai } 365a5566f65SHarrison Mutai #endif /* TRANSFER_LIST */ 366a5566f65SHarrison Mutai 36707570d59SYatharth Kochar return arm_bl2_handle_post_image_load(image_id); 36807570d59SYatharth Kochar } 369a5566f65SHarrison Mutai 370a5566f65SHarrison Mutai void arm_bl2_setup_next_ep_info(bl_mem_params_node_t *next_param_node) 371a5566f65SHarrison Mutai { 372cca1b72bSHarrison Mutai entry_point_info_t *ep __unused; 373b30d9043SHarrison Mutai 374b5d0740eSHarrison Mutai #if TRANSFER_LIST 375b30d9043SHarrison Mutai /* 376b30d9043SHarrison Mutai * Information might have been added to the TL before this (i.e. event log) 377b30d9043SHarrison Mutai * make sure the checksum is up to date. 378b30d9043SHarrison Mutai */ 379b30d9043SHarrison Mutai transfer_list_update_checksum(secure_tl); 380b30d9043SHarrison Mutai 381cca1b72bSHarrison Mutai ep = transfer_list_set_handoff_args(secure_tl, 382cca1b72bSHarrison Mutai &next_param_node->ep_info); 383cca1b72bSHarrison Mutai assert(ep != NULL); 384a5566f65SHarrison Mutai 385fe94a21aSHarrison Mutai arm_transfer_list_populate_ep_info(next_param_node, secure_tl); 386b5d0740eSHarrison Mutai #endif 387a5566f65SHarrison Mutai } 388