FFA: RXTX map/configure helper macros

Configuring/mapping RXTX buffers results in repetitive code, therefore
created helper macros.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I089b072b8b8fc49a445dcfb3967ddd4783b97628
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h
index c68a014..c91ed5f 100644
--- a/include/runtime_services/ffa_helpers.h
+++ b/include/runtime_services/ffa_helpers.h
@@ -33,10 +33,31 @@
 #include <stdint.h>
 
 struct mailbox_buffers {
-	const void *recv;
+	void *recv;
 	void *send;
 };
 
+#define CONFIGURE_MAILBOX(mb_name, buffers_size) 				\
+	do {									\
+	/* Declare RX/TX buffers at virtual FF-A instance */			\
+	static struct {								\
+			uint8_t rx[buffers_size];				\
+			uint8_t tx[buffers_size];				\
+	} __aligned(PAGE_SIZE) mb_buffers;					\
+	mb_name.recv = (void *)mb_buffers.rx;					\
+	mb_name.send = (void *)mb_buffers.tx;					\
+	} while (false)
+
+#define CONFIGURE_AND_MAP_MAILBOX(mb_name, buffers_size, smc_ret)		\
+	do {									\
+	CONFIGURE_MAILBOX(mb_name, buffers_size);				\
+	smc_ret = ffa_rxtx_map(							\
+				(uintptr_t)mb_name.send,			\
+				(uintptr_t)mb_name.recv, 			\
+				buffers_size / PAGE_SIZE			\
+			);							\
+	} while (false)
+
 struct ffa_partition_info {
 	/** The ID of the VM the information is about */
 	ffa_vm_id_t id;