summaryrefslogtreecommitdiff
path: root/lib/fconf
diff options
context:
space:
mode:
authorManish V Badarkhe <Manish.Badarkhe@arm.com>2020-06-11 22:17:30 +0100
committerManish V Badarkhe <Manish.Badarkhe@arm.com>2020-06-24 08:44:26 +0100
commit9233dd09ca3ea96aee6d3a4bfdc798eb4938c1b5 (patch)
treea9eeba8988939a77dc991a5484c48fdc71a9a8ea /lib/fconf
parent04e06973e1fef87849c498c7f045aa2be8aada1c (diff)
downloadarm-trusted-firmware-9233dd09ca3ea96aee6d3a4bfdc798eb4938c1b5.tar.gz
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: Louis Mayencourt <louis.mayencourt@arm.com> Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com> Change-Id: Ie060121d367ba12e3fcac5b8ff169d415a5c2bcd
Diffstat (limited to 'lib/fconf')
-rw-r--r--lib/fconf/fconf.c47
-rw-r--r--lib/fconf/fconf.mk2
-rw-r--r--lib/fconf/fconf_dyn_cfg_getter.c29
3 files changed, 45 insertions, 33 deletions
diff --git a/lib/fconf/fconf.c b/lib/fconf/fconf.c
index b99e7f0fa..ff16f676a 100644
--- a/lib/fconf/fconf.c
+++ b/lib/fconf/fconf.c
@@ -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;
}
diff --git a/lib/fconf/fconf.mk b/lib/fconf/fconf.mk
index c087102d7..b01dc6fea 100644
--- a/lib/fconf/fconf.mk
+++ b/lib/fconf/fconf.mk
@@ -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}
diff --git a/lib/fconf/fconf_dyn_cfg_getter.c b/lib/fconf/fconf_dyn_cfg_getter.c
index f1004fad5..1828a80bf 100644
--- a/lib/fconf/fconf_dyn_cfg_getter.c
+++ b/lib/fconf/fconf_dyn_cfg_getter.c
@@ -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;