aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Bonnici <marc.bonnici@arm.com>2021-08-24 11:31:52 +0100
committerMarc Bonnici <marc.bonnici@arm.com>2021-10-06 16:00:34 +0100
commit52756cb3d2b16df4e0c1255be4735c900c71d9b1 (patch)
tree9f67784271e064c4bc9b76548b4df9154148f6da
parentb744d4fef9c9b85c30b67380a2ea6cf7aa7869c6 (diff)
downloadtrusted-firmware-a-52756cb3d2b16df4e0c1255be4735c900c71d9b1.tar.gz
spmc: Enable Parsing of UUID from SP Manifest
Traditionally TF-A has used big endian representation and stored uuids at uint8's. FFA expects UUIDs to be little endian and stores as uint32s in other components. After using the TF-A uuid parser convert the output before storing in the partition context for easier use within FFA. Change-Id: I7de5d5ef8d98dc14bc7c76892133c2333358a379 Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
-rw-r--r--services/std_svc/spm/spmc/spmc.h5
-rw-r--r--services/std_svc/spm/spmc/spmc_main.c24
2 files changed, 29 insertions, 0 deletions
diff --git a/services/std_svc/spm/spmc/spmc.h b/services/std_svc/spm/spmc/spmc.h
index 5c0bc4d742..d043f5faeb 100644
--- a/services/std_svc/spm/spmc/spmc.h
+++ b/services/std_svc/spm/spmc/spmc.h
@@ -72,6 +72,11 @@ typedef struct spmc_sp_context {
*/
struct mailbox mailbox;
+ /*
+ * Partition UUID
+ */
+ uint32_t uuid[4];
+
} spmc_sp_context_t;
#endif /* SPMC_H */
diff --git a/services/std_svc/spm/spmc/spmc_main.c b/services/std_svc/spm/spmc/spmc_main.c
index 0b4d9356e9..6f78b63e34 100644
--- a/services/std_svc/spm/spmc/spmc_main.c
+++ b/services/std_svc/spm/spmc/spmc_main.c
@@ -140,6 +140,20 @@ static void populate_sp_mem_regions(sp_context_t *sp_ctx,
}
}
+/*
+ * Convert from the traditional TF-A representation of a UUID,
+ * big endian uint8 to little endian uint32 to be inline
+ * with FF-A.
+ */
+void convert_uuid_endian(uint8_t *be_8, uint32_t *le_32) {
+ for (int i = 0; i < 4; i++){
+ le_32[i] = be_8[(i*4)+0] << 24 |
+ be_8[(i*4)+1] << 16 |
+ be_8[(i*4)+2] << 8 |
+ be_8[(i*4)+3] << 0;
+ }
+}
+
/*******************************************************************************
* This function will parse the Secure Partition Manifest. From manifest, it
* will fetch details for preparing Secure partition image context and secure
@@ -218,6 +232,16 @@ static int sp_manifest_parse(void *sp_manifest, int offset,
else
sp_ctx->sp_pcpu_stack_size = config;
+ uint8_t be_uuid[16];
+ ret = fdtw_read_uuid(sp_manifest, node, "uuid", 16,
+ be_uuid);
+ if (ret)
+ WARN("Missing Secure Partition UUID.\n");
+ else {
+ /* Convert from BE to LE to store internally. */
+ convert_uuid_endian(be_uuid, spmc_sp_ctx[next_available_sp_index].uuid);
+ }
+
ret = fdt_read_uint32(sp_manifest, node,
"runtime-el", &config_32);
if (ret)