Core: Rename services to partitions in SPM
To get closer to the terminology used in PSA, the symbols that in the
current TF-M terminology refer to services, should be changed to refer
to partitions. This commit does this renaming in SPM, and also updates
files that reference the changed symbols.
Change-Id: Id76f179846cbc11c600a5e72d15b99afc379d1fd
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/CommonConfig.cmake b/CommonConfig.cmake
index bb56736..314377b 100644
--- a/CommonConfig.cmake
+++ b/CommonConfig.cmake
@@ -46,10 +46,10 @@
#Settings which shall be set for all projects the same way based
# on the variables above.
-set (CORE_TEST_SERVICES OFF)
+set (TFM_PARTITION_TEST_CORE OFF)
set (CORE_TEST_POSITIVE OFF)
set (CORE_TEST_INTERACTIVE OFF)
-set (SST_TEST_SERVICES OFF)
+set (TFM_PARTITION_TEST_SST OFF)
if (REGRESSION)
set(SERVICES_TEST_ENABLED ON)
@@ -72,13 +72,13 @@
if(CORE_TEST_INTERACTIVE)
add_definitions(-DCORE_TEST_INTERACTIVE)
set(TEST_FRAMEWORK_NS ON)
- set(CORE_TEST_SERVICES ON)
+ set(TFM_PARTITION_TEST_CORE ON)
endif()
if(CORE_TEST_POSITIVE)
add_definitions(-DCORE_TEST_POSITIVE)
set(TEST_FRAMEWORK_NS ON)
- set(CORE_TEST_SERVICES ON)
+ set(TFM_PARTITION_TEST_CORE ON)
endif()
if (SERVICE_TEST_S)
@@ -89,7 +89,7 @@
if (SERVICE_TEST_NS)
add_definitions(-DSERVICES_TEST_NS)
set(TEST_FRAMEWORK_NS ON)
- set(SST_TEST_SERVICES ON)
+ set(TFM_PARTITION_TEST_SST ON)
endif()
if(TEST_FRAMEWORK_S)
@@ -100,12 +100,12 @@
add_definitions(-DTEST_FRAMEWORK_NS)
endif()
-if (CORE_TEST_SERVICES)
- add_definitions(-DCORE_TEST_SERVICES)
+if (TFM_PARTITION_TEST_CORE)
+ add_definitions(-DTFM_PARTITION_TEST_CORE)
endif()
-if (SST_TEST_SERVICES)
- add_definitions(-DSST_TEST_SERVICES)
+if (TFM_PARTITION_TEST_SST)
+ add_definitions(-DTFM_PARTITION_TEST_SST)
endif()
if (BL2)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 6e84182..52e3a19 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -131,16 +131,16 @@
target_compile_definitions(${PROJECT_NAME} PRIVATE CORE_TEST)
endif()
-if (NOT DEFINED CORE_TEST_SERVICES)
- message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_SERVICES is undefined. ")
-elseif (CORE_TEST_SERVICES)
- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DCORE_TEST_SERVICES\"")
+if (NOT DEFINED TFM_PARTITION_TEST_CORE)
+ message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_CORE is undefined. ")
+elseif (TFM_PARTITION_TEST_CORE)
+ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DTFM_PARTITION_TEST_CORE\"")
endif()
-if (NOT DEFINED SST_TEST_SERVICES)
- message(FATAL_ERROR "Incomplete build configuration: SST_TEST_SERVICES is undefined. ")
-elseif (SST_TEST_SERVICES)
- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DSST_TEST_SERVICES\"")
+if (NOT DEFINED TFM_PARTITION_TEST_SST)
+ message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SST is undefined. ")
+elseif (TFM_PARTITION_TEST_SST)
+ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DTFM_PARTITION_TEST_SST\"")
endif()
#Set BL2 specific settings.
diff --git a/app/main_ns.c b/app/main_ns.c
index fb7b10a..4a731e5 100644
--- a/app/main_ns.c
+++ b/app/main_ns.c
@@ -16,10 +16,10 @@
#include "tfm_ns_svc.h"
#include "tfm_sst_svc_handler.h"
#include "tfm_ns_lock.h"
-#ifdef CORE_TEST_SERVICES
+#ifdef TFM_PARTITION_TEST_CORE
#include "test/suites/core/non_secure/svc_core_test_ns.h"
#endif
-#ifdef SST_TEST_SERVICES
+#ifdef TFM_PARTITION_TEST_SST
#include "test/test_services/tfm_sst_test_service/sst_test_service_svc.h"
#endif
#ifdef TEST_FRAMEWORK_NS
@@ -54,17 +54,17 @@
(void *)svc_secure_decrement_ns_lock_2,
#endif /* CORE_TEST_INTERACTIVE */
-#if defined(CORE_TEST_SERVICES)
+#if defined(TFM_PARTITION_TEST_CORE)
(void *)svc_tfm_core_test,
(void *)svc_tfm_core_test_multiple_calls,
-#endif /* CORE_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_CORE */
-#if defined(SST_TEST_SERVICES)
+#if defined(TFM_PARTITION_TEST_SST)
(void *)sst_test_service_svc_setup,
(void *)sst_test_service_svc_dummy_encrypt,
(void *)sst_test_service_svc_dummy_decrypt,
(void *)sst_test_service_svc_clean,
-#endif /* SST_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_SST */
//(void *)user_function1,
// ...
diff --git a/interface/include/tfm_ns_svc.h b/interface/include/tfm_ns_svc.h
index 75b78ec..330bd84 100644
--- a/interface/include/tfm_ns_svc.h
+++ b/interface/include/tfm_ns_svc.h
@@ -42,17 +42,17 @@
SVC_SECURE_DECREMENT_NS_LOCK_2,
#endif /* CORE_TEST_INTERACTIVE */
-#if defined(CORE_TEST_SERVICES)
+#if defined(TFM_PARTITION_TEST_CORE)
SVC_TFM_CORE_TEST,
SVC_TFM_CORE_TEST_MULTIPLE_CALLS,
-#endif /* CORE_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_CORE */
-#if defined(SST_TEST_SERVICES)
+#if defined(TFM_PARTITION_TEST_SST)
SVC_SST_TEST_SERVICE_SETUP,
SVC_SST_TEST_SERVICE_DUMMY_ENCRYPT,
SVC_SST_TEST_SERVICE_DUMMY_DECRYPT,
SVC_SST_TEST_SERVICE_CLEAN,
-#endif /* SST_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_SST */
/* add all the new entries above this line */
SVC_TFM_MAX,
diff --git a/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct b/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct
index 06c34a5..18a2dd8 100644
--- a/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct
+++ b/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct
@@ -47,25 +47,25 @@
*(SFN)
}
- TFM_SEC_FUNC_STORAGE +0 ALIGN 32 {
+ TFM_SP_STORAGE +0 ALIGN 32 {
*tfm_storage* (+RO)
}
-#ifdef CORE_TEST_SERVICES
- TFM_SEC_FUNC_CORE_TEST +0 ALIGN 32 {
+#ifdef TFM_PARTITION_TEST_CORE
+ TFM_SP_CORE_TEST +0 ALIGN 32 {
*tfm_ss_core_test.* (+RO)
}
- TFM_SEC_FUNC_CORE_TEST_2 +0 ALIGN 32 {
+ TFM_SP_CORE_TEST_2 +0 ALIGN 32 {
*tfm_ss_core_test_2.* (+RO)
}
-#endif /* CORE_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_CORE */
-#ifdef SST_TEST_SERVICES
- TFM_SEC_FUNC_SST_TEST_SERVICE +0 ALIGN 32 {
+#ifdef TFM_PARTITION_TEST_SST
+ TFM_SP_SST_TEST_PARTITION +0 ALIGN 32 {
*sst_test_service.* (+RO)
}
-#endif /* SST_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_SST */
ER_TFM_DATA S_DATA_START S_DATA_SIZE {
.ANY (+RW +ZI)
@@ -79,37 +79,37 @@
TFM_UNPRIV_SCRATCH +0 ALIGN 32 EMPTY 0x400 {
}
- TFM_SEC_FUNC_STORAGE_DATA +0 ALIGN 32 {
+ TFM_SP_STORAGE_DATA +0 ALIGN 32 {
*tfm_storage* (+RW +ZI)
}
- TFM_SEC_FUNC_STORAGE_STACK +0 ALIGN 128 EMPTY 0x2000 {
+ TFM_SP_STORAGE_STACK +0 ALIGN 128 EMPTY 0x2000 {
}
-#ifdef CORE_TEST_SERVICES
- TFM_SEC_FUNC_CORE_TEST_DATA +0 ALIGN 32 {
+#ifdef TFM_PARTITION_TEST_CORE
+ TFM_SP_CORE_TEST_DATA +0 ALIGN 32 {
tfm_ss_core_test.o (+RW +ZI)
}
- TFM_SEC_FUNC_CORE_TEST_STACK +0 ALIGN 128 EMPTY 0x2000 {
+ TFM_SP_CORE_TEST_STACK +0 ALIGN 128 EMPTY 0x2000 {
}
- TFM_SEC_FUNC_CORE_TEST_2_DATA +0 ALIGN 32 {
+ TFM_SP_CORE_TEST_2_DATA +0 ALIGN 32 {
tfm_ss_core_test_2.o (+RW +ZI)
}
- TFM_SEC_FUNC_CORE_TEST_2_STACK +0 ALIGN 128 EMPTY 0x2000 {
+ TFM_SP_CORE_TEST_2_STACK +0 ALIGN 128 EMPTY 0x2000 {
}
-#endif /* CORE_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_CORE */
-#ifdef SST_TEST_SERVICES
- TFM_SEC_FUNC_SST_TEST_SERVICE_DATA +0 ALIGN 32 {
+#ifdef TFM_PARTITION_TEST_SST
+ TFM_SP_SST_TEST_PARTITION_DATA +0 ALIGN 32 {
sst_test_service.o (+RW +ZI)
}
- TFM_SEC_FUNC_SST_TEST_SERVICE_STACK +0 ALIGN 128 EMPTY 0x2000 {
+ TFM_SP_SST_TEST_PARTITION_STACK +0 ALIGN 128 EMPTY 0x2000 {
}
-#endif /* SST_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_SST */
#endif /* TFM_LVL == 1 */
diff --git a/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct b/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct
index 06c34a5..18a2dd8 100644
--- a/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct
+++ b/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct
@@ -47,25 +47,25 @@
*(SFN)
}
- TFM_SEC_FUNC_STORAGE +0 ALIGN 32 {
+ TFM_SP_STORAGE +0 ALIGN 32 {
*tfm_storage* (+RO)
}
-#ifdef CORE_TEST_SERVICES
- TFM_SEC_FUNC_CORE_TEST +0 ALIGN 32 {
+#ifdef TFM_PARTITION_TEST_CORE
+ TFM_SP_CORE_TEST +0 ALIGN 32 {
*tfm_ss_core_test.* (+RO)
}
- TFM_SEC_FUNC_CORE_TEST_2 +0 ALIGN 32 {
+ TFM_SP_CORE_TEST_2 +0 ALIGN 32 {
*tfm_ss_core_test_2.* (+RO)
}
-#endif /* CORE_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_CORE */
-#ifdef SST_TEST_SERVICES
- TFM_SEC_FUNC_SST_TEST_SERVICE +0 ALIGN 32 {
+#ifdef TFM_PARTITION_TEST_SST
+ TFM_SP_SST_TEST_PARTITION +0 ALIGN 32 {
*sst_test_service.* (+RO)
}
-#endif /* SST_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_SST */
ER_TFM_DATA S_DATA_START S_DATA_SIZE {
.ANY (+RW +ZI)
@@ -79,37 +79,37 @@
TFM_UNPRIV_SCRATCH +0 ALIGN 32 EMPTY 0x400 {
}
- TFM_SEC_FUNC_STORAGE_DATA +0 ALIGN 32 {
+ TFM_SP_STORAGE_DATA +0 ALIGN 32 {
*tfm_storage* (+RW +ZI)
}
- TFM_SEC_FUNC_STORAGE_STACK +0 ALIGN 128 EMPTY 0x2000 {
+ TFM_SP_STORAGE_STACK +0 ALIGN 128 EMPTY 0x2000 {
}
-#ifdef CORE_TEST_SERVICES
- TFM_SEC_FUNC_CORE_TEST_DATA +0 ALIGN 32 {
+#ifdef TFM_PARTITION_TEST_CORE
+ TFM_SP_CORE_TEST_DATA +0 ALIGN 32 {
tfm_ss_core_test.o (+RW +ZI)
}
- TFM_SEC_FUNC_CORE_TEST_STACK +0 ALIGN 128 EMPTY 0x2000 {
+ TFM_SP_CORE_TEST_STACK +0 ALIGN 128 EMPTY 0x2000 {
}
- TFM_SEC_FUNC_CORE_TEST_2_DATA +0 ALIGN 32 {
+ TFM_SP_CORE_TEST_2_DATA +0 ALIGN 32 {
tfm_ss_core_test_2.o (+RW +ZI)
}
- TFM_SEC_FUNC_CORE_TEST_2_STACK +0 ALIGN 128 EMPTY 0x2000 {
+ TFM_SP_CORE_TEST_2_STACK +0 ALIGN 128 EMPTY 0x2000 {
}
-#endif /* CORE_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_CORE */
-#ifdef SST_TEST_SERVICES
- TFM_SEC_FUNC_SST_TEST_SERVICE_DATA +0 ALIGN 32 {
+#ifdef TFM_PARTITION_TEST_SST
+ TFM_SP_SST_TEST_PARTITION_DATA +0 ALIGN 32 {
sst_test_service.o (+RW +ZI)
}
- TFM_SEC_FUNC_SST_TEST_SERVICE_STACK +0 ALIGN 128 EMPTY 0x2000 {
+ TFM_SP_SST_TEST_PARTITION_STACK +0 ALIGN 128 EMPTY 0x2000 {
}
-#endif /* SST_TEST_SERVICES */
+#endif /* TFM_PARTITION_TEST_SST */
#endif /* TFM_LVL == 1 */
diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
index daf7fda..a45b4c7 100644
--- a/secure_fw/CMakeLists.txt
+++ b/secure_fw/CMakeLists.txt
@@ -83,16 +83,16 @@
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS " --predefine=\"-DTFM_LVL=${TFM_LVL}\"")
-if (NOT DEFINED CORE_TEST_SERVICES)
- message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_SERVICES is undefined. ")
-elseif (CORE_TEST_SERVICES)
- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DCORE_TEST_SERVICES\"")
+if (NOT DEFINED TFM_PARTITION_TEST_CORE)
+ message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_CORE is undefined. ")
+elseif (TFM_PARTITION_TEST_CORE)
+ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DTFM_PARTITION_TEST_CORE\"")
endif()
-if (NOT DEFINED SST_TEST_SERVICES)
- message(FATAL_ERROR "Incomplete build configuration: SST_TEST_SERVICES is undefined. ")
-elseif (SST_TEST_SERVICES)
- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DSST_TEST_SERVICES\"")
+if (NOT DEFINED TFM_PARTITION_TEST_SST)
+ message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SST is undefined. ")
+elseif (TFM_PARTITION_TEST_SST)
+ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DTFM_PARTITION_TEST_SST\"")
endif()
if (NOT DEFINED BL2)
@@ -102,10 +102,10 @@
endif()
if(CORE_TEST)
- embedded_set_target_compile_defines(TARGET ${PROJECT_NAME} LANGUAGE C DEFINES TFM_CORE_DEBUG CORE_TEST_SERVICES APPEND)
+ embedded_set_target_compile_defines(TARGET ${PROJECT_NAME} LANGUAGE C DEFINES TFM_CORE_DEBUG TFM_PARTITION_TEST_CORE APPEND)
set(SECURE_AXF_DIR_PREFIX "${CMAKE_BINARY_DIR}/unit_test/")
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SECURE_AXF_DIR_PREFIX})
- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DCORE_TEST_SERVICES\"")
+ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DTFM_PARTITION_TEST_CORE\"")
endif()
#Generate binary file from axf
diff --git a/secure_fw/core/tfm_core.c b/secure_fw/core/tfm_core.c
index eeeb5ad..5bd2d98 100644
--- a/secure_fw/core/tfm_core.c
+++ b/secure_fw/core/tfm_core.c
@@ -138,13 +138,13 @@
#if TFM_LVL != 1
tfm_spm_mpu_init();
#endif
- if (tfm_spm_service_init() != SPM_ERR_OK) {
+ if (tfm_spm_partition_init() != SPM_ERR_OK) {
/* Certain systems might refuse to boot altogether if services fail
* to initialize. This is a placeholder for such an error handler
*/
}
- tfm_spm_service_set_state(TFM_SEC_FUNC_CORE_ID, SPM_PART_STATE_RUNNING);
+ tfm_spm_partition_set_state(TFM_SP_CORE_ID, SPM_PARTITION_STATE_RUNNING);
extern uint32_t Stack_Mem[];
@@ -175,12 +175,12 @@
#endif
#endif
- /* We close the TFM_SEC_FUNC_CORE_ID service, because its only purpose is
+ /* We close the TFM_SP_CORE_ID service, because its only purpose is
* to be able to pass the state checks for the tests started from secure.
*/
- tfm_spm_service_set_state(TFM_SEC_FUNC_CORE_ID, SPM_PART_STATE_CLOSED);
- tfm_spm_service_set_state(TFM_SEC_FUNC_NON_SECURE_ID,
- SPM_PART_STATE_RUNNING);
+ tfm_spm_partition_set_state(TFM_SP_CORE_ID, SPM_PARTITION_STATE_CLOSED);
+ tfm_spm_partition_set_state(TFM_SP_NON_SECURE_ID,
+ SPM_PARTITION_STATE_RUNNING);
jump_to_ns_code();
}
diff --git a/secure_fw/core/tfm_secure_api.c b/secure_fw/core/tfm_secure_api.c
index d3e9cce..7e02cb4 100644
--- a/secure_fw/core/tfm_secure_api.c
+++ b/secure_fw/core/tfm_secure_api.c
@@ -64,23 +64,23 @@
static int32_t tfm_push_lock(struct tfm_sfn_req_s *desc_ptr, uint32_t lr)
{
- uint32_t caller_service_id = tfm_spm_service_get_running_service_id();
+ uint32_t caller_partition_id = tfm_spm_partition_get_running_partition_id();
- if (caller_service_id >= TFM_SEC_FUNC_BASE &&
+ if (caller_partition_id >= TFM_SP_BASE &&
/* Also check service state consistency */
- (caller_service_id == TFM_SEC_FUNC_NON_SECURE_ID) ==
+ (caller_partition_id == TFM_SP_NON_SECURE_ID) ==
(desc_ptr->ns_caller != 0)) {
- register uint32_t service_id = desc_ptr->ss_id;
+ register uint32_t partition_id = desc_ptr->ss_id;
uint32_t psp = __get_PSP();
uint32_t service_psp, service_psplim;
- uint32_t service_state = tfm_spm_service_get_state(service_id);
+ uint32_t partition_state = tfm_spm_partition_get_state(partition_id);
- if (service_state == SPM_PART_STATE_RUNNING ||
- service_state == SPM_PART_STATE_SUSPENDED ||
- service_state == SPM_PART_STATE_BLOCKED) {
+ if (partition_state == SPM_PARTITION_STATE_RUNNING ||
+ partition_state == SPM_PARTITION_STATE_SUSPENDED ||
+ partition_state == SPM_PARTITION_STATE_BLOCKED) {
/* Recursion is not permitted! */
return TFM_ERROR_SERVICE_NON_REENTRANT;
- } else if (service_state != SPM_PART_STATE_IDLE) {
+ } else if (partition_state != SPM_PARTITION_STATE_IDLE) {
/* The service to be called is not in a proper state */
return TFM_SECURE_LOCK_FAILED;
}
@@ -92,37 +92,38 @@
service_psplim =
(uint32_t)®ION_NAME(Image$$, TFM_SECURE_STACK, $$ZI$$Base);
#else
- if (caller_service_id != TFM_SEC_FUNC_NON_SECURE_ID) {
+ if (caller_partition_id != TFM_SP_NON_SECURE_ID) {
/* Store the caller PSP in case we are doing a service to
* service call
*/
- tfm_spm_service_set_stack(caller_service_id, psp);
+ tfm_spm_partition_set_stack(caller_partition_id, psp);
}
- service_psp = tfm_spm_service_get_stack(service_id);
- service_psplim = tfm_spm_service_get_stack_bottom(service_id);
+ service_psp = tfm_spm_partition_get_stack(partition_id);
+ service_psplim = tfm_spm_partition_get_stack_bottom(partition_id);
#endif
/* Stack the context for the service call */
- tfm_spm_service_set_orig_psp(service_id, psp);
- tfm_spm_service_set_orig_psplim(service_id, __get_PSPLIM());
- tfm_spm_service_set_orig_lr(service_id, lr);
- tfm_spm_service_set_caller_service_id(service_id, caller_service_id);
+ tfm_spm_partition_set_orig_psp(partition_id, psp);
+ tfm_spm_partition_set_orig_psplim(partition_id, __get_PSPLIM());
+ tfm_spm_partition_set_orig_lr(partition_id, lr);
+ tfm_spm_partition_set_caller_partition_id(partition_id,
+ caller_partition_id);
#if (TFM_LVL != 1) && (TFM_LVL != 2)
/* Dynamic service partitioning is only done is TFM level 3 */
- if (caller_service_id != TFM_SEC_FUNC_NON_SECURE_ID) {
+ if (caller_partition_id != TFM_SP_NON_SECURE_ID) {
/* In a service to service call, deconfigure the caller service */
- tfm_spm_service_sandbox_deconfig(caller_service_id);
+ tfm_spm_partition_sandbox_deconfig(caller_partition_id);
}
/* Configure service execution environment */
- tfm_spm_service_sandbox_config(service_id);
+ tfm_spm_partition_sandbox_config(partition_id);
#endif
/* Default share to scratch area in case of service-to-service calls
* this way services always get default access to input buffers
*/
/* FixMe: return value/error handling TBD */
- tfm_spm_service_set_share(service_id, desc_ptr->ns_caller ?
+ tfm_spm_partition_set_share(partition_id, desc_ptr->ns_caller ?
TFM_BUFFER_SHARE_NS_CODE : TFM_BUFFER_SHARE_SCRATCH);
#if TFM_LVL == 1
@@ -143,8 +144,9 @@
__set_PSPLIM(service_psplim);
#endif
- tfm_spm_service_set_state(caller_service_id, SPM_PART_STATE_BLOCKED);
- tfm_spm_service_set_state(service_id, SPM_PART_STATE_RUNNING);
+ tfm_spm_partition_set_state(caller_partition_id,
+ SPM_PARTITION_STATE_BLOCKED);
+ tfm_spm_partition_set_state(partition_id, SPM_PARTITION_STATE_RUNNING);
tfm_secure_lock++;
return TFM_SUCCESS;
@@ -156,59 +158,63 @@
static int32_t tfm_pop_lock(uint32_t *lr_ptr)
{
- uint32_t current_service_id = tfm_spm_service_get_running_service_id();
- uint32_t return_service_id =
- tfm_spm_service_get_caller_service_id(current_service_id);
+ uint32_t current_partition_id =
+ tfm_spm_partition_get_running_partition_id();
+ uint32_t return_partition_id =
+ tfm_spm_partition_get_caller_partition_id(current_partition_id);
- if (current_service_id < TFM_SEC_FUNC_BASE) {
+ if (current_partition_id < TFM_SP_BASE) {
return TFM_SECURE_UNLOCK_FAILED;
}
- if (return_service_id >= TFM_SEC_FUNC_BASE) {
+ if (return_partition_id >= TFM_SP_BASE) {
tfm_secure_lock--;
#if (TFM_LVL != 1) && (TFM_LVL != 2)
/* Deconfigure completed service environment */
- tfm_spm_service_sandbox_deconfig(current_service_id);
- if (return_service_id != TFM_SEC_FUNC_NON_SECURE_ID) {
+ tfm_spm_partition_sandbox_deconfig(current_partition_id);
+ if (return_partition_id != TFM_SP_NON_SECURE_ID) {
/* Configure the caller service environment in case this was a
* service to service call
*/
- tfm_spm_service_sandbox_config(return_service_id);
+ tfm_spm_partition_sandbox_config(return_partition_id);
/* Restore share status */
- tfm_spm_service_set_share(return_service_id,
- tfm_spm_service_get_share(return_service_id));
+ tfm_spm_partition_set_share(return_partition_id,
+ tfm_spm_partition_get_share(return_partition_id));
}
#endif
#if TFM_LVL == 1
- if (tfm_spm_service_get_caller_service_id(current_service_id) ==
- TFM_SEC_FUNC_NON_SECURE_ID) {
+ if (tfm_spm_partition_get_caller_partition_id(current_partition_id) ==
+ TFM_SP_NON_SECURE_ID) {
/* In TFM level 1 context restore is only done when
* returning to NS
*/
/* Restore caller PSP and LR ptr */
- __set_PSP(tfm_spm_service_get_orig_psp(current_service_id));
- __set_PSPLIM(tfm_spm_service_get_orig_psplim(current_service_id));
- *lr_ptr = tfm_spm_service_get_orig_lr(current_service_id);
+ __set_PSP(tfm_spm_partition_get_orig_psp(current_partition_id));
+ __set_PSPLIM(
+ tfm_spm_partition_get_orig_psplim(current_partition_id));
+ *lr_ptr = tfm_spm_partition_get_orig_lr(current_partition_id);
}
#else
uint32_t psp = __get_PSP();
/* Discount SVC call stack frame when storing sfn ctx */
- tfm_spm_service_set_stack(
- current_service_id, psp + SVC_STACK_FRAME_SIZE);
+ tfm_spm_partition_set_stack(
+ current_partition_id, psp + SVC_STACK_FRAME_SIZE);
/* Restore caller PSP and LR ptr */
- __set_PSP(tfm_spm_service_get_orig_psp(current_service_id));
- __set_PSPLIM(tfm_spm_service_get_orig_psplim(current_service_id));
- *lr_ptr = tfm_spm_service_get_orig_lr(current_service_id);
+ __set_PSP(tfm_spm_partition_get_orig_psp(current_partition_id));
+ __set_PSPLIM(tfm_spm_partition_get_orig_psplim(current_partition_id));
+ *lr_ptr = tfm_spm_partition_get_orig_lr(current_partition_id);
#endif
/* Clear the context entry in the context stack before returning */
- tfm_spm_service_cleanup_context(current_service_id);
+ tfm_spm_partition_cleanup_context(current_partition_id);
- tfm_spm_service_set_state(current_service_id, SPM_PART_STATE_IDLE);
- tfm_spm_service_set_state(return_service_id, SPM_PART_STATE_RUNNING);
+ tfm_spm_partition_set_state(current_partition_id,
+ SPM_PARTITION_STATE_IDLE);
+ tfm_spm_partition_set_state(return_partition_id,
+ SPM_PARTITION_STATE_RUNNING);
return TFM_SUCCESS;
} else {
@@ -251,9 +257,8 @@
return TFM_ERROR_NS_THREAD_MODE_CALL;
}
if (tfm_secure_lock != 0) {
- /*
- * Secure domain is already locked!
- * This should only happen if caller is secure function!
+ /* Secure domain is already locked!
+ * This should only happen if caller is secure partition!
* FixMe: This scenario is a potential security breach
* Take appropriate action!
*/
@@ -449,9 +454,10 @@
{
int32_t res = TFM_ERROR_GENERIC;
- uint32_t running_service_id = tfm_spm_service_get_running_service_id();
+ uint32_t running_partition_id =
+ tfm_spm_partition_get_running_partition_id();
- if (running_service_id == TFM_SEC_FUNC_NON_SECURE_ID) {
+ if (running_partition_id == TFM_SP_NON_SECURE_ID) {
/* This handler shouldn't be called from outside service context.
* Services are only allowed to run while S domain is locked.
*/
@@ -460,8 +466,8 @@
}
/* Store return value in r0 */
- if (tfm_spm_service_get_caller_service_id(running_service_id) !=
- TFM_SEC_FUNC_NON_SECURE_ID) {
+ if (tfm_spm_partition_get_caller_partition_id(running_partition_id) !=
+ TFM_SP_NON_SECURE_ID) {
res = TFM_SUCCESS;
}
svc_args[0] = res;
@@ -475,9 +481,10 @@
uint32_t max_buf_size, ptr_start, range_limit, range_check = false;
int32_t res;
- uint32_t running_service_id = tfm_spm_service_get_running_service_id();
+ uint32_t running_partition_id =
+ tfm_spm_partition_get_running_partition_id();
- if ((running_service_id == TFM_SEC_FUNC_NON_SECURE_ID) || (size == 0)) {
+ if ((running_partition_id == TFM_SP_NON_SECURE_ID) || (size == 0)) {
/* This handler shouldn't be called from outside service context.
* Services are only allowed to run while S domain is locked.
*/
@@ -487,7 +494,7 @@
int32_t flags = 0;
- if (tfm_spm_service_get_share(running_service_id) !=
+ if (tfm_spm_partition_get_share(running_partition_id) !=
TFM_BUFFER_SHARE_PRIV) {
flags |= CMSE_MPU_UNPRIV;
}
@@ -672,21 +679,23 @@
* Store input parameter before writing return value to that address
*/
enum tfm_buffer_share_region_e share;
- uint32_t running_service_id = tfm_spm_service_get_running_service_id();
+ uint32_t running_partition_id =
+ tfm_spm_partition_get_running_partition_id();
+ uint32_t caller_partition_id =
+ tfm_spm_partition_get_caller_partition_id(running_partition_id);
+
/* tfm_core_set_buffer_area() returns int32_t */
int32_t *res_ptr = (int32_t *)&args[0];
- if (running_service_id == TFM_SEC_FUNC_NON_SECURE_ID) {
- /* This handler shouldn't be called from outside service context.
- */
+ if (running_partition_id == TFM_SP_NON_SECURE_ID) {
+ /* This handler shouldn't be called from outside service context. */
*res_ptr = TFM_ERROR_INVALID_PARAMETER;
return;
}
switch (args[0]) {
case TFM_BUFFER_SHARE_DEFAULT:
- share = (tfm_spm_service_get_caller_service_id(running_service_id) ==
- TFM_SEC_FUNC_NON_SECURE_ID) ?
+ share = (caller_partition_id == TFM_SP_NON_SECURE_ID) ?
(TFM_BUFFER_SHARE_NS_CODE) : (TFM_BUFFER_SHARE_SCRATCH);
break;
case TFM_BUFFER_SHARE_SCRATCH:
@@ -698,7 +707,8 @@
return;
}
- if (tfm_spm_service_set_share(running_service_id, share) == SPM_ERR_OK) {
+ if (tfm_spm_partition_set_share(running_partition_id, share) ==
+ SPM_ERR_OK) {
*res_ptr = TFM_SUCCESS;
} else {
*res_ptr = TFM_ERROR_INVALID_PARAMETER;
diff --git a/secure_fw/ns_callable/tfm_sst_veneers.c b/secure_fw/ns_callable/tfm_sst_veneers.c
index f0920c0..65f838a 100644
--- a/secure_fw/ns_callable/tfm_sst_veneers.c
+++ b/secure_fw/ns_callable/tfm_sst_veneers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -15,13 +15,13 @@
uint16_t asset_uuid,
uint32_t *hdl)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_STORAGE_ID, sst_am_get_handle,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_STORAGE_ID, sst_am_get_handle,
app_id, asset_uuid, hdl, 0);
}
enum tfm_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint16_t asset_uuid)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_STORAGE_ID, sst_am_create,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_STORAGE_ID, sst_am_create,
app_id, asset_uuid, 0, 0);
}
@@ -30,27 +30,27 @@
uint32_t asset_handle,
struct tfm_sst_attribs_t *attrib)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_STORAGE_ID, sst_am_get_attributes,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_STORAGE_ID, sst_am_get_attributes,
app_id, asset_handle, attrib, 0);
}
enum tfm_sst_err_t tfm_sst_veneer_read(uint32_t app_id, uint32_t asset_handle,
struct tfm_sst_buf_t *data)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_STORAGE_ID, sst_am_read, app_id,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_STORAGE_ID, sst_am_read, app_id,
asset_handle, data, 0);
}
enum tfm_sst_err_t tfm_sst_veneer_write(uint32_t app_id, uint32_t asset_handle,
struct tfm_sst_buf_t *data)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_STORAGE_ID, sst_am_write, app_id,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_STORAGE_ID, sst_am_write, app_id,
asset_handle, data, 0);
}
enum tfm_sst_err_t tfm_sst_veneer_delete(uint32_t app_id, uint32_t asset_handle)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_STORAGE_ID, sst_am_delete, app_id,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_STORAGE_ID, sst_am_delete, app_id,
asset_handle, 0, 0);
}
diff --git a/secure_fw/spm/mpu_armv8m_drv.c b/secure_fw/spm/mpu_armv8m_drv.c
index 4e82e82..a374a13 100644
--- a/secure_fw/spm/mpu_armv8m_drv.c
+++ b/secure_fw/spm/mpu_armv8m_drv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -63,7 +63,7 @@
return MPU_ARMV8M_ERROR;
}
/* region_limit doesn't need to be aligned but the scatter
- * file needs to be setup to ensure that services do not overlap.
+ * file needs to be setup to ensure that partitions do not overlap.
*/
ctrl_before = mpu->CTRL;
diff --git a/secure_fw/spm/service_defs.h b/secure_fw/spm/service_defs.h
index 5aba225..6e699c1 100644
--- a/secure_fw/spm/service_defs.h
+++ b/secure_fw/spm/service_defs.h
@@ -5,13 +5,13 @@
*
*/
-#ifndef __SERVICE_DEFS_H__
-#define __SERVICE_DEFS_H__
+#ifndef __PARTITION_DEFS_H__
+#define __PARTITION_DEFS_H__
/* FixMe: allocations to be settled.
- * 8 bits reserved by TFM for secure service Id this prototype
+ * 8 bits reserved by TFM for secure partition Id this prototype
*/
-#define TFM_SEC_FUNC_BASE 256
+#define TFM_SP_BASE 256
/* A reserved partition ID that is used for uninitialised data */
#define INVALID_PARITION_ID (~0U)
@@ -21,25 +21,25 @@
* as a special secure partition. This simplifies the context switch
* operations.
*/
-#define TFM_SEC_FUNC_NON_SECURE_ID (TFM_SEC_FUNC_BASE + 0)
-/* A dummy partition for TFM_SEC_FUNC_CORE is created to handle secure service
+#define TFM_SP_NON_SECURE_ID (TFM_SP_BASE + 0)
+/* A dummy partition for TFM_SP_CORE is created to handle secure partition
* calls done directly from the core, before NS execution started.
*/
-#define TFM_SEC_FUNC_CORE_ID (TFM_SEC_FUNC_BASE + 1)
-#define TFM_SEC_FUNC_STORAGE_ID (TFM_SEC_FUNC_BASE + 2)
+#define TFM_SP_CORE_ID (TFM_SP_BASE + 1)
+#define TFM_SP_STORAGE_ID (TFM_SP_BASE + 2)
-#ifdef CORE_TEST_SERVICES
-#define TFM_SEC_FUNC_CORE_TEST_ID (TFM_SEC_FUNC_BASE + 3)
-#define TFM_SEC_FUNC_CORE_TEST_2_ID (TFM_SEC_FUNC_BASE + 4)
+#ifdef TFM_PARTITION_TEST_CORE
+#define TFM_SP_CORE_TEST_ID (TFM_SP_BASE + 3)
+#define TFM_SP_CORE_TEST_2_ID (TFM_SP_BASE + 4)
/* Give SST test service next ID after core test services */
-#ifdef SST_TEST_SERVICES
-#define TFM_SEC_FUNC_SST_TEST_SERVICE_ID (TFM_SEC_FUNC_BASE + 5)
+#ifdef TFM_PARTITION_TEST_SST
+#define TFM_SP_SST_TEST_PARTITION_ID (TFM_SP_BASE + 5)
#endif
-#elif defined(SST_TEST_SERVICES) /* CORE_TEST_SERVICES */
+#elif defined(TFM_PARTITION_TEST_SST) /* CORE_TEST_SERVICES */
/* Avoid creating a gap if core test services are not enabled */
-#define TFM_SEC_FUNC_SST_TEST_SERVICE_ID (TFM_SEC_FUNC_BASE + 3)
+#define TFM_SP_SST_TEST_PARTITION_ID (TFM_SP_BASE + 3)
#endif /* CORE_TEST_SERVICES */
-#endif /* __SERVICE_DEFS_H__ */
+#endif /* __PARTITION_DEFS_H__ */
diff --git a/secure_fw/spm/spm_api.c b/secure_fw/spm/spm_api.c
index af4f4bd..a885645 100644
--- a/secure_fw/spm/spm_api.c
+++ b/secure_fw/spm/spm_api.c
@@ -5,7 +5,7 @@
*
*/
-/* This file contains the apis exported by the SPM to tfm core */
+/* This file contains the APIs exported by the SPM to tfm core */
#include <stdio.h>
#include "spm_api.h"
@@ -15,16 +15,16 @@
#include "region_defs.h"
#include "secure_fw/core/tfm_core.h"
-struct spm_service_db_t g_spm_service_db = {0,};
+struct spm_partition_db_t g_spm_partition_db = {0,};
#define MPU_REGION_VENEERS 0
#define MPU_REGION_TFM_UNPRIV_CODE 1
#define MPU_REGION_TFM_UNPRIV_DATA 2
#define MPU_REGION_NS_DATA 3
-#define SERVICE_REGION_RO 4
-#define SERVICE_REGION_RW_STACK 5
-#define SERVICE_REGION_PERIPH 6
-#define SERVICE_REGION_SHARE 7
+#define PARTITION_REGION_RO 4
+#define PARTITION_REGION_RW_STACK 5
+#define PARTITION_REGION_PERIPH 6
+#define PARTITION_REGION_SHARE 7
/* This should move to platform retarget */
struct mpu_armv8m_dev_t dev_mpu_s = { MPU_BASE };
@@ -34,35 +34,36 @@
} ss_error_type_t;
/*
- * This function is called when a secure service causes an error.
+ * 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
* returned.
*/
-static void tfm_spm_service_err_handler(
- struct spm_service_region_t *service,
+static void tfm_spm_partition_err_handler(
+ struct spm_partition_region_t *partition,
ss_error_type_t err_type,
int32_t err_code)
{
#ifdef TFM_CORE_DEBUG
if (err_type == TFM_INIT_FAILURE) {
- printf("Service init failed for service id 0x%08X\r\n",
- service->service_id);
+ printf("Partition init failed for partition id 0x%08X\r\n",
+ partition->partition_id);
} else {
- printf("Unknown service error %d for service id 0x%08X\r\n",
- err_type, service->service_id);
+ printf("Unknown partition error %d for partition id 0x%08X\r\n",
+ err_type, partition->partition_id);
}
#endif
- tfm_spm_service_set_state(service->service_id, SPM_PART_STATE_CLOSED);
+ tfm_spm_partition_set_state(partition->partition_id,
+ SPM_PARTITION_STATE_CLOSED);
}
enum spm_err_t tfm_spm_db_init(void)
{
- /* This function initialises service db */
- g_spm_service_db.is_init = 1;
- g_spm_service_db.running_service_id = INVALID_PARITION_ID;
+ /* This function initialises partition db */
+ g_spm_partition_db.is_init = 1;
+ g_spm_partition_db.running_partition_id = INVALID_PARITION_ID;
- g_spm_service_db.services_count =
- create_user_service_db(&g_spm_service_db, SPM_MAX_SERVICES);
+ g_spm_partition_db.partition_count =
+ create_user_partition_db(&g_spm_partition_db, SPM_MAX_PARTITIONS);
return SPM_ERR_OK;
}
@@ -127,7 +128,7 @@
}
/**
- * Set share region to which the service needs access
+ * Set share region to which the partition needs access
*/
static enum spm_err_t tfm_spm_set_share_region(
enum tfm_buffer_share_region_e share)
@@ -141,17 +142,17 @@
mpu_armv8m_disable(&dev_mpu_s);
if (share == TFM_BUFFER_SHARE_DISABLE) {
- mpu_armv8m_region_disable(&dev_mpu_s, SERVICE_REGION_SHARE);
+ mpu_armv8m_region_disable(&dev_mpu_s, PARTITION_REGION_SHARE);
} else {
struct mpu_armv8m_region_cfg_t region_cfg;
- region_cfg.region_nr = SERVICE_REGION_SHARE;
+ region_cfg.region_nr = PARTITION_REGION_SHARE;
region_cfg.attr_access = MPU_ARMV8M_AP_RW_PRIV_UNPRIV;
region_cfg.attr_sh = MPU_ARMV8M_SH_NONE;
region_cfg.attr_exec = MPU_ARMV8M_XN_EXEC_NEVER;
switch (share) {
case TFM_BUFFER_SHARE_SCRATCH:
- /* Use scratch area for service-to-service data sharing */
+ /* Use scratch area for SP-to-SP data sharing */
region_cfg.region_base = scratch_base;
region_cfg.region_limit = scratch_limit;
res = SPM_ERR_OK;
@@ -179,33 +180,34 @@
}
#endif
-enum spm_err_t tfm_spm_service_init(void)
+enum spm_err_t tfm_spm_partition_init(void)
{
- struct spm_service_region_t *serv;
+ struct spm_partition_region_t *serv;
int32_t fail_cnt = 0;
uint32_t i;
- /* Call the init function for each service */
+ /* Call the init function for each partition */
/* FixMe: This implementation only fits level 1 isolation.
* On higher levels MPU (and PPC) configuration need to be in place to have
* proper isolation during init.
*/
- for (i = 0; i < g_spm_service_db.services_count; ++i) {
- serv = &g_spm_service_db.services[i];
+ for (i = 0; i < g_spm_partition_db.partition_count; ++i) {
+ serv = &g_spm_partition_db.partitions[i];
if (serv->periph_start) {
ppc_configure_to_secure(serv->periph_ppc_bank,
serv->periph_ppc_loc);
}
- if (serv->service_init == NULL) {
- tfm_spm_service_set_state(serv->service_id, SPM_PART_STATE_IDLE);
+ if (serv->partition_init == NULL) {
+ tfm_spm_partition_set_state(serv->partition_id,
+ SPM_PARTITION_STATE_IDLE);
} else {
- int32_t ret = serv->service_init();
+ int32_t ret = serv->partition_init();
if (ret == TFM_SUCCESS) {
- tfm_spm_service_set_state(
- serv->service_id, SPM_PART_STATE_IDLE);
+ tfm_spm_partition_set_state(
+ serv->partition_id, SPM_PARTITION_STATE_IDLE);
} else {
- tfm_spm_service_err_handler(serv, TFM_INIT_FAILURE, ret);
+ tfm_spm_partition_err_handler(serv, TFM_INIT_FAILURE, ret);
fail_cnt++;
}
}
@@ -214,33 +216,33 @@
if (fail_cnt == 0) {
return SPM_ERR_OK;
} else {
- return SPM_ERR_SERV_NOT_AVAILABLE;
+ return SPM_ERR_PARTITION_NOT_AVAILABLE;
}
}
#if TFM_LVL != 1
-enum spm_err_t tfm_spm_service_sandbox_config(uint32_t service_id)
+enum spm_err_t tfm_spm_partition_sandbox_config(uint32_t partition_id)
{
- /* This function takes a service id and enables the
- * SPM partition for that service
+ /* This function takes a partition id and enables the
+ * SPM partition for that partition
*/
- struct spm_service_region_t *serv;
+ struct spm_partition_region_t *serv;
struct mpu_armv8m_region_cfg_t region_cfg;
- if (!g_spm_service_db.is_init) {
- return SPM_ERR_SERV_DB_NOT_INIT;
+ if (!g_spm_partition_db.is_init) {
+ return SPM_ERR_PARTITION_DB_NOT_INIT;
}
/*brute force id*/
- serv = &g_spm_service_db.services[SERVICE_ID_GET(service_id)];
+ serv = &g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)];
mpu_armv8m_disable(&dev_mpu_s);
/* Configure Regions */
/* RO region*/
- region_cfg.region_nr = SERVICE_REGION_RO;
+ region_cfg.region_nr = PARTITION_REGION_RO;
region_cfg.region_base = serv->ro_start;
region_cfg.region_limit = serv->ro_limit;
region_cfg.attr_access = MPU_ARMV8M_AP_RO_PRIV_UNPRIV;
@@ -250,7 +252,7 @@
mpu_armv8m_region_enable(&dev_mpu_s, ®ion_cfg);
/* RW, ZI and stack as one region*/
- region_cfg.region_nr = SERVICE_REGION_RW_STACK;
+ region_cfg.region_nr = PARTITION_REGION_RW_STACK;
region_cfg.region_base = serv->rw_start;
region_cfg.region_limit = serv->stack_top;
region_cfg.attr_access = MPU_ARMV8M_AP_RW_PRIV_UNPRIV;
@@ -261,7 +263,7 @@
if (serv->periph_start) {
/* Peripheral */
- region_cfg.region_nr = SERVICE_REGION_PERIPH;
+ region_cfg.region_nr = PARTITION_REGION_PERIPH;
region_cfg.region_base = serv->periph_start;
region_cfg.region_limit = serv->periph_limit;
region_cfg.attr_access = MPU_ARMV8M_AP_RW_PRIV_UNPRIV;
@@ -292,10 +294,10 @@
return SPM_ERR_OK;
}
-enum spm_err_t tfm_spm_service_sandbox_deconfig(uint32_t service_id)
+enum spm_err_t tfm_spm_partition_sandbox_deconfig(uint32_t partition_id)
{
- /* This function takes a service id and disables the
- * SPM partition for that service
+ /* This function takes a partition id and disables the
+ * SPM partition for that partition
*/
#ifndef UNPRIV_JUMP_TO_NS
@@ -311,9 +313,9 @@
__ISB();
#endif
- struct spm_service_region_t *serv;
+ struct spm_partition_region_t *serv;
- serv = &g_spm_service_db.services[SERVICE_ID_GET(service_id)];
+ serv = &g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)];
if (serv->periph_start) {
/* Peripheral */
@@ -321,100 +323,113 @@
}
mpu_armv8m_disable(&dev_mpu_s);
- mpu_armv8m_region_disable(&dev_mpu_s, SERVICE_REGION_RO);
- mpu_armv8m_region_disable(&dev_mpu_s, SERVICE_REGION_RW_STACK);
- mpu_armv8m_region_disable(&dev_mpu_s, SERVICE_REGION_PERIPH);
- mpu_armv8m_region_disable(&dev_mpu_s, SERVICE_REGION_SHARE);
+ mpu_armv8m_region_disable(&dev_mpu_s, PARTITION_REGION_RO);
+ mpu_armv8m_region_disable(&dev_mpu_s, PARTITION_REGION_RW_STACK);
+ mpu_armv8m_region_disable(&dev_mpu_s, PARTITION_REGION_PERIPH);
+ mpu_armv8m_region_disable(&dev_mpu_s, PARTITION_REGION_SHARE);
mpu_armv8m_enable(&dev_mpu_s, 1, 1);
return SPM_ERR_OK;
}
-uint32_t tfm_spm_service_get_stack(uint32_t service_id)
+uint32_t tfm_spm_partition_get_stack(uint32_t partition_id)
{
- return g_spm_service_db.services[SERVICE_ID_GET(service_id)].stack_ptr;
+ return g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].
+ stack_ptr;
}
-uint32_t tfm_spm_service_get_stack_bottom(uint32_t service_id)
+uint32_t tfm_spm_partition_get_stack_bottom(uint32_t partition_id)
{
- return g_spm_service_db.services[SERVICE_ID_GET(service_id)].stack_bottom;
+ return g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].
+ stack_bottom;
}
-uint32_t tfm_spm_service_get_stack_top(uint32_t service_id)
+uint32_t tfm_spm_partition_get_stack_top(uint32_t partition_id)
{
- return g_spm_service_db.services[SERVICE_ID_GET(service_id)].stack_top;
+ return
+ g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].stack_top;
}
-void tfm_spm_service_set_stack(uint32_t service_id, uint32_t stack_ptr)
+void tfm_spm_partition_set_stack(uint32_t partition_id, uint32_t stack_ptr)
{
- g_spm_service_db.services[SERVICE_ID_GET(service_id)].stack_ptr = stack_ptr;
+ g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].stack_ptr =
+ stack_ptr;
}
#endif
-uint32_t tfm_spm_service_get_state(uint32_t service_id)
+uint32_t tfm_spm_partition_get_state(uint32_t partition_id)
{
- return g_spm_service_db.services[SERVICE_ID_GET(service_id)].
- service_state;
+ return g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].
+ partition_state;
}
-uint32_t tfm_spm_service_get_caller_service_id(uint32_t service_id)
+uint32_t tfm_spm_partition_get_caller_partition_id(uint32_t partition_id)
{
- return g_spm_service_db.services[SERVICE_ID_GET(service_id)].
- caller_service_id;
+ return g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].
+ caller_partition_id;
}
-uint32_t tfm_spm_service_get_orig_psp(uint32_t service_id)
+uint32_t tfm_spm_partition_get_orig_psp(uint32_t partition_id)
{
- return g_spm_service_db.services[SERVICE_ID_GET(service_id)].orig_psp;
+ return
+ g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].orig_psp;
}
-uint32_t tfm_spm_service_get_orig_psplim(uint32_t service_id)
+uint32_t tfm_spm_partition_get_orig_psplim(uint32_t partition_id)
{
- return g_spm_service_db.services[SERVICE_ID_GET(service_id)].orig_psplim;
-}
-
-uint32_t tfm_spm_service_get_orig_lr(uint32_t service_id)
-{
- return g_spm_service_db.services[SERVICE_ID_GET(service_id)].orig_lr;
-}
-
-uint32_t tfm_spm_service_get_share(uint32_t service_id)
-{
- return g_spm_service_db.services[SERVICE_ID_GET(service_id)].share;
-}
-
-void tfm_spm_service_set_state(uint32_t service_id, uint32_t state)
-{
- g_spm_service_db.services[SERVICE_ID_GET(service_id)].service_state = state;
- if (state == SPM_PART_STATE_RUNNING) {
- g_spm_service_db.running_service_id = service_id;
- }
-}
-
-void tfm_spm_service_set_caller_service_id(uint32_t service_id,
- uint32_t caller_service_id)
-{
- g_spm_service_db.services[SERVICE_ID_GET(service_id)].caller_service_id =
- caller_service_id;
-}
-
-void tfm_spm_service_set_orig_psp(uint32_t service_id, uint32_t orig_psp)
-{
- g_spm_service_db.services[SERVICE_ID_GET(service_id)].orig_psp = orig_psp;
-}
-
-void tfm_spm_service_set_orig_psplim(uint32_t service_id, uint32_t orig_psplim)
-{
- g_spm_service_db.services[SERVICE_ID_GET(service_id)].orig_psplim =
+ return g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].
orig_psplim;
}
-void tfm_spm_service_set_orig_lr(uint32_t service_id, uint32_t orig_lr)
+uint32_t tfm_spm_partition_get_orig_lr(uint32_t partition_id)
{
- g_spm_service_db.services[SERVICE_ID_GET(service_id)].orig_lr = orig_lr;
+ return g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].
+ orig_lr;
}
-enum spm_err_t tfm_spm_service_set_share(uint32_t service_id, uint32_t share)
+uint32_t tfm_spm_partition_get_share(uint32_t partition_id)
+{
+ return g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].share;
+}
+
+void tfm_spm_partition_set_state(uint32_t partition_id, uint32_t state)
+{
+ g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].
+ partition_state = state;
+ if (state == SPM_PARTITION_STATE_RUNNING) {
+ g_spm_partition_db.running_partition_id = partition_id;
+ }
+}
+
+void tfm_spm_partition_set_caller_partition_id(uint32_t partition_id,
+ uint32_t caller_partition_id)
+{
+ g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].
+ caller_partition_id = caller_partition_id;
+}
+
+void tfm_spm_partition_set_orig_psp(uint32_t partition_id,
+ uint32_t orig_psp)
+{
+ g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].orig_psp =
+ orig_psp;
+}
+
+void tfm_spm_partition_set_orig_psplim(uint32_t partition_id,
+ uint32_t orig_psplim)
+{
+ g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].orig_psplim =
+ orig_psplim;
+}
+
+void tfm_spm_partition_set_orig_lr(uint32_t partition_id, uint32_t orig_lr)
+{
+ g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].orig_lr =
+ orig_lr;
+}
+
+enum spm_err_t tfm_spm_partition_set_share(uint32_t partition_id,
+ uint32_t share)
{
enum spm_err_t ret = SPM_ERR_OK;
@@ -424,24 +439,25 @@
#endif
if (ret == SPM_ERR_OK) {
- g_spm_service_db.services[SERVICE_ID_GET(service_id)].share = share;
+ g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)].share =
+ share;
}
return ret;
}
-uint32_t tfm_spm_service_get_running_service_id(void)
+uint32_t tfm_spm_partition_get_running_partition_id(void)
{
- return g_spm_service_db.running_service_id;
+ return g_spm_partition_db.running_partition_id;
}
-void tfm_spm_service_cleanup_context(uint32_t service_id)
+void tfm_spm_partition_cleanup_context(uint32_t partition_id)
{
- struct spm_service_region_t *service =
- &g_spm_service_db.services[SERVICE_ID_GET(service_id)];
- service->service_state = 0;
- service->caller_service_id = 0;
- service->orig_psp = 0;
- service->orig_psplim = 0;
- service->orig_lr = 0;
- service->share = 0;
+ struct spm_partition_region_t *partition =
+ &g_spm_partition_db.partitions[PARTITION_ID_GET(partition_id)];
+ partition->partition_state = 0;
+ partition->caller_partition_id = 0;
+ partition->orig_psp = 0;
+ partition->orig_psplim = 0;
+ partition->orig_lr = 0;
+ partition->share = 0;
}
diff --git a/secure_fw/spm/spm_api.h b/secure_fw/spm/spm_api.h
index 92263f7..ca4994c 100644
--- a/secure_fw/spm/spm_api.h
+++ b/secure_fw/spm/spm_api.h
@@ -14,229 +14,231 @@
enum spm_err_t {
SPM_ERR_OK = 0,
- SPM_ERR_SERV_DB_NOT_INIT,
- SPM_ERR_SERV_ALREADY_ACTIVE,
- SPM_ERR_SERV_NOT_AVAILABLE,
+ SPM_ERR_PARTITION_DB_NOT_INIT,
+ SPM_ERR_PARTITION_ALREADY_ACTIVE,
+ SPM_ERR_PARTITION_NOT_AVAILABLE,
SPM_ERR_INVALID_CONFIG,
};
enum spm_part_state_t {
- SPM_PART_STATE_UNINIT = 0,
- SPM_PART_STATE_IDLE,
- SPM_PART_STATE_RUNNING,
- SPM_PART_STATE_SUSPENDED,
- SPM_PART_STATE_BLOCKED,
- SPM_PART_STATE_CLOSED,
+ SPM_PARTITION_STATE_UNINIT = 0,
+ SPM_PARTITION_STATE_IDLE,
+ SPM_PARTITION_STATE_RUNNING,
+ SPM_PARTITION_STATE_SUSPENDED,
+ SPM_PARTITION_STATE_BLOCKED,
+ SPM_PARTITION_STATE_CLOSED
};
/**
- * \brief Configure isolated sandbox for a service
+ * \brief Configure isolated sandbox for a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
* \return Error code \ref spm_err_t
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-enum spm_err_t tfm_spm_service_sandbox_config(uint32_t service_id);
+enum spm_err_t tfm_spm_partition_sandbox_config(uint32_t partition_id);
/**
- * \brief Deconfigure sandbox for a service
+ * \brief Deconfigure sandbox for a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
* \return Error code \ref spm_err_t
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-enum spm_err_t tfm_spm_service_sandbox_deconfig(uint32_t service_id);
+enum spm_err_t tfm_spm_partition_sandbox_deconfig(uint32_t partition_id);
/**
* \brief Get saved stack pointer for a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
* \return Stack pointer value
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-uint32_t tfm_spm_service_get_stack(uint32_t service_id);
+uint32_t tfm_spm_partition_get_stack(uint32_t partition_id);
/**
- * \brief Get bottom of stack region for a service
+ * \brief Get bottom of stack region for a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
* \return Stack region bottom value
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-uint32_t tfm_spm_service_get_stack_bottom(uint32_t service_id);
+uint32_t tfm_spm_partition_get_stack_bottom(uint32_t partition_id);
/**
- * \brief Get top of stack region for a service
+ * \brief Get top of stack region for a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
* \return Stack region top value
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-uint32_t tfm_spm_service_get_stack_top(uint32_t service_id);
+uint32_t tfm_spm_partition_get_stack_top(uint32_t partition_id);
/**
- * \brief Get the current state of a service
+ * \brief Get the current state of a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
- * \return The state of the specified service
+ * \return The state of the specified partition
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
* \note The returned value has the value set of \ref spm_part_state_t.
*/
-uint32_t tfm_spm_service_get_state(uint32_t service_id);
+uint32_t tfm_spm_partition_get_state(uint32_t partition_id);
/**
- * \brief Get the Id of the caller of the service given
+ * \brief Get the Id of the caller of the partition given
*
- * \param[in] service_id Service id to get the caller of
+ * \param[in] partition_id Partition id to get the caller of
*
- * \return The Id of the caller service
+ * \return The Id of the caller partition
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-uint32_t tfm_spm_service_get_caller_service_id(uint32_t service_id);
+uint32_t tfm_spm_partition_get_caller_partition_id(uint32_t partition_id);
/**
- * \brief Get the original PSP of the service
+ * \brief Get the original PSP of the partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
- * \return The original PSP of the service
+ * \return The original PSP of the partition
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-uint32_t tfm_spm_service_get_orig_psp(uint32_t service_id);
+uint32_t tfm_spm_partition_get_orig_psp(uint32_t partition_id);
/**
- * \brief Get the original PSP limit of the service
+ * \brief Get the original PSP limit of the partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
- * \return The original PSP limit of the service
+ * \return The original PSP limit of the partition
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-uint32_t tfm_spm_service_get_orig_psplim(uint32_t service_id);
+uint32_t tfm_spm_partition_get_orig_psplim(uint32_t partition_id);
/**
- * \brief Get the original link register value of the service
+ * \brief Get the original link register value of the partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
- * \return The original link register value of the service
+ * \return The original link register value of the partition
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-uint32_t tfm_spm_service_get_orig_lr(uint32_t service_id);
+uint32_t tfm_spm_partition_get_orig_lr(uint32_t partition_id);
/**
- * \brief Get the buffer share region of the service
+ * \brief Get the buffer share region of the partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
- * \return The buffer share region of the service
+ * \return The buffer share region of the partition
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
* \note The returned value has the value set of \ref tfm_buffer_share_region_e
*/
-uint32_t tfm_spm_service_get_share(uint32_t service_id);
+uint32_t tfm_spm_partition_get_share(uint32_t partition_id);
/**
- * \brief Returns the id of the service that has running state
+ * \brief Returns the id of the partition that has running state
*
- * \return The Id of the service with the running state, if there is any set.
+ * \return The Id of the partition with the running state, if there is any set.
* 0 otherwise.
*/
-uint32_t tfm_spm_service_get_running_service_id(void);
+uint32_t tfm_spm_partition_get_running_partition_id(void);
/**
- * \brief Save stack pointer for service in database
+ * \brief Save stack pointer for partition in database
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
* \param[in] stack_ptr Stack pointer to be stored
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-void tfm_spm_service_set_stack(uint32_t service_id, uint32_t stack_ptr);
+void tfm_spm_partition_set_stack(uint32_t partition_id, uint32_t stack_ptr);
/**
- * \brief Set the current state of a service
+ * \brief Set the current state of a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
* \param[in] state The state to be set
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
* \note The \ref state has to have the value set of \ref spm_part_state_t.
*/
-void tfm_spm_service_set_state(uint32_t service_id, uint32_t state);
+void tfm_spm_partition_set_state(uint32_t partition_id, uint32_t state);
/**
- * \brief Set the caller service Id for a given service
+ * \brief Set the caller partition Id for a given partition
*
- * \param[in] service_id Service id
- * \param[in] caller_service_id The Id of the caller service
+ * \param[in] partition_id Partition id
+ * \param[in] caller_partition_id The Id of the caller partition
*
- * \note This function doesn't check if any of the service_ids is valid.
+ * \note This function doesn't check if any of the partition_ids is valid.
*/
-void tfm_spm_service_set_caller_service_id(uint32_t service_id,
- uint32_t caller_service_id);
+void tfm_spm_partition_set_caller_partition_id(uint32_t partition_id,
+ uint32_t caller_partition_id);
/**
- * \brief Set the original PSP value of a service
+ * \brief Set the original PSP value of a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
* \param[in] orig_psp The PSP value to set
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-void tfm_spm_service_set_orig_psp(uint32_t service_id, uint32_t orig_psp);
+void tfm_spm_partition_set_orig_psp(uint32_t partition_id, uint32_t orig_psp);
/**
- * \brief Set the original PSP limit value of a service
+ * \brief Set the original PSP limit value of a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
* \param[in] orig_psplim The PSP limit value to set
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-void tfm_spm_service_set_orig_psplim(uint32_t service_id, uint32_t orig_psplim);
+void tfm_spm_partition_set_orig_psplim(uint32_t partition_id,
+ uint32_t orig_psplim);
/**
- * \brief Set the original link register value of a service
+ * \brief Set the original link register value of a partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
* \param[in] orig_lr The link register value to set
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-void tfm_spm_service_set_orig_lr(uint32_t service_id, uint32_t orig_lr);
+void tfm_spm_partition_set_orig_lr(uint32_t partition_id, uint32_t orig_lr);
/**
- * \brief Set the buffer share region of the service
+ * \brief Set the buffer share region of the partition
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
* \param[in] share The buffer share region to be set
*
* \return Error code \ref spm_err_t
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
* \note share has to have the value set of \ref tfm_buffer_share_region_e
*/
-enum spm_err_t tfm_spm_service_set_share(uint32_t service_id, uint32_t share);
+enum spm_err_t tfm_spm_partition_set_share(uint32_t partition_id,
+ uint32_t share);
/**
- * \brief Initialize service database
+ * \brief Initialize partition database
*
* \return Error code \ref spm_err_t
*/
@@ -250,19 +252,19 @@
enum spm_err_t tfm_spm_mpu_init(void);
/**
- * \brief Execute service init function
+ * \brief Execute partition init function
*
* \return Error code \ref spm_err_t
*/
-enum spm_err_t tfm_spm_service_init(void);
+enum spm_err_t tfm_spm_partition_init(void);
/**
- * \brief Clears the context info from the database for a service.
+ * \brief Clears the context info from the database for a partition.
*
- * \param[in] service_id Service id
+ * \param[in] partition_id Partition id
*
- * \note This function doesn't check if service_id is valid.
+ * \note This function doesn't check if partition_id is valid.
*/
-void tfm_spm_service_cleanup_context(uint32_t service_id);
+void tfm_spm_partition_cleanup_context(uint32_t partition_id);
#endif /*__SPM_API_H__ */
diff --git a/secure_fw/spm/spm_db.h b/secure_fw/spm/spm_db.h
index cb3dd3a..5c6d1b4 100644
--- a/secure_fw/spm/spm_db.h
+++ b/secure_fw/spm/spm_db.h
@@ -11,20 +11,20 @@
#include <stdint.h>
/* This limit is only used to define the size of the database reserved for
- * services. There's no requirement that it match the number of services
+ * partitions. There's no requirement that it match the number of partitions
* that get registered in a specific build
*/
-#define SPM_MAX_SERVICES (6)
+#define SPM_MAX_PARTITIONS (6)
-#define SERVICE_ID_GET(id) (id - TFM_SEC_FUNC_BASE)
+#define PARTITION_ID_GET(id) (id - TFM_SP_BASE)
-typedef int32_t(*ss_init_function)(void);
+typedef int32_t(*sp_init_function)(void);
#if TFM_LVL == 1
-struct spm_service_region_t {
- uint32_t service_id;
- uint32_t service_state;
- uint32_t caller_service_id;
+struct spm_partition_region_t {
+ uint32_t partition_id;
+ uint32_t partition_state;
+ uint32_t caller_partition_id;
uint32_t orig_psp;
uint32_t orig_psplim;
uint32_t orig_lr;
@@ -34,13 +34,13 @@
uint32_t periph_limit;
uint16_t periph_ppc_bank;
uint16_t periph_ppc_loc;
- ss_init_function service_init;
+ sp_init_function partition_init;
};
#else
-struct spm_service_region_t {
- uint32_t service_id;
- uint32_t service_state;
- uint32_t caller_service_id;
+struct spm_partition_region_t {
+ uint32_t partition_id;
+ uint32_t partition_state;
+ uint32_t caller_partition_id;
uint32_t orig_psp;
uint32_t orig_psplim;
uint32_t orig_lr;
@@ -60,18 +60,18 @@
uint32_t periph_limit;
uint16_t periph_ppc_bank;
uint16_t periph_ppc_loc;
- ss_init_function service_init;
+ sp_init_function partition_init;
};
#endif
-struct spm_service_db_t {
+struct spm_partition_db_t {
uint32_t is_init;
- uint32_t services_count;
- uint32_t running_service_id;
- struct spm_service_region_t services[SPM_MAX_SERVICES];
+ uint32_t partition_count;
+ uint32_t running_partition_id;
+ struct spm_partition_region_t partitions[SPM_MAX_PARTITIONS];
};
-/* Macros to pick linker symbols and allow to form the service data base */
+/* 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)
#if TFM_LVL == 1
@@ -80,144 +80,146 @@
#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
#endif
-#define SERVICE_DECLARE(service) \
- REGION_DECLARE(Image$$, service, $$Base); \
- REGION_DECLARE(Image$$, service, $$Limit); \
- REGION_DECLARE(Image$$, service, $$RO$$Base); \
- REGION_DECLARE(Image$$, service, $$RO$$Limit); \
- REGION_DECLARE(Image$$, service, _DATA$$RW$$Base); \
- REGION_DECLARE(Image$$, service, _DATA$$RW$$Limit); \
- REGION_DECLARE(Image$$, service, _DATA$$ZI$$Base); \
- REGION_DECLARE(Image$$, service, _DATA$$ZI$$Limit); \
- REGION_DECLARE(Image$$, service, _STACK$$ZI$$Base); \
- REGION_DECLARE(Image$$, service, _STACK$$ZI$$Limit); \
+#define PARTITION_DECLARE(partition) \
+ 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); \
#if TFM_LVL == 1
-#define SERVICE_ADD(service) { \
- if (index >= max_services) { \
- return max_services; \
- } \
- db_ptr = (uint32_t *)&(db->services[index]); \
- *db_ptr++ = service##_ID; \
- *db_ptr++ = SPM_PART_STATE_UNINIT; /* service_state */ \
- *db_ptr++ = 0U; /* caller service id */ \
- *db_ptr++ = 0U; /* original psp */ \
- *db_ptr++ = 0U; /* original psplim */ \
- *db_ptr++ = 0U; /* original lr */ \
- *db_ptr++ = 0U; /* share */ \
- *db_ptr++ = 0U; /* stack pointer on service enter */ \
- *db_ptr++ = 0U; /* peripheral start */ \
- *db_ptr++ = 0U; /* peripheral limit */ \
- *db_ptr++ = 0U; /* uint16_t[2] peripheral bank/loc */ \
- *db_ptr++ = 0U; /* service init function*/ \
- index++; \
+#define PARTITION_ADD(partition) { \
+ if (index >= max_partitions) { \
+ return max_partitions; \
+ } \
+ db_ptr = (uint32_t *)&(db->partitions[index]); \
+ *db_ptr++ = partition##_ID; \
+ *db_ptr++ = SPM_PARTITION_STATE_UNINIT; /* partition_state */ \
+ *db_ptr++ = 0U; /* caller partition id */ \
+ *db_ptr++ = 0U; /* original psp */ \
+ *db_ptr++ = 0U; /* original psplim */ \
+ *db_ptr++ = 0U; /* original lr */ \
+ *db_ptr++ = 0U; /* share */ \
+ *db_ptr++ = 0U; /* stack pointer on partition enter */ \
+ *db_ptr++ = 0U; /* peripheral start */ \
+ *db_ptr++ = 0U; /* peripheral limit */ \
+ *db_ptr++ = 0U; /* uint16_t[2] peripheral bank/loc */ \
+ *db_ptr++ = 0U; /* partition init function*/ \
+ index++; \
}
#else
-#define SERVICE_ADD(service) { \
- if (index >= max_services) { \
- return max_services; \
- } \
- db_ptr = (uint32_t *)&(db->services[index]); \
- *db_ptr++ = service##_ID; \
- *db_ptr++ = SPM_PART_STATE_UNINIT; /* service_state */ \
- *db_ptr++ = 0U; /* caller service id */ \
- *db_ptr++ = 0U; /* original psp */ \
- *db_ptr++ = 0U; /* original psplim */ \
- *db_ptr++ = 0U; /* original lr */ \
- *db_ptr++ = 0U; /* share */ \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, $$Base); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, $$Limit); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, $$RO$$Base); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, $$RO$$Limit); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, _DATA$$RW$$Base); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, _DATA$$RW$$Limit); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, _DATA$$ZI$$Base); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, _DATA$$ZI$$Limit); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, _STACK$$ZI$$Base); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, _STACK$$ZI$$Limit); \
- *db_ptr++ = (uint32_t)®ION_NAME(Image$$, service, _STACK$$ZI$$Limit); \
- *db_ptr++ = 0U; /* peripheral start */ \
- *db_ptr++ = 0U; /* peripheral limit */ \
- *db_ptr++ = 0U; /* uint16_t[2] peripheral bank/loc */ \
- *db_ptr++ = 0U; /* service init function*/ \
- index++; \
+#define PARTITION_ADD(partition) { \
+ if (index >= max_partitions) { \
+ return max_partitions; \
+ } \
+ db_ptr = (uint32_t *)&(db->partitions[index]); \
+ *db_ptr++ = partition##_ID; \
+ *db_ptr++ = SPM_PARTITION_STATE_UNINIT; /* partition_state */ \
+ *db_ptr++ = 0U; /* caller partition id */ \
+ *db_ptr++ = 0U; /* original psp */ \
+ *db_ptr++ = 0U; /* original psplim */ \
+ *db_ptr++ = 0U; /* original lr */ \
+ *db_ptr++ = 0U; /* share */ \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, $$Base); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, $$Limit); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, $$RO$$Base); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, $$RO$$Limit); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, _DATA$$RW$$Base); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, _DATA$$RW$$Limit); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, _DATA$$ZI$$Base); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, _DATA$$ZI$$Limit); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, _STACK$$ZI$$Base); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, _STACK$$ZI$$Limit); \
+ *db_ptr++ = (uint32_t)®ION_NAME(Image$$, partition, _STACK$$ZI$$Limit); \
+ *db_ptr++ = 0U; /* peripheral start */ \
+ *db_ptr++ = 0U; /* peripheral limit */ \
+ *db_ptr++ = 0U; /* uint16_t[2] peripheral bank/loc */ \
+ *db_ptr++ = 0U; /* partition init function*/ \
+ index++; \
}
#endif
#if TFM_LVL == 1
-#define DUMMY_SERVICE_ADD(service) { \
- if (index >= max_services) { \
- return max_services; \
- } \
- db_ptr = (uint32_t *)&(db->services[index]); \
- *db_ptr++ = service##_ID; \
- *db_ptr++ = SPM_PART_STATE_UNINIT; /* service_state */ \
- *db_ptr++ = 0U; /* caller service id */ \
- *db_ptr++ = 0U; /* original psp */ \
- *db_ptr++ = 0U; /* original psplim */ \
- *db_ptr++ = 0U; /* original lr */ \
- *db_ptr++ = 0U; /* share */ \
- *db_ptr++ = 0U; /* stack pointer on service enter */ \
- *db_ptr++ = 0U; /* peripheral start */ \
- *db_ptr++ = 0U; /* peripheral limit */ \
- *db_ptr++ = 0U; /* uint16_t[2] peripheral bank/loc */ \
- *db_ptr++ = 0U; /* service init function*/ \
- index++; \
+#define DUMMY_PARTITION_ADD(partition) { \
+ if (index >= max_partitions) { \
+ return max_partitions; \
+ } \
+ db_ptr = (uint32_t *)&(db->partitions[index]); \
+ *db_ptr++ = partition##_ID; \
+ *db_ptr++ = SPM_PARTITION_STATE_UNINIT; /* partition_state */ \
+ *db_ptr++ = 0U; /* caller partition id */ \
+ *db_ptr++ = 0U; /* original psp */ \
+ *db_ptr++ = 0U; /* original psplim */ \
+ *db_ptr++ = 0U; /* original lr */ \
+ *db_ptr++ = 0U; /* share */ \
+ *db_ptr++ = 0U; /* stack pointer on partition enter */ \
+ *db_ptr++ = 0U; /* peripheral start */ \
+ *db_ptr++ = 0U; /* peripheral limit */ \
+ *db_ptr++ = 0U; /* uint16_t[2] peripheral bank/loc */ \
+ *db_ptr++ = 0U; /* partition init function*/ \
+ index++; \
}
#else
-#define DUMMY_SERVICE_ADD(service) { \
- if (index >= max_services) { \
- return max_services; \
- } \
- db_ptr = (uint32_t *)&(db->services[index]); \
- *db_ptr++ = service##_ID; \
- *db_ptr++ = SPM_PART_STATE_UNINIT; /* service_state */ \
- *db_ptr++ = 0U; /* caller service id */ \
- *db_ptr++ = 0U; /* original_psp */ \
- *db_ptr++ = 0U; /* original_psplim */ \
- *db_ptr++ = 0U; /* original_lr */ \
- *db_ptr++ = 0U; /* share */ \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; \
- *db_ptr++ = 0U; /* peripheral start */ \
- *db_ptr++ = 0U; /* peripheral limit */ \
- *db_ptr++ = 0U; /* uint16_t[2] peripheral bank/loc */ \
- *db_ptr++ = 0U; /* service init function*/ \
- index++; \
+#define DUMMY_PARTITION_ADD(partition) { \
+ if (index >= max_partitions) { \
+ return max_partitions; \
+ } \
+ db_ptr = (uint32_t *)&(db->partitions[index]); \
+ *db_ptr++ = partition##_ID; \
+ *db_ptr++ = SPM_PARTITION_STATE_UNINIT; /* partition_state */ \
+ *db_ptr++ = 0U; /* caller partition id */ \
+ *db_ptr++ = 0U; /* original_psp */ \
+ *db_ptr++ = 0U; /* original_psplim */ \
+ *db_ptr++ = 0U; /* original_lr */ \
+ *db_ptr++ = 0U; /* share */ \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; \
+ *db_ptr++ = 0U; /* peripheral start */ \
+ *db_ptr++ = 0U; /* peripheral limit */ \
+ *db_ptr++ = 0U; /* uint16_t[2] peripheral bank/loc */ \
+ *db_ptr++ = 0U; /* partition init function*/ \
+ index++; \
}
#endif
-#define SERVICE_ADD_PERIPHERAL(service, start, limit, bank, loc) { \
- db_ptr = (uint32_t *)&(db->services[SERVICE_ID_GET(service##_ID)]); \
- ((struct spm_service_region_t *)db_ptr)->periph_start = start; \
- ((struct spm_service_region_t *)db_ptr)->periph_limit = limit; \
- ((struct spm_service_region_t *)db_ptr)->periph_ppc_bank = bank; \
- ((struct spm_service_region_t *)db_ptr)->periph_ppc_loc = loc; \
+#define PARTITION_ADD_PERIPHERAL(partition, start, limit, bank, loc) { \
+ db_ptr = \
+ (uint32_t *)&(db->partitions[PARTITION_ID_GET(partition##_ID)]);\
+ ((struct spm_partition_region_t *)db_ptr)->periph_start = start; \
+ ((struct spm_partition_region_t *)db_ptr)->periph_limit = limit; \
+ ((struct spm_partition_region_t *)db_ptr)->periph_ppc_bank = bank; \
+ ((struct spm_partition_region_t *)db_ptr)->periph_ppc_loc = loc; \
}
-#define SERVICE_ADD_INIT_FUNC(service, init_func) { \
- extern int32_t init_func(void); \
- db_ptr = (uint32_t *)&(db->services[SERVICE_ID_GET(service##_ID)]); \
- ((struct spm_service_region_t *)db_ptr)->service_init = init_func; \
+#define PARTITION_ADD_INIT_FUNC(partition, init_func) { \
+ extern int32_t init_func(void); \
+ db_ptr = \
+ (uint32_t *)&(db->partitions[PARTITION_ID_GET(partition##_ID)]);\
+ ((struct spm_partition_region_t *)db_ptr)->partition_init = init_func; \
}
/*This file is meant to be included twice*/
#include "user_service_defines.inc"
-struct spm_service_db_t;
+struct spm_partition_db_t;
-uint32_t create_user_service_db(struct spm_service_db_t *db,
- uint32_t max_services)
+uint32_t create_user_partition_db(struct spm_partition_db_t *db,
+ uint32_t max_partitions)
{
uint32_t index = 0;
uint32_t *db_ptr;
diff --git a/secure_fw/spm/user_service_defines.inc b/secure_fw/spm/user_service_defines.inc
index 59ab7bc..023835e 100644
--- a/secure_fw/spm/user_service_defines.inc
+++ b/secure_fw/spm/user_service_defines.inc
@@ -6,62 +6,62 @@
*/
/* The file is meant to be included twice */
-#ifndef __SPM_DECLARE_USER_SERVICES__
-#define __SPM_DECLARE_USER_SERVICES__
+#ifndef __SPM_DECLARE_USER_PARTITIONS__
+#define __SPM_DECLARE_USER_PARTITIONS__
#include "platform_retarget.h"
#include "target_cfg.h"
#include "service_defs.h"
-/* TFM_SEC_FUNC_NON_SECURE and TFM_SEC_FUNC_CORE are not real services, we
+/* TFM_SP_NON_SECURE and TFM_SP_CORE are not real partitions, we
* only created them to have an entry for them in the database. They don't have
* their dedicated sections in the scatter file, so no symbols are needed to
* be declared.
*/
-/* SERVICE_DECLARE(TFM_SEC_FUNC_NON_SECURE) */
-/* SERVICE_DECLARE(TFM_SEC_FUNC_CORE) */
-SERVICE_DECLARE(TFM_SEC_FUNC_STORAGE)
+/* PARTITION_DECLARE(TFM_SP_NON_SECURE) */
+/* PARTITION_DECLARE(TFM_SP_CORE) */
+PARTITION_DECLARE(TFM_SP_STORAGE)
-#ifdef CORE_TEST_SERVICES
-SERVICE_DECLARE(TFM_SEC_FUNC_CORE_TEST)
-SERVICE_DECLARE(TFM_SEC_FUNC_CORE_TEST_2)
-#endif /* CORE_TEST_SERVICES */
+#ifdef TFM_PARTITION_TEST_CORE
+PARTITION_DECLARE(TFM_SP_CORE_TEST)
+PARTITION_DECLARE(TFM_SP_CORE_TEST_2)
+#endif /* TFM_PARTITION_TEST_CORE */
-#ifdef SST_TEST_SERVICES
-SERVICE_DECLARE(TFM_SEC_FUNC_SST_TEST_SERVICE)
-#endif /* SST_TEST_SERVICES */
+#ifdef TFM_PARTITION_TEST_SST
+PARTITION_DECLARE(TFM_SP_SST_TEST_PARTITION)
+#endif /* TFM_PARTITION_TEST_SST */
-#elif !defined(__SPM_ADD_USER_SERVICES__) /*__SPM_DECLARE_USER_SERVICES__*/
-#define __SPM_ADD_USER_SERVICES__
+#elif !defined(__SPM_ADD_USER_PARTITIONS__) /*__SPM_DECLARE_USER_PARTITIONS__*/
+#define __SPM_ADD_USER_PARTITIONS__
/* Order must be same as id!!! */
-DUMMY_SERVICE_ADD(TFM_SEC_FUNC_NON_SECURE)
-DUMMY_SERVICE_ADD(TFM_SEC_FUNC_CORE)
-SERVICE_ADD(TFM_SEC_FUNC_STORAGE)
+DUMMY_PARTITION_ADD(TFM_SP_NON_SECURE)
+DUMMY_PARTITION_ADD(TFM_SP_CORE)
+PARTITION_ADD(TFM_SP_STORAGE)
-#ifdef CORE_TEST_SERVICES
-SERVICE_ADD(TFM_SEC_FUNC_CORE_TEST)
-SERVICE_ADD(TFM_SEC_FUNC_CORE_TEST_2)
-#endif /* CORE_TEST_SERVICES */
+#ifdef TFM_PARTITION_TEST_CORE
+PARTITION_ADD(TFM_SP_CORE_TEST)
+PARTITION_ADD(TFM_SP_CORE_TEST_2)
+#endif /* TFM_PARTITION_TEST_CORE */
-#ifdef SST_TEST_SERVICES
-SERVICE_ADD(TFM_SEC_FUNC_SST_TEST_SERVICE)
-#endif /* SST_TEST_SERVICES */
+#ifdef TFM_PARTITION_TEST_SST
+PARTITION_ADD(TFM_SP_SST_TEST_PARTITION)
+#endif /* TFM_PARTITION_TEST_SST */
-SERVICE_ADD_INIT_FUNC(TFM_SEC_FUNC_STORAGE, sst_am_prepare)
+PARTITION_ADD_INIT_FUNC(TFM_SP_STORAGE, sst_am_prepare)
-#ifdef CORE_TEST_SERVICES
-SERVICE_ADD_INIT_FUNC(TFM_SEC_FUNC_CORE_TEST, core_test_init)
-SERVICE_ADD_PERIPHERAL(TFM_SEC_FUNC_CORE_TEST,
+#ifdef TFM_PARTITION_TEST_CORE
+PARTITION_ADD_INIT_FUNC(TFM_SP_CORE_TEST, core_test_init)
+PARTITION_ADD_PERIPHERAL(TFM_SP_CORE_TEST,
MPS2_IO_FPGAIO_BASE_S, MPS2_IO_FPGAIO_BASE_S + 0xFFF,
PPC_SP_APB_PPC_EXP2, CMSDK_FPGA_IO_PPC_POS)
-SERVICE_ADD_INIT_FUNC(TFM_SEC_FUNC_CORE_TEST_2, core_test_2_init)
-#endif /* CORE_TEST_SERVICES */
+PARTITION_ADD_INIT_FUNC(TFM_SP_CORE_TEST_2, core_test_2_init)
+#endif /* TFM_PARTITION_TEST_CORE */
-#ifdef SST_TEST_SERVICES
-SERVICE_ADD_INIT_FUNC(TFM_SEC_FUNC_SST_TEST_SERVICE, sst_test_service_init)
-#endif /* SST_TEST_SERVICES */
+#ifdef TFM_PARTITION_TEST_SST
+PARTITION_ADD_INIT_FUNC(TFM_SP_SST_TEST_PARTITION, sst_test_service_init)
+#endif /* TFM_PARTITION_TEST_SST */
-#else /* __SPM_ADD_USER_SERVICES__ */
+#else /* __SPM_ADD_USER_PARTITIONS__ */
#error "unexpected inclusion of the file"
-#endif /* __SPM_ADD_USER_SERVICES__ */
+#endif /* __SPM_ADD_USER_PARTITIONS__ */
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
index 9ba5f43..fa1c115 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -19,12 +19,12 @@
/* Non-secure SST test cases */
{®ister_testsuite_ns_sst_interface, 0, 0, 0},
-#ifdef SST_TEST_SERVICES
+#ifdef TFM_PARTITION_TEST_SST
/* Non-secure SST referenced access testsuite */
{®ister_testsuite_ns_sst_ref_access, 0, 0, 0},
#endif
-#ifdef CORE_TEST_SERVICES
+#ifdef TFM_PARTITION_TEST_CORE
/* Non-secure invert test cases */
/* Note: since this is sample code, only run if test services are enabled */
{®ister_testsuite_ns_invert_interface, 0, 0, 0},
diff --git a/test/framework/secure_suites.c b/test/framework/secure_suites.c
index 1b5360c..f0e7dca 100644
--- a/test/framework/secure_suites.c
+++ b/test/framework/secure_suites.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -26,7 +26,7 @@
* {®ister_testsuite_s_sst_interface, 0, 0, 0},
*/
-#ifdef CORE_TEST_SERVICES
+#ifdef TFM_PARTITION_TEST_CORE
/* Secure invert test cases */
/* Note: since this is sample code, only run if test services are enabled */
{®ister_testsuite_s_invert_interface, 0, 0, 0},
diff --git a/test/suites/core/CMakeLists.inc b/test/suites/core/CMakeLists.inc
index 4c516d1..aff2f05 100644
--- a/test/suites/core/CMakeLists.inc
+++ b/test/suites/core/CMakeLists.inc
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -24,9 +24,9 @@
message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
endif()
-if (NOT DEFINED CORE_TEST_SERVICES)
+if (NOT DEFINED TFM_PARTITION_TEST_CORE)
message(FATAL_ERROR "Incomplete build configuration: CORE_TEST is undefined. ")
-elseif (CORE_TEST_SERVICES)
+elseif (TFM_PARTITION_TEST_CORE)
list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/non_secure/core_test_api.c"
"${CORE_TEST_DIR}/non_secure/svc_core_test_ns.c")
endif()
diff --git a/test/suites/sst/CMakeLists.inc b/test/suites/sst/CMakeLists.inc
index cd987d4..08f57ab 100644
--- a/test/suites/sst/CMakeLists.inc
+++ b/test/suites/sst/CMakeLists.inc
@@ -39,9 +39,9 @@
list(APPEND ALL_SRC_C_NS "${SECURE_STORAGE_TEST_DIR}/non_secure/sst_ns_interface_testsuite.c")
- if (NOT DEFINED SST_TEST_SERVICES)
- message(FATAL_ERROR "Incomplete build configuration: SST_TEST_SERVICES is undefined.")
- elseif (SST_TEST_SERVICES)
+ if (NOT DEFINED TFM_PARTITION_TEST_SST)
+ message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SST is undefined.")
+ elseif (TFM_PARTITION_TEST_SST)
list(APPEND ALL_SRC_C_NS "${SECURE_STORAGE_TEST_DIR}/non_secure/sst_ns_ref_access_testsuite.c")
endif()
diff --git a/test/test_services/CMakeLists.inc b/test/test_services/CMakeLists.inc
index c03c96e..4e042d0 100644
--- a/test/test_services/CMakeLists.inc
+++ b/test/test_services/CMakeLists.inc
@@ -42,9 +42,9 @@
)
endif()
-if (NOT DEFINED SST_TEST_SERVICES)
- message(FATAL_ERROR "Incomplete build configuration: SST_TEST_SERVICES is undefined. ")
-elseif (SST_TEST_SERVICES)
+if (NOT DEFINED TFM_PARTITION_TEST_SST)
+ message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SST is undefined. ")
+elseif (TFM_PARTITION_TEST_SST)
list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_sst_test_service/sst_test_service.c"
"${CORE_TEST_DIR}/tfm_sst_test_service/sst_test_service_veneers.c"
)
diff --git a/test/test_services/tfm_core_test/tfm_ss_core_test.c b/test/test_services/tfm_core_test/tfm_ss_core_test.c
index 3438d06..a5d7143 100644
--- a/test/test_services/tfm_core_test/tfm_ss_core_test.c
+++ b/test/test_services/tfm_core_test/tfm_ss_core_test.c
@@ -16,18 +16,18 @@
#include "smm_mps2.h"
-static int32_t service_init_done;
+static int32_t partition_init_done;
int32_t core_test_init(void)
{
- service_init_done = 1;
+ partition_init_done = 1;
return TFM_SUCCESS;
}
int32_t spm_core_test_sfn_init_success(void)
{
- if (service_init_done) {
+ if (partition_init_done) {
return CORE_TEST_ERRNO_SUCCESS;
} else {
return CORE_TEST_ERRNO_SERVICE_NOT_INITED;
diff --git a/test/test_services/tfm_core_test/tfm_ss_core_test_veneers.c b/test/test_services/tfm_core_test/tfm_ss_core_test_veneers.c
index 0568411..653f82d 100644
--- a/test/test_services/tfm_core_test/tfm_ss_core_test_veneers.c
+++ b/test/test_services/tfm_core_test/tfm_ss_core_test_veneers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,20 +12,20 @@
int32_t tfm_core_test_sfn_init_success(void)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_CORE_TEST_ID,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_CORE_TEST_ID,
spm_core_test_sfn_init_success,
0, 0, 0, 0);
}
int32_t tfm_core_test_sfn_direct_recursion(int32_t depth)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_CORE_TEST_ID,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_CORE_TEST_ID,
spm_core_test_sfn_direct_recursion,
depth, 0, 0, 0);
}
int32_t tfm_core_test_sfn(int32_t a, int32_t b, int32_t c, int32_t d)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_CORE_TEST_ID, spm_core_test_sfn,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_CORE_TEST_ID, spm_core_test_sfn,
a, b, c, d);
}
diff --git a/test/test_services/tfm_core_test_2/tfm_ss_core_test_2_veneers.c b/test/test_services/tfm_core_test_2/tfm_ss_core_test_2_veneers.c
index ca8d437..6e6fa3c 100644
--- a/test/test_services/tfm_core_test_2/tfm_ss_core_test_2_veneers.c
+++ b/test/test_services/tfm_core_test_2/tfm_ss_core_test_2_veneers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -13,7 +13,7 @@
/* Add functions to the service*/
int32_t tfm_core_test_2_veneer_slave_service(void)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_CORE_TEST_2_ID,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_CORE_TEST_2_ID,
spm_core_test_2_slave_service,
0, 0, 0, 0);
}
@@ -21,7 +21,7 @@
int32_t tfm_core_test_2_sfn_invert(int32_t *res_ptr, uint32_t *in_ptr,
uint32_t *out_ptr, int32_t len)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_CORE_TEST_2_ID,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_CORE_TEST_2_ID,
spm_core_test_2_sfn_invert,
res_ptr, in_ptr, out_ptr, len);
}
diff --git a/test/test_services/tfm_sst_test_service/sst_test_service_veneers.c b/test/test_services/tfm_sst_test_service/sst_test_service_veneers.c
index 802ba59..fc8d66b 100644
--- a/test/test_services/tfm_sst_test_service/sst_test_service_veneers.c
+++ b/test/test_services/tfm_sst_test_service/sst_test_service_veneers.c
@@ -13,7 +13,7 @@
enum tfm_sst_err_t sst_test_service_veneer_setup(void)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_SST_TEST_SERVICE_ID,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_SST_TEST_PARTITION_ID,
sst_test_service_sfn_setup,
0, 0, 0, 0);
}
@@ -23,7 +23,7 @@
uint8_t *buf,
uint32_t buf_size)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_SST_TEST_SERVICE_ID,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_SST_TEST_PARTITION_ID,
sst_test_service_sfn_dummy_encrypt,
app_id, key_uuid, buf, buf_size);
}
@@ -33,14 +33,14 @@
uint8_t *buf,
uint32_t buf_size)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_SST_TEST_SERVICE_ID,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_SST_TEST_PARTITION_ID,
sst_test_service_sfn_dummy_decrypt,
app_id, key_uuid, buf, buf_size);
}
enum tfm_sst_err_t sst_test_service_veneer_clean(void)
{
- TFM_CORE_SERVICE_REQUEST(TFM_SEC_FUNC_SST_TEST_SERVICE_ID,
+ TFM_CORE_SERVICE_REQUEST(TFM_SP_SST_TEST_PARTITION_ID,
sst_test_service_sfn_clean,
0, 0, 0, 0);
}