Add event log parameter handling in SP
A generic publish/subscribe mechanism is implemented to allow
boot information such as the TPM event log to be passed to
specific SPs, based on subscriptions specified in the SP
manifest. This change implements the in-SP handling
for the initialization parameters. The env_test has
been extended to include tests that check that the
event log is being passed and stored in the config store.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I89211ebffd9e2d1768eaf5736e6b28dceafb0a02
diff --git a/components/config/loader/sp/sp_config_loader.c b/components/config/loader/sp/sp_config_loader.c
index a1c8804..5fa953b 100644
--- a/components/config/loader/sp/sp_config_loader.c
+++ b/components/config/loader/sp/sp_config_loader.c
@@ -4,7 +4,8 @@
*/
#include <string.h>
-#include <config/interface/platform_config.h>
+#include <config/interface/config_store.h>
+#include <config/interface/config_blob.h>
#include <platform/interface/device_region.h>
#include "sp_config_loader.h"
@@ -16,9 +17,15 @@
size_t size;
};
+static void load_device_regions(const struct ffa_name_value_pair *value_pair);
+static void load_memory_regions(const struct ffa_name_value_pair *value_pair);
+static void load_blob(const struct ffa_name_value_pair *value_pair);
+
/**
- * Loads externally provided configuration data originating from
- * theh SP manifest.
+ * Loads externally provided configuration data passed into the SP via
+ * FFA initialisation parameters. Data can originate from
+ * the SP manifest, an external device tree or a dynamic configuration
+ * mechanism such as a handover block (HOB).
*/
void sp_config_load(struct ffa_init_info *init_info)
{
@@ -27,22 +34,55 @@
if (!strcmp((const char *)init_info->nvp[param_index].name,"DEVICE_REGIONS")) {
- struct sp_param_device_region *d = (struct sp_param_device_region *)init_info->nvp[param_index].value;
+ load_device_regions(&init_info->nvp[param_index]);
+ }
+ else if (!strcmp((const char *)init_info->nvp[param_index].name,"MEMORY_REGIONS")) {
- /*Iterate over the device regions*/
- while ((uintptr_t)d < (init_info->nvp[param_index].value + init_info->nvp[param_index].size)) {
+ load_memory_regions(&init_info->nvp[param_index]);
+ }
+ else {
- struct device_region device_region;
-
- strcpy(device_region.dev_class, d->name);
- device_region.dev_instance = 0;
- device_region.base_addr = d->location;
- device_region.io_region_size = d->size;
-
- platform_config_device_add(&device_region);
-
- ++d;
- }
+ load_blob(&init_info->nvp[param_index]);
}
}
}
+
+static void load_device_regions(const struct ffa_name_value_pair *value_pair)
+{
+ struct sp_param_device_region *d = (struct sp_param_device_region *)value_pair->value;
+
+ /* Iterate over the device regions */
+ while ((uintptr_t)d < (value_pair->value + value_pair->size)) {
+
+ struct device_region device_region;
+
+ strcpy(device_region.dev_class, d->name);
+ device_region.dev_instance = 0;
+ device_region.base_addr = d->location;
+ device_region.io_region_size = d->size;
+
+ config_store_add(CONFIG_CLASSIFIER_DEVICE_REGION,
+ device_region.dev_class, device_region.dev_instance,
+ &device_region, sizeof(device_region));
+
+ ++d;
+ }
+}
+
+static void load_memory_regions(const struct ffa_name_value_pair *value_pair)
+{
+ /* Not yet supported */
+ (void)value_pair;
+}
+
+static void load_blob(const struct ffa_name_value_pair *value_pair)
+{
+ struct config_blob blob;
+
+ blob.data = (const void*)value_pair->value;
+ blob.data_len = value_pair->size;
+
+ config_store_add(CONFIG_CLASSIFIER_BLOB,
+ (const char *)value_pair->name, 0,
+ &blob, sizeof(blob));
+}