refactor(ff-a): add payload getters
Add `ffa_partition_msg_payload` and `ffa_partition_msg_payload_const`
functions for accessing the the payload of the partition message.
These functions are necessary because the `.payload` field does not
necessary correspond to the `.offset` field.
Change-Id: I91246a084ccb68c02809b3e1afe85b07482bfb1b
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/inc/vmapi/hf/ffa.h b/inc/vmapi/hf/ffa.h
index 93c9228..875bd94 100644
--- a/inc/vmapi/hf/ffa.h
+++ b/inc/vmapi/hf/ffa.h
@@ -553,6 +553,21 @@
static_assert(sizeof(struct ffa_partition_msg) == HF_MAILBOX_SIZE,
"FF-A message size must match mailbox size");
+/**
+ * Get the partition message's payload, according to the header's `offset`
+ * field.
+ */
+static inline void *ffa_partition_msg_payload(struct ffa_partition_msg *msg)
+{
+ return (char *)msg + msg->header.offset;
+}
+
+static inline const void *ffa_partition_msg_payload_const(
+ const struct ffa_partition_msg *msg)
+{
+ return (const char *)msg + msg->header.offset;
+}
+
/* The maximum length possible for a single message. */
#define FFA_MSG_PAYLOAD_MAX HF_MAILBOX_SIZE