Parse HW features from the SP manifest
Read the "arm,hw-features" node of the SP manifest and add its contents
to the config store. This way the SPMC can pass information about which
HW features are implemented by the core, since the SP itself cannot
discover this info (to read the necessary feature description registers
the exception level must be EL1 or higher).
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: I47844189c70e536817d32b674c7253f4f16efd75
diff --git a/components/config/loader/sp/sp_config_loader.c b/components/config/loader/sp/sp_config_loader.c
index a515cb2..d4a6119 100644
--- a/components/config/loader/sp/sp_config_loader.c
+++ b/components/config/loader/sp/sp_config_loader.c
@@ -279,5 +279,29 @@
}
}
+ /* Find hardware features */
+ node = fdt_node_offset_by_compatible(fdt, root, "arm,hw-features");
+ if (node >= 0) {
+ const char *prop_name = NULL;
+ uint32_t prop_value = 0;
+ int prop_offset = 0;
+
+ fdt_for_each_property_offset(prop_offset, fdt, node) {
+ if (!dt_get_u32_by_offset(fdt, prop_offset, &prop_name, &prop_value)) {
+ /* skip other properties in the node, e.g. the compatible string */
+ DMSG("skipping non-u32 property '%s' in hw-features", prop_name);
+ continue;
+ }
+
+ if (!config_store_add(CONFIG_CLASSIFIER_HW_FEATURE, prop_name, 0,
+ &prop_value, sizeof(prop_value))) {
+ DMSG("error: failed to add HW feature to config store");
+ return false;
+ }
+ }
+ } else {
+ DMSG("arm,hw-features node not present in SP manifest");
+ }
+
return true;
}