aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--secure_fw/core/ipc/tfm_svcalls.c6
-rw-r--r--secure_fw/services/tfm_service_list.inc960
-rw-r--r--secure_fw/services/tfm_service_list.inc.template38
-rw-r--r--secure_fw/spm/spm_api.h2
-rw-r--r--secure_fw/spm/spm_api_ipc.c43
5 files changed, 646 insertions, 403 deletions
diff --git a/secure_fw/core/ipc/tfm_svcalls.c b/secure_fw/core/ipc/tfm_svcalls.c
index a5f32390de..cee5c7e49a 100644
--- a/secure_fw/core/ipc/tfm_svcalls.c
+++ b/secure_fw/core/ipc/tfm_svcalls.c
@@ -57,11 +57,11 @@ uint32_t tfm_svcall_psa_version(uint32_t *args, int32_t ns_caller)
* It should return PSA_VERSION_NONE if the caller is not authorized
* to access the RoT Service.
*/
- if (ns_caller && !service->service_db->non_secure_client) {
+ if (ns_caller && !service->service_db.non_secure_client) {
return PSA_VERSION_NONE;
}
- return service->service_db->minor_version;
+ return service->service_db.minor_version;
}
psa_handle_t tfm_svcall_psa_connect(uint32_t *args, int32_t ns_caller)
@@ -95,7 +95,7 @@ psa_handle_t tfm_svcall_psa_connect(uint32_t *args, int32_t ns_caller)
* It is a fatal error if the caller is not authorized to access the RoT
* Service.
*/
- if (ns_caller && !service->service_db->non_secure_client) {
+ if (ns_caller && !service->service_db.non_secure_client) {
tfm_panic();
}
diff --git a/secure_fw/services/tfm_service_list.inc b/secure_fw/services/tfm_service_list.inc
index 617b3ced1c..3ff8d7b567 100644
--- a/secure_fw/services/tfm_service_list.inc
+++ b/secure_fw/services/tfm_service_list.inc
@@ -22,385 +22,625 @@
#include "test/test_services/tfm_ipc_client/psa_manifest/tfm_ipc_client_partition.h"
#include "test/test_services/tfm_irq_test_service_1/psa_manifest/tfm_irq_test_service_1.h"
-/******** TFM_SP_STORAGE ********/
-{
- "TFM_SST_SET",
- TFM_SP_STORAGE_ID,
- TFM_SST_SET_SIG,
- 0x00000060,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "TFM_SST_GET",
- TFM_SP_STORAGE_ID,
- TFM_SST_GET_SIG,
- 0x00000061,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "TFM_SST_GET_INFO",
- TFM_SP_STORAGE_ID,
- TFM_SST_GET_INFO_SIG,
- 0x00000062,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "TFM_SST_REMOVE",
- TFM_SP_STORAGE_ID,
- TFM_SST_REMOVE_SIG,
- 0x00000063,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "TFM_SST_GET_SUPPORT",
- TFM_SP_STORAGE_ID,
- TFM_SST_GET_SUPPORT_SIG,
- 0x00000064,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
+/**************************************************************************/
+/** The service list */
+/**************************************************************************/
+struct tfm_spm_service_t service[] =
+{
+ /******** TFM_SP_STORAGE ********/
+ {
+ .service_db = {
+ .name = "TFM_SST_SET",
+ .partition_id = TFM_SP_STORAGE_ID,
+ .signal = TFM_SST_SET_SIG,
+ .sid = 0x00000060,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "TFM_SST_GET",
+ .partition_id = TFM_SP_STORAGE_ID,
+ .signal = TFM_SST_GET_SIG,
+ .sid = 0x00000061,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "TFM_SST_GET_INFO",
+ .partition_id = TFM_SP_STORAGE_ID,
+ .signal = TFM_SST_GET_INFO_SIG,
+ .sid = 0x00000062,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "TFM_SST_REMOVE",
+ .partition_id = TFM_SP_STORAGE_ID,
+ .signal = TFM_SST_REMOVE_SIG,
+ .sid = 0x00000063,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "TFM_SST_GET_SUPPORT",
+ .partition_id = TFM_SP_STORAGE_ID,
+ .signal = TFM_SST_GET_SUPPORT_SIG,
+ .sid = 0x00000064,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
-/******** TFM_SP_CRYPTO ********/
-{
- "TFM_CRYPTO",
- TFM_SP_CRYPTO_ID,
- TFM_CRYPTO_SIG,
- 0x00000080,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
+ /******** TFM_SP_CRYPTO ********/
+ {
+ .service_db = {
+ .name = "TFM_CRYPTO",
+ .partition_id = TFM_SP_CRYPTO_ID,
+ .signal = TFM_CRYPTO_SIG,
+ .sid = 0x00000080,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
-/******** TFM_SP_INITIAL_ATTESTATION ********/
-{
- "TFM_ATTEST_GET_TOKEN",
- TFM_SP_INITIAL_ATTESTATION_ID,
- PSA_ATTEST_GET_TOKEN_SIG,
- 0x00000020,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "TFM_ATTEST_GET_TOKEN_SIZE",
- TFM_SP_INITIAL_ATTESTATION_ID,
- PSA_ATTEST_GET_TOKEN_SIZE_SIG,
- 0x00000021,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
+ /******** TFM_SP_INITIAL_ATTESTATION ********/
+ {
+ .service_db = {
+ .name = "TFM_ATTEST_GET_TOKEN",
+ .partition_id = TFM_SP_INITIAL_ATTESTATION_ID,
+ .signal = PSA_ATTEST_GET_TOKEN_SIG,
+ .sid = 0x00000020,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "TFM_ATTEST_GET_TOKEN_SIZE",
+ .partition_id = TFM_SP_INITIAL_ATTESTATION_ID,
+ .signal = PSA_ATTEST_GET_TOKEN_SIZE_SIG,
+ .sid = 0x00000021,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
#ifdef TFM_PARTITION_TEST_CORE
-/******** TFM_SP_CORE_TEST ********/
-{
- "SPM_CORE_TEST_INIT_SUCCESS",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_INIT_SUCCESS_SIGNAL,
- 0x0000F020,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_DIRECT_RECURSION",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_DIRECT_RECURSION_SIGNAL,
- 0x0000F021,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_MPU_ACCESS",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_MPU_ACCESS_SIGNAL,
- 0x0000F022,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_MEMORY_PERMISSIONS",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_MEMORY_PERMISSIONS_SIGNAL,
- 0x0000F023,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_SHARE_REDIRECTION",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_SHARE_REDIRECTION_SIGNAL,
- 0x0000F024,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_SS_TO_SS",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_SS_TO_SS_SIGNAL,
- 0x0000F025,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_SS_TO_SS_BUFFER",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_SS_TO_SS_BUFFER_SIGNAL,
- 0x0000F026,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_OUTVEC_WRITE",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_OUTVEC_WRITE_SIGNAL,
- 0x0000F027,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_PERIPHERAL_ACCESS",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_PERIPHERAL_ACCESS_SIGNAL,
- 0x0000F028,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_GET_CALLER_CLIENT_ID",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_GET_CALLER_CLIENT_ID_SIGNAL,
- 0x0000F029,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_SPM_REQUEST",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_SPM_REQUEST_SIGNAL,
- 0x0000F02A,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_BLOCK",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_BLOCK_SIGNAL,
- 0x0000F02B,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_NS_THREAD",
- TFM_SP_CORE_TEST_ID,
- SPM_CORE_TEST_NS_THREAD_SIGNAL,
- 0x0000F02C,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
+ /******** TFM_SP_CORE_TEST ********/
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_INIT_SUCCESS",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_INIT_SUCCESS_SIGNAL,
+ .sid = 0x0000F020,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_DIRECT_RECURSION",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_DIRECT_RECURSION_SIGNAL,
+ .sid = 0x0000F021,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_MPU_ACCESS",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_MPU_ACCESS_SIGNAL,
+ .sid = 0x0000F022,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_MEMORY_PERMISSIONS",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_MEMORY_PERMISSIONS_SIGNAL,
+ .sid = 0x0000F023,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_SHARE_REDIRECTION",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_SHARE_REDIRECTION_SIGNAL,
+ .sid = 0x0000F024,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_SS_TO_SS",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_SS_TO_SS_SIGNAL,
+ .sid = 0x0000F025,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_SS_TO_SS_BUFFER",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_SS_TO_SS_BUFFER_SIGNAL,
+ .sid = 0x0000F026,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_OUTVEC_WRITE",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_OUTVEC_WRITE_SIGNAL,
+ .sid = 0x0000F027,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_PERIPHERAL_ACCESS",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_PERIPHERAL_ACCESS_SIGNAL,
+ .sid = 0x0000F028,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_GET_CALLER_CLIENT_ID",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_GET_CALLER_CLIENT_ID_SIGNAL,
+ .sid = 0x0000F029,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_SPM_REQUEST",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_SPM_REQUEST_SIGNAL,
+ .sid = 0x0000F02A,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_BLOCK",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_BLOCK_SIGNAL,
+ .sid = 0x0000F02B,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_NS_THREAD",
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .signal = SPM_CORE_TEST_NS_THREAD_SIGNAL,
+ .sid = 0x0000F02C,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
#endif /* TFM_PARTITION_TEST_CORE */
#ifdef TFM_PARTITION_TEST_CORE
-/******** TFM_SP_CORE_TEST_2 ********/
-{
- "SPM_CORE_TEST_2_SLAVE_SERVICE",
- TFM_SP_CORE_TEST_2_ID,
- SPM_CORE_TEST_2_SLAVE_SERVICE_SIGNAL,
- 0x0000F040,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID",
- TFM_SP_CORE_TEST_2_ID,
- SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID_SIGNAL,
- 0x0000F041,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE",
- TFM_SP_CORE_TEST_2_ID,
- SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_SIGNAL,
- 0x0000F042,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_2_INVERT",
- TFM_SP_CORE_TEST_2_ID,
- SPM_CORE_TEST_2_INVERT_SIGNAL,
- 0x0000F043,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_2_PREPARE_TEST_SCENARIO",
- TFM_SP_CORE_TEST_2_ID,
- SPM_CORE_TEST_2_PREPARE_TEST_SCENARIO_SIGNAL,
- 0x0000F044,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_TEST_2_EXECUTE_TEST_SCENARIO",
- TFM_SP_CORE_TEST_2_ID,
- SPM_CORE_TEST_2_EXECUTE_TEST_SCENARIO_SIGNAL,
- 0x0000F045,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
+ /******** TFM_SP_CORE_TEST_2 ********/
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_2_SLAVE_SERVICE",
+ .partition_id = TFM_SP_CORE_TEST_2_ID,
+ .signal = SPM_CORE_TEST_2_SLAVE_SERVICE_SIGNAL,
+ .sid = 0x0000F040,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID",
+ .partition_id = TFM_SP_CORE_TEST_2_ID,
+ .signal = SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID_SIGNAL,
+ .sid = 0x0000F041,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE",
+ .partition_id = TFM_SP_CORE_TEST_2_ID,
+ .signal = SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_SIGNAL,
+ .sid = 0x0000F042,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_2_INVERT",
+ .partition_id = TFM_SP_CORE_TEST_2_ID,
+ .signal = SPM_CORE_TEST_2_INVERT_SIGNAL,
+ .sid = 0x0000F043,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_2_PREPARE_TEST_SCENARIO",
+ .partition_id = TFM_SP_CORE_TEST_2_ID,
+ .signal = SPM_CORE_TEST_2_PREPARE_TEST_SCENARIO_SIGNAL,
+ .sid = 0x0000F044,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_TEST_2_EXECUTE_TEST_SCENARIO",
+ .partition_id = TFM_SP_CORE_TEST_2_ID,
+ .signal = SPM_CORE_TEST_2_EXECUTE_TEST_SCENARIO_SIGNAL,
+ .sid = 0x0000F045,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
#endif /* TFM_PARTITION_TEST_CORE */
#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
-/******** TFM_SP_SECURE_TEST_PARTITION ********/
-{
- "TFM_SECURE_CLIENT_SFN_RUN_TESTS",
- TFM_SP_SECURE_TEST_PARTITION_ID,
- TFM_SECURE_CLIENT_SFN_RUN_TESTS_SIG,
- 0x0000F000,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
+ /******** TFM_SP_SECURE_TEST_PARTITION ********/
+ {
+ .service_db = {
+ .name = "TFM_SECURE_CLIENT_SFN_RUN_TESTS",
+ .partition_id = TFM_SP_SECURE_TEST_PARTITION_ID,
+ .signal = TFM_SECURE_CLIENT_SFN_RUN_TESTS_SIG,
+ .sid = 0x0000F000,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
#ifdef TFM_PARTITION_TEST_CORE_IPC
-/******** TFM_SP_IPC_SERVICE_TEST ********/
-{
- "IPC_SERVICE_TEST_BASIC",
- TFM_SP_IPC_SERVICE_TEST_ID,
- IPC_SERVICE_TEST_BASIC_SIGNAL,
- 0x0000F080,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "IPC_SERVICE_TEST_PSA_ACCESS_APP_MEM",
- TFM_SP_IPC_SERVICE_TEST_ID,
- IPC_SERVICE_TEST_PSA_ACCESS_APP_MEM_SIGNAL,
- 0x0000F081,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "IPC_SERVICE_TEST_PSA_ACCESS_APP_READ_ONLY_MEM",
- TFM_SP_IPC_SERVICE_TEST_ID,
- IPC_SERVICE_TEST_PSA_ACCESS_APP_READ_ONLY_MEM_SIGNAL,
- 0x0000F082,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "IPC_SERVICE_TEST_APP_ACCESS_PSA_MEM",
- TFM_SP_IPC_SERVICE_TEST_ID,
- IPC_SERVICE_TEST_APP_ACCESS_PSA_MEM_SIGNAL,
- 0x0000F083,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
+ /******** TFM_SP_IPC_SERVICE_TEST ********/
+ {
+ .service_db = {
+ .name = "IPC_SERVICE_TEST_BASIC",
+ .partition_id = TFM_SP_IPC_SERVICE_TEST_ID,
+ .signal = IPC_SERVICE_TEST_BASIC_SIGNAL,
+ .sid = 0x0000F080,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "IPC_SERVICE_TEST_PSA_ACCESS_APP_MEM",
+ .partition_id = TFM_SP_IPC_SERVICE_TEST_ID,
+ .signal = IPC_SERVICE_TEST_PSA_ACCESS_APP_MEM_SIGNAL,
+ .sid = 0x0000F081,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "IPC_SERVICE_TEST_PSA_ACCESS_APP_READ_ONLY_MEM",
+ .partition_id = TFM_SP_IPC_SERVICE_TEST_ID,
+ .signal = IPC_SERVICE_TEST_PSA_ACCESS_APP_READ_ONLY_MEM_SIGNAL,
+ .sid = 0x0000F082,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "IPC_SERVICE_TEST_APP_ACCESS_PSA_MEM",
+ .partition_id = TFM_SP_IPC_SERVICE_TEST_ID,
+ .signal = IPC_SERVICE_TEST_APP_ACCESS_PSA_MEM_SIGNAL,
+ .sid = 0x0000F083,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
#endif /* TFM_PARTITION_TEST_CORE_IPC */
#ifdef TFM_PARTITION_TEST_CORE_IPC
-/******** TFM_SP_IPC_CLIENT_TEST ********/
-{
- "IPC_CLIENT_TEST_BASIC",
- TFM_SP_IPC_CLIENT_TEST_ID,
- IPC_CLIENT_TEST_BASIC_SIGNAL,
- 0x0000F060,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "IPC_CLIENT_TEST_PSA_ACCESS_APP_MEM",
- TFM_SP_IPC_CLIENT_TEST_ID,
- IPC_CLIENT_TEST_PSA_ACCESS_APP_MEM_SIGNAL,
- 0x0000F061,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "IPC_CLIENT_TEST_PSA_ACCESS_APP_READ_ONLY_MEM",
- TFM_SP_IPC_CLIENT_TEST_ID,
- IPC_CLIENT_TEST_PSA_ACCESS_APP_READ_ONLY_MEM_SIGNAL,
- 0x0000F062,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "IPC_CLIENT_TEST_APP_ACCESS_PSA_MEM",
- TFM_SP_IPC_CLIENT_TEST_ID,
- IPC_CLIENT_TEST_APP_ACCESS_PSA_MEM_SIGNAL,
- 0x0000F063,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "IPC_CLIENT_TEST_MEM_CHECK",
- TFM_SP_IPC_CLIENT_TEST_ID,
- IPC_CLIENT_TEST_MEM_CHECK_SIGNAL,
- 0x0000F064,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
+ /******** TFM_SP_IPC_CLIENT_TEST ********/
+ {
+ .service_db = {
+ .name = "IPC_CLIENT_TEST_BASIC",
+ .partition_id = TFM_SP_IPC_CLIENT_TEST_ID,
+ .signal = IPC_CLIENT_TEST_BASIC_SIGNAL,
+ .sid = 0x0000F060,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "IPC_CLIENT_TEST_PSA_ACCESS_APP_MEM",
+ .partition_id = TFM_SP_IPC_CLIENT_TEST_ID,
+ .signal = IPC_CLIENT_TEST_PSA_ACCESS_APP_MEM_SIGNAL,
+ .sid = 0x0000F061,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "IPC_CLIENT_TEST_PSA_ACCESS_APP_READ_ONLY_MEM",
+ .partition_id = TFM_SP_IPC_CLIENT_TEST_ID,
+ .signal = IPC_CLIENT_TEST_PSA_ACCESS_APP_READ_ONLY_MEM_SIGNAL,
+ .sid = 0x0000F062,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "IPC_CLIENT_TEST_APP_ACCESS_PSA_MEM",
+ .partition_id = TFM_SP_IPC_CLIENT_TEST_ID,
+ .signal = IPC_CLIENT_TEST_APP_ACCESS_PSA_MEM_SIGNAL,
+ .sid = 0x0000F063,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "IPC_CLIENT_TEST_MEM_CHECK",
+ .partition_id = TFM_SP_IPC_CLIENT_TEST_ID,
+ .signal = IPC_CLIENT_TEST_MEM_CHECK_SIGNAL,
+ .sid = 0x0000F064,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
#endif /* TFM_PARTITION_TEST_CORE_IPC */
#ifdef TFM_PARTITION_TEST_CORE
-/******** TFM_IRQ_TEST_1 ********/
-{
- "SPM_CORE_IRQ_TEST_1_PREPARE_TEST_SCENARIO",
- TFM_IRQ_TEST_1_ID,
- SPM_CORE_IRQ_TEST_1_PREPARE_TEST_SCENARIO_SIGNAL,
- 0x0000F0A0,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
-{
- "SPM_CORE_IRQ_TEST_1_EXECUTE_TEST_SCENARIO",
- TFM_IRQ_TEST_1_ID,
- SPM_CORE_IRQ_TEST_1_EXECUTE_TEST_SCENARIO_SIGNAL,
- 0x0000F0A1,
- true,
- 1,
- TFM_VERSION_POLICY_STRICT
-},
+ /******** TFM_IRQ_TEST_1 ********/
+ {
+ .service_db = {
+ .name = "SPM_CORE_IRQ_TEST_1_PREPARE_TEST_SCENARIO",
+ .partition_id = TFM_IRQ_TEST_1_ID,
+ .signal = SPM_CORE_IRQ_TEST_1_PREPARE_TEST_SCENARIO_SIGNAL,
+ .sid = 0x0000F0A0,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+ {
+ .service_db = {
+ .name = "SPM_CORE_IRQ_TEST_1_EXECUTE_TEST_SCENARIO",
+ .partition_id = TFM_IRQ_TEST_1_ID,
+ .signal = SPM_CORE_IRQ_TEST_1_EXECUTE_TEST_SCENARIO_SIGNAL,
+ .sid = 0x0000F0A1,
+ .non_secure_client = true,
+ .minor_version = 1,
+ .minor_policy = TFM_VERSION_POLICY_STRICT
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
#endif /* TFM_PARTITION_TEST_CORE */
+};
#endif /* __TFM_SERVICE_LIST_INC__ */
diff --git a/secure_fw/services/tfm_service_list.inc.template b/secure_fw/services/tfm_service_list.inc.template
index 6d056750b5..3cfb945c51 100644
--- a/secure_fw/services/tfm_service_list.inc.template
+++ b/secure_fw/services/tfm_service_list.inc.template
@@ -14,35 +14,46 @@
#include "{{header}}"
{% endfor %}
+/**************************************************************************/
+/** The service list */
+/**************************************************************************/
+struct tfm_spm_service_t service[] =
+{
{% for manifest in manifests %}
{% if manifest.attr.tfm_partition_ipc %}
{% if manifest.manifest.services %}
{% if manifest.attr.conditional %}
#ifdef {{manifest.attr.conditional}}
{% endif %}
-/******** {{manifest.manifest.name}} ********/
+ /******** {{manifest.manifest.name}} ********/
{% for service in manifest.manifest.services %}
-{{'{'}}
- "{{service.name}}",
- {{manifest.manifest.name}}_ID,
- {{service.signal}},
- {{service.sid}},
+ {{'{'}}
+ .service_db = {
+ .name = "{{service.name}}",
+ .partition_id = {{manifest.manifest.name}}_ID,
+ .signal = {{service.signal}},
+ .sid = {{service.sid}},
{% if service.non_secure_clients is sameas true %}
- true,
+ .non_secure_client = true,
{% else %}
- false,
+ .non_secure_client = false,
{% endif %}
{% if service.minor_version %}
- {{service.minor_version}},
+ .minor_version = {{service.minor_version}},
{% else %}
- 1,
+ .minor_version = 1,
{% endif %}
{% if service.minor_policy %}
- TFM_VERSION_POLICY_{{service.minor_policy}}
+ .minor_policy = TFM_VERSION_POLICY_{{service.minor_policy}}
{% else %}
- TFM_VERSION_POLICY_STRICT
+ .minor_policy = TFM_VERSION_POLICY_STRICT
{% endif %}
-{{'}'}},
+ },
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ {{'}'}},
{% endfor %}
{% if manifest.attr.conditional %}
#endif /* {{manifest.attr.conditional}} */
@@ -51,4 +62,5 @@
{% endif %}
{% endfor %}
+};
#endif /* __TFM_SERVICE_LIST_INC__ */
diff --git a/secure_fw/spm/spm_api.h b/secure_fw/spm/spm_api.h
index 02c5dbf1b6..eb2d1078cb 100644
--- a/secure_fw/spm/spm_api.h
+++ b/secure_fw/spm/spm_api.h
@@ -136,7 +136,7 @@ struct tfm_spm_service_db_t {
/* RoT Service data */
struct tfm_spm_service_t {
- struct tfm_spm_service_db_t *service_db; /* Service database pointer */
+ struct tfm_spm_service_db_t service_db; /* Service database pointer */
struct spm_partition_desc_t *partition; /*
* Point to secure partition
* data
diff --git a/secure_fw/spm/spm_api_ipc.c b/secure_fw/spm/spm_api_ipc.c
index b05ec81b40..60fd82d17f 100644
--- a/secure_fw/spm/spm_api_ipc.c
+++ b/secure_fw/spm/spm_api_ipc.c
@@ -28,6 +28,11 @@
#include "tfm_nspm.h"
#include "tfm_memory_utils.h"
+#include "secure_fw/services/tfm_service_list.inc"
+
+/* Extern service variable */
+extern struct tfm_spm_service_t service[];
+
/* Extern SPM variable */
extern struct spm_partition_db_t g_spm_partition_db;
@@ -37,15 +42,9 @@ extern int32_t tfm_secure_lock;
/* Pools */
TFM_POOL_DECLARE(conn_handle_pool, sizeof(struct tfm_conn_handle_t),
TFM_CONN_HANDLE_MAX_NUM);
-TFM_POOL_DECLARE(spm_service_pool, sizeof(struct tfm_spm_service_t),
- TFM_SPM_MAX_ROT_SERV_NUM);
TFM_POOL_DECLARE(msg_db_pool, sizeof(struct tfm_msg_body_t),
TFM_MSG_QUEUE_MAX_MSG_NUM);
-static struct tfm_spm_service_db_t g_spm_service_db[] = {
- #include "secure_fw/services/tfm_service_list.inc"
-};
-
/********************** SPM functions for handler mode ***********************/
/* Service handle management functions */
@@ -166,7 +165,7 @@ struct tfm_spm_service_t *
head = &partition->runtime_data.service_list;
TFM_LIST_FOR_EACH(node, head) {
service = TFM_GET_CONTAINER_PTR(node, struct tfm_spm_service_t, list);
- if (service->service_db->signal == signal) {
+ if (service->service_db.signal == signal) {
return service;
}
}
@@ -195,7 +194,7 @@ struct tfm_spm_service_t *tfm_spm_get_service_by_sid(uint32_t sid)
TFM_LIST_FOR_EACH(node, head) {
service = TFM_GET_CONTAINER_PTR(node, struct tfm_spm_service_t,
list);
- if (service->service_db->sid == sid) {
+ if (service->service_db.sid == sid) {
return service;
}
}
@@ -265,14 +264,14 @@ int32_t tfm_spm_check_client_version(struct tfm_spm_service_t *service,
{
TFM_ASSERT(service);
- switch (service->service_db->minor_policy) {
+ switch (service->service_db.minor_policy) {
case TFM_VERSION_POLICY_RELAXED:
- if (minor_version > service->service_db->minor_version) {
+ if (minor_version > service->service_db.minor_version) {
return IPC_ERROR_VERSION;
}
break;
case TFM_VERSION_POLICY_STRICT:
- if (minor_version != service->service_db->minor_version) {
+ if (minor_version != service->service_db.minor_version) {
return IPC_ERROR_VERSION;
}
break;
@@ -401,7 +400,7 @@ int32_t tfm_spm_send_event(struct tfm_spm_service_t *service,
}
/* Messages put. Update signals */
- p_runtime_data->signals |= service->service_db->signal;
+ p_runtime_data->signals |= service->service_db.signal;
tfm_event_wake(&p_runtime_data->signal_evnt, (p_runtime_data->signals &
p_runtime_data->signal_mask));
@@ -499,16 +498,13 @@ void tfm_spm_init(void)
{
uint32_t i, num;
struct spm_partition_desc_t *partition;
- struct tfm_spm_service_t *service;
+ /*struct tfm_spm_service_t *service;*/
struct tfm_thrd_ctx *pth, this_thrd;
tfm_pool_init(conn_handle_pool,
POOL_BUFFER_SIZE(conn_handle_pool),
sizeof(struct tfm_conn_handle_t),
TFM_CONN_HANDLE_MAX_NUM);
- tfm_pool_init(spm_service_pool, POOL_BUFFER_SIZE(spm_service_pool),
- sizeof(struct tfm_spm_service_t),
- TFM_SPM_MAX_ROT_SERV_NUM);
tfm_pool_init(msg_db_pool, POOL_BUFFER_SIZE(msg_db_pool),
sizeof(struct tfm_msg_body_t),
TFM_MSG_QUEUE_MAX_MSG_NUM);
@@ -545,22 +541,17 @@ void tfm_spm_init(void)
}
/* Init Service */
- num = sizeof(g_spm_service_db) / sizeof(struct tfm_spm_service_db_t);
+ num = sizeof(service) / sizeof(struct tfm_spm_service_t);
for (i = 0; i < num; i++) {
partition =
- tfm_spm_get_partition_by_id(g_spm_service_db[i].partition_id);
+ tfm_spm_get_partition_by_id(service[i].service_db.partition_id);
if (!partition) {
tfm_panic();
}
- service = (struct tfm_spm_service_t *)tfm_pool_alloc(spm_service_pool);
- if (!service) {
- tfm_panic();
- }
- service->service_db = &g_spm_service_db[i];
- service->partition = partition;
- tfm_list_init(&service->handle_list);
+ service[i].partition = partition;
+ tfm_list_init(&service[i].handle_list);
tfm_list_add_tail(&partition->runtime_data.service_list,
- &service->list);
+ &service[i].list);
}
/*