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/psa_client.c b/interface/src/psa/psa_client.c
similarity index 88%
rename from secure_fw/core/ipc/psa_client.c
rename to interface/src/psa/psa_client.c
index ce26816..214449b 100644
--- a/secure_fw/core/ipc/psa_client.c
+++ b/interface/src/psa/psa_client.c
@@ -10,7 +10,7 @@
#include "psa/client.h"
#include "tfm_api.h"
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
uint32_t psa_framework_version(void)
{
__ASM volatile("SVC %0 \n"
@@ -18,7 +18,7 @@
: : "I" (TFM_SVC_PSA_FRAMEWORK_VERSION));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
uint32_t psa_version(uint32_t sid)
{
__ASM volatile("SVC %0 \n"
@@ -26,7 +26,7 @@
: : "I" (TFM_SVC_PSA_VERSION));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
psa_handle_t psa_connect(uint32_t sid, uint32_t version)
{
__ASM volatile("SVC %0 \n"
@@ -34,7 +34,7 @@
: : "I" (TFM_SVC_PSA_CONNECT));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
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)
@@ -44,7 +44,6 @@
: : "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,
@@ -60,7 +59,7 @@
return psa_call_param_pack(handle, &ctrl_param, in_vec, out_vec);
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
void psa_close(psa_handle_t handle)
{
__ASM volatile("SVC %0 \n"
diff --git a/secure_fw/core/ipc/psa_service.c b/interface/src/psa/psa_service.c
similarity index 82%
rename from secure_fw/core/ipc/psa_service.c
rename to interface/src/psa/psa_service.c
index 05cfe08..032bf26 100644
--- a/secure_fw/core/ipc/psa_service.c
+++ b/interface/src/psa/psa_service.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -11,7 +11,7 @@
#include "psa/client.h"
#include "psa/service.h"
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
psa_signal_t psa_wait(psa_signal_t signal_mask, uint32_t timeout)
{
@@ -20,7 +20,7 @@
: : "I" (TFM_SVC_PSA_WAIT));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
psa_status_t psa_get(psa_signal_t signal, psa_msg_t *msg)
{
__ASM volatile("SVC %0 \n"
@@ -28,7 +28,7 @@
: : "I" (TFM_SVC_PSA_GET));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
void psa_set_rhandle(psa_handle_t msg_handle, void *rhandle)
{
__ASM volatile("SVC %0 \n"
@@ -36,7 +36,7 @@
: : "I" (TFM_SVC_PSA_SET_RHANDLE));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
size_t psa_read(psa_handle_t msg_handle, uint32_t invec_idx,
void *buffer, size_t num_bytes)
@@ -46,7 +46,7 @@
: : "I" (TFM_SVC_PSA_READ));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
size_t psa_skip(psa_handle_t msg_handle, uint32_t invec_idx, size_t num_bytes)
{
__ASM volatile("SVC %0 \n"
@@ -54,7 +54,7 @@
: : "I" (TFM_SVC_PSA_SKIP));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
void psa_write(psa_handle_t msg_handle, uint32_t outvec_idx,
const void *buffer, size_t num_bytes)
{
@@ -63,7 +63,7 @@
: : "I" (TFM_SVC_PSA_WRITE));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
void psa_reply(psa_handle_t msg_handle, psa_status_t retval)
{
__ASM volatile("SVC %0 \n"
@@ -71,7 +71,7 @@
: : "I" (TFM_SVC_PSA_REPLY));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
void psa_notify(int32_t partition_id)
{
__ASM volatile("SVC %0 \n"
@@ -79,7 +79,7 @@
: : "I" (TFM_SVC_PSA_NOTIFY));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
void psa_clear(void)
{
__ASM volatile("SVC %0 \n"
@@ -87,7 +87,7 @@
: : "I" (TFM_SVC_PSA_CLEAR));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
void psa_eoi(psa_signal_t irq_signal)
{
__ASM volatile("SVC %0 \n"
@@ -95,7 +95,7 @@
: : "I" (TFM_SVC_PSA_EOI));
}
-__attribute__((naked, section("SFN")))
+__attribute__((naked))
void psa_panic(void)
{
__ASM volatile("SVC %0 \n"
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/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)