diff options
author | Edison Ai <edison.ai@arm.com> | 2019-06-21 11:28:11 +0800 |
---|---|---|
committer | Ken Liu <ken.liu@arm.com> | 2019-07-19 10:14:51 +0000 |
commit | b892dfe77a29a217ba76a8301b03dad458b230ba (patch) | |
tree | 1aa028b4c3d960c297fd5132230f9089e297c385 | |
parent | 870abb4d77aee748a78a107fc79ce5e3bed69aab (diff) | |
download | trusted-firmware-m-b892dfe77a29a217ba76a8301b03dad458b230ba.tar.gz |
SST: Use macros generated by tools
- Use the SID and service version defined in sid.h.
- Use signal defined in tfm_secure_storage.h.
- Remove manual definitions in tfm_sst_defs.h.
- Remove tfm_sst_signal.h.
Change-Id: Iccedbb1a8947847e5c7c33b341b8302e334fec27
Signed-off-by: Edison Ai <edison.ai@arm.com>
-rw-r--r-- | interface/include/tfm_sst_defs.h | 17 | ||||
-rw-r--r-- | interface/src/tfm_sst_api.c | 14 | ||||
-rw-r--r-- | secure_fw/services/secure_storage/tfm_sst_req_mngr.c | 2 | ||||
-rw-r--r-- | secure_fw/services/secure_storage/tfm_sst_secure_api.c | 14 | ||||
-rw-r--r-- | secure_fw/services/secure_storage/tfm_sst_signal.h | 32 |
5 files changed, 17 insertions, 62 deletions
diff --git a/interface/include/tfm_sst_defs.h b/interface/include/tfm_sst_defs.h index 3a5e8197f..9132cce76 100644 --- a/interface/include/tfm_sst_defs.h +++ b/interface/include/tfm_sst_defs.h @@ -15,23 +15,6 @@ extern "C" { /* Invalid UID */ #define TFM_SST_INVALID_UID 0 -#ifdef TFM_PSA_API -/* - * Defines for SID and minor version number. These SIDs should align with the - * value in service manifest file. - */ -#define TFM_SST_SET_SID (0x00000060) -#define TFM_SST_SET_MIN_VER (0x0001) -#define TFM_SST_GET_SID (0x00000061) -#define TFM_SST_GET_MIN_VER (0x0001) -#define TFM_SST_GET_INFO_SID (0x00000062) -#define TFM_SST_GET_INFO_MIN_VER (0x0001) -#define TFM_SST_REMOVE_SID (0x00000063) -#define TFM_SST_REMOVE_MIN_VER (0x0001) -#define TFM_SST_GET_SUPPORT_SID (0x00000064) -#define TFM_SST_GET_SUPPORT_MIN_VER (0x0001) -#endif - #ifdef __cplusplus } #endif diff --git a/interface/src/tfm_sst_api.c b/interface/src/tfm_sst_api.c index 34d19fe23..af06424e3 100644 --- a/interface/src/tfm_sst_api.c +++ b/interface/src/tfm_sst_api.c @@ -9,7 +9,9 @@ #include "tfm_ns_lock.h" #include "tfm_veneers.h" -#include "tfm_sst_defs.h" +#ifdef TFM_PSA_API +#include "psa_manifest/sid.h" +#endif #define IOVEC_LEN(x) (uint32_t)(sizeof(x)/sizeof(x[0])) /* FixMe: Check if PSA framework header would provide similar macro. */ @@ -37,7 +39,7 @@ psa_ps_status_t psa_ps_set(psa_ps_uid_t uid, }; #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_SET_SID, TFM_SST_SET_MIN_VER); + handle = psa_connect(TFM_SST_SET_SID, TFM_SST_SET_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return PSA_PS_ERROR_OPERATION_FAILED; } @@ -84,7 +86,7 @@ psa_ps_status_t psa_ps_get(psa_ps_uid_t uid, }; #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_GET_SID, TFM_SST_GET_MIN_VER); + handle = psa_connect(TFM_SST_GET_SID, TFM_SST_GET_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return PSA_PS_ERROR_OPERATION_FAILED; } @@ -128,7 +130,7 @@ psa_ps_status_t psa_ps_get_info(psa_ps_uid_t uid, struct psa_ps_info_t *p_info) }; #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_GET_INFO_SID, TFM_SST_GET_INFO_MIN_VER); + handle = psa_connect(TFM_SST_GET_INFO_SID, TFM_SST_GET_INFO_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return PSA_PS_ERROR_OPERATION_FAILED; } @@ -171,7 +173,7 @@ psa_ps_status_t psa_ps_remove(psa_ps_uid_t uid) }; #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_REMOVE_SID, TFM_SST_REMOVE_MIN_VER); + handle = psa_connect(TFM_SST_REMOVE_SID, TFM_SST_REMOVE_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return PSA_PS_ERROR_OPERATION_FAILED; } @@ -236,7 +238,7 @@ uint32_t psa_ps_get_support(void) * ignored. */ #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_GET_SUPPORT_SID, TFM_SST_GET_SUPPORT_MIN_VER); + handle = psa_connect(TFM_SST_GET_SUPPORT_SID, TFM_SST_GET_SUPPORT_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return support_flags; } diff --git a/secure_fw/services/secure_storage/tfm_sst_req_mngr.c b/secure_fw/services/secure_storage/tfm_sst_req_mngr.c index 0ebadee1a..87d4e76d2 100644 --- a/secure_fw/services/secure_storage/tfm_sst_req_mngr.c +++ b/secure_fw/services/secure_storage/tfm_sst_req_mngr.c @@ -16,7 +16,7 @@ #include "tfm_protected_storage.h" #ifdef TFM_PSA_API #include "psa/service.h" -#include "tfm_sst_signal.h" +#include "psa_manifest/tfm_secure_storage.h" #include "flash_layout.h" #endif diff --git a/secure_fw/services/secure_storage/tfm_sst_secure_api.c b/secure_fw/services/secure_storage/tfm_sst_secure_api.c index d38cb7752..a5afc36ff 100644 --- a/secure_fw/services/secure_storage/tfm_sst_secure_api.c +++ b/secure_fw/services/secure_storage/tfm_sst_secure_api.c @@ -7,7 +7,9 @@ #include "psa/protected_storage.h" #include "tfm_veneers.h" -#include "tfm_sst_defs.h" +#ifdef TFM_PSA_API +#include "psa_manifest/sid.h" +#endif #define IOVEC_LEN(x) (sizeof(x)/sizeof(x[0])) /* FixMe: Check if PSA framework header would provide similar macro. */ @@ -36,7 +38,7 @@ psa_ps_status_t psa_ps_set(psa_ps_uid_t uid, }; #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_SET_SID, TFM_SST_SET_MIN_VER); + handle = psa_connect(TFM_SST_SET_SID, TFM_SST_SET_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return PSA_PS_ERROR_OPERATION_FAILED; } @@ -83,7 +85,7 @@ psa_ps_status_t psa_ps_get(psa_ps_uid_t uid, }; #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_GET_SID, TFM_SST_GET_MIN_VER); + handle = psa_connect(TFM_SST_GET_SID, TFM_SST_GET_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return PSA_PS_ERROR_OPERATION_FAILED; } @@ -126,7 +128,7 @@ psa_ps_status_t psa_ps_get_info(psa_ps_uid_t uid, struct psa_ps_info_t *p_info) }; #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_GET_INFO_SID, TFM_SST_GET_INFO_MIN_VER); + handle = psa_connect(TFM_SST_GET_INFO_SID, TFM_SST_GET_INFO_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return PSA_PS_ERROR_OPERATION_FAILED; } @@ -169,7 +171,7 @@ psa_ps_status_t psa_ps_remove(psa_ps_uid_t uid) }; #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_REMOVE_SID, TFM_SST_REMOVE_MIN_VER); + handle = psa_connect(TFM_SST_REMOVE_SID, TFM_SST_REMOVE_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return PSA_PS_ERROR_OPERATION_FAILED; } @@ -236,7 +238,7 @@ uint32_t psa_ps_get_support(void) * ignored. */ #ifdef TFM_PSA_API - handle = psa_connect(TFM_SST_GET_SUPPORT_SID, TFM_SST_GET_SUPPORT_MIN_VER); + handle = psa_connect(TFM_SST_GET_SUPPORT_SID, TFM_SST_GET_SUPPORT_VERSION); if (!TFM_PSA_HANDLE_IS_VALID(handle)) { return support_flags; } diff --git a/secure_fw/services/secure_storage/tfm_sst_signal.h b/secure_fw/services/secure_storage/tfm_sst_signal.h deleted file mode 100644 index 3e7eb1b98..000000000 --- a/secure_fw/services/secure_storage/tfm_sst_signal.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_SST_SIGNAL_H__ -#define __TFM_SST_SIGNAL_H__ - -/* - * FixMe: hardcode it now, will add support to autogenerate these signal - * definitons later. - */ -/* - * Each Secure Partition has up to 32 different signals. A signal is represented - * as a single-bit value within a 32-bit integer. - * The following signals are reserved in all Secure Partitions: - * - 0x00000001U - * - 0x00000002U - * - 0x00000004U - * - 0x00000008U - * The remaining 28 general signals can be associated with other inputs to the - * Secure Partition. - */ -#define TFM_SST_SET_SIG (1 << (0 + 4)) -#define TFM_SST_GET_SIG (1 << (1 + 4)) -#define TFM_SST_GET_INFO_SIG (1 << (2 + 4)) -#define TFM_SST_REMOVE_SIG (1 << (3 + 4)) -#define TFM_SST_GET_SUPPORT_SIG (1 << (4 + 4)) - -#endif /* __TFM_SST_SIGNAL_H__ */ |