plat/arm: Use only fw_config between bl2 and bl31

Passed the address of fw_config instead of soc_fw_config
as arg1 to BL31 from BL2 for ARM fvp platform.

BL31 then retrieve load-address of other device trees
from fw_config device tree.

Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: Ib7e9581cd765d76111dcc3b7e0dafc12503c83c1
This commit is contained in:
Manish V Badarkhe 2020-05-30 17:40:44 +01:00
parent 99bcae5ea6
commit 7fb9bcd846
4 changed files with 67 additions and 10 deletions

View file

@ -31,14 +31,14 @@
* is loaded at base of DRAM. * is loaded at base of DRAM.
*/ */
soc_fw-config { soc_fw-config {
load-address = <0x0 0x04001000>; load-address = <0x0 0x04001300>;
max-size = <0x200>; max-size = <0x200>;
id = <SOC_FW_CONFIG_ID>; id = <SOC_FW_CONFIG_ID>;
}; };
tos_fw-config { tos_fw-config {
load-address = <0x0 0x04001200>; load-address = <0x0 0x04001500>;
max-size = <0x1000>; max-size = <0xB00>;
id = <TOS_FW_CONFIG_ID>; id = <TOS_FW_CONFIG_ID>;
}; };

View file

@ -4,7 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <assert.h>
#include <common/desc_image_load.h>
#include <drivers/arm/sp804_delay_timer.h> #include <drivers/arm/sp804_delay_timer.h>
#include <lib/fconf/fconf.h>
#include <lib/fconf/fconf_dyn_cfg_getter.h>
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <platform_def.h> #include <platform_def.h>
@ -26,3 +32,40 @@ void bl2_platform_setup(void)
/* Initialize System level generic or SP804 timer */ /* Initialize System level generic or SP804 timer */
fvp_timer_init(); fvp_timer_init();
} }
/*******************************************************************************
* This function returns the list of executable images
******************************************************************************/
struct bl_params *plat_get_next_bl_params(void)
{
struct bl_params *arm_bl_params;
arm_bl_params = arm_get_next_bl_params();
#if __aarch64__ && !BL2_AT_EL3
const struct dyn_cfg_dtb_info_t *fw_config_info;
bl_mem_params_node_t *param_node;
uintptr_t fw_config_base = 0U;
entry_point_info_t *ep_info;
/* Get BL31 image node */
param_node = get_bl_mem_params_node(BL31_IMAGE_ID);
assert(param_node != NULL);
/* get fw_config load 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 != 0U);
/*
* Get the entry point info of BL31 image and override
* arg1 of entry point info with fw_config base address
*/
ep_info = &param_node->ep_info;
ep_info->args.arg1 = (uint32_t)fw_config_base;
#endif /* __aarch64__ && !BL2_AT_EL3 */
return arm_bl_params;
}

View file

@ -9,6 +9,7 @@
#include <drivers/arm/smmu_v3.h> #include <drivers/arm/smmu_v3.h>
#include <fconf_hw_config_getter.h> #include <fconf_hw_config_getter.h>
#include <lib/fconf/fconf.h> #include <lib/fconf/fconf.h>
#include <lib/fconf/fconf_dyn_cfg_getter.h>
#include <lib/mmio.h> #include <lib/mmio.h>
#include <plat/arm/common/arm_config.h> #include <plat/arm/common/arm_config.h>
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
@ -16,11 +17,22 @@
#include "fvp_private.h" #include "fvp_private.h"
uintptr_t hw_config_dtb;
void __init bl31_early_platform_setup2(u_register_t arg0, void __init bl31_early_platform_setup2(u_register_t arg0,
u_register_t arg1, u_register_t arg2, u_register_t arg3) u_register_t arg1, u_register_t arg2, u_register_t arg3)
{ {
#if !RESET_TO_BL31 && !BL2_AT_EL3
const struct dyn_cfg_dtb_info_t *soc_fw_config_info;
INFO("BL31 FCONF: FW_CONFIG address = %lx\n", (uintptr_t)arg1);
/* Fill the properties struct with the info from the config dtb */
fconf_populate("FW_CONFIG", arg1);
soc_fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, SOC_FW_CONFIG_ID);
if (soc_fw_config_info != NULL) {
arg1 = soc_fw_config_info->config_addr;
}
#endif /* !RESET_TO_BL31 && !BL2_AT_EL3 */
arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3); arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
/* Initialize the platform config for future decision making */ /* Initialize the platform config for future decision making */
@ -47,8 +59,6 @@ void __init bl31_early_platform_setup2(u_register_t arg0,
/* On FVP RevC, initialize SMMUv3 */ /* On FVP RevC, initialize SMMUv3 */
if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U) if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U)
smmuv3_init(PLAT_FVP_SMMUV3_BASE); smmuv3_init(PLAT_FVP_SMMUV3_BASE);
hw_config_dtb = arg2;
} }
void __init bl31_plat_arch_setup(void) void __init bl31_plat_arch_setup(void)
@ -61,10 +71,13 @@ void __init bl31_plat_arch_setup(void)
* control is passed to BL31. * control is passed to BL31.
*/ */
#if !RESET_TO_BL31 && !BL2_AT_EL3 #if !RESET_TO_BL31 && !BL2_AT_EL3
assert(hw_config_dtb != 0U); /* HW_CONFIG was also loaded by BL2 */
const struct dyn_cfg_dtb_info_t *hw_config_info;
INFO("BL31 FCONF: HW_CONFIG address = %p\n", (void *)hw_config_dtb); hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID);
fconf_populate("HW_CONFIG", hw_config_dtb); assert(hw_config_info != NULL);
fconf_populate("HW_CONFIG", hw_config_info->config_addr);
#endif #endif
} }

View file

@ -217,6 +217,7 @@ BL31_SOURCES += drivers/arm/fvp/fvp_pwrc.c \
ifeq ($(filter 1,${BL2_AT_EL3} ${RESET_TO_BL31}),) ifeq ($(filter 1,${BL2_AT_EL3} ${RESET_TO_BL31}),)
BL31_SOURCES += common/fdt_wrappers.c \ BL31_SOURCES += common/fdt_wrappers.c \
lib/fconf/fconf.c \ lib/fconf/fconf.c \
lib/fconf/fconf_dyn_cfg_getter.c \
plat/arm/board/fvp/fconf/fconf_hw_config_getter.c plat/arm/board/fvp/fconf/fconf_hw_config_getter.c
ifeq (${SEC_INT_DESC_IN_FCONF},1) ifeq (${SEC_INT_DESC_IN_FCONF},1)