Tidying FFA helpers

Moved SP specific functions/macros to "sp_helpers.c/h".
Placed ffa interfaces/symbols shared between tftf and SPs in
"ffa_helpers.c/h".

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I4cf967f87837ce3e7d0f7244f9cc0677f608f9cd
diff --git a/spm/common/sp_helpers.c b/spm/common/sp_helpers.c
index 5aec977..7dc1648 100644
--- a/spm/common/sp_helpers.c
+++ b/spm/common/sp_helpers.c
@@ -9,6 +9,9 @@
 #include <platform_def.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include <ffa_svc.h>
+
+#include "sp_helpers.h"
 
 uintptr_t bound_rand(uintptr_t min, uintptr_t max)
 {
@@ -52,7 +55,7 @@
 
 void announce_test_end(const char *test_desc)
 {
-	INFO("Test \"%s\" passed.\n", test_desc);
+	INFO("Test \"%s\" end.\n", test_desc);
 }
 
 void sp_sleep(uint32_t ms)
@@ -67,3 +70,40 @@
 		time2 = mmio_read_64(SYS_CNT_READ_BASE);
 	}
 }
+
+/*******************************************************************************
+ * Hypervisor Calls Wrappers
+ ******************************************************************************/
+
+ffa_vcpu_count_t spm_vcpu_get_count(ffa_vm_id_t vm_id)
+{
+	hvc_args args = {
+		.fid = SPM_VCPU_GET_COUNT,
+		.arg1 = vm_id
+	};
+
+	hvc_ret_values ret = tftf_hvc(&args);
+
+	return ret.ret0;
+}
+
+ffa_vm_count_t spm_vm_get_count(void)
+{
+	hvc_args args = {
+		.fid = SPM_VM_GET_COUNT
+	};
+
+	hvc_ret_values ret = tftf_hvc(&args);
+
+	return ret.ret0;
+}
+
+void spm_debug_log(char c)
+{
+	hvc_args args = {
+		.fid = SPM_DEBUG_LOG,
+		.arg1 = c
+	};
+
+	(void)tftf_hvc(&args);
+}
diff --git a/spm/common/sp_helpers.h b/spm/common/sp_helpers.h
index d06fec3..2b9cc2e 100644
--- a/spm/common/sp_helpers.h
+++ b/spm/common/sp_helpers.h
@@ -8,6 +8,14 @@
 #define SP_HELPERS_H
 
 #include <stdint.h>
+#include <tftf_lib.h>
+#include <ffa_helpers.h>
+
+#define SPM_VM_ID_FIRST                 (1)
+
+#define SPM_VM_GET_COUNT                (0xFF01)
+#define SPM_VCPU_GET_COUNT              (0xFF02)
+#define SPM_DEBUG_LOG                   (0xBD000000)
 
 typedef struct {
 	u_register_t fid;
@@ -57,4 +65,14 @@
 /* Sleep for at least 'ms' milliseconds. */
 void sp_sleep(uint32_t ms);
 
+/*
+ * Hypervisor Calls Wrappers
+ */
+
+ffa_vcpu_count_t spm_vcpu_get_count(ffa_vm_id_t vm_id);
+
+ffa_vm_count_t spm_vm_get_count(void);
+
+void spm_debug_log(char c);
+
 #endif /* SP_HELPERS_H */