mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-07 21:33:54 +00:00
feat(arm): add support for loading CONFIG from BL2
This commit introduces a new ARM platform-specific build option called `ARM_FW_CONFIG_LOAD_ENABLE`. This option enables the loading of the `fw_config` device tree when resetting to the BL2 scenario. Additionally, the FW_CONFIG image reference has been added to the fdts/tbbr_cot_descriptors.dtsi file in order to use in the scenario of RESET_TO_BL2. Signed-off-by: Divin Raj <divin.raj@arm.com> Change-Id: I11de497b7dbb1386ed84d939d6fd2a11856e9e1b
This commit is contained in:
parent
bcce173da3
commit
973e0b7f2c
6 changed files with 77 additions and 1 deletions
|
@ -16,6 +16,12 @@ Arm Platform Build Options
|
|||
should match the frame used by the Non-Secure image (normally the Linux
|
||||
kernel). Default is true (access to the frame is allowed).
|
||||
|
||||
- ``ARM_FW_CONFIG_LOAD_ENABLE``: Boolean option to enable the loading of
|
||||
FW_CONFIG device trees from the Firmware Image Package (FIP). When enabled,
|
||||
BL2 calls the platform specific function `arm_bl2_el3_plat_config_load`.
|
||||
This function is responsible for loading, parsing, and validating the
|
||||
FW_CONFIG device trees from the FIP. The option depends on RESET_TO_BL2.
|
||||
|
||||
- ``ARM_DISABLE_TRUSTED_WDOG``: boolean option to disable the Trusted Watchdog.
|
||||
By default, Arm platforms use a watchdog to trigger a system reset in case
|
||||
an error is encountered during the boot process (for example, when an image
|
||||
|
|
|
@ -195,6 +195,12 @@ cot {
|
|||
hash = <&hw_config_hash>;
|
||||
};
|
||||
|
||||
fw_config {
|
||||
image-id = <FW_CONFIG_ID>;
|
||||
parent = <&trusted_boot_fw_cert>;
|
||||
hash = <&fw_config_hash>;
|
||||
};
|
||||
|
||||
scp_bl2_image {
|
||||
image-id = <SCP_BL2_IMAGE_ID>;
|
||||
parent = <&scp_fw_content_cert>;
|
||||
|
|
|
@ -262,6 +262,9 @@ void arm_bl2_setup_next_ep_info(bl_mem_params_node_t *next_param_node);
|
|||
/* BL2 at EL3 functions */
|
||||
void arm_bl2_el3_early_platform_setup(void);
|
||||
void arm_bl2_el3_plat_arch_setup(void);
|
||||
#if ARM_FW_CONFIG_LOAD_ENABLE
|
||||
void arm_bl2_el3_plat_config_load(void);
|
||||
#endif /* ARM_FW_CONFIG_LOAD_ENABLE */
|
||||
|
||||
/* BL2U utility functions */
|
||||
void arm_bl2u_early_platform_setup(struct meminfo *mem_layout,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2023, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2017-2024, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include <drivers/generic_delay_timer.h>
|
||||
#include <drivers/partition/partition.h>
|
||||
#include <lib/fconf/fconf.h>
|
||||
#include <lib/fconf/fconf_dyn_cfg_getter.h>
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
#include <plat/common/platform.h>
|
||||
#include <platform_def.h>
|
||||
|
@ -64,6 +66,43 @@ void bl2_el3_early_platform_setup(u_register_t arg0 __unused,
|
|||
generic_delay_timer_init();
|
||||
}
|
||||
|
||||
#if ARM_FW_CONFIG_LOAD_ENABLE
|
||||
/*************************************************************************************
|
||||
* FW CONFIG load function for BL2 when RESET_TO_BL2=1 && ARM_FW_CONFIG_LOAD_ENABLE=1
|
||||
*************************************************************************************/
|
||||
void arm_bl2_el3_plat_config_load(void)
|
||||
{
|
||||
int ret;
|
||||
const struct dyn_cfg_dtb_info_t *fw_config_info;
|
||||
|
||||
/* Set global DTB info for fixed fw_config information */
|
||||
set_config_info(PLAT_FW_CONFIG_BASE, ~0UL, PLAT_FW_CONFIG_MAX_SIZE, FW_CONFIG_ID);
|
||||
|
||||
/* Fill the device tree information struct with the info from the config dtb */
|
||||
ret = fconf_load_config(FW_CONFIG_ID);
|
||||
if (ret < 0) {
|
||||
ERROR("Loading of FW_CONFIG failed %d\n", ret);
|
||||
plat_error_handler(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* FW_CONFIG loaded successfully. Check the FW_CONFIG device tree parsing
|
||||
* is successful.
|
||||
*/
|
||||
fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, FW_CONFIG_ID);
|
||||
if (fw_config_info == NULL) {
|
||||
ret = -1;
|
||||
ERROR("Invalid FW_CONFIG address\n");
|
||||
plat_error_handler(ret);
|
||||
}
|
||||
ret = fconf_populate_dtb_registry(fw_config_info->config_addr);
|
||||
if (ret < 0) {
|
||||
ERROR("Parsing of FW_CONFIG failed %d\n", ret);
|
||||
plat_error_handler(ret);
|
||||
}
|
||||
}
|
||||
#endif /* ARM_FW_CONFIG_LOAD_ENABLE */
|
||||
|
||||
/*******************************************************************************
|
||||
* Perform the very early platform specific architectural setup here. At the
|
||||
* moment this is only initializes the mmu in a quick and dirty way.
|
||||
|
|
|
@ -140,6 +140,9 @@ void bl2_plat_preload_setup(void)
|
|||
|
||||
arm_transfer_list_dyn_cfg_init(secure_tl);
|
||||
#else
|
||||
#if ARM_FW_CONFIG_LOAD_ENABLE
|
||||
arm_bl2_el3_plat_config_load();
|
||||
#endif /* ARM_FW_CONFIG_LOAD_ENABLE */
|
||||
arm_bl2_dyn_cfg_init();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -164,6 +164,25 @@ ifneq ($(filter 1,${RESET_TO_BL31} ${RESET_TO_SP_MIN}),)
|
|||
ENABLE_PIE := 1
|
||||
endif
|
||||
|
||||
# On Arm platform, disable ARM_FW_CONFIG_LOAD_ENABLE by default.
|
||||
ARM_FW_CONFIG_LOAD_ENABLE := 0
|
||||
$(eval $(call assert_boolean,ARM_FW_CONFIG_LOAD_ENABLE))
|
||||
$(eval $(call add_define,ARM_FW_CONFIG_LOAD_ENABLE))
|
||||
|
||||
# In order to enable ARM_FW_CONFIG_LOAD_ENABLE for the Arm platform, the
|
||||
# platform should be reset to BL2 (RESET_TO_BL2=1), and FW_CONFIG must be
|
||||
# specified.
|
||||
ifeq (${ARM_FW_CONFIG_LOAD_ENABLE},1)
|
||||
ifneq (${RESET_TO_BL2},1)
|
||||
$(error RESET_TO_BL2 must be enabled when ARM_FW_CONFIG_LOAD_ENABLE \
|
||||
is enabled)
|
||||
endif
|
||||
ifeq (${FW_CONFIG},)
|
||||
$(error FW_CONFIG must be specified when ARM_FW_CONFIG_LOAD_ENABLE \
|
||||
is enabled)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Disable GPT parser support, use FIP image by default
|
||||
ARM_GPT_SUPPORT := 0
|
||||
$(eval $(call assert_boolean,ARM_GPT_SUPPORT))
|
||||
|
|
Loading…
Add table
Reference in a new issue