mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-11 07:04:22 +00:00
refactor(arm): simplify early platform setup function in BL31
Refactor `arm_bl31_early_platform_setup` to accept generic u_register_t values, enabling support for firmware handoff boot arguments in common code. This simplifies the interface for early platform setup. Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com> Change-Id: Iff20300d2372e1a9825827ddccbd1b3bc6751e40
This commit is contained in:
parent
8187b95ec0
commit
b6e6e2e610
6 changed files with 24 additions and 43 deletions
|
@ -274,13 +274,8 @@ void arm_bl2u_platform_setup(void);
|
|||
void arm_bl2u_plat_arch_setup(void);
|
||||
|
||||
/* BL31 utility functions */
|
||||
#if TRANSFER_LIST
|
||||
void arm_bl31_early_platform_setup(u_register_t arg0, u_register_t arg1,
|
||||
u_register_t arg2, u_register_t arg3);
|
||||
#else
|
||||
void arm_bl31_early_platform_setup(void *from_bl2, uintptr_t soc_fw_config,
|
||||
uintptr_t hw_config, void *plat_params_from_bl2);
|
||||
#endif
|
||||
void arm_bl31_platform_setup(void);
|
||||
void arm_bl31_plat_runtime_setup(void);
|
||||
void arm_bl31_plat_arch_setup(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2013-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -28,10 +28,7 @@ void __init bl31_early_platform_setup2(u_register_t arg0,
|
|||
/* Initialize the console to provide early debug support */
|
||||
arm_console_boot_init();
|
||||
|
||||
#if TRANSFER_LIST
|
||||
arm_bl31_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||
#else
|
||||
#if !RESET_TO_BL31 && !RESET_TO_BL2
|
||||
#if !(TRANSFER_LIST || RESET_TO_BL31 || RESET_TO_BL2)
|
||||
const struct dyn_cfg_dtb_info_t *soc_fw_config_info;
|
||||
|
||||
INFO("BL31 FCONF: FW_CONFIG address = %lx\n", (uintptr_t)arg1);
|
||||
|
@ -53,9 +50,9 @@ void __init bl31_early_platform_setup2(u_register_t arg0,
|
|||
assert(hw_config_info != NULL);
|
||||
assert(hw_config_info->secondary_config_addr != 0UL);
|
||||
arg2 = hw_config_info->secondary_config_addr;
|
||||
#endif /* !RESET_TO_BL31 && !RESET_TO_BL2 */
|
||||
arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
|
||||
#endif /* TRANSFER_LIST */
|
||||
#endif /* !(TRANSFER_LIST || RESET_TO_BL31 || RESET_TO_BL2)*/
|
||||
|
||||
arm_bl31_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||
|
||||
/* Initialize the platform config for future decision making */
|
||||
fvp_config_setup();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2021-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -27,7 +27,7 @@ void __init bl31_early_platform_setup2(u_register_t arg0,
|
|||
arg1 = soc_fw_config_info->config_addr;
|
||||
}
|
||||
|
||||
arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
|
||||
arm_bl31_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||
|
||||
/*
|
||||
* Initialize Interconnect for this cluster during cold boot.
|
||||
|
|
|
@ -179,7 +179,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
|||
arg1 = soc_fw_config_info->config_addr;
|
||||
}
|
||||
#endif /* SPMD_SPM_AT_SEL2 && !RESET_TO_BL31 */
|
||||
arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
|
||||
arm_bl31_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -154,7 +154,10 @@ scmi_channel_plat_info_t *plat_css_get_scmi_info(unsigned int channel_id __unuse
|
|||
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
||||
u_register_t arg2, u_register_t arg3)
|
||||
{
|
||||
arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
|
||||
/* Initialize the console to provide early debug support */
|
||||
arm_console_boot_init();
|
||||
|
||||
arm_bl31_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||
|
||||
/* Fill the properties struct with the info from the config dtb */
|
||||
fconf_populate("FW_CONFIG", arg1);
|
||||
|
|
|
@ -154,10 +154,10 @@ struct entry_point_info *bl31_plat_get_next_image_ep_info(uint32_t type)
|
|||
* while creating page tables. BL2 has flushed this information to memory, so
|
||||
* we are guaranteed to pick up good data.
|
||||
******************************************************************************/
|
||||
#if TRANSFER_LIST
|
||||
void __init arm_bl31_early_platform_setup(u_register_t arg0, u_register_t arg1,
|
||||
u_register_t arg2, u_register_t arg3)
|
||||
{
|
||||
#if TRANSFER_LIST
|
||||
#if RESET_TO_BL31
|
||||
/* Populate entry point information for BL33 */
|
||||
SET_PARAM_HEAD(&bl33_image_ep_info, PARAM_EP, VERSION_1, 0);
|
||||
|
@ -208,18 +208,11 @@ void __init arm_bl31_early_platform_setup(u_register_t arg0, u_register_t arg1,
|
|||
}
|
||||
}
|
||||
#endif /* RESET_TO_BL31 */
|
||||
}
|
||||
#else
|
||||
void __init arm_bl31_early_platform_setup(void *from_bl2, uintptr_t soc_fw_config,
|
||||
uintptr_t hw_config, void *plat_params_from_bl2)
|
||||
{
|
||||
/* Initialize the console to provide early debug support */
|
||||
arm_console_boot_init();
|
||||
|
||||
#else /* (!TRANSFER_LIST) */
|
||||
#if RESET_TO_BL31
|
||||
/* There are no parameters from BL2 if BL31 is a reset vector */
|
||||
assert(from_bl2 == NULL);
|
||||
assert(plat_params_from_bl2 == NULL);
|
||||
assert((void *)arg0 == NULL);
|
||||
assert((void *)arg3 == NULL);
|
||||
|
||||
# ifdef BL32_BASE
|
||||
/* Populate entry point information for BL32 */
|
||||
|
@ -258,21 +251,18 @@ void __init arm_bl31_early_platform_setup(void *from_bl2, uintptr_t soc_fw_confi
|
|||
*/
|
||||
rmm_image_ep_info.pc = RMM_BASE;
|
||||
#endif /* ENABLE_RME */
|
||||
|
||||
#else /* RESET_TO_BL31 */
|
||||
|
||||
/*
|
||||
* In debug builds, we pass a special value in 'plat_params_from_bl2'
|
||||
* In debug builds, we pass a special value in 'arg3'
|
||||
* to verify platform parameters from BL2 to BL31.
|
||||
* In release builds, it's not used.
|
||||
*/
|
||||
assert(((unsigned long long)plat_params_from_bl2) ==
|
||||
ARM_BL31_PLAT_PARAM_VAL);
|
||||
assert(((unsigned long long)arg3) == ARM_BL31_PLAT_PARAM_VAL);
|
||||
|
||||
/*
|
||||
* Check params passed from BL2 should not be NULL,
|
||||
*/
|
||||
bl_params_t *params_from_bl2 = (bl_params_t *)from_bl2;
|
||||
bl_params_t *params_from_bl2 = (bl_params_t *)arg0;
|
||||
assert(params_from_bl2 != NULL);
|
||||
assert(params_from_bl2->h.type == PARAM_BL_PARAMS);
|
||||
assert(params_from_bl2->h.version >= VERSION_2);
|
||||
|
@ -325,7 +315,7 @@ void __init arm_bl31_early_platform_setup(void *from_bl2, uintptr_t soc_fw_confi
|
|||
#endif
|
||||
#endif /* RESET_TO_BL31 */
|
||||
|
||||
# if ARM_LINUX_KERNEL_AS_BL33
|
||||
#if ARM_LINUX_KERNEL_AS_BL33
|
||||
/*
|
||||
* According to the file ``Documentation/arm64/booting.txt`` of the
|
||||
* Linux kernel tree, Linux expects the physical address of the device
|
||||
|
@ -339,23 +329,19 @@ void __init arm_bl31_early_platform_setup(void *from_bl2, uintptr_t soc_fw_confi
|
|||
#if RESET_TO_BL31
|
||||
bl33_image_ep_info.args.arg0 = (u_register_t)ARM_PRELOADED_DTB_BASE;
|
||||
#else
|
||||
bl33_image_ep_info.args.arg0 = (u_register_t)hw_config;
|
||||
#endif
|
||||
bl33_image_ep_info.args.arg0 = arg2;
|
||||
#endif /* RESET_TO_BL31 */
|
||||
bl33_image_ep_info.args.arg1 = 0U;
|
||||
bl33_image_ep_info.args.arg2 = 0U;
|
||||
bl33_image_ep_info.args.arg3 = 0U;
|
||||
# endif
|
||||
#endif /* ARM_LINUX_KERNEL_AS_BL33 */
|
||||
#endif /* TRANSFER_LIST */
|
||||
}
|
||||
#endif
|
||||
|
||||
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
||||
u_register_t arg2, u_register_t arg3)
|
||||
{
|
||||
#if TRANSFER_LIST
|
||||
arm_bl31_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||
#else
|
||||
arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize Interconnect for this cluster during cold boot.
|
||||
|
|
Loading…
Add table
Reference in a new issue