Commit 9233dd09 authored by Manish V Badarkhe's avatar Manish V Badarkhe
Browse files

fconf: Allow fconf to load additional firmware configuration



Modified the `fconf_load_config` function so that it can
additionally support loading of tb_fw_config along with
fw_config.
Signed-off-by: default avatarLouis Mayencourt <louis.mayencourt@arm.com>
Signed-off-by: default avatarManish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: Ie060121d367ba12e3fcac5b8ff169d415a5c2bcd
parent 04e06973
......@@ -43,8 +43,8 @@ struct fconf_populator {
int (*populate)(uintptr_t config);
};
/* Load firmware configuration dtb */
void fconf_load_config(void);
/* This function supports to load tb_fw_config and fw_config dtb */
void fconf_load_config(unsigned int image_id);
/* Top level populate function
*
......
......@@ -9,48 +9,40 @@
#include <common/debug.h>
#include <common/fdt_wrappers.h>
#include <lib/fconf/fconf.h>
#include <lib/fconf/fconf_dyn_cfg_getter.h>
#include <libfdt.h>
#include <plat/common/platform.h>
#include <platform_def.h>
struct fconf_dtb_info_t fconf_dtb_info;
void fconf_load_config(void)
void fconf_load_config(unsigned int image_id)
{
int err;
/* fconf FW_CONFIG and TB_FW_CONFIG are currently the same DTB */
image_info_t arm_tb_fw_info = {
struct dyn_cfg_dtb_info_t *config_info;
assert((image_id == FW_CONFIG_ID) || (image_id == TB_FW_CONFIG_ID));
image_info_t image_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_FW_CONFIG_BASE,
.image_max_size = (uint32_t)
(ARM_FW_CONFIG_LIMIT - ARM_FW_CONFIG_BASE)
.h.attr = 0
};
VERBOSE("FCONF: Loading FW_CONFIG\n");
err = load_auth_image(TB_FW_CONFIG_ID, &arm_tb_fw_info);
config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, image_id);
image_info.image_base = config_info->config_addr;
image_info.image_max_size = config_info->config_max_size;
VERBOSE("FCONF: Loading config with image ID: %d\n", image_id);
err = load_auth_image(image_id, &image_info);
if (err != 0) {
/* Return if FW_CONFIG is not loaded */
VERBOSE("FW_CONFIG not loaded, continuing without it\n");
VERBOSE("Failed to load config %d, continuing without it\n",
image_id);
return;
}
/* At this point we know that a DTB is indeed available */
fconf_dtb_info.base_addr = arm_tb_fw_info.image_base;
fconf_dtb_info.size = (size_t)arm_tb_fw_info.image_size;
INFO("FCONF: Config file with image ID:%d loaded at address = 0x%lx\n",
image_id, image_info.image_base);
#if !BL2_AT_EL3
image_desc_t *desc;
/* 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 = arm_tb_fw_info.image_base;
#endif
INFO("FCONF: FW_CONFIG loaded at address = 0x%lx\n", arm_tb_fw_info.image_base);
}
void fconf_populate(const char *config_type, uintptr_t config)
......@@ -81,7 +73,4 @@ void fconf_populate(const char *config_type, uintptr_t config)
}
}
}
/* save local pointer to the config dtb */
fconf_dtb_info.base_addr = config;
}
......@@ -8,5 +8,5 @@
FCONF_SOURCES := lib/fconf/fconf.c
FCONF_DYN_SOURCES := lib/fconf/fconf_dyn_cfg_getter.c
BL1_SOURCES += ${FCONF_SOURCES}
BL1_SOURCES += ${FCONF_SOURCES} ${FCONF_DYN_SOURCES}
BL2_SOURCES += ${FCONF_SOURCES} ${FCONF_DYN_SOURCES}
......@@ -12,11 +12,25 @@
#include <lib/object_pool.h>
#include <libfdt.h>
/* We currently use TB_FW, SOC_FW, TOS_FW, NS_fw and HW configs */
#define MAX_DTB_INFO U(5)
/* We currently use FW, TB_FW, SOC_FW, TOS_FW, NS_fw and HW configs */
#define MAX_DTB_INFO U(6)
#ifdef IMAGE_BL1
static struct dyn_cfg_dtb_info_t dtb_infos[MAX_DTB_INFO] = {
[0] = {
.config_addr = ARM_FW_CONFIG_BASE,
.config_max_size = (uint32_t)
(ARM_FW_CONFIG_LIMIT - ARM_FW_CONFIG_BASE),
.config_id = FW_CONFIG_ID
},
};
/* Create an object pool starting at the second element */
static OBJECT_POOL(dtb_info_pool, &dtb_infos[1],
sizeof(struct dyn_cfg_dtb_info_t), MAX_DTB_INFO-1);
#else
static struct dyn_cfg_dtb_info_t dtb_infos[MAX_DTB_INFO];
static OBJECT_POOL_ARRAY(dtb_info_pool, dtb_infos);
#endif
struct dyn_cfg_dtb_info_t *dyn_cfg_dtb_info_getter(unsigned int config_id)
{
......@@ -56,6 +70,15 @@ int fconf_populate_dtb_registry(uintptr_t config)
return node;
}
#ifndef IMAGE_BL1
/* Save config dtb information */
dtb_info = pool_alloc(&dtb_info_pool);
dtb_info->config_addr = config;
dtb_info->config_max_size = fdt_totalsize(dtb);
dtb_info->config_id = FW_CONFIG_ID;
#endif
fdt_for_each_subnode(child, dtb, node) {
uint32_t val32;
uint64_t val64;
......
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