Commit b8247e11 authored by Sandrine Bailleux's avatar Sandrine Bailleux Committed by TrustedFirmware Code Review
Browse files

Merge changes from topic "fw_config_handoff" into integration

* changes:
  doc: Update arg usage for BL2 and BL31 setup functions
  doc: Update BL1 and BL2 boot flow
  plat/arm: Use only fw_config between bl2 and bl31
parents 99bcae5e d1c54e5b
......@@ -49,8 +49,10 @@ Hence each ``populate()`` function must be registered with a specific
configuration properties which is usually a device tree file.
Example:
- FW_CONFIG: properties related to base address, maximum size and image id
of other DTBs etc.
- TB_FW: properties related to trusted firmware such as IO policies,
base address of other DTBs, mbedtls heap info etc.
mbedtls heap info etc.
- HW_CONFIG: properties related to hardware configuration of the SoC
such as topology, GIC controller, PSCI hooks, CPU ID etc.
......@@ -88,9 +90,10 @@ explain how the properties are described for a specific backend. Refer to the
Loading the property device tree
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``fconf_load_config()`` must be called to load the device tree containing
the properties' values. This must be done after the io layer is initialized, as
the |DTB| is stored on an external device (FIP).
The ``fconf_load_config(image_id)`` must be called to load fw_config and
tb_fw_config devices tree containing the properties' values. This must be done
after the io layer is initialized, as the |DTB| is stored on an external
device (FIP).
.. uml:: ../../resources/diagrams/plantuml/fconf_bl1_load_config.puml
......
......@@ -1424,7 +1424,7 @@ are platform specific.
On Arm standard platforms, the arguments received are :
arg0 - Points to load address of HW_CONFIG if present
arg0 - Points to load address of FW_CONFIG
arg1 - ``meminfo`` structure populated by BL1. The platform copies
the contents of ``meminfo`` as it may be subsequently overwritten by BL2.
......@@ -1736,6 +1736,10 @@ In Arm standard platforms, the arguments received are :
which is list of executable images following BL31,
arg1 - Points to load address of SOC_FW_CONFIG if present
except in case of Arm FVP platform.
In case of Arm FVP platform, Points to load address
of FW_CONFIG.
arg2 - Points to load address of HW_CONFIG if present
......
......@@ -13,6 +13,7 @@ end box
box "platform common code"
participant plat_bl1_common
participant fconf_dyn_cfg_getter
participant fconf
end box
......@@ -20,12 +21,17 @@ bl1_main -> fvp_bl1_setup : bl1_platform_setup()
fvp_bl1_setup -> arm_bl1_setup : arm_bl1_platform_setup()
arm_bl1_setup -> arm_io_storage : plat_arm_io_setup()
note over arm_io_storage : register and setup fip
arm_bl1_setup -> fconf : fconf_load_config()
arm_bl1_setup -> fconf : set_fw_config_info(fw_config_base, max_size)
note over fconf
set fw_config information
(address, size, image_id)
in global dtb_infos array.
end note
activate fconf
note over fconf
create and populate an
image_desc_t for FW_CONFIG
end note
arm_bl1_setup -> fconf : fconf_load_config(FW_CONFIG_ID)
fconf -> fconf : FCONF_GET_PROPERTY(dyn_cfg, dtb, FW_CONFIG_ID)
fconf -> fconf_dyn_cfg_getter: dyn_cfg_dtb_info_getter(FW_CONFIG_ID)
fconf_dyn_cfg_getter -> fconf: fw_config_info
fconf -> bl_common : load_auth_image(FW_CONFIG_ID, &image_info)
activate bl_common
note over bl_common
......@@ -33,18 +39,38 @@ activate fconf
with info from plat_io_policy
end note
bl_common -> arm_io_storage
arm_io_storage -> fconf: FCONF_GET_PROPERTY(arm, arm_io_policies, tb_fw_cfg)
note over fconf: use staticaly defined policies in bl1
arm_io_storage -> fconf: FCONF_GET_PROPERTY(arm, arm_io_policies, FW_CONFIG_ID)
note over fconf: use statically defined policies in bl1
fconf <- bl_common : image_info
deactivate bl_common
note over fconf : get fw_config_dtb from image_info
arm_bl1_setup -> fconf: FCONF_GET_PROPERTY(dyn_cfg, dtb, FW_CONFIG_ID)
fconf -> fconf_dyn_cfg_getter: dyn_cfg_dtb_info_getter(FW_CONFIG_ID)
fconf_dyn_cfg_getter -> arm_bl1_setup: fw_config_info
arm_bl1_setup -> fconf_dyn_cfg_getter: populate_dtb_registry(uintptr_t dtb)
arm_bl1_setup -> fconf: fconf_load_config(TB_FW_CONFIG_ID)
fconf -> fconf : FCONF_GET_PROPERTY(dyn_cfg, dtb, TB_FW_CONFIG_ID)
fconf -> fconf_dyn_cfg_getter: dyn_cfg_dtb_info_getter(TB_FW_CONFIG_ID)
fconf_dyn_cfg_getter -> fconf: tb_fw_config_info
fconf -> bl_common : load_auth_image(TB_FW_CONFIG_ID, &image_info)
activate bl_common
note over bl_common
load and auth image from fip
with info from plat_io_policy
end note
bl_common -> arm_io_storage
arm_io_storage -> fconf: FCONF_GET_PROPERTY(arm, arm_io_policies, TB_FW_CONFIG_ID)
note over fconf: use statically defined policies in bl1
fconf <- bl_common : image_info
deactivate bl_common
note over fconf : get tb_fw_config_dtb from image_info
fconf -> plat_bl1_common : bl1_plat_get_image_desc(BL2_IMAGE_ID)
fconf <- plat_bl1_common : BL2_IMAGE_DESC
note over fconf
set ep_info.args.arg0 of BL2_IMAGE_DESC
to FW_CONFIG base address
fconf -> arm_bl1_setup
arm_bl1_setup -> plat_bl1_common : bl1_plat_get_image_desc(BL2_IMAGE_ID)
arm_bl1_setup <- plat_bl1_common : BL2_IMAGE_DESC
note over arm_bl1_setup
set ep_info.args.arg0 of BL2_IMAGE_DESC
to FW_CONFIG base address
end note
arm_bl1_setup <- fconf
deactivate fconf
== load & auth, prepare and jump to BL2 ==
......
......@@ -8,6 +8,7 @@ end box
box "platform common code"
participant fconf
participant fconf_tbbr_getter
participant fconf_dyn_cfg_getter
end box
box "arm platform code" #LightBlue
......@@ -25,10 +26,17 @@ note over arm_bl2_setup
end note
arm_bl2_setup -> arm_bl2_setup : arm_bl2_early_platform_setup(\n\t fw_config, mem_layout)
activate arm_bl2_setup
arm_bl2_setup -> fconf: fconf_polulate("TB_FW", fw_config)
arm_bl2_setup -> fconf: fconf_populate("FW_CONFIG", fw_config)
activate fconf
fconf -> fconf_dyn_cfg_getter: populate_dtb_registry(uintptr_t dtb)
note over fconf_dyn_cfg_getter: read dtb_registry properties from dtb
fconf_dyn_cfg_getter -> arm_bl2_setup
arm_bl2_setup -> fconf: FCONF_GET_PROPERTY(dyn_cfg, dtb, TB_FW_CONFIG_ID)
fconf -> fconf_dyn_cfg_getter: dyn_cfg_dtb_info_getter(TB_FW_CONFIG_ID)
fconf_dyn_cfg_getter -> arm_bl2_setup: tb_fw_config_info
arm_bl2_setup -> fconf: fconf_populate("TB_FW_CONFIG", tb_fw_config)
fconf -> fconf_tbbr_getter: fconf_populate_tbbr_dyn_config(uintptr_t dtb)
note over fconf_tbbr_getter: read tbbr propeties from dtb
note over fconf_tbbr_getter: read tbbr properties from dtb
fconf -> arm_fconf_io: fconf_populate_arm_io_policies(uintptr_t dtb)
note over arm_fconf_io: read arm io propeties from dtb
deactivate fconf
......
......@@ -31,14 +31,14 @@
* is loaded at base of DRAM.
*/
soc_fw-config {
load-address = <0x0 0x04001000>;
load-address = <0x0 0x04001300>;
max-size = <0x200>;
id = <SOC_FW_CONFIG_ID>;
};
tos_fw-config {
load-address = <0x0 0x04001200>;
max-size = <0x1000>;
load-address = <0x0 0x04001500>;
max-size = <0xB00>;
id = <TOS_FW_CONFIG_ID>;
};
......
......@@ -4,7 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
#include <common/desc_image_load.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/common/platform.h>
#include <platform_def.h>
......@@ -26,3 +32,40 @@ void bl2_platform_setup(void)
/* Initialize System level generic or SP804 timer */
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;
}
......@@ -9,6 +9,7 @@
#include <drivers/arm/smmu_v3.h>
#include <fconf_hw_config_getter.h>
#include <lib/fconf/fconf.h>
#include <lib/fconf/fconf_dyn_cfg_getter.h>
#include <lib/mmio.h>
#include <plat/arm/common/arm_config.h>
#include <plat/arm/common/plat_arm.h>
......@@ -16,11 +17,22 @@
#include "fvp_private.h"
uintptr_t hw_config_dtb;
void __init bl31_early_platform_setup2(u_register_t arg0,
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);
/* 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 */
if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U)
smmuv3_init(PLAT_FVP_SMMUV3_BASE);
hw_config_dtb = arg2;
}
void __init bl31_plat_arch_setup(void)
......@@ -61,10 +71,13 @@ void __init bl31_plat_arch_setup(void)
* control is passed to BL31.
*/
#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;
hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID);
assert(hw_config_info != NULL);
INFO("BL31 FCONF: HW_CONFIG address = %p\n", (void *)hw_config_dtb);
fconf_populate("HW_CONFIG", hw_config_dtb);
fconf_populate("HW_CONFIG", hw_config_info->config_addr);
#endif
}
......
......@@ -217,6 +217,7 @@ BL31_SOURCES += drivers/arm/fvp/fvp_pwrc.c \
ifeq ($(filter 1,${BL2_AT_EL3} ${RESET_TO_BL31}),)
BL31_SOURCES += common/fdt_wrappers.c \
lib/fconf/fconf.c \
lib/fconf/fconf_dyn_cfg_getter.c \
plat/arm/board/fvp/fconf/fconf_hw_config_getter.c
ifeq (${SEC_INT_DESC_IN_FCONF},1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment