SPM: Test open and close handle
The tests request valid and invalid handles and close them.
Change-Id: Ie421507d8dd4793e635e82f74c206529d9ba59d0
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index 942e9f8..983aed3 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -9,6 +9,7 @@
#include <plat_topology.h>
#include <psci.h>
+#include <spci_svc.h>
#include <tftf_lib.h>
#include <trusted_os.h>
#include <tsp.h>
@@ -113,6 +114,27 @@
version & MM_VERSION_MINOR_MASK); \
} while (0)
+#define SKIP_TEST_IF_SPCI_VERSION_LESS_THAN(major, minor) \
+ do { \
+ smc_args version_smc = { SPCI_VERSION }; \
+ smc_ret_values smc_ret = tftf_smc(&version_smc); \
+ uint32_t version = smc_ret.ret0; \
+ \
+ if (version == SMC_UNKNOWN) { \
+ tftf_testcase_printf("SPM not detected.\n"); \
+ return TEST_RESULT_SKIPPED; \
+ } \
+ \
+ if (version < SPCI_VERSION_FORM(major, minor)) { \
+ tftf_testcase_printf("SPCI_VERSION returned %d.%d\n" \
+ "The required version is %d.%d\n", \
+ version >> SPCI_VERSION_MAJOR_SHIFT,\
+ version & SPCI_VERSION_MINOR_MASK, \
+ major, minor); \
+ return TEST_RESULT_SKIPPED; \
+ } \
+ } while (0)
+
/* Helper macro to verify if system suspend API is supported */
#define is_psci_sys_susp_supported() \
(tftf_get_psci_feature_info(SMC_PSCI_SYSTEM_SUSPEND) \