TFTF: helpers for SPM tests
Added functions and macros to help check at the beginning of the test,
that system is as expected for SPM tests in which Hafnium is deployed as
SPMC.
This includes:
- Checking SPMC has expected FFA_VERSION;
- Checking that expected FF-A endpoints are deployed in the system;
- Getting global TFTF mailbox.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I9195bcff8ed93156e838b192bb70a9634e18fbbf
diff --git a/tftf/tests/common/test_helpers.c b/tftf/tests/common/test_helpers.c
index b1868cd..9861070 100644
--- a/tftf/tests/common/test_helpers.c
+++ b/tftf/tests/common/test_helpers.c
@@ -147,3 +147,33 @@
}
return false;
}
+
+test_result_t check_hafnium_spmc_testing_set_up(
+ uint32_t ffa_version_major, uint32_t ffa_version_minor,
+ const struct ffa_uuid *ffa_uuids, size_t ffa_uuids_size)
+{
+ struct mailbox_buffers mb;
+
+ if (ffa_uuids == NULL) {
+ ERROR("Invalid parameter ffa_uuids!\n");
+ return TEST_RESULT_FAIL;
+ }
+
+ SKIP_TEST_IF_FFA_VERSION_LESS_THAN(ffa_version_major,
+ ffa_version_minor);
+
+ /**********************************************************************
+ * If OP-TEE is SPMC skip the current test.
+ **********************************************************************/
+ if (check_spmc_execution_level()) {
+ VERBOSE("OPTEE as SPMC at S-EL1. Skipping test!\n");
+ return TEST_RESULT_SKIPPED;
+ }
+
+ GET_TFTF_MAILBOX(mb);
+
+ for (unsigned int i = 0U; i < ffa_uuids_size; i++)
+ SKIP_TEST_IF_FFA_ENDPOINT_NOT_DEPLOYED(*mb, ffa_uuids[i].uuid);
+
+ return TEST_RESULT_SUCCESS;
+}