aboutsummaryrefslogtreecommitdiff
path: root/services/std_svc
diff options
context:
space:
mode:
authorMarc Bonnici <marc.bonnici@arm.com>2019-11-14 16:28:23 +0000
committerMarc Bonnici <marc.bonnici@arm.com>2019-11-25 15:01:06 +0000
commit6000303269b2cf6705dc74340cc26fcc8174dc55 (patch)
tree0856758d98cd596493f032475bf9607b6dc86431 /services/std_svc
parent789e030c3de002ff7ea2d0ea17cbe81e5177cbf7 (diff)
downloadtrusted-firmware-a-topics/spci_beta0_spmd.tar.gz
SPMD: Add support for SPCI_ID_GETtopics/spci_beta0_spmd
This patch introduces the `SPCI_ID_GET` interface which will return the ID of the calling SPCI component. Returns 0 for requests from the non-secure world and the spmc component ID as specified in the manifest for secure world requests. Change-Id: Id61725f8195106f9a30d61b9d99ed1d7da8c1163
Diffstat (limited to 'services/std_svc')
-rw-r--r--services/std_svc/spmd/spmd_main.c33
-rw-r--r--services/std_svc/spmd/spmd_private.h9
2 files changed, 42 insertions, 0 deletions
diff --git a/services/std_svc/spmd/spmd_main.c b/services/std_svc/spmd/spmd_main.c
index 251c05d7df..ad88536b76 100644
--- a/services/std_svc/spmd/spmd_main.c
+++ b/services/std_svc/spmd/spmd_main.c
@@ -208,6 +208,16 @@ int32_t spmd_setup(void)
INFO("SPM core run time EL%x.\n", spmc_attrs.runtime_el);
+ /* Validate the SPMC ID, Ensure high bit is set */
+ if (!(spmc_attrs.spmc_id >> SPMC_SECURE_ID_SHIFT) &
+ SPMC_SECURE_ID_MASK) {
+ WARN("Invalid ID (0x%x) for SPMC.\n",
+ spmc_attrs.spmc_id);
+ goto error;
+ }
+
+ INFO("SPMC ID %x.\n", spmc_attrs.spmc_id);
+
/* Validate the SPM core execution state */
if ((spmc_attrs.exec_state != MODE_RW_64) &&
(spmc_attrs.exec_state != MODE_RW_32)) {
@@ -392,6 +402,29 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2,
SMC_GET_GP(handle, CTX_GPREG_X6),
SMC_GET_GP(handle, CTX_GPREG_X7));
}
+ case SPCI_ID_GET:
+ /*
+ * Returns the ID of the calling SPCI component.
+ */
+ if (in_sstate == NON_SECURE) {
+ SMC_RET8(handle, SPCI_SUCCESS,
+ SPCI_TARGET_INFO_MBZ,
+ SPCI_NS_ENDPOINT_ID,
+ SPCI_PARAM_MBZ,
+ SPCI_PARAM_MBZ,
+ SPCI_PARAM_MBZ,
+ SPCI_PARAM_MBZ,
+ SPCI_PARAM_MBZ);
+ } else {
+ SMC_RET8(handle, SPCI_SUCCESS,
+ SPCI_TARGET_INFO_MBZ,
+ spmc_attrs.spmc_id,
+ SPCI_PARAM_MBZ,
+ SPCI_PARAM_MBZ,
+ SPCI_PARAM_MBZ,
+ SPCI_PARAM_MBZ,
+ SPCI_PARAM_MBZ);
+ }
case SPCI_RX_RELEASE:
case SPCI_RXTX_MAP_SMC32:
diff --git a/services/std_svc/spmd/spmd_private.h b/services/std_svc/spmd/spmd_private.h
index eb9a5c5f4f..4420597c7f 100644
--- a/services/std_svc/spmd/spmd_private.h
+++ b/services/std_svc/spmd/spmd_private.h
@@ -81,6 +81,15 @@ extern const spd_pm_ops_t spmd_pm;
/* SPMC entry point information */
extern entry_point_info_t *spmc_ep_info;
+/*
+ * Reserve ID for NS physical SPCI Endpoint.
+ */
+#define SPCI_NS_ENDPOINT_ID U(0)
+
+/* Mask and shift to check valid secure SPCI Endpoint ID. */
+#define SPMC_SECURE_ID_MASK 0x1
+#define SPMC_SECURE_ID_SHIFT 15
+
#endif /* __ASSEMBLY__ */
#endif /* SPMD_PRIVATE_H */