diff options
author | Louis Mayencourt <louis.mayencourt@arm.com> | 2019-10-17 14:46:51 +0100 |
---|---|---|
committer | Louis Mayencourt <louis.mayencourt@arm.com> | 2020-02-07 13:48:47 +0000 |
commit | 3b5ea741fd92088c9e005d3508b73e50f1d5daf7 (patch) | |
tree | 905139a63e85c583b3fc40b0c42f0603aa69cc95 /lib | |
parent | ab1981db9ea793accf1279446b9f7666a3be04ca (diff) | |
download | platform_external_arm-trusted-firmware-3b5ea741fd92088c9e005d3508b73e50f1d5daf7.tar.gz platform_external_arm-trusted-firmware-3b5ea741fd92088c9e005d3508b73e50f1d5daf7.tar.bz2 platform_external_arm-trusted-firmware-3b5ea741fd92088c9e005d3508b73e50f1d5daf7.zip |
fconf: Load config dtb from bl1
Move the loading of the dtb from arm_dym_cfg to fconf. The new loading
function is not associated to arm platform anymore, and can be moved
to bl_main if wanted.
Change-Id: I847d07eaba36d31d9d3ed9eba8e58666ea1ba563
Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fconf/fconf.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/fconf/fconf.c b/lib/fconf/fconf.c index 387e758d2..7e0b00b08 100644 --- a/lib/fconf/fconf.c +++ b/lib/fconf/fconf.c @@ -9,8 +9,47 @@ #include <common/debug.h> #include <lib/fconf/fconf.h> #include <libfdt.h> +#include <plat/common/platform.h> #include <platform_def.h> +static uintptr_t tb_fw_cfg_dtb; +static size_t tb_fw_cfg_dtb_size; + +void fconf_load_config(void) +{ + int err; + image_desc_t *desc; + + image_info_t arm_tb_fw_info = { + .h.type = (uint8_t)PARAM_IMAGE_BINARY, + .h.version = (uint8_t)VERSION_2, + .h.size = (uint16_t)sizeof(image_info_t), + .h.attr = 0, + .image_base = ARM_TB_FW_CONFIG_BASE, + .image_max_size = (uint32_t) + (ARM_TB_FW_CONFIG_LIMIT - ARM_TB_FW_CONFIG_BASE) + }; + + VERBOSE("FCONF: Loading FW_CONFIG\n"); + err = load_auth_image(TB_FW_CONFIG_ID, &arm_tb_fw_info); + if (err != 0) { + /* Return if FW_CONFIG is not loaded */ + VERBOSE("Failed to load FW_CONFIG\n"); + return; + } + + /* At this point we know that a DTB is indeed available */ + tb_fw_cfg_dtb = arm_tb_fw_info.image_base; + tb_fw_cfg_dtb_size = (size_t)arm_tb_fw_info.image_size; + + /* The BL2 ep_info arg0 is modified to point to FW_CONFIG */ + desc = bl1_plat_get_image_desc(BL2_IMAGE_ID); + assert(desc != NULL); + desc->ep_info.args.arg0 = tb_fw_cfg_dtb; + + INFO("FCONF: FW_CONFIG loaded at address = 0x%lx\n", tb_fw_cfg_dtb); +} + void fconf_populate(uintptr_t config) { assert(config != 0UL); |