mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-05-03 17:38:39 +00:00
refactor(arm): simplify early platform setup function in BL2
Refactor `arm_bl2_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: Ie0dbe4d32bbef22bd185fdafe50091a2ea5f550f
This commit is contained in:
parent
4c5ccbf43c
commit
8187b95ec0
6 changed files with 20 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
|
* Copyright (c) 2015-2025, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -249,7 +249,8 @@ void arm_bl1_platform_setup(void);
|
||||||
void arm_bl1_plat_arch_setup(void);
|
void arm_bl1_plat_arch_setup(void);
|
||||||
|
|
||||||
/* BL2 utility functions */
|
/* BL2 utility functions */
|
||||||
void arm_bl2_early_platform_setup(uintptr_t fw_config, struct meminfo *mem_layout);
|
void arm_bl2_early_platform_setup(u_register_t arg0, u_register_t arg1,
|
||||||
|
u_register_t arg2, u_register_t arg3);
|
||||||
void arm_bl2_platform_setup(void);
|
void arm_bl2_platform_setup(void);
|
||||||
void arm_bl2_plat_arch_setup(void);
|
void arm_bl2_plat_arch_setup(void);
|
||||||
uint32_t arm_get_spsr_for_bl32_entry(void);
|
uint32_t arm_get_spsr_for_bl32_entry(void);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Arm Limited. All rights reserved.
|
* Copyright (c) 2019-2025, Arm Limited. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
||||||
u_register_t arg2, u_register_t arg3)
|
u_register_t arg2, u_register_t arg3)
|
||||||
{
|
{
|
||||||
arm_bl2_early_platform_setup((uintptr_t)arg0, (meminfo_t *)arg1);
|
arm_bl2_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bl2_platform_setup(void)
|
void bl2_platform_setup(void)
|
||||||
|
|
|
@ -52,10 +52,7 @@ static const arm_gpt_info_t arm_gpt_info = {
|
||||||
|
|
||||||
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
|
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
|
||||||
{
|
{
|
||||||
#if TRANSFER_LIST
|
arm_bl2_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||||
arg0 = arg3;
|
|
||||||
#endif
|
|
||||||
arm_bl2_early_platform_setup((uintptr_t)arg0, (meminfo_t *)arg1);
|
|
||||||
|
|
||||||
/* Initialize the platform config for future decision making */
|
/* Initialize the platform config for future decision making */
|
||||||
fvp_config_setup();
|
fvp_config_setup();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Arm Limited. All rights reserved.
|
* Copyright (c) 2019-2025, Arm Limited. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
|
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);
|
arm_bl2_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||||
|
|
||||||
/* Initialize the platform config for future decision making */
|
/* Initialize the platform config for future decision making */
|
||||||
fvp_ve_config_setup();
|
fvp_ve_config_setup();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
|
* Copyright (c) 2015-2025, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -66,8 +66,8 @@ struct transfer_list_header *secure_tl __unused;
|
||||||
* in x0. This memory layout is sitting at the base of the free trusted SRAM.
|
* in x0. This memory layout is sitting at the base of the free trusted SRAM.
|
||||||
* Copy it to a safe location before its reclaimed by later BL2 functionality.
|
* Copy it to a safe location before its reclaimed by later BL2 functionality.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void arm_bl2_early_platform_setup(uintptr_t fw_config,
|
void arm_bl2_early_platform_setup(u_register_t arg0, u_register_t arg1,
|
||||||
struct meminfo *mem_layout)
|
u_register_t arg2, u_register_t arg3)
|
||||||
{
|
{
|
||||||
struct transfer_list_entry *te __unused;
|
struct transfer_list_entry *te __unused;
|
||||||
int __maybe_unused ret;
|
int __maybe_unused ret;
|
||||||
|
@ -76,8 +76,7 @@ void arm_bl2_early_platform_setup(uintptr_t fw_config,
|
||||||
arm_console_boot_init();
|
arm_console_boot_init();
|
||||||
|
|
||||||
#if TRANSFER_LIST
|
#if TRANSFER_LIST
|
||||||
// TODO: modify the prototype of this function fw_config != bl2_tl
|
secure_tl = (struct transfer_list_header *)arg3;
|
||||||
secure_tl = (struct transfer_list_header *)fw_config;
|
|
||||||
|
|
||||||
te = transfer_list_find(secure_tl, TL_TAG_SRAM_LAYOUT64);
|
te = transfer_list_find(secure_tl, TL_TAG_SRAM_LAYOUT64);
|
||||||
assert(te != NULL);
|
assert(te != NULL);
|
||||||
|
@ -85,11 +84,11 @@ void arm_bl2_early_platform_setup(uintptr_t fw_config,
|
||||||
bl2_tzram_layout = *(meminfo_t *)transfer_list_entry_data(te);
|
bl2_tzram_layout = *(meminfo_t *)transfer_list_entry_data(te);
|
||||||
transfer_list_rem(secure_tl, te);
|
transfer_list_rem(secure_tl, te);
|
||||||
#else
|
#else
|
||||||
config_base = fw_config;
|
config_base = (uintptr_t)arg0;
|
||||||
|
|
||||||
/* Setup the BL2 memory layout */
|
/* Setup the BL2 memory layout */
|
||||||
bl2_tzram_layout = *mem_layout;
|
bl2_tzram_layout = *(meminfo_t *)arg1;
|
||||||
#endif
|
#endif /* TRANSFER_LIST */
|
||||||
|
|
||||||
/* Initialise the IO layer and register platform IO devices */
|
/* Initialise the IO layer and register platform IO devices */
|
||||||
plat_arm_io_setup();
|
plat_arm_io_setup();
|
||||||
|
@ -105,9 +104,10 @@ void arm_bl2_early_platform_setup(uintptr_t fw_config,
|
||||||
#endif /* ARM_GPT_SUPPORT */
|
#endif /* ARM_GPT_SUPPORT */
|
||||||
}
|
}
|
||||||
|
|
||||||
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
|
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);
|
arm_bl2_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||||
|
|
||||||
generic_delay_timer_init();
|
generic_delay_timer_init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
|
* Copyright (c) 2015-2025, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -56,7 +56,7 @@ static unsigned int scp_boot_config;
|
||||||
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
||||||
u_register_t arg2, u_register_t arg3)
|
u_register_t arg2, u_register_t arg3)
|
||||||
{
|
{
|
||||||
arm_bl2_early_platform_setup((uintptr_t)arg0, (meminfo_t *)arg1);
|
arm_bl2_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||||
|
|
||||||
/* Save SCP Boot config before it gets overwritten by SCP_BL2 loading */
|
/* Save SCP Boot config before it gets overwritten by SCP_BL2 loading */
|
||||||
scp_boot_config = mmio_read_32(SCP_BOOT_CFG_ADDR);
|
scp_boot_config = mmio_read_32(SCP_BOOT_CFG_ADDR);
|
||||||
|
|
Loading…
Add table
Reference in a new issue