diff options
Diffstat (limited to 'secure_fw')
17 files changed, 60 insertions, 59 deletions
diff --git a/secure_fw/include/load/partition_defs.h b/secure_fw/include/load/partition_defs.h index 74d04d0db4..80edfd978a 100644 --- a/secure_fw/include/load/partition_defs.h +++ b/secure_fw/include/load/partition_defs.h @@ -21,7 +21,7 @@ #define TFM_PARTITION_PRIVILEGED_MODE (1U) /* - * Partition static data - flags + * Partition load data - flags * bit 7-0: priority * bit 8: 1 - PSA_ROT, 0 - APP_ROT * bit 9: 1 - IPC model, 0 - SFN model @@ -42,7 +42,7 @@ * aligned. It includes: stack and heap position, dependencies, services and * assets data. */ -struct partition_static_info_t { +struct partition_load_info_t { uint32_t psa_ff_ver; /* Encode the version with magic */ uint32_t pid; /* Partition ID */ uint32_t flags; /* ARoT/PRoT, SFN/IPC, priority */ diff --git a/secure_fw/include/load/partition_static_load.h b/secure_fw/include/load/partition_static_load.h index f2f9c3d615..698c03474f 100644 --- a/secure_fw/include/load/partition_static_load.h +++ b/secure_fw/include/load/partition_static_load.h @@ -24,23 +24,26 @@ #define POSITION_TO_PTR(x, t) (t)(x) /* Length of extendable variables in partition static type */ -#define STATIC_INFO_EXT_LENGTH 2 +#define LOAD_INFO_EXT_LENGTH 2 /* - * Argument "ps_ptr" must have be a "struct partition_static_info_t *" type and + * Argument "ps_ptr" must have be a "struct partition_load_info_t *" type and * must be validated before using. */ -#define STATIC_INFSZ_BYTES(ps_ptr) \ - (sizeof(*(ps_ptr)) + STATIC_INFO_EXT_LENGTH * sizeof(uintptr_t) + \ - (ps_ptr)->ndeps * sizeof(uint32_t) + \ - (ps_ptr)->nservices * sizeof(struct service_static_info_t) + \ +#define LOAD_INFSZ_BYTES(ps_ptr) \ + (sizeof(*(ps_ptr)) + LOAD_INFO_EXT_LENGTH * sizeof(uintptr_t) + \ + (ps_ptr)->ndeps * sizeof(uint32_t) + \ + (ps_ptr)->nservices * sizeof(struct service_load_info_t) + \ (ps_ptr)->nassets * sizeof(struct asset_desc_t)) -#define STATIC_INF_DEPS(ps_ptr) \ - ((uintptr_t)(ps_ptr + 1) + STATIC_INFO_EXT_LENGTH * sizeof(uintptr_t)) -#define STATIC_INF_SERVICE(ps_ptr) \ - ((uintptr_t)STATIC_INF_DEPS(ps_ptr) + (ps_ptr)->ndeps * sizeof(uint32_t)) -#define STATIC_INF_ASSET(ps_ptr) \ - ((uintptr_t)STATIC_INF_SERVICE(ps_ptr) + \ - (ps_ptr)->nservices * sizeof(struct service_static_info_t)) +/* 'Allocate' stack based on load info */ +#define LOAD_ALLOCED_STACK_ADDR(ps_ptr) (*((uintptr_t *)(ps_ptr + 1))) + +#define LOAD_INFO_DEPS(ps_ptr) \ + ((uintptr_t)(ps_ptr + 1) + LOAD_INFO_EXT_LENGTH * sizeof(uintptr_t)) +#define LOAD_INFO_SERVICE(ps_ptr) \ + ((uintptr_t)LOAD_INFO_DEPS(ps_ptr) + (ps_ptr)->ndeps * sizeof(uint32_t)) +#define LOAD_INFO_ASSET(ps_ptr) \ + ((uintptr_t)LOAD_INFO_SERVICE(ps_ptr) + \ + (ps_ptr)->nservices * sizeof(struct service_load_info_t)) #endif /* __PARTITION_STATIC_LOAD_H__ */ diff --git a/secure_fw/include/load/service_defs.h b/secure_fw/include/load/service_defs.h index 7dda24bff4..d0825072d4 100644 --- a/secure_fw/include/load/service_defs.h +++ b/secure_fw/include/load/service_defs.h @@ -32,7 +32,7 @@ ((flag) & SERVICE_VERSION_POLICY_MASK) /* Common service structure type */ -struct service_static_info_t { +struct service_load_info_t { uintptr_t name_strid; /* String ID for name */ psa_signal_t signal; /* Service signal */ uint32_t sid; /* Service ID */ diff --git a/secure_fw/partitions/crypto/CMakeLists.txt b/secure_fw/partitions/crypto/CMakeLists.txt index 0f59870c47..94f56a7441 100644 --- a/secure_fw/partitions/crypto/CMakeLists.txt +++ b/secure_fw/partitions/crypto/CMakeLists.txt @@ -36,7 +36,7 @@ target_sources(tfm_psa_rot_partition_crypto target_sources(tfm_partitions INTERFACE $<$<BOOL:${TFM_PSA_API}>: - ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/crypto/auto_generated/static_info_tfm_crypto.c> + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/crypto/auto_generated/load_info_tfm_crypto.c> ) # Set include directory diff --git a/secure_fw/partitions/firmware_update/CMakeLists.txt b/secure_fw/partitions/firmware_update/CMakeLists.txt index ffb78dde4b..bebea75bfa 100644 --- a/secure_fw/partitions/firmware_update/CMakeLists.txt +++ b/secure_fw/partitions/firmware_update/CMakeLists.txt @@ -36,7 +36,7 @@ target_sources(tfm_psa_rot_partition_fwu target_sources(tfm_partitions INTERFACE $<$<BOOL:${TFM_PSA_API}>: - ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/firmware_update/auto_generated/static_info_tfm_firmware_update.c> + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/firmware_update/auto_generated/load_info_tfm_firmware_update.c> ) # The bootloader specific configuration. diff --git a/secure_fw/partitions/initial_attestation/CMakeLists.txt b/secure_fw/partitions/initial_attestation/CMakeLists.txt index aa34af2f4e..a11b2fbc89 100644 --- a/secure_fw/partitions/initial_attestation/CMakeLists.txt +++ b/secure_fw/partitions/initial_attestation/CMakeLists.txt @@ -40,7 +40,7 @@ target_sources(tfm_psa_rot_partition_attestation target_sources(tfm_partitions INTERFACE $<$<BOOL:${TFM_PSA_API}>: - ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/initial_attestation/auto_generated/static_info_tfm_initial_attestation.c> + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/initial_attestation/auto_generated/load_info_tfm_initial_attestation.c> ) # Set include directory diff --git a/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt b/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt index df8a9e847b..cbf7a92a9d 100644 --- a/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt +++ b/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt @@ -50,7 +50,7 @@ target_sources(tfm_psa_rot_partition_its target_sources(tfm_partitions INTERFACE $<$<BOOL:${TFM_PSA_API}>: - ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage/auto_generated/static_info_tfm_internal_trusted_storage.c> + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage/auto_generated/load_info_tfm_internal_trusted_storage.c> ) target_link_libraries(tfm_psa_rot_partition_its diff --git a/secure_fw/partitions/ns_proxy_partition/CMakeLists.txt b/secure_fw/partitions/ns_proxy_partition/CMakeLists.txt index e08525ebe3..45da7b6422 100644 --- a/secure_fw/partitions/ns_proxy_partition/CMakeLists.txt +++ b/secure_fw/partitions/ns_proxy_partition/CMakeLists.txt @@ -10,5 +10,5 @@ cmake_policy(SET CMP0079 NEW) target_sources(tfm_partitions INTERFACE - $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/static_info_ns_proxy.c> + $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/load_info_ns_proxy.c> ) diff --git a/secure_fw/partitions/ns_proxy_partition/static_info_ns_proxy.c b/secure_fw/partitions/ns_proxy_partition/load_info_ns_proxy.c index ae101e9e04..2a1446779f 100644 --- a/secure_fw/partitions/ns_proxy_partition/static_info_ns_proxy.c +++ b/secure_fw/partitions/ns_proxy_partition/load_info_ns_proxy.c @@ -32,9 +32,9 @@ REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Limit); /* Entrypoint function declaration */ extern void tfm_nspm_thread_entry(void); -struct partition_tfm_sp_ns_proxy_static_info_t { +struct partition_tfm_sp_ns_proxy_load_info_t { /* common length data */ - struct partition_static_info_t cmn_info; + struct partition_load_info_t cmn_info; /* per-partition variable length data */ uintptr_t stack_pos; uintptr_t heap_pos; @@ -44,7 +44,7 @@ struct partition_tfm_sp_ns_proxy_static_info_t { } __attribute__((aligned(4))); /* Partition static, deps, service static data. Put to a dedicated section. */ -const struct partition_tfm_sp_ns_proxy_static_info_t +const struct partition_tfm_sp_ns_proxy_load_info_t tfm_sp_ns_proxy_static __attribute__((used, section(".partition_info"))) = { .cmn_info = { .psa_ff_ver = 0x0100 | PARTITION_INFO_MAGIC, diff --git a/secure_fw/partitions/partition_static_info.template b/secure_fw/partitions/partition_load_info.template index 5de343c090..2ce1b677eb 100644 --- a/secure_fw/partitions/partition_static_info.template +++ b/secure_fw/partitions/partition_load_info.template @@ -54,9 +54,9 @@ extern uint8_t {{manifest.name|lower}}_stack[]; extern void {{manifest.entry_point}}(void); /* partition static info type definition */ -struct partition_{{manifest.name|lower}}_static_info_t { +struct partition_{{manifest.name|lower}}_load_info_t { /* common length data */ - struct partition_static_info_t cmn_info; + struct partition_load_info_t cmn_info; /* per-partition variable length data */ uintptr_t stack_pos; uintptr_t heap_pos; @@ -64,7 +64,7 @@ struct partition_{{manifest.name|lower}}_static_info_t { uint32_t deps[{{(manifest.name|upper + "_NDEPS")}}]; {% endif %} {% if manifest.services %} - struct service_static_info_t services[{{(manifest.name|upper + "_NSERVS")}}]; + struct service_load_info_t services[{{(manifest.name|upper + "_NSERVS")}}]; {% endif %} #if TFM_LVL == 3 struct asset_desc_t assets[{{(manifest.name|upper + "_NASSETS")}}]; @@ -76,7 +76,7 @@ struct partition_{{manifest.name|lower}}_static_info_t { } __attribute__((aligned(4))); /* Partition static, deps, service static data. Put to a dedicated section. */ -const struct partition_{{manifest.name|lower}}_static_info_t {{manifest.name|lower}}_static +const struct partition_{{manifest.name|lower}}_load_info_t {{manifest.name|lower}}_static __attribute__((used, section(".partition_info"))) = { .cmn_info = { {% if manifest.psa_framework_version == 1.0 %} diff --git a/secure_fw/partitions/platform/CMakeLists.txt b/secure_fw/partitions/platform/CMakeLists.txt index e52d44e013..89457d06ae 100644 --- a/secure_fw/partitions/platform/CMakeLists.txt +++ b/secure_fw/partitions/platform/CMakeLists.txt @@ -25,7 +25,7 @@ target_sources(tfm_psa_rot_partition_platform target_sources(tfm_partitions INTERFACE $<$<BOOL:${TFM_PSA_API}>: - ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/platform/auto_generated/static_info_tfm_platform.c> + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/platform/auto_generated/load_info_tfm_platform.c> ) # Set include directory diff --git a/secure_fw/partitions/protected_storage/CMakeLists.txt b/secure_fw/partitions/protected_storage/CMakeLists.txt index 7f2366a333..79d5d46512 100644 --- a/secure_fw/partitions/protected_storage/CMakeLists.txt +++ b/secure_fw/partitions/protected_storage/CMakeLists.txt @@ -56,7 +56,7 @@ target_sources(tfm_app_rot_partition_ps target_sources(tfm_partitions INTERFACE $<$<BOOL:${TFM_PSA_API}>: - ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage/auto_generated/static_info_tfm_protected_storage.c> + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage/auto_generated/load_info_tfm_protected_storage.c> ) target_link_libraries(tfm_app_rot_partition_ps diff --git a/secure_fw/partitions/psa_proxy/CMakeLists.txt b/secure_fw/partitions/psa_proxy/CMakeLists.txt index 2a515df541..ba8bfda136 100644 --- a/secure_fw/partitions/psa_proxy/CMakeLists.txt +++ b/secure_fw/partitions/psa_proxy/CMakeLists.txt @@ -42,7 +42,7 @@ target_sources(tfm_psa_rot_partition_psa_proxy ) target_sources(tfm_partitions INTERFACE - ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/psa_proxy/auto_generated/static_info_tfm_psa_proxy.c + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/psa_proxy/auto_generated/load_info_tfm_psa_proxy.c ) target_link_libraries(tfm_psa_rot_partition_psa_proxy diff --git a/secure_fw/partitions/tfm_ffm11_partition/CMakeLists.txt b/secure_fw/partitions/tfm_ffm11_partition/CMakeLists.txt index 6c5d6a74d2..b3870d63c9 100644 --- a/secure_fw/partitions/tfm_ffm11_partition/CMakeLists.txt +++ b/secure_fw/partitions/tfm_ffm11_partition/CMakeLists.txt @@ -27,7 +27,7 @@ target_sources(tfm_app_rot_partition_ffm11 target_sources(tfm_partitions INTERFACE $<$<BOOL:${TFM_PSA_API}>: - ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/tfm_ffm11_partition/auto_generated/static_info_tfm_ffm11_partition.c> + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/tfm_ffm11_partition/auto_generated/load_info_tfm_ffm11_partition.c> ) # Set include directory diff --git a/secure_fw/spm/CMakeLists.txt b/secure_fw/spm/CMakeLists.txt index 8ad1f2dc0c..fb5571b817 100755 --- a/secure_fw/spm/CMakeLists.txt +++ b/secure_fw/spm/CMakeLists.txt @@ -76,9 +76,9 @@ if (TEST_PSA_API STREQUAL IPC) target_sources(tfm_app_rot_partition_server_partition PRIVATE ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/intermedia_server_partition_psa.c) target_sources(tfm_partitions INTERFACE - ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/static_info_driver_partition_psa.c - ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/static_info_client_partition_psa.c - ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/static_info_server_partition_psa.c + ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/load_info_driver_partition_psa.c + ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/load_info_client_partition_psa.c + ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/load_info_server_partition_psa.c ) endif() diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c index e401111123..e057754a3e 100644 --- a/secure_fw/spm/cmsis_psa/spm_ipc.c +++ b/secure_fw/spm/cmsis_psa/spm_ipc.c @@ -432,7 +432,7 @@ int32_t tfm_spm_check_authorization(uint32_t sid, tfm_core_panic(); } - dep = (uint32_t *)STATIC_INF_DEPS(partition->p_static); + dep = (uint32_t *)LOAD_INFO_DEPS(partition->p_static); for (i = 0; i < partition->p_static->ndeps; i++) { if (dep[i] == sid) { break; @@ -683,7 +683,7 @@ static struct service_t *tfm_allocate_service(uint32_t service_count) } /* Check partition static data validation */ -bool tfm_validate_partition_static(struct partition_static_info_t *p_cmninf) +bool tfm_validate_partition_static(struct partition_load_info_t *p_cmninf) { return ((p_cmninf->psa_ff_ver & PARTITION_INFO_MAGIC_MASK) == PARTITION_INFO_MAGIC); @@ -692,15 +692,14 @@ bool tfm_validate_partition_static(struct partition_static_info_t *p_cmninf) uint32_t tfm_spm_init(void) { uint32_t i, j; - uintptr_t *p_ext_static_info; struct partition_t *partition; struct service_t *service; struct tfm_core_thread_t *pth, *p_ns_entry_thread = NULL; const struct platform_data_t *platform_data_p; - uintptr_t part_static_start, part_static_end; - struct partition_static_info_t *p_cmninf; - struct service_static_info_t *p_service_static; - struct asset_desc_t *p_asset_static; + uintptr_t part_load_start, part_load_end; + struct partition_load_info_t *p_cmninf; + struct service_load_info_t *p_service_static; + struct asset_desc_t *p_asset_load; #ifdef TFM_FIH_PROFILE_ON fih_int fih_rc = FIH_FAILURE; #endif @@ -711,14 +710,14 @@ uint32_t tfm_spm_init(void) TFM_CONN_HANDLE_MAX_NUM); /* Load partition and service data */ - part_static_start = PART_REGION_ADDR(TFM_SP_STATIC_LIST, $$RO$$Base); - part_static_end = PART_REGION_ADDR(TFM_SP_STATIC_LIST, $$RO$$Limit); - while (part_static_start < part_static_end) { - p_cmninf = (struct partition_static_info_t *)part_static_start; + part_load_start = PART_REGION_ADDR(TFM_SP_STATIC_LIST, $$RO$$Base); + part_load_end = PART_REGION_ADDR(TFM_SP_STATIC_LIST, $$RO$$Limit); + while (part_load_start < part_load_end) { + p_cmninf = (struct partition_load_info_t *)part_load_start; /* Validate static info section range */ - part_static_start += STATIC_INFSZ_BYTES(p_cmninf); - if (part_static_start > part_static_end) { + part_load_start += LOAD_INFSZ_BYTES(p_cmninf); + if (part_load_start > part_load_end) { tfm_core_panic(); } @@ -752,14 +751,14 @@ uint32_t tfm_spm_init(void) partition->p_static = p_cmninf; /* Init partition device object assets */ - p_asset_static = (struct asset_desc_t *)STATIC_INF_ASSET(p_cmninf); + p_asset_load = (struct asset_desc_t *)LOAD_INFO_ASSET(p_cmninf); for (i = 0; i < p_cmninf->nassets; i++) { /* Skip the memory-based asset */ - if (!(p_asset_static[i].attr & ASSET_DEV_REF_BIT)) { + if (!(p_asset_load[i].attr & ASSET_DEV_REF_BIT)) { continue; } - platform_data_p = POSITION_TO_PTR(p_asset_static[i].dev.addr_ref, + platform_data_p = POSITION_TO_PTR(p_asset_load[i].dev.addr_ref, struct platform_data_t *); #ifdef TFM_FIH_PROFILE_ON FIH_CALL(tfm_spm_hal_configure_default_isolation, fih_rc, i, @@ -803,13 +802,12 @@ uint32_t tfm_spm_init(void) } /* Extendable partition static info is right after p_cmninf. */ - p_ext_static_info = (uintptr_t *)(p_cmninf + 1); tfm_core_thrd_init( pth, POSITION_TO_ENTRY(p_cmninf->entry, tfm_core_thrd_entry_t), NULL, - p_ext_static_info[0] + p_cmninf->stack_size, - p_ext_static_info[0]); + LOAD_ALLOCED_STACK_ADDR(p_cmninf) + p_cmninf->stack_size, + LOAD_ALLOCED_STACK_ADDR(p_cmninf)); pth->prior = TO_THREAD_PRIORITY(PARTITION_GET_PRIOR(p_cmninf->flags)); @@ -825,7 +823,7 @@ uint32_t tfm_spm_init(void) /* Init Services in the partition */ p_service_static = - (struct service_static_info_t *)STATIC_INF_SERVICE(p_cmninf); + (struct service_load_info_t *)LOAD_INFO_SERVICE(p_cmninf); for (i = 0; i < p_cmninf->nservices; i++) { /* Fill service runtime data */ partition->signals_allowed |= p_service_static[i].signal; @@ -871,7 +869,7 @@ void tfm_pendsv_do_schedule(struct tfm_arch_ctx_t *p_actx) { #if TFM_LVL != 1 struct partition_t *p_next_partition; - const struct partition_static_info_t *p_part_static; + const struct partition_load_info_t *p_part_static; uint32_t is_privileged; #endif struct tfm_core_thread_t *pth_next = tfm_core_thrd_get_next(); @@ -901,7 +899,7 @@ void tfm_pendsv_do_schedule(struct tfm_arch_ctx_t *p_actx) */ if (is_privileged == TFM_PARTITION_UNPRIVILEGED_MODE) { struct asset_desc_t *p_asset = - (struct asset_desc_t *)STATIC_INF_ASSET(p_part_static); + (struct asset_desc_t *)LOAD_INFO_ASSET(p_part_static); /* Partition must have private data as the first asset in LVL3 */ if (p_part_static->nassets == 0) { tfm_core_panic(); diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.h b/secure_fw/spm/cmsis_psa/spm_ipc.h index 437a4bb87b..52ca01adf0 100644 --- a/secure_fw/spm/cmsis_psa/spm_ipc.h +++ b/secure_fw/spm/cmsis_psa/spm_ipc.h @@ -83,7 +83,7 @@ struct tfm_msg_body_t { * divided to structures, to keep the related fields close to each other. */ struct partition_t { - const struct partition_static_info_t *p_static; + const struct partition_load_info_t *p_static; void *p_platform; void *p_interrupts; void *p_metadata; @@ -102,7 +102,7 @@ struct spm_partition_db_t { /* RoT Service data */ struct service_t { - const struct service_static_info_t *service_db; /* Service static pointer */ + const struct service_load_info_t *service_db; /* Service static pointer */ struct partition_t *partition; /* Owner of the service */ struct bi_list_node_t handle_list; /* Service handle list */ struct bi_list_node_t list; /* For list operation */ |