cactus: add command to request memory sharing between SPs
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Id6f2557b7ae0f9f5d74f194a2cb35f5a571192ff
diff --git a/spm/cactus/cactus_test_cmds.h b/spm/cactus/cactus_test_cmds.h
index 3e16e57..0a31783 100644
--- a/spm/cactus/cactus_test_cmds.h
+++ b/spm/cactus/cactus_test_cmds.h
@@ -97,21 +97,37 @@
* Command to notify cactus of a memory management operation. The cmd value
* should be the memory management smc function id.
*/
-#define CACTUS_MEM_SEND_CMD(source, dest, mem_func, handle) \
+#define CACTUS_MEM_SEND_CMD(source, dest, mem_func, handle) \
CACTUS_SEND_CMD(source, dest, mem_func, handle, 0, 0, 0)
#define CACTUS_MEM_SEND_GET_HANDLE(smc_ret) smc_ret.ret4
/**
+ * Command to request a memory management operation. The 'mem_func' argument
+ * identifies the operation that is to be performend, and 'receiver' is the id
+ * of the partition to receive the memory region.
+ *
+ * The command id is the hex representation of the string "memory".
+ */
+#define CACTUS_REQ_MEM_SEND_CMD U(0x6d656d6f7279)
+
+#define CACTUS_REQ_MEM_SEND_SEND_CMD(source, dest, mem_func, receiver) \
+ CACTUS_SEND_CMD(source, dest, CACTUS_REQ_MEM_SEND_CMD, mem_func, \
+ receiver, 0, 0)
+
+#define CACTUS_REQ_MEM_SEND_GET_MEM_FUNC(smc_ret) smc_ret.ret4
+#define CACTUS_REQ_MEM_SEND_GET_RECEIVER(smc_ret) smc_ret.ret5
+
+/**
* Template for responses to CACTUS commands.
*/
-#define CACTUS_RESPONSE(source, dest, response) \
+#define CACTUS_RESPONSE(source, dest, response) \
ffa_msg_send_direct_resp(source, dest, response)
-#define CACTUS_SUCCESS_RESP(source, dest) \
+#define CACTUS_SUCCESS_RESP(source, dest) \
CACTUS_RESPONSE(source, dest, CACTUS_SUCCESS)
-#define CACTUS_ERROR_RESP(source, dest) \
+#define CACTUS_ERROR_RESP(source, dest) \
CACTUS_RESPONSE(source, dest, CACTUS_ERROR)
#define CACTUS_GET_RESPONSE(smc_ret) smc_ret.ret3
@@ -119,4 +135,7 @@
#define CACTUS_IS_SUCCESS_RESP(smc_ret) \
(CACTUS_GET_RESPONSE(smc_ret) == CACTUS_SUCCESS)
+#define CACTUS_IS_ERROR_RESP(smc_ret) \
+ (CACTUS_GET_RESPONSE(smc_ret) == CACTUS_ERROR)
+
#endif