aboutsummaryrefslogtreecommitdiff
path: root/services/std_svc/spmd
diff options
context:
space:
mode:
Diffstat (limited to 'services/std_svc/spmd')
-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 */