aboutsummaryrefslogtreecommitdiff
path: root/interface
diff options
context:
space:
mode:
authorSummer Qin <summer.qin@arm.com>2019-10-18 17:36:04 +0800
committerSummer Qin <summer.qin@arm.com>2020-01-03 13:30:58 +0800
commit254ee97369bd469cc15970c9869dbde04c415aa6 (patch)
tree0ade304df62e2027c098507886e9905f457e8917 /interface
parent806af74e7b12f0986fcecf192b79f53bfa4e028a (diff)
downloadtrusted-firmware-m-254ee97369bd469cc15970c9869dbde04c415aa6.tar.gz
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>
Diffstat (limited to 'interface')
-rw-r--r--interface/src/psa/psa_client.c68
-rw-r--r--interface/src/psa/psa_service.c104
2 files changed, 172 insertions, 0 deletions
diff --git a/interface/src/psa/psa_client.c b/interface/src/psa/psa_client.c
new file mode 100644
index 0000000000..214449b89e
--- /dev/null
+++ b/interface/src/psa/psa_client.c
@@ -0,0 +1,68 @@
+/*
+ * 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))
+uint32_t psa_framework_version(void)
+{
+ __ASM volatile("SVC %0 \n"
+ "BX LR \n"
+ : : "I" (TFM_SVC_PSA_FRAMEWORK_VERSION));
+}
+
+__attribute__((naked))
+uint32_t psa_version(uint32_t sid)
+{
+ __ASM volatile("SVC %0 \n"
+ "BX LR \n"
+ : : "I" (TFM_SVC_PSA_VERSION));
+}
+
+__attribute__((naked))
+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))
+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));
+}
+
+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))
+void psa_close(psa_handle_t handle)
+{
+ __ASM volatile("SVC %0 \n"
+ "BX LR \n"
+ : : "I" (TFM_SVC_PSA_CLOSE));
+}
diff --git a/interface/src/psa/psa_service.c b/interface/src/psa/psa_service.c
new file mode 100644
index 0000000000..032bf26ae8
--- /dev/null
+++ b/interface/src/psa/psa_service.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2018-2020, 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))
+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))
+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))
+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))
+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))
+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))
+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))
+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))
+void psa_notify(int32_t partition_id)
+{
+ __ASM volatile("SVC %0 \n"
+ "BX LR \n"
+ : : "I" (TFM_SVC_PSA_NOTIFY));
+}
+
+__attribute__((naked))
+void psa_clear(void)
+{
+ __ASM volatile("SVC %0 \n"
+ "BX LR \n"
+ : : "I" (TFM_SVC_PSA_CLEAR));
+}
+
+__attribute__((naked))
+void psa_eoi(psa_signal_t irq_signal)
+{
+ __ASM volatile("SVC %0 \n"
+ "BX LR \n"
+ : : "I" (TFM_SVC_PSA_EOI));
+}
+
+__attribute__((naked))
+void psa_panic(void)
+{
+ __ASM volatile("SVC %0 \n"
+ "BX LR \n"
+ : : "I" (TFM_SVC_PSA_PANIC));
+}