aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMate Toth-Pal <mate.toth-pal@arm.com>2019-07-11 21:43:37 +0200
committerMate Toth-Pal <mate.toth-pal@arm.com>2019-07-29 13:55:30 +0200
commit3ad2e3e2b07f260087034025f237e44ae23bb771 (patch)
tree5a46fa1c7436bbf5e632741c9bc4a8b253c45a1d
parentaae98ffed0d8b67d3b7405f70ca1a2f1b792e8e6 (diff)
downloadtrusted-firmware-m-3ad2e3e2b07f260087034025f237e44ae23bb771.tar.gz
Core: Eliminate SPM DB initialising code
This commit modifies template files related to the SPM DB so that instead of generating code that initialises the DB, a C structure initialiser is generated directly for the DB. Change-Id: I88c2cd077a15101d24559027a73716a2f0a5c185 Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
-rw-r--r--secure_fw/core/ipc/tfm_spm.c9
-rw-r--r--secure_fw/services/tfm_partition_list.inc136
-rw-r--r--secure_fw/services/tfm_partition_list.inc.template51
-rw-r--r--secure_fw/services/tfm_spm_db.inc1223
-rw-r--r--secure_fw/services/tfm_spm_db.inc.template223
-rw-r--r--secure_fw/spm/spm_api.c45
-rw-r--r--secure_fw/spm/spm_db.h7
-rw-r--r--secure_fw/spm/spm_db_setup.h151
-rw-r--r--tools/tfm_generated_file_list.yaml2
9 files changed, 1468 insertions, 379 deletions
diff --git a/secure_fw/core/ipc/tfm_spm.c b/secure_fw/core/ipc/tfm_spm.c
index 31e81b5449..13b5fcdf8f 100644
--- a/secure_fw/core/ipc/tfm_spm.c
+++ b/secure_fw/core/ipc/tfm_spm.c
@@ -14,7 +14,6 @@
#include "platform/include/tfm_spm_hal.h"
#include "spm_api.h"
#include "spm_db.h"
-#include "spm_db_setup.h"
#include "tfm_internal_defines.h"
#include "tfm_wait.h"
#include "tfm_message_queue.h"
@@ -183,7 +182,7 @@ struct tfm_spm_service_t *tfm_spm_get_service_by_sid(uint32_t sid)
struct tfm_list_node_t *node, *head;
struct tfm_spm_service_t *service;
- for (i = 0; i < SPM_MAX_PARTITIONS; i++) {
+ for (i = 0; i < g_spm_partition_db.partition_count; i++) {
/* Skip partition without IPC flag */
if ((tfm_spm_partition_get_flags(g_spm_ipc_partition[i].index) &
SPM_PART_FLAG_IPC) == 0) {
@@ -215,7 +214,7 @@ struct tfm_spm_service_t *
struct tfm_list_node_t *handle_node, *handle_head;
struct tfm_spm_service_t *service;
- for (i = 0; i < SPM_MAX_PARTITIONS; i++) {
+ for (i = 0; i < g_spm_partition_db.partition_count; i++) {
/* Skip partition without IPC flag */
if ((tfm_spm_partition_get_flags(g_spm_ipc_partition[i].index) &
SPM_PART_FLAG_IPC) == 0) {
@@ -248,7 +247,7 @@ struct tfm_spm_ipc_partition_t *
{
uint32_t i;
- for (i = 0; i < SPM_MAX_PARTITIONS; i++) {
+ for (i = 0; i < g_spm_partition_db.partition_count; i++) {
if (g_spm_ipc_partition[i].id == partition_id) {
return &g_spm_ipc_partition[i];
}
@@ -508,7 +507,7 @@ void tfm_spm_init(void)
TFM_MSG_QUEUE_MAX_MSG_NUM);
/* Init partition first for it will be used when init service */
- for (i = 0; i < SPM_MAX_PARTITIONS; i++) {
+ for (i = 0; i < g_spm_partition_db.partition_count; i++) {
part = &g_spm_partition_db.partitions[i];
tfm_spm_hal_configure_default_isolation(part->platform_data);
g_spm_ipc_partition[i].index = i;
diff --git a/secure_fw/services/tfm_partition_list.inc b/secure_fw/services/tfm_partition_list.inc
deleted file mode 100644
index aaa9e556d1..0000000000
--- a/secure_fw/services/tfm_partition_list.inc
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-/*********** WARNING: This is an auto-generated file. Do not edit! ***********/
-
-#include "tfm_partition_defs.inc"
-
-#ifndef __TFM_PARTITION_LIST_INC__
-#define __TFM_PARTITION_LIST_INC__
-
-/******** TFM_SP_STORAGE ********/
-#define TFM_PARTITION_TFM_SP_STORAGE_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_STORAGE,
- SPM_PART_FLAG_IPC,
- "PSA-ROT",
- TFM_SP_STORAGE_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_SP_STORAGE, tfm_sst_req_mngr_init);
-
-#ifdef TFM_PARTITION_AUDIT_LOG
-/******** TFM_SP_AUDIT_LOG ********/
-#define TFM_PARTITION_TFM_SP_AUDIT_LOG_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_AUDIT_LOG,
- 0,
- "PSA-ROT",
- TFM_SP_AUDIT_LOG_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_SP_AUDIT_LOG, audit_core_init);
-#ifdef AUDIT_UART_REDIRECTION
-PARTITION_ADD_PERIPHERAL(TFM_SP_AUDIT_LOG, TFM_PERIPHERAL_UART1);
-#endif /* AUDIT_UART_REDIRECTION */
-#endif /* TFM_PARTITION_AUDIT_LOG */
-
-/******** TFM_SP_CRYPTO ********/
-#define TFM_PARTITION_TFM_SP_CRYPTO_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_CRYPTO,
- SPM_PART_FLAG_IPC,
- "PSA-ROT",
- TFM_SP_CRYPTO_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_SP_CRYPTO, tfm_crypto_init);
-
-#ifdef TFM_PARTITION_PLATFORM
-/******** TFM_SP_PLATFORM ********/
-#define TFM_PARTITION_TFM_SP_PLATFORM_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_PLATFORM,
- 0,
- "PSA-ROT",
- TFM_SP_PLATFORM_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_SP_PLATFORM, platform_sp_init);
-#endif /* TFM_PARTITION_PLATFORM */
-
-/******** TFM_SP_INITIAL_ATTESTATION ********/
-#define TFM_PARTITION_TFM_SP_INITIAL_ATTESTATION_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_INITIAL_ATTESTATION,
- SPM_PART_FLAG_IPC,
- "PSA-ROT",
- TFM_SP_INITIAL_ATTESTATION_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_SP_INITIAL_ATTESTATION, attest_partition_init);
-
-#ifdef TFM_PARTITION_TEST_CORE
-/******** TFM_SP_CORE_TEST ********/
-#define TFM_PARTITION_TFM_SP_CORE_TEST_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_CORE_TEST,
- SPM_PART_FLAG_IPC,
- "APPLICATION-ROT",
- TFM_SP_CORE_TEST_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_SP_CORE_TEST, core_test_init);
-PARTITION_ADD_PERIPHERAL(TFM_SP_CORE_TEST, TFM_PERIPHERAL_FPGA_IO);
-#endif /* TFM_PARTITION_TEST_CORE */
-
-#ifdef TFM_PARTITION_TEST_CORE
-/******** TFM_SP_CORE_TEST_2 ********/
-#define TFM_PARTITION_TFM_SP_CORE_TEST_2_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_CORE_TEST_2,
- SPM_PART_FLAG_IPC,
- "APPLICATION-ROT",
- TFM_SP_CORE_TEST_2_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_SP_CORE_TEST_2, core_test_2_init);
-#endif /* TFM_PARTITION_TEST_CORE */
-
-#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
-/******** TFM_SP_SECURE_TEST_PARTITION ********/
-#define TFM_PARTITION_TFM_SP_SECURE_TEST_PARTITION_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_SECURE_TEST_PARTITION,
- SPM_PART_FLAG_IPC,
- "PSA-ROT",
- TFM_SP_SECURE_TEST_PARTITION_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_SP_SECURE_TEST_PARTITION, tfm_secure_client_service_init);
-PARTITION_ADD_PERIPHERAL(TFM_SP_SECURE_TEST_PARTITION, TFM_PERIPHERAL_STD_UART);
-#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
-
-#ifdef TFM_PARTITION_TEST_CORE_IPC
-/******** TFM_SP_IPC_SERVICE_TEST ********/
-#define TFM_PARTITION_TFM_SP_IPC_SERVICE_TEST_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_IPC_SERVICE_TEST,
- SPM_PART_FLAG_IPC,
- "PSA-ROT",
- TFM_SP_IPC_SERVICE_TEST_ID,
- HIGH);
-PARTITION_ADD_INIT_FUNC(TFM_SP_IPC_SERVICE_TEST, ipc_service_test_main);
-#endif /* TFM_PARTITION_TEST_CORE_IPC */
-
-#ifdef TFM_PARTITION_TEST_CORE_IPC
-/******** TFM_SP_IPC_CLIENT_TEST ********/
-#define TFM_PARTITION_TFM_SP_IPC_CLIENT_TEST_IRQ_COUNT 0
-PARTITION_DECLARE(TFM_SP_IPC_CLIENT_TEST,
- SPM_PART_FLAG_IPC,
- "APPLICATION-ROT",
- TFM_SP_IPC_CLIENT_TEST_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_SP_IPC_CLIENT_TEST, ipc_client_test_main);
-#endif /* TFM_PARTITION_TEST_CORE_IPC */
-
-#ifdef TFM_PARTITION_TEST_CORE
-/******** TFM_IRQ_TEST_1 ********/
-#define TFM_PARTITION_TFM_IRQ_TEST_1_IRQ_COUNT 1
-PARTITION_DECLARE(TFM_IRQ_TEST_1,
- SPM_PART_FLAG_IPC,
- "APPLICATION-ROT",
- TFM_IRQ_TEST_1_ID,
- NORMAL);
-PARTITION_ADD_INIT_FUNC(TFM_IRQ_TEST_1, tfm_irq_test_1_init);
-PARTITION_ADD_PERIPHERAL(TFM_IRQ_TEST_1, TFM_PERIPHERAL_TIMER0);
-#endif /* TFM_PARTITION_TEST_CORE */
-
-#endif /* __TFM_PARTITION_LIST_INC__ */
diff --git a/secure_fw/services/tfm_partition_list.inc.template b/secure_fw/services/tfm_partition_list.inc.template
deleted file mode 100644
index d949f19167..0000000000
--- a/secure_fw/services/tfm_partition_list.inc.template
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-{{utilities.donotedit_warning}}
-
-#include "tfm_partition_defs.inc"
-
-#ifndef __TFM_PARTITION_LIST_INC__
-#define __TFM_PARTITION_LIST_INC__
-
-{% for manifest in manifests %}
- {% if manifest.attr.conditional %}
-#ifdef {{manifest.attr.conditional}}
- {% endif %}
-/******** {{manifest.manifest.name}} ********/
- {% if manifest.manifest.irqs %}
-#define TFM_PARTITION_{{manifest.manifest.name}}_IRQ_COUNT {{manifest.manifest.irqs | length() }}
- {% else %}
-#define TFM_PARTITION_{{manifest.manifest.name}}_IRQ_COUNT 0
- {% endif %}
-PARTITION_DECLARE({{manifest.manifest.name}},
- {% if manifest.attr.tfm_partition_ipc %}
- SPM_PART_FLAG_IPC,
- {% else %}
- 0,
- {% endif %}
- "{{manifest.manifest.type}}",
- {{manifest.manifest.name}}_ID,
- {{manifest.manifest.priority}});
-PARTITION_ADD_INIT_FUNC({{manifest.manifest.name}}, {{manifest.manifest.entry_point}});
- {% if manifest.manifest.mmio_regions %}
- {% for region in manifest.manifest.mmio_regions %}
- {% if region.conditional %}
-#ifdef {{region.conditional}}
- {% endif %}
-PARTITION_ADD_PERIPHERAL({{manifest.manifest.name}}, {{region.name}});
- {% if region.conditional %}
-#endif /* {{region.conditional}} */
- {% endif %}
- {% endfor %}
- {% endif %}
- {% if manifest.attr.conditional %}
-#endif /* {{manifest.attr.conditional}} */
- {% endif %}
-
-{% endfor %}
-#endif /* __TFM_PARTITION_LIST_INC__ */
diff --git a/secure_fw/services/tfm_spm_db.inc b/secure_fw/services/tfm_spm_db.inc
new file mode 100644
index 0000000000..35b0774b36
--- /dev/null
+++ b/secure_fw/services/tfm_spm_db.inc
@@ -0,0 +1,1223 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/*********** WARNING: This is an auto-generated file. Do not edit! ***********/
+
+#ifndef __TFM_SPM_DB_INC__
+#define __TFM_SPM_DB_INC__
+
+#include "spm_api.h"
+
+/**************************************************************************/
+/** IRQ count per partition */
+/**************************************************************************/
+#define TFM_PARTITION_TFM_SP_STORAGE_IRQ_COUNT 0
+
+#ifdef TFM_PARTITION_AUDIT_LOG
+#define TFM_PARTITION_TFM_SP_AUDIT_LOG_IRQ_COUNT 0
+#endif /* TFM_PARTITION_AUDIT_LOG */
+
+#define TFM_PARTITION_TFM_SP_CRYPTO_IRQ_COUNT 0
+
+#ifdef TFM_PARTITION_PLATFORM
+#define TFM_PARTITION_TFM_SP_PLATFORM_IRQ_COUNT 0
+#endif /* TFM_PARTITION_PLATFORM */
+
+#define TFM_PARTITION_TFM_SP_INITIAL_ATTESTATION_IRQ_COUNT 0
+
+#ifdef TFM_PARTITION_TEST_CORE
+#define TFM_PARTITION_TFM_SP_CORE_TEST_IRQ_COUNT 0
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_CORE
+#define TFM_PARTITION_TFM_SP_CORE_TEST_2_IRQ_COUNT 0
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+#define TFM_PARTITION_TFM_SP_SECURE_TEST_PARTITION_IRQ_COUNT 0
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+#define TFM_PARTITION_TFM_SP_IPC_SERVICE_TEST_IRQ_COUNT 0
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+#define TFM_PARTITION_TFM_SP_IPC_CLIENT_TEST_IRQ_COUNT 0
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE
+#define TFM_PARTITION_TFM_IRQ_TEST_1_IRQ_COUNT 1
+#endif /* TFM_PARTITION_TEST_CORE */
+
+/**************************************************************************/
+/** Declarations of partition init functions */
+/**************************************************************************/
+extern int32_t tfm_sst_req_mngr_init(void);
+
+#ifdef TFM_PARTITION_AUDIT_LOG
+extern int32_t audit_core_init(void);
+#endif /* TFM_PARTITION_AUDIT_LOG */
+
+extern int32_t tfm_crypto_init(void);
+
+#ifdef TFM_PARTITION_PLATFORM
+extern int32_t platform_sp_init(void);
+#endif /* TFM_PARTITION_PLATFORM */
+
+extern int32_t attest_partition_init(void);
+
+#ifdef TFM_PARTITION_TEST_CORE
+extern int32_t core_test_init(void);
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_CORE
+extern int32_t core_test_2_init(void);
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+extern int32_t tfm_secure_client_service_init(void);
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+extern int32_t ipc_service_test_main(void);
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+extern int32_t ipc_client_test_main(void);
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE
+extern int32_t tfm_irq_test_1_init(void);
+#endif /* TFM_PARTITION_TEST_CORE */
+
+/**************************************************************************/
+/** Memory region declarations */
+/**************************************************************************/
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_STORAGE, _STACK$$ZI$$Limit);
+
+#ifdef TFM_PARTITION_AUDIT_LOG
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_AUDIT_LOG, _STACK$$ZI$$Limit);
+#endif /* TFM_PARTITION_AUDIT_LOG */
+
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CRYPTO, _STACK$$ZI$$Limit);
+
+#ifdef TFM_PARTITION_PLATFORM
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_PLATFORM, _STACK$$ZI$$Limit);
+#endif /* TFM_PARTITION_PLATFORM */
+
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_INITIAL_ATTESTATION, _STACK$$ZI$$Limit);
+
+#ifdef TFM_PARTITION_TEST_CORE
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST, _STACK$$ZI$$Limit);
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_CORE
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_CORE_TEST_2, _STACK$$ZI$$Limit);
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_SECURE_TEST_PARTITION, _STACK$$ZI$$Limit);
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_SERVICE_TEST, _STACK$$ZI$$Limit);
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Limit);
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, $$Base);
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, $$Limit);
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _STACK$$ZI$$Limit);
+#endif /* TFM_PARTITION_TEST_CORE */
+
+/**************************************************************************/
+/** Context stacks for IRQ handling */
+/**************************************************************************/
+/* The max size of the context stack can be calculated as a function of the IRQ
+ * count of the secure partition:
+ *
+ * max_stack_size = intr_ctx_size + (IRQ_CNT * (intr_ctx_size + hndl_ctx_size))
+ *
+ * where:
+ * intr_ctx: Frame pushed when the partition is interrupted
+ * hndl_ctx: Frame pushed when the partition is handling an interrupt
+ */
+static uint32_t ctx_stack_TFM_SP_STORAGE[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_STORAGE_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+
+#ifdef TFM_PARTITION_AUDIT_LOG
+static uint32_t ctx_stack_TFM_SP_AUDIT_LOG[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_AUDIT_LOG_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+#endif /* TFM_PARTITION_AUDIT_LOG */
+
+static uint32_t ctx_stack_TFM_SP_CRYPTO[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_CRYPTO_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+
+#ifdef TFM_PARTITION_PLATFORM
+static uint32_t ctx_stack_TFM_SP_PLATFORM[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_PLATFORM_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+#endif /* TFM_PARTITION_PLATFORM */
+
+static uint32_t ctx_stack_TFM_SP_INITIAL_ATTESTATION[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_INITIAL_ATTESTATION_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+
+#ifdef TFM_PARTITION_TEST_CORE
+static uint32_t ctx_stack_TFM_SP_CORE_TEST[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_CORE_TEST_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_CORE
+static uint32_t ctx_stack_TFM_SP_CORE_TEST_2[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_CORE_TEST_2_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+static uint32_t ctx_stack_TFM_SP_SECURE_TEST_PARTITION[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_SECURE_TEST_PARTITION_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+static uint32_t ctx_stack_TFM_SP_IPC_SERVICE_TEST[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_IPC_SERVICE_TEST_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+static uint32_t ctx_stack_TFM_SP_IPC_CLIENT_TEST[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_IPC_CLIENT_TEST_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE
+static uint32_t ctx_stack_TFM_IRQ_TEST_1[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_IRQ_TEST_1_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+#endif /* TFM_PARTITION_TEST_CORE */
+
+/**************************************************************************/
+/** The partition list for the DB */
+/**************************************************************************/
+struct spm_partition_desc_t partition_list [] =
+{
+ {{0}}, /* placeholder for Non-secure internal partition */
+ {{0}}, /* placeholder for TF-M Core internal partition */
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_STORAGE */
+ /* -----------------------------------------------------------------------*/
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_STORAGE_ID,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = tfm_sst_req_mngr_init,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_STORAGE, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_STORAGE,
+ .signal_mask = 0,
+ },
+
+ .platform_data = NULL,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_STORAGE, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_STORAGE, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_STORAGE, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_STORAGE, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_STORAGE, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_STORAGE, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_AUDIT_LOG */
+ /* -----------------------------------------------------------------------*/
+#ifdef TFM_PARTITION_AUDIT_LOG
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_AUDIT_LOG_ID,
+ .partition_flags = 0
+ | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = audit_core_init,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_AUDIT_LOG,
+ .signal_mask = 0,
+ },
+
+ /* platform data */
+ /* FIXME: Only adding the first mmio region */
+#ifdef AUDIT_UART_REDIRECTION
+ .platform_data = TFM_PERIPHERAL_UART1,
+#else /* AUDIT_UART_REDIRECTION */
+ .platform_data = NULL,
+#endif /* AUDIT_UART_REDIRECTION */
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+#endif /* TFM_PARTITION_AUDIT_LOG */
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_CRYPTO */
+ /* -----------------------------------------------------------------------*/
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_CRYPTO_ID,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = tfm_crypto_init,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_CRYPTO, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_CRYPTO,
+ .signal_mask = 0,
+ },
+
+ .platform_data = NULL,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_CRYPTO, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_CRYPTO, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_CRYPTO, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_CRYPTO, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_CRYPTO, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_CRYPTO, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_PLATFORM */
+ /* -----------------------------------------------------------------------*/
+#ifdef TFM_PARTITION_PLATFORM
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_PLATFORM_ID,
+ .partition_flags = 0
+ | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = platform_sp_init,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_PLATFORM, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_PLATFORM,
+ .signal_mask = 0,
+ },
+
+ .platform_data = NULL,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_PLATFORM, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_PLATFORM, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_PLATFORM, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_PLATFORM, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_PLATFORM, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_PLATFORM, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+#endif /* TFM_PARTITION_PLATFORM */
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_INITIAL_ATTESTATION */
+ /* -----------------------------------------------------------------------*/
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_INITIAL_ATTESTATION_ID,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = attest_partition_init,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_INITIAL_ATTESTATION,
+ .signal_mask = 0,
+ },
+
+ .platform_data = NULL,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_CORE_TEST */
+ /* -----------------------------------------------------------------------*/
+#ifdef TFM_PARTITION_TEST_CORE
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_CORE_TEST_ID,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = core_test_init,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_CORE_TEST, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_CORE_TEST,
+ .signal_mask = 0,
+ },
+
+ /* platform data */
+ /* FIXME: Only adding the first mmio region */
+ .platform_data = TFM_PERIPHERAL_FPGA_IO,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_CORE_TEST, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_CORE_TEST, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+#endif /* TFM_PARTITION_TEST_CORE */
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_CORE_TEST_2 */
+ /* -----------------------------------------------------------------------*/
+#ifdef TFM_PARTITION_TEST_CORE
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_CORE_TEST_2_ID,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = core_test_2_init,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_CORE_TEST_2,
+ .signal_mask = 0,
+ },
+
+ .platform_data = NULL,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+#endif /* TFM_PARTITION_TEST_CORE */
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_SECURE_TEST_PARTITION */
+ /* -----------------------------------------------------------------------*/
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_SECURE_TEST_PARTITION_ID,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = tfm_secure_client_service_init,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_SECURE_TEST_PARTITION,
+ .signal_mask = 0,
+ },
+
+ /* platform data */
+ /* FIXME: Only adding the first mmio region */
+ .platform_data = TFM_PERIPHERAL_STD_UART,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_IPC_SERVICE_TEST */
+ /* -----------------------------------------------------------------------*/
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_IPC_SERVICE_TEST_ID,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(HIGH),
+ .partition_init = ipc_service_test_main,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_IPC_SERVICE_TEST,
+ .signal_mask = 0,
+ },
+
+ .platform_data = NULL,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_IPC_CLIENT_TEST */
+ /* -----------------------------------------------------------------------*/
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_SP_IPC_CLIENT_TEST_ID,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = ipc_client_test_main,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_SP_IPC_CLIENT_TEST,
+ .signal_mask = 0,
+ },
+
+ .platform_data = NULL,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_IRQ_TEST_1 */
+ /* -----------------------------------------------------------------------*/
+#ifdef TFM_PARTITION_TEST_CORE
+ {
+ /* Static data */
+ {
+ .partition_id = TFM_IRQ_TEST_1_ID,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = tfm_irq_test_1_init,
+ },
+
+ /* Runtime data */
+ {
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR(TFM_IRQ_TEST_1, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{0}},
+ .in_len = 0,
+ .out_vec = {{0}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_TFM_IRQ_TEST_1,
+ .signal_mask = 0,
+ },
+
+ /* platform data */
+ /* FIXME: Only adding the first mmio region */
+ .platform_data = TFM_PERIPHERAL_TIMER0,
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {
+ .code_start = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_IRQ_TEST_1, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_IRQ_TEST_1, _STACK$$ZI$$Limit),
+ },
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ },
+#endif /* TFM_PARTITION_TEST_CORE */
+
+};
+
+struct spm_partition_db_t g_spm_partition_db = {
+ .is_init = 0,
+ .partition_count = sizeof(partition_list) / sizeof(partition_list[0]),
+ .running_partition_idx = 0,
+ .partitions = partition_list,
+};
+
+#endif /* __TFM_SPM_DB_INC__ */
diff --git a/secure_fw/services/tfm_spm_db.inc.template b/secure_fw/services/tfm_spm_db.inc.template
new file mode 100644
index 0000000000..2b52b4de24
--- /dev/null
+++ b/secure_fw/services/tfm_spm_db.inc.template
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+{{utilities.donotedit_warning}}
+
+#ifndef __TFM_SPM_DB_INC__
+#define __TFM_SPM_DB_INC__
+
+#include "spm_api.h"
+
+/**************************************************************************/
+/** IRQ count per partition */
+/**************************************************************************/
+{% for manifest in manifests %}
+ {% if manifest.attr.conditional %}
+#ifdef {{manifest.attr.conditional}}
+ {% endif %}
+ {% if manifest.manifest.irqs %}
+#define TFM_PARTITION_{{manifest.manifest.name}}_IRQ_COUNT {{manifest.manifest.irqs | length() }}
+ {% else %}
+#define TFM_PARTITION_{{manifest.manifest.name}}_IRQ_COUNT 0
+ {% endif %}
+ {% if manifest.attr.conditional %}
+#endif /* {{manifest.attr.conditional}} */
+ {% endif %}
+
+{% endfor %}
+/**************************************************************************/
+/** Declarations of partition init functions */
+/**************************************************************************/
+{% for manifest in manifests %}
+ {% if manifest.attr.conditional %}
+#ifdef {{manifest.attr.conditional}}
+ {% endif %}
+extern int32_t {{manifest.manifest.entry_point}}(void);
+ {% if manifest.attr.conditional %}
+#endif /* {{manifest.attr.conditional}} */
+ {% endif %}
+
+{% endfor %}
+/**************************************************************************/
+/** Memory region declarations */
+/**************************************************************************/
+{% for manifest in manifests %}
+ {% if manifest.attr.conditional %}
+#ifdef {{manifest.attr.conditional}}
+ {% endif %}
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, $$Base);
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, $$Limit);
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, $$RO$$Base);
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, $$RO$$Limit);
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, {{manifest.manifest.name}}, _STACK$$ZI$$Limit);
+ {% if manifest.attr.conditional %}
+#endif /* {{manifest.attr.conditional}} */
+ {% endif %}
+
+{% endfor %}
+/**************************************************************************/
+/** Context stacks for IRQ handling */
+/**************************************************************************/
+/* The max size of the context stack can be calculated as a function of the IRQ
+ * count of the secure partition:
+ *
+ * max_stack_size = intr_ctx_size + (IRQ_CNT * (intr_ctx_size + hndl_ctx_size))
+ *
+ * where:
+ * intr_ctx: Frame pushed when the partition is interrupted
+ * hndl_ctx: Frame pushed when the partition is handling an interrupt
+ */
+{% for manifest in manifests %}
+ {% if manifest.attr.conditional %}
+#ifdef {{manifest.attr.conditional}}
+ {% endif %}
+static uint32_t ctx_stack_{{manifest.manifest.name}}[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_{{manifest.manifest.name}}_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+ {% if manifest.attr.conditional %}
+#endif /* {{manifest.attr.conditional}} */
+ {% endif %}
+
+{% endfor %}
+/**************************************************************************/
+/** The partition list for the DB */
+/**************************************************************************/
+struct spm_partition_desc_t partition_list [] =
+{
+ {{'{{0}}'}}, /* placeholder for Non-secure internal partition */
+ {{'{{0}}'}}, /* placeholder for TF-M Core internal partition */
+
+{% for manifest in manifests %}
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for {{manifest.manifest.name}} */
+ /* -----------------------------------------------------------------------*/
+ {% if manifest.attr.conditional %}
+#ifdef {{manifest.attr.conditional}}
+ {% endif %}
+ {{'{'}}
+ /* Static data */
+ {{'{'}}
+ .partition_id = {{manifest.manifest.name}}_ID,
+ {% if manifest.attr.tfm_partition_ipc %}
+ .partition_flags = SPM_PART_FLAG_IPC
+ {% else %}
+ .partition_flags = 0
+ {% endif %}
+ {% if manifest.manifest.type == "APPLICATION-ROT" %}
+ | SPM_PART_FLAG_APP_ROT
+ {% elif manifest.manifest.type == "PSA-ROT" %}
+ | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+ {% else %}
+#error "Unsupported type '{{manifest.manifest.type}}' for partition '{{manifest.manifest.name}}'!"
+ {% endif %}
+ ,
+ .partition_priority = TFM_PRIORITY({{manifest.manifest.priority}}),
+ .partition_init = {{manifest.manifest.entry_point}},
+ {{'},'}}
+
+ /* Runtime data */
+ {{'{'}}
+ .partition_state = SPM_PARTITION_STATE_UNINIT,
+ .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
+ .caller_client_id = TFM_INVALID_CLIENT_ID,
+ .share = TFM_BUFFER_SHARE_DISABLE,
+#if TFM_LVL != 1
+ .stack_ptr = PART_REGION_ADDR({{manifest.manifest.name}}, _STACK$$ZI$$Limit) -
+ sizeof(struct iovec_args_t),
+#else /* TFM_LVL != 1 */
+ .stack_ptr = 0,
+#endif /* TFM_LVL != 1 */
+ .lr = 0,
+ .iovec_api = TFM_SFN_API_IOVEC,
+ .iovec_args =
+ {
+ .in_vec = {{'{{0}}'}},
+ .in_len = 0,
+ .out_vec = {{'{{0}}'}},
+ .out_len = 0,
+ },
+ .orig_outvec = NULL,
+ .ctx_stack_ptr = ctx_stack_{{manifest.manifest.name}},
+ .signal_mask = 0,
+ {{'},'}}
+
+ {% if manifest.manifest.mmio_regions %}
+ /* platform data */
+ /* FIXME: Only adding the first mmio region */
+ {% for region in manifest.manifest.mmio_regions %}
+ {% if loop.first %}
+ {% if region.conditional %}
+#ifdef {{region.conditional}}
+ {% endif %}
+ .platform_data = {{region.name}},
+ {% if region.conditional %}
+#else /* {{region.conditional}} */
+ .platform_data = NULL,
+#endif /* {{region.conditional}} */
+ {% endif %}
+ {% else %} {# print nothing #} {% endif %}
+ {% endfor %}
+ {% else %}
+ .platform_data = NULL,
+ {% endif %}
+
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
+ /* memory_data */
+ .memory_data = {{'{'}}
+ .code_start = PART_REGION_ADDR({{manifest.manifest.name}}, $$Base),
+ .code_limit = PART_REGION_ADDR({{manifest.manifest.name}}, $$Limit),
+ .ro_start = PART_REGION_ADDR({{manifest.manifest.name}}, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR({{manifest.manifest.name}}, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR({{manifest.manifest.name}}, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR({{manifest.manifest.name}}, _STACK$$ZI$$Limit),
+ {{'},'}}
+#endif
+
+#ifdef TFM_PSA_API
+ /* sp_thrd */
+ .sp_thrd = {
+ .pfn = NULL,
+ .param = NULL,
+ .sp_base = NULL,
+ .sp_top = NULL,
+ .prior = THRD_PRIOR_LOWEST,
+ .status = THRD_STAT_INVALID,
+ .state_ctx =
+ {
+ .ctxb = {0}, /* Fields are not detailed as they are architecture dependent*/
+ },
+ .next = NULL,
+ },
+#endif /* defined(TFM_PSA_API) */
+ {{'},'}}
+ {% if manifest.attr.conditional %}
+#endif /* {{manifest.attr.conditional}} */
+ {% endif %}
+
+{% endfor %}
+};
+
+struct spm_partition_db_t g_spm_partition_db = {
+ .is_init = 0,
+ .partition_count = sizeof(partition_list) / sizeof(partition_list[0]),
+ .running_partition_idx = 0,
+ .partitions = partition_list,
+};
+
+#endif /* __TFM_SPM_DB_INC__ */
diff --git a/secure_fw/spm/spm_api.c b/secure_fw/spm/spm_api.c
index 9b3f3f2164..ffca849412 100644
--- a/secure_fw/spm/spm_api.c
+++ b/secure_fw/spm/spm_api.c
@@ -12,7 +12,7 @@
#include "spm_api.h"
#include "platform/include/tfm_spm_hal.h"
#include "tfm_memory_utils.h"
-#include "spm_db_setup.h"
+#include "spm_db.h"
#include "tfm_internal.h"
#include "tfm_api.h"
#include "tfm_nspm.h"
@@ -20,8 +20,8 @@
#include "tfm_peripherals_def.h"
#include "spm_partition_defs.h"
-
-struct spm_partition_db_t g_spm_partition_db = {0,};
+#define NON_SECURE_INTERNAL_PARTITION_DB_IDX 0
+#define TFM_CORE_INTERNAL_PARTITION_DB_IDX 1
typedef enum {
TFM_INIT_FAILURE,
@@ -45,6 +45,9 @@ struct handler_ctx_stack_frame_t {
uint32_t caller_partition_idx;
};
+/* Define SPM DB structure */
+#include "secure_fw/services/tfm_spm_db.inc"
+
/*
* This function is called when a secure partition causes an error.
* In case of an error in the error handling, a non-zero value have to be
@@ -74,17 +77,6 @@ static void tfm_spm_partition_err_handler(
}
#endif /* !defined(TFM_PSA_API) */
-/*
- * This function prevents name clashes between the variable names accessibles in
- * the scope of where tfm_partition_list.inc is included and the varaible names
- * defined inside tfm_partition_list.inc file.
- */
-static inline enum spm_err_t add_user_defined_partitions(void) {
- #include "secure_fw/services/tfm_partition_list.inc"
-
- return SPM_ERR_OK;
-}
-
uint32_t get_partition_idx(uint32_t partition_id)
{
uint32_t i;
@@ -104,18 +96,13 @@ uint32_t get_partition_idx(uint32_t partition_id)
enum spm_err_t tfm_spm_db_init(void)
{
- struct spm_partition_desc_t *part_ptr;
- enum spm_err_t err;
+ struct spm_partition_desc_t *part_ptr;
static uint32_t ns_interrupt_ctx_stack[
sizeof(struct interrupted_ctx_stack_frame_t)/sizeof(uint32_t)] = {0};
static uint32_t tfm_core_interrupt_ctx_stack[
sizeof(struct interrupted_ctx_stack_frame_t)/sizeof(uint32_t)] = {0};
- (void)tfm_memset (&g_spm_partition_db, 0, sizeof(g_spm_partition_db));
-
/* This function initialises partition db */
- g_spm_partition_db.running_partition_idx = SPM_INVALID_PARTITION_IDX;
- g_spm_partition_db.partition_count = 0;
/* There are a few partitions that are used by TF-M internally.
* These are explicitly added to the partition db here.
@@ -128,11 +115,9 @@ enum spm_err_t tfm_spm_db_init(void)
uint32_t psp_stack_bottom = (uint32_t)Image$$ARM_LIB_STACK$$ZI$$Base;
uint32_t psp_stack_top = (uint32_t)Image$$ARM_LIB_STACK$$ZI$$Limit;
#endif
- if (g_spm_partition_db.partition_count >= SPM_MAX_PARTITIONS) {
- return SPM_ERR_INVALID_CONFIG;
- }
+
part_ptr = &(g_spm_partition_db.partitions[
- g_spm_partition_db.partition_count]);
+ NON_SECURE_INTERNAL_PARTITION_DB_IDX]);
part_ptr->static_data.partition_id = TFM_SP_NON_SECURE_ID;
#ifdef TFM_PSA_API
part_ptr->static_data.partition_flags = SPM_PART_FLAG_APP_ROT |
@@ -155,25 +140,15 @@ enum spm_err_t tfm_spm_db_init(void)
part_ptr->runtime_data.partition_state = SPM_PARTITION_STATE_UNINIT;
part_ptr->runtime_data.ctx_stack_ptr = ns_interrupt_ctx_stack;
tfm_nspm_configure_clients();
- ++g_spm_partition_db.partition_count;
/* For the TF-M core environment itself */
- if (g_spm_partition_db.partition_count >= SPM_MAX_PARTITIONS) {
- return SPM_ERR_INVALID_CONFIG;
- }
part_ptr = &(g_spm_partition_db.partitions[
- g_spm_partition_db.partition_count]);
+ TFM_CORE_INTERNAL_PARTITION_DB_IDX]);
part_ptr->static_data.partition_id = TFM_SP_CORE_ID;
part_ptr->static_data.partition_flags =
SPM_PART_FLAG_APP_ROT | SPM_PART_FLAG_PSA_ROT;
part_ptr->runtime_data.partition_state = SPM_PARTITION_STATE_UNINIT;
part_ptr->runtime_data.ctx_stack_ptr = tfm_core_interrupt_ctx_stack;
- ++g_spm_partition_db.partition_count;
-
- err = add_user_defined_partitions();
- if (err != SPM_ERR_OK) {
- return err;
- }
g_spm_partition_db.is_init = 1;
diff --git a/secure_fw/spm/spm_db.h b/secure_fw/spm/spm_db.h
index a3af8be0d5..8b1a00b75a 100644
--- a/secure_fw/spm/spm_db.h
+++ b/secure_fw/spm/spm_db.h
@@ -61,6 +61,13 @@ struct spm_partition_desc_t {
#endif
};
+struct spm_partition_db_t {
+ uint32_t is_init;
+ uint32_t partition_count;
+ uint32_t running_partition_idx;
+ struct spm_partition_desc_t *partitions;
+};
+
/* Macros to pick linker symbols and allow to form the partition data base */
#define REGION(a, b, c) a##b##c
#define REGION_NAME(a, b, c) REGION(a, b, c)
diff --git a/secure_fw/spm/spm_db_setup.h b/secure_fw/spm/spm_db_setup.h
deleted file mode 100644
index 31696dce3c..0000000000
--- a/secure_fw/spm/spm_db_setup.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __SPM_DB_SETUP_H__
-#define __SPM_DB_SETUP_H__
-
-#include <stdint.h>
-#include "spm_db.h"
-
-/**
- * \brief Get the index of a partition.
- *
- * Gets the index of a partition in the partition db based on the partition ID
- * provided as a parameter.
- *
- * \param[in] partition_idx The index of the partition
- *
- * \return \ref INVALID_PARTITION_IDX if the provided index is invalid. The
- * index of the partition otherwise.
- */
-uint32_t get_partition_idx(uint32_t partition_id);
-
-struct spm_partition_db_t {
- uint32_t is_init;
- uint32_t partition_count;
- uint32_t running_partition_idx;
- struct spm_partition_desc_t partitions[SPM_MAX_PARTITIONS];
-};
-
-#define PARTITION_INIT_STATIC_DATA(data, partition, flags, id, priority) \
- do { \
- data.partition_id = partition##_ID; \
- data.partition_flags = flags; \
- data.partition_priority = TFM_PRIORITY(priority); \
- } while (0)
-
-#if (TFM_LVL == 1) && !defined(TFM_PSA_API)
-#define PARTITION_INIT_MEMORY_DATA(data, partition)
-#else
-#define PARTITION_INIT_MEMORY_DATA(data, partition) \
- do { \
- data.code_start = PART_REGION_ADDR(partition, $$Base); \
- data.code_limit = PART_REGION_ADDR(partition, $$Limit); \
- data.ro_start = PART_REGION_ADDR(partition, $$RO$$Base); \
- data.ro_limit = PART_REGION_ADDR(partition, $$RO$$Limit); \
- data.rw_start = PART_REGION_ADDR(partition, _DATA$$RW$$Base); \
- data.rw_limit = PART_REGION_ADDR(partition, _DATA$$RW$$Limit); \
- data.zi_start = PART_REGION_ADDR(partition, _DATA$$ZI$$Base); \
- data.zi_limit = PART_REGION_ADDR(partition, _DATA$$ZI$$Limit); \
- data.stack_bottom = PART_REGION_ADDR(partition, _STACK$$ZI$$Base); \
- data.stack_top = PART_REGION_ADDR(partition, _STACK$$ZI$$Limit); \
- } while (0)
-#endif
-
-/* The max size of the context stack can be calculated as a function of the IRQ
- * count of the secure partition:
- *
- * max_stack_size = intr_ctx_size + (IRQ_CNT * (intr_ctx_size + hndl_ctx_size))
- *
- * where:
- * intr_ctx: Frame pushed when the partition is interrupted
- * hndl_ctx: Frame pushed when the partition is handling an interrupt
- */
-#define DECLARE_CONTEXT_STACK(partition) \
- static uint32_t ctx_stack_ptr_##partition[ \
- (sizeof(struct interrupted_ctx_stack_frame_t) + \
- (TFM_PARTITION_##partition##_IRQ_COUNT) * ( \
- sizeof(struct interrupted_ctx_stack_frame_t) + \
- sizeof(struct handler_ctx_stack_frame_t) \
- )) / sizeof(uint32_t)]
-
-#if TFM_LVL == 1
-#define PARTITION_INIT_RUNTIME_DATA(data, partition) \
- do { \
- DECLARE_CONTEXT_STACK(partition); \
- data.partition_state = SPM_PARTITION_STATE_UNINIT; \
- data.ctx_stack_ptr = ctx_stack_ptr_##partition; \
- } while (0)
-#else
-#define PARTITION_INIT_RUNTIME_DATA(data, partition) \
- do { \
- DECLARE_CONTEXT_STACK(partition); \
- data.partition_state = SPM_PARTITION_STATE_UNINIT; \
- /* The top of the stack is reserved for the iovec */ \
- /* parameters of the service called. That's why in */ \
- /* data.stack_ptr we extract sizeof(struct iovec_args_t) */ \
- /* from the limit. */ \
- data.stack_ptr = \
- PART_REGION_ADDR(partition, _STACK$$ZI$$Limit - \
- sizeof(struct iovec_args_t)); \
- data.ctx_stack_ptr = ctx_stack_ptr_##partition; \
- } while (0)
-#endif
-
-#define PARTITION_DECLARE(partition, flag, type, id, priority) \
- do { \
- REGION_DECLARE(Image$$, partition, $$Base); \
- REGION_DECLARE(Image$$, partition, $$Limit); \
- REGION_DECLARE(Image$$, partition, $$RO$$Base); \
- REGION_DECLARE(Image$$, partition, $$RO$$Limit); \
- REGION_DECLARE(Image$$, partition, _DATA$$RW$$Base); \
- REGION_DECLARE(Image$$, partition, _DATA$$RW$$Limit); \
- REGION_DECLARE(Image$$, partition, _DATA$$ZI$$Base); \
- REGION_DECLARE(Image$$, partition, _DATA$$ZI$$Limit); \
- REGION_DECLARE(Image$$, partition, _STACK$$ZI$$Base); \
- REGION_DECLARE(Image$$, partition, _STACK$$ZI$$Limit); \
- int32_t flags = flag; \
- if (tfm_memcmp(type, TFM_PARTITION_TYPE_APP, \
- strlen(TFM_PARTITION_TYPE_APP)) == 0) { \
- flags |= SPM_PART_FLAG_APP_ROT; \
- } else if (tfm_memcmp(type, TFM_PARTITION_TYPE_PSA, \
- strlen(TFM_PARTITION_TYPE_PSA)) == 0) { \
- flags |= SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT; \
- } else { \
- return SPM_ERR_INVALID_CONFIG; \
- } \
- struct spm_partition_desc_t *part_ptr; \
- if (g_spm_partition_db.partition_count >= SPM_MAX_PARTITIONS) { \
- return SPM_ERR_INVALID_CONFIG; \
- } \
- part_ptr = &(g_spm_partition_db.partitions[ \
- g_spm_partition_db.partition_count]); \
- PARTITION_INIT_STATIC_DATA(part_ptr->static_data, partition, flags, \
- id, priority); \
- PARTITION_INIT_RUNTIME_DATA(part_ptr->runtime_data, partition); \
- PARTITION_INIT_MEMORY_DATA(part_ptr->memory_data, partition); \
- ++g_spm_partition_db.partition_count; \
- } while (0)
-
-#define PARTITION_ADD_INIT_FUNC(partition, init_func) \
- do { \
- extern int32_t init_func(void); \
- uint32_t partition_idx = get_partition_idx(partition##_ID); \
- struct spm_partition_desc_t *part_ptr = \
- &(g_spm_partition_db.partitions[partition_idx]); \
- part_ptr->static_data.partition_init = init_func; \
- } while (0)
-
-#define PARTITION_ADD_PERIPHERAL(partition, peripheral) \
- do { \
- uint32_t partition_idx = get_partition_idx(partition##_ID); \
- struct spm_partition_desc_t *part_ptr = \
- &(g_spm_partition_db.partitions[partition_idx]); \
- part_ptr->platform_data = peripheral; \
- } while (0)
-
-#endif /* __SPM_DB_SETUP_H__ */
diff --git a/tools/tfm_generated_file_list.yaml b/tools/tfm_generated_file_list.yaml
index 7cc9445b8a..1f0f4913d5 100644
--- a/tools/tfm_generated_file_list.yaml
+++ b/tools/tfm_generated_file_list.yaml
@@ -19,7 +19,7 @@
{
"name": "Secure Partition declarations",
"short_name": "tfm_partition_list",
- "output": "secure_fw/services/tfm_partition_list.inc"
+ "output": "secure_fw/services/tfm_spm_db.inc"
},
{
"name": "Secure Service list",