cactus: add commands CACTUS_ECHO_CMD and CACTUS_REQ_ECHO_CMD
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Ide72ffab984b59400b4bdf84fd0ba6542969d0eb
diff --git a/spm/cactus/cactus_test_cmds.h b/spm/cactus/cactus_test_cmds.h
index 1fc4bba..52aa55b 100644
--- a/spm/cactus/cactus_test_cmds.h
+++ b/spm/cactus/cactus_test_cmds.h
@@ -35,6 +35,35 @@
smc_ret.ret6, smc_ret.ret7)
/**
+ * With this test command the sender transmits a 64-bit value that it then
+ * expects to receive on the respective command response.
+ *
+ * The id is the hex representation of the string 'echo'.
+ */
+#define CACTUS_ECHO_CMD U(0x6563686f)
+
+#define CACTUS_ECHO_SEND_CMD(source, dest, echo_val) \
+ CACTUS_SEND_CMD(source, dest, CACTUS_ECHO_CMD, echo_val,\
+ 0, 0, 0)
+
+#define CACTUS_ECHO_GET_VAL(smc_ret) smc_ret.ret4
+
+/**
+ * Command to request a cactus secure partition to send an echo command to
+ * another partition.
+ *
+ * The sender of this command expects to receive CACTUS_SUCCESS if the requested
+ * echo interaction happened successfully, or CACTUS_ERROR otherwise.
+ */
+#define CACTUS_REQ_ECHO_CMD (CACTUS_ECHO_CMD + 1)
+
+#define CACTUS_REQ_ECHO_SEND_CMD(source, dest, echo_dest, echo_val) \
+ CACTUS_SEND_CMD(source, dest, CACTUS_REQ_ECHO_CMD, echo_val, \
+ echo_dest, 0, 0)
+
+#define CACTUS_REQ_ECHO_GET_ECHO_DEST(smc_ret) smc_ret.ret5
+
+/**
* Command to notify cactus of a memory management operation. The cmd value
* should be the memory management smc function id.
*/
@@ -57,4 +86,7 @@
#define CACTUS_GET_RESPONSE(smc_ret) smc_ret.ret3
+#define CACTUS_IS_SUCCESS_RESP(smc_ret) \
+ (CACTUS_GET_RESPONSE(smc_ret) == CACTUS_SUCCESS)
+
#endif