Update RPC layer initialization in SE proxy SP

Change ffa_call_ep to ts_rpc_endpoint_sp.

Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: I297fea525f6a8772d7bc5c8cd39a3711c243c843
diff --git a/deployments/se-proxy/env/commonsp/se_proxy_sp.c b/deployments/se-proxy/env/commonsp/se_proxy_sp.c
index 5990bb2..155e948 100644
--- a/deployments/se-proxy/env/commonsp/se_proxy_sp.c
+++ b/deployments/se-proxy/env/commonsp/se_proxy_sp.c
@@ -3,8 +3,8 @@
  * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
  */
 
-#include "rpc/ffarpc/endpoint/ffarpc_call_ep.h"
-#include "rpc/common/demux/rpc_demux.h"
+#include "components/rpc/common/endpoint/rpc_service_interface.h"
+#include "components/rpc/ts_rpc/endpoint/sp/ts_rpc_endpoint_sp.h"
 #include "config/ramstore/config_ramstore.h"
 #include "config/loader/sp/sp_config_loader.h"
 #include "sp_api.h"
@@ -18,13 +18,13 @@
 
 void __noreturn sp_main(union ffa_boot_info *boot_info)
 {
-	struct ffa_call_ep ffarpc_call_ep = { 0 };
+	struct ts_rpc_endpoint_sp rpc_endpoint = { 0 };
 	struct sp_msg req_msg = { 0 };
 	struct sp_msg resp_msg = { 0 };
-	struct rpc_demux rpc_demux = { 0 };
-	struct rpc_interface *rpc_iface = NULL;
+	struct rpc_service_interface *rpc_iface = NULL;
 	uint16_t own_id = 0;
 	sp_result result = SP_RESULT_INTERNAL_ERROR;
+	rpc_status_t rpc_status = RPC_ERROR_INTERNAL;
 
 	/* Boot phase */
 	if (!sp_init(&own_id)) {
@@ -39,14 +39,12 @@
 		goto fatal_error;
 	}
 
-	rpc_iface = rpc_demux_init(&rpc_demux);
-	if (!rpc_iface) {
-		EMSG("Failed to initialize RPC demux");
+	rpc_status = ts_rpc_endpoint_sp_init(&rpc_endpoint, 4, 16);
+	if (rpc_status != RPC_SUCCESS) {
+		EMSG("Failed to initialize RPC endpoint: %d", rpc_status);
 		goto fatal_error;
 	}
 
-	ffa_call_ep_init(&ffarpc_call_ep, rpc_iface, own_id);
-
 	/* Create service proxies */
 	rpc_iface = its_proxy_create();
 	if (!rpc_iface) {
@@ -54,28 +52,47 @@
 		goto fatal_error;
 	}
 
-	rpc_demux_attach(&rpc_demux, SE_PROXY_INTERFACE_ID_ITS, rpc_iface);
+	rpc_status = ts_rpc_endpoint_sp_add_service(&rpc_endpoint, rpc_iface);
+	if (rpc_status != RPC_SUCCESS) {
+		EMSG("Failed to add service to RPC endpoint: %d", rpc_status);
+		goto fatal_error;
+	}
 
 	rpc_iface = ps_proxy_create();
 	if (!rpc_iface) {
 		EMSG("Failed to create PS proxy");
 		goto fatal_error;
 	}
-	rpc_demux_attach(&rpc_demux, SE_PROXY_INTERFACE_ID_PS, rpc_iface);
+
+	rpc_status = ts_rpc_endpoint_sp_add_service(&rpc_endpoint, rpc_iface);
+	if (rpc_status != RPC_SUCCESS) {
+		EMSG("Failed to add service to RPC endpoint: %d", rpc_status);
+		goto fatal_error;
+	}
 
 	rpc_iface = crypto_proxy_create();
 	if (!rpc_iface) {
 		EMSG("Failed to create Crypto proxy");
 		goto fatal_error;
 	}
-	rpc_demux_attach(&rpc_demux, SE_PROXY_INTERFACE_ID_CRYPTO, rpc_iface);
+
+	rpc_status = ts_rpc_endpoint_sp_add_service(&rpc_endpoint, rpc_iface);
+	if (rpc_status != RPC_SUCCESS) {
+		EMSG("Failed to add service to RPC endpoint: %d", rpc_status);
+		goto fatal_error;
+	}
 
 	rpc_iface = attest_proxy_create();
 	if (!rpc_iface) {
 		EMSG("Failed to create Attestation proxy");
 		goto fatal_error;
 	}
-	rpc_demux_attach(&rpc_demux, SE_PROXY_INTERFACE_ID_ATTEST, rpc_iface);
+
+	rpc_status = ts_rpc_endpoint_sp_add_service(&rpc_endpoint, rpc_iface);
+	if (rpc_status != RPC_SUCCESS) {
+		EMSG("Failed to add service to RPC endpoint: %d", rpc_status);
+		goto fatal_error;
+	}
 
 	/* End of boot phase */
 	result = sp_msg_wait(&req_msg);
@@ -85,7 +102,7 @@
 	}
 
 	while (1) {
-		ffa_call_ep_receive(&ffarpc_call_ep, &req_msg, &resp_msg);
+		ts_rpc_endpoint_sp_receive(&rpc_endpoint, &req_msg, &resp_msg);
 
 		result = sp_msg_send_direct_resp(&resp_msg, &req_msg);
 		if (result != SP_RESULT_OK) {