TFTF: Use CACTUS_ECHO_CMD in direct message tests
There were two very similar tests, that were targeted to the same
purpose. This patch keeps the logic using an echo value, as it was being
used in tests involving SPs.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Ib278d28098e60dddf807b267951f7e2b8762e9e3
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 37b8bd5..650f06d 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -41,9 +41,7 @@
static void __dead2 message_loop(ffa_vm_id_t vm_id, struct mailbox_buffers *mb)
{
smc_ret_values ffa_ret;
- uint32_t sp_response;
ffa_vm_id_t destination;
- uint64_t cactus_cmd;
/*
* This initial wait call is necessary to inform SPMD that
@@ -54,8 +52,6 @@
ffa_ret = ffa_msg_wait();
for (;;) {
- /* temporary 'skip_switch' label. Deleted in following commit */
- skip_switch:
VERBOSE("Woke up with func id: %x\n", ffa_func_id(ffa_ret));
if (ffa_func_id(ffa_ret) == FFA_ERROR) {
@@ -80,25 +76,7 @@
PRINT_CMD(ffa_ret);
- cactus_cmd = cactus_get_cmd(ffa_ret);
-
- if (cactus_handle_cmd(&ffa_ret, &ffa_ret, mb)) {
- goto skip_switch;
- }
- switch (cactus_cmd) {
- default:
- /*
- * Currently direct message test is handled here.
- * TODO: create a case within the switch case
- * For the sake of testing, add the vm id to the
- * received message.
- */
- sp_response = ffa_ret.ret3 | vm_id;
- VERBOSE("Replying with direct message response: %x\n", sp_response);
- ffa_ret = ffa_msg_send_direct_resp(vm_id,
- HYP_ID,
- sp_response);
-
+ if (!cactus_handle_cmd(&ffa_ret, &ffa_ret, mb)) {
break;
}
}
diff --git a/spm/cactus/cactus_test_cmds.c b/spm/cactus/cactus_test_cmds.c
index 128f4c0..e13e40d 100644
--- a/spm/cactus/cactus_test_cmds.c
+++ b/spm/cactus/cactus_test_cmds.c
@@ -21,12 +21,14 @@
bool cactus_handle_cmd(smc_ret_values *cmd_args, smc_ret_values *ret,
struct mailbox_buffers *mb)
{
+ uint64_t in_cmd;
+
if (cmd_args == NULL || ret == NULL) {
ERROR("Invalid argumentos passed to %s!\n", __func__);
return false;
}
- uint64_t in_cmd = cactus_get_cmd(*cmd_args);
+ in_cmd = cactus_get_cmd(*cmd_args);
for (struct cactus_cmd_handler *it_cmd = cactus_cmd_handler_begin;
it_cmd < cactus_cmd_handler_end;
@@ -37,5 +39,8 @@
}
}
- return false;
+ *ret = cactus_error_resp(ffa_dir_msg_dest(*cmd_args),
+ ffa_dir_msg_source(*cmd_args),
+ CACTUS_ERROR_UNHANDLED);
+ return true;
}
diff --git a/spm/cactus/cactus_test_cmds.h b/spm/cactus/cactus_test_cmds.h
index d8bba95..f892a2c 100644
--- a/spm/cactus/cactus_test_cmds.h
+++ b/spm/cactus/cactus_test_cmds.h
@@ -23,6 +23,7 @@
#define CACTUS_ERROR_INVALID U(1)
#define CACTUS_ERROR_TEST U(2)
#define CACTUS_ERROR_FFA_CALL U(3)
+#define CACTUS_ERROR_UNHANDLED U(4)
/**
* Get command from struct smc_ret_values.