Cactus: FFA Version Test

Added simple test of the FFA interface to cactus:
- FFA version ABI helper;
- New test file for test to FFA ABIs;
- Invoking "ffa_tests" from cactus main.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I8c8445ad6d9da79f1880d143836e7a6da68eaff7
diff --git a/spm/cactus/cactus_ffa_tests.c b/spm/cactus/cactus_ffa_tests.c
new file mode 100644
index 0000000..2143e75
--- /dev/null
+++ b/spm/cactus/cactus_ffa_tests.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#include <assert.h>
+#include <errno.h>
+#include <debug.h>
+#include "ffa_helpers.h"
+#include <sp_helpers.h>
+
+/* FFA version test helpers */
+#define FFA_MAJOR 1U
+#define FFA_MINOR 0U
+
+void ffa_tests(void)
+{
+	const char *test_ffa = "FFA Interfaces";
+	const char *test_ffa_version = "FFA Version interface";
+
+	announce_test_section_start(test_ffa);
+
+	announce_test_start(test_ffa_version);
+
+	smc_ret_values ret = ffa_version(MAKE_FFA_VERSION(FFA_MAJOR, FFA_MINOR));
+	uint32_t spm_version = (uint32_t)(0xFFFFFFFF & ret.ret0);
+
+	bool ffa_version_compatible = ((spm_version >> FFA_VERSION_MAJOR_SHIFT) == FFA_MAJOR &&
+				       (FFA_VERSION_MINOR_MASK & spm_version) >= FFA_MINOR);
+
+	NOTICE("FFA_VERSION returned %u.%u; Compatible: %i\n",
+		spm_version >> FFA_VERSION_MAJOR_SHIFT,
+		spm_version & FFA_VERSION_MINOR_MASK,
+		(int)ffa_version_compatible);
+
+	expect((int)ffa_version_compatible, (int)true);
+
+	announce_test_end(test_ffa_version);
+
+	announce_test_section_end(test_ffa);
+}