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>
diff --git a/interface/include/tfm_sst_defs.h b/interface/include/tfm_sst_defs.h
index 3a5e819..9132cce 100644
--- a/interface/include/tfm_sst_defs.h
+++ b/interface/include/tfm_sst_defs.h
@@ -15,23 +15,6 @@
/* 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 34d19fe..af06424 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 @@
};
#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 @@
};
#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 @@
};
#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 @@
};
#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 @@
* 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 0ebadee..87d4e76 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 d38cb77..a5afc36 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 @@
};
#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 @@
};
#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 @@
};
#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 @@
};
#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 @@
* 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 3e7eb1b..0000000
--- 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__ */