SPM: Create source file for psa_version & psa_framework_version implementation
This patch moves implementation of psa_version & psa_framework_version
to psa_version_api.c.
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: Ic6f642a1aae7436d7a8c0d506882d0e82b9215e8
diff --git a/secure_fw/spm/CMakeLists.txt b/secure_fw/spm/CMakeLists.txt
index 4574e22..2632fd0 100755
--- a/secure_fw/spm/CMakeLists.txt
+++ b/secure_fw/spm/CMakeLists.txt
@@ -45,6 +45,7 @@
cmsis_psa/static_loader.c
ffm/psa_api.c
ffm/psa_call_api.c
+ ffm/psa_version_api.c
$<$<BOOL:${CONFIG_TFM_CONNECTION_BASED_SERVICE_API}>:ffm/psa_connection_api.c>
$<$<BOOL:${CONFIG_TFM_SPM_BACKEND_IPC}>:ffm/backend_ipc.c>
$<$<BOOL:${CONFIG_TFM_SPM_BACKEND_SFN}>:ffm/backend_sfn.c>
diff --git a/secure_fw/spm/ffm/psa_api.c b/secure_fw/spm/ffm/psa_api.c
index 8880d7e..f72609b 100644
--- a/secure_fw/spm/ffm/psa_api.c
+++ b/secure_fw/spm/ffm/psa_api.c
@@ -106,38 +106,6 @@
return PSA_LIFECYCLE_UNKNOWN;
}
-/* PSA Client API function body */
-
-uint32_t tfm_spm_client_psa_framework_version(void)
-{
- return PSA_FRAMEWORK_VERSION;
-}
-
-uint32_t tfm_spm_client_psa_version(uint32_t sid)
-{
- struct service_t *service;
- bool ns_caller = tfm_spm_is_ns_caller();
-
- /*
- * It should return PSA_VERSION_NONE if the RoT Service is not
- * implemented.
- */
- service = tfm_spm_get_service_by_sid(sid);
- if (!service) {
- return PSA_VERSION_NONE;
- }
-
- /*
- * It should return PSA_VERSION_NONE if the caller is not authorized
- * to access the RoT Service.
- */
- if (tfm_spm_check_authorization(sid, service, ns_caller) != PSA_SUCCESS) {
- return PSA_VERSION_NONE;
- }
-
- return service->p_ldinf->version;
-}
-
/* PSA Partition API function body */
#if CONFIG_TFM_SPM_BACKEND_IPC == 1 \
diff --git a/secure_fw/spm/ffm/psa_version_api.c b/secure_fw/spm/ffm/psa_version_api.c
new file mode 100644
index 0000000..3048d93
--- /dev/null
+++ b/secure_fw/spm/ffm/psa_version_api.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2019-2023, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023 Cypress Semiconductor Corporation (an Infineon
+ * company) or an affiliate of Cypress Semiconductor Corporation. All rights
+ * reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "ffm/psa_api.h"
+#include "load/service_defs.h"
+#include "spm.h"
+
+uint32_t tfm_spm_client_psa_framework_version(void)
+{
+ return PSA_FRAMEWORK_VERSION;
+}
+
+uint32_t tfm_spm_client_psa_version(uint32_t sid)
+{
+ struct service_t *service;
+ bool ns_caller = tfm_spm_is_ns_caller();
+
+ /*
+ * It should return PSA_VERSION_NONE if the RoT Service is not
+ * implemented.
+ */
+ service = tfm_spm_get_service_by_sid(sid);
+ if (!service) {
+ return PSA_VERSION_NONE;
+ }
+
+ /*
+ * It should return PSA_VERSION_NONE if the caller is not authorized
+ * to access the RoT Service.
+ */
+ if (tfm_spm_check_authorization(sid, service, ns_caller) != PSA_SUCCESS) {
+ return PSA_VERSION_NONE;
+ }
+
+ return service->p_ldinf->version;
+}