test(spm): use ffa_helpers for ivy partition
Allow the ivy partition to use the ffa_helpers functions.
To achieve this we create a common struct for ff-a calls that is
used for both parameters and returns, this aligns with the Hafnium
implementation. We can then use preprocessor macros to pick either
SMC or SVC as the conduit depending on the exception level the SP
is running at.
Change-Id: Ic9525baabcf40d15545b6f6d504cf954373f08f9
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
diff --git a/spm/ivy/app/ivy_main.c b/spm/ivy/app/ivy_main.c
index 232ab2e..1aafb57 100644
--- a/spm/ivy/app/ivy_main.c
+++ b/spm/ivy/app/ivy_main.c
@@ -9,7 +9,6 @@
#include <errno.h>
#include <ffa_helpers.h>
#include <sp_debug.h>
-#include <sp_helpers.h>
#include "ivy.h"
@@ -19,46 +18,35 @@
void __dead2 ivy_main(void)
{
- u_register_t ret;
- svc_args args;
+ struct ffa_value ret;
ffa_id_t my_id;
set_putc_impl(SVC_CALL_AS_STDOUT);
/* Get FF-A id. */
- args = (svc_args){.fid = FFA_ID_GET};
- ret = sp_svc(&args);
- if (ret != FFA_SUCCESS_SMC32) {
+ ret = ffa_id_get();
+ if (ffa_func_id(ret) != FFA_SUCCESS_SMC32) {
ERROR("Cannot get FF-A id.\n");
panic();
}
- my_id = (ffa_id_t)args.arg2;
+ my_id = ffa_endpoint_id(ret);
NOTICE("Booting Secure Partition (ID: %x)\n", my_id);
NOTICE("%s\n", build_message);
NOTICE("%s\n", version_string);
init:
- args = (svc_args) {.fid = FFA_MSG_WAIT};
- ret = sp_svc(&args);
+ ret = ffa_msg_wait();
while (1) {
- ffa_id_t req_sender = (ffa_id_t)(args.arg1 >> 16);
-
- if (ret != FFA_MSG_SEND_DIRECT_REQ_SMC32) {
- ERROR("unknown FF-A request %lx\n", ret);
+ if (ffa_func_id(ret) != FFA_MSG_SEND_DIRECT_REQ_SMC32) {
+ ERROR("unknown FF-A request %x\n", ffa_func_id(ret));
goto init;
}
- VERBOSE("Received request: %lx\n", args.arg3);
+ VERBOSE("Received request: %lx\n", ret.ret3);
-
- args.fid = FFA_MSG_SEND_DIRECT_RESP_SMC32;
- args.arg1 = ((u_register_t)my_id) << 16 |
- (u_register_t)req_sender;
- args.arg2 = 0;
- args.arg3 = 0;
-
- ret = sp_svc(&args);
+ ret = ffa_msg_send_direct_resp32(my_id, ffa_dir_msg_source(ret),
+ 0, 0, 0, 0, 0);
}
}