1 /* 2 * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <plat/arm/common/plat_arm.h> 8 #include <platform_def.h> 9 10 void arm_transfer_list_dyn_cfg_init(struct transfer_list_header *secure_tl) 11 { 12 struct transfer_list_entry *te; 13 bl_mem_params_node_t *next_param_node = 14 get_bl_mem_params_node(HW_CONFIG_ID); 15 assert(next_param_node != NULL); 16 17 /* 18 * The HW_CONFIG needs to be authenticated via the normal loading 19 * mechanism. Pre-allocate a TE for the configuration and update the 20 * load information so the configuration is loaded directly into the TE. 21 */ 22 te = transfer_list_add(secure_tl, TL_TAG_FDT, PLAT_ARM_HW_CONFIG_SIZE, 23 NULL); 24 assert(te != NULL); 25 26 next_param_node->image_info.h.attr &= ~IMAGE_ATTRIB_SKIP_LOADING; 27 next_param_node->image_info.image_max_size = PLAT_ARM_HW_CONFIG_SIZE; 28 next_param_node->image_info.image_base = 29 (uintptr_t)transfer_list_entry_data(te); 30 } 31 32 void arm_transfer_list_populate_ep_info(bl_mem_params_node_t *next_param_node, 33 struct transfer_list_header *secure_tl) 34 { 35 uint32_t next_exe_img_id; 36 entry_point_info_t *ep; 37 struct transfer_list_entry *te; 38 39 assert(next_param_node != NULL); 40 41 while ((next_exe_img_id = next_param_node->next_handoff_image_id) != 42 INVALID_IMAGE_ID) { 43 next_param_node = 44 &bl_mem_params_desc_ptr[get_bl_params_node_index( 45 next_exe_img_id)]; 46 assert(next_param_node != NULL); 47 48 te = transfer_list_add(secure_tl, TL_TAG_EXEC_EP_INFO64, 49 sizeof(entry_point_info_t), 50 &next_param_node->ep_info); 51 assert(te != NULL); 52 53 ep = transfer_list_entry_data(te); 54 55 if ((next_exe_img_id == BL32_IMAGE_ID) && SPMC_AT_EL3) { 56 /* 57 * Populate the BL32 image base, size and max limit in 58 * the entry point information, since there is no 59 * platform function to retrieve them in generic 60 * code. We choose arg2, arg3 and arg4 since the generic 61 * code uses arg1 for stashing the SP manifest size. The 62 * SPMC setup uses these arguments to update SP manifest 63 * with actual SP's base address and it size. 64 */ 65 ep->args.arg2 = next_param_node->image_info.image_base; 66 ep->args.arg3 = next_param_node->image_info.image_size; 67 ep->args.arg4 = 68 next_param_node->image_info.image_base + 69 next_param_node->image_info.image_max_size; 70 } 71 72 next_exe_img_id = next_param_node->next_handoff_image_id; 73 } 74 75 flush_dcache_range((uintptr_t)secure_tl, secure_tl->size); 76 } 77