Update RPC init for ITS and PS in psa-api-test

Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: I8ea37d05ac9a3b055c8186b6bac9742bfa0d6612
diff --git a/deployments/psa-api-test/arch_test_runner.c b/deployments/psa-api-test/arch_test_runner.c
index e8745d8..8fd3dac 100644
--- a/deployments/psa-api-test/arch_test_runner.c
+++ b/deployments/psa-api-test/arch_test_runner.c
@@ -10,9 +10,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include "rpc/common/logging/logging_caller.h"
 #include "service_under_test.h"
-#include "service_locator.h"
 
 #define TEST_ID_OFFSET      (5)
 #define TEST_POSTFIX_OFFSET (8)
@@ -118,11 +116,6 @@
 {
     int rval = -1;
     int option_index = 0;
-    struct logging_caller *selected_call_logger = NULL;
-    struct logging_caller call_logger;
-
-    logging_caller_init(&call_logger, stdout);
-    service_locator_init();
 
      /* Print available tests */
     if (option_selected("-l", argc, argv, &option_index)) {
@@ -149,10 +142,6 @@
         pal_set_custom_test_list(test_list_values);
     }
 
-    /* Setup verbose mode */
-    if (option_selected("-v", argc, argv, &option_index))
-        selected_call_logger = &call_logger;
-
     /* Print help */
     if (option_selected("-h", argc, argv, &option_index)) {
         print_help();
@@ -160,7 +149,7 @@
     }
 
     /* Locate service under test */
-    rval = locate_service_under_test(selected_call_logger);
+    rval = locate_service_under_test();
 
     /* Run tests */
     if (!rval) {
@@ -174,7 +163,5 @@
         printf("Failed to locate service under test.  Error code: %d\n", rval);
     }
 
-    logging_caller_deinit(&call_logger);
-
     return rval;
 }
diff --git a/deployments/psa-api-test/internal_trusted_storage/its_locator.c b/deployments/psa-api-test/internal_trusted_storage/its_locator.c
index e100328..7119d21 100644
--- a/deployments/psa-api-test/internal_trusted_storage/its_locator.c
+++ b/deployments/psa-api-test/internal_trusted_storage/its_locator.c
@@ -12,40 +12,32 @@
 #include "../service_under_test.h"
 
 /* RPC context */
-static rpc_session_handle session_handle = NULL;
+static struct rpc_caller_session *session = NULL;
 static struct service_context *ps_service_context = NULL;
 static struct secure_storage_client storage_client;
 
-int locate_service_under_test(struct logging_caller *call_logger)
+int locate_service_under_test(void)
 {
 	int status = -1;
 
-	if (!session_handle && !ps_service_context) {
+	service_locator_init();
 
-		struct rpc_caller *caller;
+	if (!session && !ps_service_context) {
 
 		ps_service_context =
-			service_locator_query("sn:trustedfirmware.org:internal-trusted-storage:0", &status);
+			service_locator_query("sn:trustedfirmware.org:internal-trusted-storage:0");
 
 		if (ps_service_context) {
 
-			session_handle =
-				service_context_open(ps_service_context, TS_RPC_ENCODING_PACKED_C, &caller);
+			session =
+				service_context_open(ps_service_context);
 
-			if (session_handle) {
+			if (session) {
 
 				struct storage_backend *storage_backend = NULL;
 				status = -1;
 
-				if (call_logger) {
-
-					storage_backend = secure_storage_client_init(&storage_client,
-						logging_caller_attach(call_logger, caller));
-				}
-				else {
-
-					storage_backend = secure_storage_client_init(&storage_client,  caller);
-				}
+				storage_backend = secure_storage_client_init(&storage_client, session);
 
 				if (storage_backend) {
 
@@ -61,15 +53,15 @@
 	return status;
 }
 
-void relinquish_service_under_test(void)
+int relinquish_service_under_test(void)
 {
 	psa_its_frontend_init(NULL);
 	secure_storage_client_deinit(&storage_client);
 
-	if (ps_service_context && session_handle) {
+	if (ps_service_context && session) {
 
-		service_context_close(ps_service_context, session_handle);
-		session_handle = NULL;
+		service_context_close(ps_service_context, session);
+		session = NULL;
 	}
 
 	if (ps_service_context) {
@@ -77,4 +69,6 @@
 		service_context_relinquish(ps_service_context);
 		ps_service_context = NULL;
 	}
+
+	return 0;
 }
diff --git a/deployments/psa-api-test/protected_storage/ps_locator.c b/deployments/psa-api-test/protected_storage/ps_locator.c
index 3ed35b6..aba8547 100644
--- a/deployments/psa-api-test/protected_storage/ps_locator.c
+++ b/deployments/psa-api-test/protected_storage/ps_locator.c
@@ -12,40 +12,30 @@
 #include "../service_under_test.h"
 
 /* RPC context */
-static rpc_session_handle session_handle = NULL;
+static struct rpc_caller_session *session = NULL;
 static struct service_context *ps_service_context = NULL;
 static struct secure_storage_client storage_client;
 
-int locate_service_under_test(struct logging_caller *call_logger)
+int locate_service_under_test(void)
 {
 	int status = -1;
 
-	if (!session_handle && !ps_service_context) {
+	if (!session && !ps_service_context) {
 
-		struct rpc_caller *caller;
+		service_locator_init();
 
 		ps_service_context =
-			service_locator_query("sn:trustedfirmware.org:protected-storage:0", &status);
+			service_locator_query("sn:trustedfirmware.org:protected-storage:0");
 
 		if (ps_service_context) {
 
-			session_handle =
-				service_context_open(ps_service_context, TS_RPC_ENCODING_PACKED_C, &caller);
+			session = service_context_open(ps_service_context);
 
-			if (session_handle) {
+			if (session) {
 
 				struct storage_backend *storage_backend = NULL;
-				status = -1;
 
-				if (call_logger) {
-
-					storage_backend = secure_storage_client_init(&storage_client,
-						logging_caller_attach(call_logger, caller));
-				}
-				else {
-
-					storage_backend = secure_storage_client_init(&storage_client,  caller);
-				}
+				storage_backend = secure_storage_client_init(&storage_client,  session);
 
 				if (storage_backend) {
 
@@ -61,15 +51,15 @@
 	return status;
 }
 
-void relinquish_service_under_test(void)
+int relinquish_service_under_test(void)
 {
 	psa_ps_frontend_init(NULL);
 	secure_storage_client_deinit(&storage_client);
 
-	if (ps_service_context && session_handle) {
+	if (ps_service_context && session) {
 
-		service_context_close(ps_service_context, session_handle);
-		session_handle = NULL;
+		service_context_close(ps_service_context, session);
+		session = NULL;
 	}
 
 	if (ps_service_context) {
@@ -77,4 +67,6 @@
 		service_context_relinquish(ps_service_context);
 		ps_service_context = NULL;
 	}
-}
+
+	return 0;
+}
\ No newline at end of file
diff --git a/deployments/psa-api-test/psa-api-test.cmake b/deployments/psa-api-test/psa-api-test.cmake
index 5c3469c..739ed26 100644
--- a/deployments/psa-api-test/psa-api-test.cmake
+++ b/deployments/psa-api-test/psa-api-test.cmake
@@ -29,9 +29,6 @@
 		"components/common/tlv"
 		"components/service/common/client"
 		"components/service/common/include"
-		"components/service/discovery/client"
-		"components/rpc/common/caller"
-		"components/rpc/common/logging"
 )
 
 target_sources(${PROJECT_NAME} PRIVATE
diff --git a/deployments/psa-api-test/service_under_test.h b/deployments/psa-api-test/service_under_test.h
index 29f99f7..834384e 100644
--- a/deployments/psa-api-test/service_under_test.h
+++ b/deployments/psa-api-test/service_under_test.h
@@ -7,8 +7,6 @@
 #ifndef SERVICE_UNDER_TEST_H
 #define SERVICE_UNDER_TEST_H
 
-#include <rpc/common/logging/logging_caller.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -19,12 +17,12 @@
  * associate an RPC Caller with the singleton PSA API client used by
  * the API tests.
  */
-int locate_service_under_test(struct logging_caller *call_logger);
+int locate_service_under_test(void);
 
 /**
  * Reliquish the RPC session when the test run is complete.
  */
-void relinquish_service_under_test(void);
+int relinquish_service_under_test(void);
 
 
 #ifdef __cplusplus