aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Bonnici <marc.bonnici@arm.com>2021-08-19 14:21:09 +0100
committerMarc Bonnici <marc.bonnici@arm.com>2021-10-06 16:00:34 +0100
commite3bacd043d4f264915ab6984427d091c0ff0fd19 (patch)
treec1e2e0c3bcfecc22f271e7ba3695b4b0c53a1ad5
parentdde7e7be815e5fd1c3da4c4d90b5e1dfcf32de14 (diff)
downloadtrusted-firmware-a-e3bacd043d4f264915ab6984427d091c0ff0fd19.tar.gz
ffa_svc: Add helper macros to determine FFA ID states
Add macros to help determine which security state a FFA partition ID refers to, along with seperating a sender and receivers partition ID. Change-Id: I64858de533741d8fbc35a236be16f93957237206 Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
-rw-r--r--include/services/ffa_svc.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/services/ffa_svc.h b/include/services/ffa_svc.h
index ab36d9e1f6..0df03f8544 100644
--- a/include/services/ffa_svc.h
+++ b/include/services/ffa_svc.h
@@ -7,6 +7,8 @@
#ifndef FFA_SVC_H
#define FFA_SVC_H
+#include <stdbool.h>
+
#include <lib/smccc.h>
#include <lib/utils_def.h>
#include <tools_share/uuid.h>
@@ -53,6 +55,15 @@
(((blk) & FFA_MSG_SEND_ATTRS_BLK_MASK) \
<< FFA_MSG_SEND_ATTRS_BLK_SHIFT)
+
+/* FFA_RELATED helper macros */
+#define FFA_PARTITION_ID_MASK 0xFFFF
+#define FFA_SENDER(src_dst_ids) \
+ ((src_dst_ids >> 16) & FFA_PARTITION_ID_MASK)
+#define FFA_RECEIVER(src_dst_ids) \
+ (src_dst_ids & FFA_PARTITION_ID_MASK)
+
+
/* Get FFA fastcall std FID from function number */
#define FFA_FID(smc_cc, func_num) \
((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \
@@ -162,6 +173,11 @@
#define FFA_ENDPOINT_ID_MAX U(1 << 16)
/*
+ * FFA Mask for the normal world.
+ */
+#define FFA_SECURE_WORLD_ID_MASK U(0x8000)
+
+/*
* Mask for source and destination endpoint id in
* a direct message request/response.
*/
@@ -195,4 +211,22 @@ static inline uint16_t ffa_endpoint_source(unsigned int ep)
FFA_DIRECT_MSG_ENDPOINT_ID_MASK;
}
+/******************************************************************************
+ * ffa helper functions to determine partition ID world
+ *****************************************************************************/
+
+/*
+ * Determine if provided ID is in the secure world.
+ */
+static inline bool ffa_is_secure_world_id(uint16_t id) {
+ return id & FFA_SECURE_WORLD_ID_MASK;
+}
+
+/*
+ * Determine if provided ID is in the normal world.
+ */
+static inline bool ffa_is_normal_world_id(uint16_t id) {
+ return !ffa_is_secure_world_id(id);
+}
+
#endif /* FFA_SVC_H */