Core: Move PSA API to SPRTL

Move psa_client.c and psa_service.c files into interface folder and
store in SPRTL.

Change-Id: I5bfb5888016e8e18eb39876744f87f4b6de760c0
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/secure_fw/core/ipc/CMakeLists.inc b/secure_fw/core/ipc/CMakeLists.inc
index bd457c7..e9f9f69 100644
--- a/secure_fw/core/ipc/CMakeLists.inc
+++ b/secure_fw/core/ipc/CMakeLists.inc
@@ -34,8 +34,6 @@
 	message(FATAL_ERROR "Incomplete build configuration: TFM_PSA_API is undefined. ")
 elseif (TFM_PSA_API)
 	set (SS_IPC_C_SRC "${SS_IPC_DIR}/tfm_svcalls.c"
-			"${SS_IPC_DIR}/psa_service.c"
-			"${SS_IPC_DIR}/psa_client.c"
 			"${SS_IPC_DIR}/tfm_thread.c"
 			"${SS_IPC_DIR}/tfm_wait.c"
 			"${SS_IPC_DIR}/tfm_message_queue.c"
diff --git a/secure_fw/core/ipc/psa_client.c b/secure_fw/core/ipc/psa_client.c
deleted file mode 100644
index ce26816..0000000
--- a/secure_fw/core/ipc/psa_client.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <inttypes.h>
-#include "core/tfm_core_svc.h"
-#include "psa/client.h"
-#include "tfm_api.h"
-
-__attribute__((naked, section("SFN")))
-uint32_t psa_framework_version(void)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_FRAMEWORK_VERSION));
-}
-
-__attribute__((naked, section("SFN")))
-uint32_t psa_version(uint32_t sid)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_VERSION));
-}
-
-__attribute__((naked, section("SFN")))
-psa_handle_t psa_connect(uint32_t sid, uint32_t version)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_CONNECT));
-}
-
-__attribute__((naked, section("SFN")))
-static psa_status_t psa_call_param_pack(psa_handle_t handle,
-                                   struct tfm_control_parameter_t *ctrl_param,
-                                   const psa_invec *in_vec, psa_outvec *out_vec)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_CALL));
-}
-
-__attribute__((section("SFN")))
-psa_status_t psa_call(psa_handle_t handle,
-                      int32_t type,
-                      const psa_invec *in_vec,
-                      size_t in_len,
-                      psa_outvec *out_vec,
-                      size_t out_len)
-{
-    struct tfm_control_parameter_t ctrl_param;
-    ctrl_param.type = type;
-    ctrl_param.in_len = in_len;
-    ctrl_param.out_len = out_len;
-
-    return psa_call_param_pack(handle, &ctrl_param, in_vec, out_vec);
-}
-
-__attribute__((naked, section("SFN")))
-void psa_close(psa_handle_t handle)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_CLOSE));
-}
diff --git a/secure_fw/core/ipc/psa_service.c b/secure_fw/core/ipc/psa_service.c
deleted file mode 100644
index 05cfe08..0000000
--- a/secure_fw/core/ipc/psa_service.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <inttypes.h>
-#include <stdio.h>
-#include "core/tfm_core_svc.h"
-#include "psa/client.h"
-#include "psa/service.h"
-
-__attribute__((naked, section("SFN")))
-psa_signal_t psa_wait(psa_signal_t signal_mask, uint32_t timeout)
-
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_WAIT));
-}
-
-__attribute__((naked, section("SFN")))
-psa_status_t psa_get(psa_signal_t signal, psa_msg_t *msg)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_GET));
-}
-
-__attribute__((naked, section("SFN")))
-void psa_set_rhandle(psa_handle_t msg_handle, void *rhandle)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_SET_RHANDLE));
-}
-
-__attribute__((naked, section("SFN")))
-size_t psa_read(psa_handle_t msg_handle, uint32_t invec_idx,
-                void *buffer, size_t num_bytes)
-
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_READ));
-}
-
-__attribute__((naked, section("SFN")))
-size_t psa_skip(psa_handle_t msg_handle, uint32_t invec_idx, size_t num_bytes)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_SKIP));
-}
-
-__attribute__((naked, section("SFN")))
-void psa_write(psa_handle_t msg_handle, uint32_t outvec_idx,
-               const void *buffer, size_t num_bytes)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_WRITE));
-}
-
-__attribute__((naked, section("SFN")))
-void psa_reply(psa_handle_t msg_handle, psa_status_t retval)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_REPLY));
-}
-
-__attribute__((naked, section("SFN")))
-void psa_notify(int32_t partition_id)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_NOTIFY));
-}
-
-__attribute__((naked, section("SFN")))
-void psa_clear(void)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_CLEAR));
-}
-
-__attribute__((naked, section("SFN")))
-void psa_eoi(psa_signal_t irq_signal)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_EOI));
-}
-
-__attribute__((naked, section("SFN")))
-void psa_panic(void)
-{
-    __ASM volatile("SVC %0           \n"
-                   "BX LR            \n"
-                   : : "I" (TFM_SVC_PSA_PANIC));
-}
diff --git a/secure_fw/lib/sprt/CMakeLists.inc b/secure_fw/lib/sprt/CMakeLists.inc
index dca3a87..55ae920 100644
--- a/secure_fw/lib/sprt/CMakeLists.inc
+++ b/secure_fw/lib/sprt/CMakeLists.inc
@@ -30,6 +30,13 @@
     "${LIBSPRT_DIR}/tfm_libsprt_c_memcmp.c"
     "${TFM_ROOT_DIR}/interface/src/log/tfm_log_raw.c")
 
+if (TFM_PSA_API)
+    list(APPEND LIBSPRT_C_SRC
+        "${TFM_ROOT_DIR}/interface/src/psa/psa_client.c"
+        "${TFM_ROOT_DIR}/interface/src/psa/psa_service.c"
+    )
+endif()
+
 #Append all our source files to global lists.
 list(APPEND ALL_SRC_C_S ${LIBSPRT_C_SRC})
 unset(LIBSPRT_C_SRC)