diff options
author | Madhukar Pappireddy <madhukar.pappireddy@arm.com> | 2019-12-06 15:46:42 -0600 |
---|---|---|
committer | Madhukar Pappireddy <madhukar.pappireddy@arm.com> | 2020-03-11 10:19:21 -0500 |
commit | 25d740c45e14d42c9284ab1788a8d7b516608ece (patch) | |
tree | e0eb3eae765d72813ee49c15797cbae89d171e32 /lib | |
parent | f09852c97bc5de46d7322f2d1532fdddbd787043 (diff) | |
download | platform_external_arm-trusted-firmware-25d740c45e14d42c9284ab1788a8d7b516608ece.tar.gz platform_external_arm-trusted-firmware-25d740c45e14d42c9284ab1788a8d7b516608ece.tar.bz2 platform_external_arm-trusted-firmware-25d740c45e14d42c9284ab1788a8d7b516608ece.zip |
fconf: enhancements to firmware configuration framework
A populate() function essentially captures the value of a property,
defined by a platform, into a fconf related c structure. Such a
callback is usually platform specific and is associated to a specific
configuration source.
For example, a populate() function which captures the hardware topology
of the platform can only parse HW_CONFIG DTB. Hence each populator
function must be registered with a specific 'config_type' identifier.
It broadly represents a logical grouping of configuration properties
which is usually a device tree source file.
Example:
> TB_FW: properties related to trusted firmware such as IO policies,
base address of other DTBs, mbedtls heap info etc.
> HW_CONFIG: properties related to hardware configuration of the SoC
such as topology, GIC controller, PSCI hooks, CPU ID etc.
This patch modifies FCONF_REGISTER_POPULATOR macro and fconf_populate()
to register and invoke the appropriate callbacks selectively based on
configuration type.
Change-Id: I6f63b1fd7a8729c6c9137d5b63270af1857bb44a
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fconf/fconf.c | 16 | ||||
-rw-r--r-- | lib/fconf/fconf_dyn_cfg_getter.c | 2 | ||||
-rw-r--r-- | lib/fconf/fconf_tbbr_getter.c | 2 |
3 files changed, 11 insertions, 9 deletions
diff --git a/lib/fconf/fconf.c b/lib/fconf/fconf.c index a6da56b00..9ce46354d 100644 --- a/lib/fconf/fconf.c +++ b/lib/fconf/fconf.c @@ -53,17 +53,17 @@ void fconf_load_config(void) INFO("FCONF: FW_CONFIG loaded at address = 0x%lx\n", arm_tb_fw_info.image_base); } -void fconf_populate(uintptr_t config) +void fconf_populate(const char *config_type, uintptr_t config) { assert(config != 0UL); /* Check if the pointer to DTB is correct */ if (fdt_check_header((void *)config) != 0) { - ERROR("FCONF: Invalid DTB file passed for FW_CONFIG\n"); + ERROR("FCONF: Invalid DTB file passed for %s\n", config_type); panic(); } - INFO("FCONF: Reading firmware configuration file from: 0x%lx\n", config); + INFO("FCONF: Reading %s firmware configuration file from: 0x%lx\n", config_type, config); /* Go through all registered populate functions */ IMPORT_SYM(struct fconf_populator *, __FCONF_POPULATOR_START__, start); @@ -73,10 +73,12 @@ void fconf_populate(uintptr_t config) for (populator = start; populator != end; populator++) { assert((populator->info != NULL) && (populator->populate != NULL)); - INFO("FCONF: Reading firmware configuration information for: %s\n", populator->info); - if (populator->populate(config) != 0) { - /* TODO: handle property miss */ - panic(); + if (strcmp(populator->config_type, config_type) == 0) { + INFO("FCONF: Reading firmware configuration information for: %s\n", populator->info); + if (populator->populate(config) != 0) { + /* TODO: handle property miss */ + panic(); + } } } diff --git a/lib/fconf/fconf_dyn_cfg_getter.c b/lib/fconf/fconf_dyn_cfg_getter.c index d313a5618..317d3e5d3 100644 --- a/lib/fconf/fconf_dyn_cfg_getter.c +++ b/lib/fconf/fconf_dyn_cfg_getter.c @@ -92,4 +92,4 @@ int fconf_populate_dtb_registry(uintptr_t config) return 0; } -FCONF_REGISTER_POPULATOR(dyn_cfg, fconf_populate_dtb_registry); +FCONF_REGISTER_POPULATOR(TB_FW, dyn_cfg, fconf_populate_dtb_registry); diff --git a/lib/fconf/fconf_tbbr_getter.c b/lib/fconf/fconf_tbbr_getter.c index c6df9c876..a4d61d8cd 100644 --- a/lib/fconf/fconf_tbbr_getter.c +++ b/lib/fconf/fconf_tbbr_getter.c @@ -72,4 +72,4 @@ int fconf_populate_tbbr_dyn_config(uintptr_t config) return 0; } -FCONF_REGISTER_POPULATOR(tbbr, fconf_populate_tbbr_dyn_config); +FCONF_REGISTER_POPULATOR(TB_FW, tbbr, fconf_populate_tbbr_dyn_config); |