SPCI is now called PSA FF-A

SPCI is renamed as PSA FF-A which stands for Platform Security
Architecture Firmware Framework for A class processors.
This patch replaces the occurrence of SPCI with PSA FF-A(in documents)
or simply FFA(in code).

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I17728c1503312845944a5ba060c252c2b98f3e91
diff --git a/spm/README.txt b/spm/README.txt
index 0a25d6b..cb22636 100644
--- a/spm/README.txt
+++ b/spm/README.txt
@@ -1,4 +1,4 @@
-This is a prototype loosely based on the SPCI Beta1 specification.
+This is a prototype loosely based on the PSA FF-A v1.0 specification.
 Any interface / platform API introduced for this is subject to
 change as it evolves.
 
diff --git a/spm/cactus/cactus-secondary.dts b/spm/cactus/cactus-secondary.dts
index 041cd31..4450b1b 100644
--- a/spm/cactus/cactus-secondary.dts
+++ b/spm/cactus/cactus-secondary.dts
@@ -11,11 +11,11 @@
 /dts-v1/;
 
 / {
-	compatible = "arm,spci-manifest-1.0";
+	compatible = "arm,ffa-manifest-1.0";
 
 	/* Properties */
 	description = "Base-1";
-	spci-version = <0x00000009>; /* 31:16 - Major, 15:0 - Minor */
+	ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */
 	uuid = <0xd1582309 0xf02347b9 0x827c4464 0xf5578fc8>;
 	id = <2>;
 	auxiliary-id = <0xae>;
@@ -34,7 +34,7 @@
 	gp-register-num = <0x0>;
 
 	rx_tx-info {
-		compatible = "arm,spci-manifest-rx_tx-buffer";
+		compatible = "arm,ffa-manifest-rx_tx-buffer";
 
 		description = "NS RX/TX Buffer";
 		pages-count = <1>;
@@ -43,7 +43,7 @@
 	};
 
 	memory-regions {
-		compatible = "arm,spci-manifest-memory-regions";
+		compatible = "arm,ffa-manifest-memory-regions";
 		test-memory {
 			description = "Test Memory";
 			pages-count = <32>; /* 128KiB with 4KiB pages */
@@ -53,7 +53,7 @@
 	};
 
 	device-regions {
-		compatible = "arm,spci-manifest-device-regions";
+		compatible = "arm,ffa-manifest-device-regions";
 		attributes = <0x0>;
 		test-reg {
 			reg = <0x10000008 0x00000001 1>; /* Arbitrary test address */
diff --git a/spm/cactus/cactus.dts b/spm/cactus/cactus.dts
index 78cbb56..ea2b133 100644
--- a/spm/cactus/cactus.dts
+++ b/spm/cactus/cactus.dts
@@ -11,11 +11,11 @@
 /dts-v1/;
 
 / {
-	compatible = "arm,spci-manifest-1.0";
+	compatible = "arm,ffa-manifest-1.0";
 
 	/* Properties */
 	description = "Base-1";
-	spci-version = <0x00000009>; /* 31:16 - Major, 15:0 - Minor */
+	ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */
 	uuid = <0xb4b5671e 0x4a904fe1 0xb81ffb13 0xdae1dacb>;
 	id = <1>;
 	auxiliary-id = <0xae>;
@@ -34,7 +34,7 @@
 	gp-register-num = <0x0>;
 
 	rx_tx-info {
-		compatible = "arm,spci-manifest-rx_tx-buffer";
+		compatible = "arm,ffa-manifest-rx_tx-buffer";
 
 		description = "NS RX/TX Buffer";
 		pages-count = <1>;
@@ -43,7 +43,7 @@
 	};
 
 	memory-regions {
-		compatible = "arm,spci-manifest-memory-regions";
+		compatible = "arm,ffa-manifest-memory-regions";
 		test-memory {
 			description = "Test Memory";
 			pages-count = <32>; /* 128KiB with 4KiB pages */
@@ -53,7 +53,7 @@
 	};
 
 	device-regions {
-		compatible = "arm,spci-manifest-device-regions";
+		compatible = "arm,ffa-manifest-device-regions";
 		attributes = <0x0>;
 		test-reg {
 			reg = <0x10000008 0x00000001 1>; /* Arbitrary test address */
diff --git a/spm/cactus/cactus_debug.c b/spm/cactus/cactus_debug.c
index cce0973..91fbfda 100644
--- a/spm/cactus/cactus_debug.c
+++ b/spm/cactus/cactus_debug.c
@@ -8,7 +8,7 @@
 #include <drivers/console.h>
 
 #include "cactus.h"
-#include "spci_helpers.h"
+#include "ffa_helpers.h"
 
 static int (*putc_impl)(int);
 
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index be137ad..375a875 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -19,7 +19,7 @@
 
 #include "cactus.h"
 #include "cactus_def.h"
-#include "spci_helpers.h"
+#include "ffa_helpers.h"
 
 /* Host machine information injected by the build system in the ELF file. */
 extern const char build_message[];
@@ -33,9 +33,9 @@
  * but rather through Hafnium print hypercall.
  *
  */
-static void __dead2 message_loop(spci_vm_id_t vm_id)
+static void __dead2 message_loop(ffa_vm_id_t vm_id)
 {
-	smc_ret_values spci_ret;
+	smc_ret_values ffa_ret;
 	uint32_t sp_response;
 
 	/*
@@ -43,22 +43,22 @@
 	 * SP initialization has completed. It blocks until receiving
 	 * a direct message request.
 	 */
-	spci_ret = spci_msg_wait();
+	ffa_ret = ffa_msg_wait();
 
 	for (;;) {
 
-		if (spci_ret.ret0 != SPCI_MSG_SEND_DIRECT_REQ_SMC32) {
-			spci_ret = spci_error(-1);
+		if (ffa_ret.ret0 != FFA_MSG_SEND_DIRECT_REQ_SMC32) {
+			ffa_ret = ffa_error(-1);
 			continue;
 		}
 
-		if (spci_ret.ret1 != SP_ID(vm_id)) {
-			spci_ret = spci_error(-2);
+		if (ffa_ret.ret1 != SP_ID(vm_id)) {
+			ffa_ret = ffa_error(-2);
 			continue;
 		}
 
-		if (spci_ret.ret2 != HYP_ID) {
-			spci_ret = spci_error(-3);
+		if (ffa_ret.ret2 != HYP_ID) {
+			ffa_ret = ffa_error(-3);
 			continue;
 		}
 
@@ -66,13 +66,13 @@
 		 * For the sake of testing, add the vm id to the
 		 * received message.
 		 */
-		sp_response = spci_ret.ret3 | vm_id;
+		sp_response = ffa_ret.ret3 | vm_id;
 
 		/*
 		 * Send a response through direct messaging then block
 		 * until receiving a new message request.
 		 */
-		spci_ret = spci_msg_send_direct_resp(SP_ID(vm_id),
+		ffa_ret = ffa_msg_send_direct_resp(SP_ID(vm_id),
 						     HYP_ID, sp_response);
 	}
 }
@@ -147,16 +147,16 @@
 	cactus_plat_configure_mmu();
 	enable_mmu_el1(0);
 
-	/* Get current SPCI id */
-	smc_ret_values spci_id_ret = spci_id_get();
-	if (spci_id_ret.ret0 != SPCI_SUCCESS_SMC32) {
-		ERROR("SPCI_ID_GET failed.\n");
+	/* Get current FFA id */
+	smc_ret_values ffa_id_ret = ffa_id_get();
+	if (ffa_id_ret.ret0 != FFA_SUCCESS_SMC32) {
+		ERROR("FFA_ID_GET failed.\n");
 		panic();
 	}
 
-	spci_vm_id_t spci_id = spci_id_ret.ret2 & 0xffff;
+	ffa_vm_id_t ffa_id = ffa_id_ret.ret2 & 0xffff;
 
-	if (spci_id == SPM_VM_ID_FIRST) {
+	if (ffa_id == SPM_VM_ID_FIRST) {
 		console_init(PL011_UART2_BASE,
 			PL011_UART2_CLK_IN_HZ,
 			PL011_BAUDRATE);
@@ -168,13 +168,13 @@
 
 		cactus_print_memory_layout();
 
-		NOTICE("SPCI id: %u\n", spci_id); /* Expect VM id 1 */
+		NOTICE("FFA id: %u\n", ffa_id); /* Expect VM id 1 */
 
 		/* Get number of VMs */
 		NOTICE("VM count: %u\n", spm_vm_get_count());
 
 		/* Get virtual CPU count for current VM */
-		NOTICE("vCPU count: %u\n", spm_vcpu_get_count(spci_id));
+		NOTICE("vCPU count: %u\n", spm_vcpu_get_count(ffa_id));
 	} else {
 		set_putc_impl(HVC_CALL_AS_STDOUT);
 
@@ -182,7 +182,7 @@
 			build_message, version_string);
 	}
 	/* End up to message loop */
-	message_loop(spci_id);
+	message_loop(ffa_id);
 
 	/* Not reached */
 }
diff --git a/spm/cactus/spci_helpers.h b/spm/cactus/ffa_helpers.h
similarity index 62%
rename from spm/cactus/spci_helpers.h
rename to spm/cactus/ffa_helpers.h
index 189df9a..8f6beb4 100644
--- a/spm/cactus/spci_helpers.h
+++ b/spm/cactus/ffa_helpers.h
@@ -4,11 +4,11 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#ifndef __SPCI_HELPERS_H__
-#define __SPCI_HELPERS_H__
+#ifndef __FFA_HELPERS_H__
+#define __FFA_HELPERS_H__
 
 
-#include <spci_svc.h>
+#include <ffa_svc.h>
 #include "tftf_lib.h"
 
 #define SPM_VM_ID_FIRST                 (1)
@@ -17,19 +17,19 @@
 #define SPM_VCPU_GET_COUNT              (0xFF02)
 #define SPM_DEBUG_LOG                   (0xBD000000)
 
-/* Hypervisor ID at physical SPCI instance */
+/* Hypervisor ID at physical FFA instance */
 #define HYP_ID          (0)
 
 /* By convention, SP IDs (as opposed to VM IDs) have bit 15 set */
 #define SP_ID(x)        ((x) | (1 << 15))
 
-typedef unsigned short spci_vm_id_t;
-typedef unsigned short spci_vm_count_t;
-typedef unsigned short spci_vcpu_count_t;
+typedef unsigned short ffa_vm_id_t;
+typedef unsigned short ffa_vm_count_t;
+typedef unsigned short ffa_vcpu_count_t;
 
 /* Functions */
 
-static inline spci_vcpu_count_t spm_vcpu_get_count(spci_vm_id_t vm_id)
+static inline ffa_vcpu_count_t spm_vcpu_get_count(ffa_vm_id_t vm_id)
 {
 	hvc_args args = {
 		.fid = SPM_VCPU_GET_COUNT,
@@ -41,7 +41,7 @@
 	return ret.ret0;
 }
 
-static inline spci_vm_count_t spm_vm_get_count(void)
+static inline ffa_vm_count_t spm_vm_get_count(void)
 {
 	hvc_args args = {
 		.fid = SPM_VM_GET_COUNT
@@ -62,31 +62,31 @@
 	(void)tftf_hvc(&args);
 }
 
-static inline smc_ret_values spci_id_get(void)
+static inline smc_ret_values ffa_id_get(void)
 {
 	smc_args args = {
-		.fid = SPCI_ID_GET
+		.fid = FFA_ID_GET
 	};
 
 	return tftf_smc(&args);
 }
 
-static inline smc_ret_values spci_msg_wait(void)
+static inline smc_ret_values ffa_msg_wait(void)
 {
 	smc_args args = {
-		.fid = SPCI_MSG_WAIT
+		.fid = FFA_MSG_WAIT
 	};
 
 	return tftf_smc(&args);
 }
 
 /* Send response through registers using direct messaging */
-static inline smc_ret_values spci_msg_send_direct_resp(spci_vm_id_t sender_vm_id,
-						spci_vm_id_t target_vm_id,
+static inline smc_ret_values ffa_msg_send_direct_resp(ffa_vm_id_t sender_vm_id,
+						ffa_vm_id_t target_vm_id,
 						uint32_t message)
 {
 	smc_args args = {
-		.fid = SPCI_MSG_SEND_DIRECT_RESP_SMC32,
+		.fid = FFA_MSG_SEND_DIRECT_RESP_SMC32,
 		.arg1 = ((uint32_t)sender_vm_id << 16) | target_vm_id,
 		.arg3 = message
 	};
@@ -94,10 +94,10 @@
 	return tftf_smc(&args);
 }
 
-static inline smc_ret_values spci_error(int32_t error_code)
+static inline smc_ret_values ffa_error(int32_t error_code)
 {
 	smc_args args = {
-		.fid = SPCI_ERROR,
+		.fid = FFA_ERROR,
 		.arg1 = 0,
 		.arg2 = error_code
 	};
@@ -105,4 +105,4 @@
 	return tftf_smc(&args);
 }
 
-#endif /* __SPCI_HELPERS_H__ */
+#endif /* __FFA_HELPERS_H__ */