diff options
author | Manish Pandey <manish.pandey2@arm.com> | 2023-10-31 12:59:37 +0100 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2023-10-31 12:59:37 +0100 |
commit | fd7e32b810c3f746adc72f06bf01a0afbbe9c78e (patch) | |
tree | 5993cf451dd7f49dc68cf61112a25a0d1691266c | |
parent | 7bf18514cdd88c19732b0b1ec048b8e28ee89ee3 (diff) | |
parent | 568d406ce7ad8cb5054bc5ae6a9b8d443d6e088f (diff) |
Merge changes from topic "hm/post-image" into integration
* changes:
refactor(fvp): move image handling into generic procedure
refactor(bl2): make post image handling platform-specific
-rw-r--r-- | plat/arm/board/a5ds/a5ds_bl2_setup.c | 5 | ||||
-rw-r--r-- | plat/arm/board/fvp/fvp_bl2_setup.c | 102 | ||||
-rw-r--r-- | plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c | 5 | ||||
-rw-r--r-- | plat/arm/common/arm_bl2_setup.c | 5 | ||||
-rw-r--r-- | plat/arm/css/common/css_bl2_setup.c | 7 |
5 files changed, 76 insertions, 48 deletions
diff --git a/plat/arm/board/a5ds/a5ds_bl2_setup.c b/plat/arm/board/a5ds/a5ds_bl2_setup.c index 1979c509c..a0aa639ab 100644 --- a/plat/arm/board/a5ds/a5ds_bl2_setup.c +++ b/plat/arm/board/a5ds/a5ds_bl2_setup.c @@ -16,3 +16,8 @@ void bl2_platform_setup(void) { arm_bl2_platform_setup(); } + +int bl2_plat_handle_post_image_load(unsigned int image_id) +{ + return arm_bl2_plat_handle_post_image_load(image_id); +} diff --git a/plat/arm/board/fvp/fvp_bl2_setup.c b/plat/arm/board/fvp/fvp_bl2_setup.c index d3dc5a365..ebd52664b 100644 --- a/plat/arm/board/fvp/fvp_bl2_setup.c +++ b/plat/arm/board/fvp/fvp_bl2_setup.c @@ -19,6 +19,8 @@ #include "fvp_private.h" +static struct transfer_list_header *ns_tl __unused; + void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) { arm_bl2_early_platform_setup((uintptr_t)arg0, (meminfo_t *)arg1); @@ -31,6 +33,10 @@ void bl2_platform_setup(void) { arm_bl2_platform_setup(); +#if TRANSFER_LIST + ns_tl = transfer_list_init((void *)FW_NS_HANDOFF_BASE, FW_HANDOFF_SIZE); + assert(ns_tl != NULL); +#endif /* Initialize System level generic or SP804 timer */ fvp_timer_init(); } @@ -42,16 +48,14 @@ struct bl_params *plat_get_next_bl_params(void) { struct bl_params *arm_bl_params; const struct dyn_cfg_dtb_info_t *hw_config_info __unused; - bl_mem_params_node_t *param_node __unused; - static struct transfer_list_header *ns_tl __unused; struct transfer_list_entry *te __unused; + bl_mem_params_node_t *param_node __unused; arm_bl_params = arm_get_next_bl_params(); #if !RESET_TO_BL2 && !EL3_PAYLOAD_BASE const struct dyn_cfg_dtb_info_t *fw_config_info; uintptr_t fw_config_base = 0UL; - entry_point_info_t *ep_info; #if __aarch64__ /* Get BL31 image node */ @@ -62,61 +66,75 @@ struct bl_params *plat_get_next_bl_params(void) #endif /* __aarch64__ */ assert(param_node != NULL); - /* get fw_config load address */ + /* Update the next image's ep info with the FW config address */ fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, FW_CONFIG_ID); assert(fw_config_info != NULL); fw_config_base = fw_config_info->config_addr; assert(fw_config_base != 0UL); - /* - * Get the entry point info of next executable image and override - * arg1 of entry point info with fw_config base address - */ - ep_info = ¶m_node->ep_info; - ep_info->args.arg1 = (uint32_t)fw_config_base; - - /* grab NS HW config address */ - hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID); - assert(hw_config_info != NULL); + param_node->ep_info.args.arg1 = (uint32_t)fw_config_base; - /* To retrieve actual size of the HW_CONFIG */ - param_node = get_bl_mem_params_node(HW_CONFIG_ID); + /* Update BL33's ep info with the NS HW config address */ + param_node = get_bl_mem_params_node(BL33_IMAGE_ID); assert(param_node != NULL); - bl_mem_params_node_t *bl33_param_node = get_bl_mem_params_node(BL33_IMAGE_ID); - assert(bl33_param_node != NULL); - #if TRANSFER_LIST - ns_tl = transfer_list_init((void *)FW_NS_HANDOFF_BASE, FW_HANDOFF_SIZE); - assert(ns_tl != NULL); - /* Update BL33's ep info with NS HW config address */ - te = transfer_list_add(ns_tl, TL_TAG_FDT, param_node->image_info.image_size, - (void *)hw_config_info->config_addr); + te = transfer_list_find(ns_tl, TL_TAG_FDT); assert(te != NULL); - bl33_param_node->ep_info.args.arg1 = TRANSFER_LIST_SIGNATURE | REGISTER_CONVENTION_VERSION_MASK; - bl33_param_node->ep_info.args.arg2 = 0; - bl33_param_node->ep_info.args.arg3 = (uintptr_t)ns_tl; - bl33_param_node->ep_info.args.arg0 = te ? (uintptr_t)transfer_list_entry_data(te) : 0; + param_node->ep_info.args.arg1 = TRANSFER_LIST_SIGNATURE | + REGISTER_CONVENTION_VERSION_MASK; + param_node->ep_info.args.arg2 = 0; + param_node->ep_info.args.arg3 = (uintptr_t)ns_tl; + param_node->ep_info.args.arg0 = + te ? (uintptr_t)transfer_list_entry_data(te) : 0; #else - /* Copy HW config from Secure address to NS address */ - memcpy((void *)hw_config_info->secondary_config_addr, - (void *)hw_config_info->config_addr, - (size_t)param_node->image_info.image_size); - - /* - * Ensure HW-config device tree committed to memory, as there is - * a possibility to use HW-config without cache and MMU enabled - * at BL33 - */ - flush_dcache_range(hw_config_info->secondary_config_addr, - param_node->image_info.image_size); - - bl33_param_node->ep_info.args.arg1 = hw_config_info->secondary_config_addr; + hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID); + assert(hw_config_info != NULL); + + param_node->ep_info.args.arg1 = hw_config_info->secondary_config_addr; #endif /* TRANSFER_LIST */ #endif /* !RESET_TO_BL2 && !EL3_PAYLOAD_BASE */ return arm_bl_params; } + +int bl2_plat_handle_post_image_load(unsigned int image_id) +{ +#if !RESET_TO_BL2 && !EL3_PAYLOAD_BASE + if (image_id == HW_CONFIG_ID) { + const struct dyn_cfg_dtb_info_t *hw_config_info; + struct transfer_list_entry *te __unused; + + const bl_mem_params_node_t *param_node = + get_bl_mem_params_node(image_id); + assert(param_node != NULL); + + hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID); + assert(hw_config_info != NULL); + +#if TRANSFER_LIST + /* Update BL33's ep info with NS HW config address */ + te = transfer_list_add(ns_tl, TL_TAG_FDT, + param_node->image_info.image_size, + (void *)hw_config_info->config_addr); + assert(te != NULL); +#else + memcpy((void *)hw_config_info->secondary_config_addr, + (void *)hw_config_info->config_addr, + (size_t)param_node->image_info.image_size); + + /* + * Ensure HW-config device tree is committed to memory, as the HW-Config + * might be used without cache and MMU enabled at BL33. + */ + flush_dcache_range(hw_config_info->secondary_config_addr, + param_node->image_info.image_size); +#endif /* TRANSFER_LIST */ + } +#endif /* !RESET_TO_BL2 && !EL3_PAYLOAD_BASE */ + + return arm_bl2_plat_handle_post_image_load(image_id); +} diff --git a/plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c b/plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c index 4ccae27a2..cc29f36c5 100644 --- a/plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c +++ b/plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c @@ -39,3 +39,8 @@ void bl2_platform_setup(void) generic_delay_timer_init(); #endif /* USE_SP804_TIMER */ } + +int bl2_plat_handle_post_image_load(unsigned int image_id) +{ + return arm_bl2_plat_handle_post_image_load(image_id); +} diff --git a/plat/arm/common/arm_bl2_setup.c b/plat/arm/common/arm_bl2_setup.c index 6f3d0e944..e15bf0f93 100644 --- a/plat/arm/common/arm_bl2_setup.c +++ b/plat/arm/common/arm_bl2_setup.c @@ -318,8 +318,3 @@ int arm_bl2_plat_handle_post_image_load(unsigned int image_id) #endif return arm_bl2_handle_post_image_load(image_id); } - -int bl2_plat_handle_post_image_load(unsigned int image_id) -{ - return arm_bl2_plat_handle_post_image_load(image_id); -} diff --git a/plat/arm/css/common/css_bl2_setup.c b/plat/arm/css/common/css_bl2_setup.c index 002c6eb93..1e055c599 100644 --- a/plat/arm/css/common/css_bl2_setup.c +++ b/plat/arm/css/common/css_bl2_setup.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -84,3 +84,8 @@ void bl2_platform_setup(void) # endif /* EL3_PAYLOAD_BASE */ #endif /* CSS_USE_SCMI_SDS_DRIVER */ + +int bl2_plat_handle_post_image_load(unsigned int image_id) +{ + return arm_bl2_plat_handle_post_image_load(image_id); +} |