SPM: Depreciate vague header 'tfm_internal.h'
The name of this file is vague. Depreciate it by:
- Remove tfm_internal.h
- Move function model architecture code into a new create arch.h
- Create tfm_boot_data.h and put boot related function declaration
in it
Change-Id: Ia2ad1b0f95c1137624f99a4e81807bedf9086857
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/secure_fw/spm/cmsis_func/CMakeLists.inc b/secure_fw/spm/cmsis_func/CMakeLists.inc
index 2a43547..5555d61 100644
--- a/secure_fw/spm/cmsis_func/CMakeLists.inc
+++ b/secure_fw/spm/cmsis_func/CMakeLists.inc
@@ -52,6 +52,7 @@
unset(SFW_FUNC_SPM_SRC)
#Setting include directories
+embedded_include_directories(PATH ${SFW_SPM_DIR} ABSOLUTE)
embedded_include_directories(PATH ${SFW_FUNC_SPM_DIR} ABSOLUTE)
embedded_include_directories(PATH ${SFW_FUNC_SPM_DIR}/include ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
diff --git a/secure_fw/spm/cmsis_func/arch.c b/secure_fw/spm/cmsis_func/arch.c
index d142e84..d5d0310 100644
--- a/secure_fw/spm/cmsis_func/arch.c
+++ b/secure_fw/spm/cmsis_func/arch.c
@@ -5,8 +5,8 @@
*
*/
+#include "arch.h"
#include "tfm_secure_api.h"
-#include "tfm_internal.h"
#include "tfm/tfm_spm_services.h"
nsfptr_t ns_entry;
diff --git a/secure_fw/spm/cmsis_func/arch.h b/secure_fw/spm/cmsis_func/arch.h
new file mode 100644
index 0000000..964ddf7
--- /dev/null
+++ b/secure_fw/spm/cmsis_func/arch.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __ARCH_H__
+#define __ARCH_H__
+
+/*
+ * This function pointer is meant to only hold non secure function pointers.
+ * It will be turned into a non-secure one (LSB cleared) before being called
+ * whatever happens anyway (unless cast to another function pointer type).
+ * Registers will be cleared before branching so that no information leaks
+ * from secure to non-secure world.
+ */
+typedef void (*nsfptr_t) (void) __attribute__((cmse_nonsecure_call));
+
+extern nsfptr_t ns_entry;
+
+/**
+ * \brief Jump to non-secure code.
+ */
+void jump_to_ns_code(void);
+
+#endif /* __ARCH_H__ */
diff --git a/secure_fw/spm/cmsis_func/main.c b/secure_fw/spm/cmsis_func/main.c
index e070515..e785587 100644
--- a/secure_fw/spm/cmsis_func/main.c
+++ b/secure_fw/spm/cmsis_func/main.c
@@ -5,11 +5,12 @@
*
*/
+#include "arch.h"
+#include "common/tfm_boot_data.h"
#include "log/tfm_log.h"
#include "region.h"
#include "spm_func.h"
#include "tfm_hal_platform.h"
-#include "tfm_internal.h"
#include "tfm_irq_list.h"
#include "tfm_nspm.h"
#include "tfm_spm_hal.h"
diff --git a/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c b/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c
index 98d776b..e7fb2db 100644
--- a/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c
+++ b/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c
@@ -13,11 +13,11 @@
#include "spm_func.h"
#include "spm_partition_defs.h"
#include "tfm_api.h"
-#include "tfm_internal.h"
#include "tfm_memory_utils.h"
#include "tfm_arch.h"
#include "tfm_peripherals_def.h"
#include "tfm_irq_list.h"
+#include "common/tfm_boot_data.h"
#ifdef PLATFORM_SVC_HANDLERS
extern int32_t platform_svc_handlers(tfm_svc_number_t svc_num,
diff --git a/secure_fw/spm/cmsis_func/tfm_nspm_func.c b/secure_fw/spm/cmsis_func/tfm_nspm_func.c
index 73eca4c..ad4a17e 100644
--- a/secure_fw/spm/cmsis_func/tfm_nspm_func.c
+++ b/secure_fw/spm/cmsis_func/tfm_nspm_func.c
@@ -11,9 +11,9 @@
#include "tfm_spm_hal.h"
#include "tfm_arch.h"
#include "tfm_api.h"
-#include "tfm_internal.h"
#include "tfm_nspm.h"
#include "ext/tz_context.h"
+#include "arch.h"
#ifndef TFM_MAX_NS_THREAD_COUNT
#define TFM_MAX_NS_THREAD_COUNT 8
diff --git a/secure_fw/spm/cmsis_psa/CMakeLists.inc b/secure_fw/spm/cmsis_psa/CMakeLists.inc
index fbd83cc..c40f55e 100644
--- a/secure_fw/spm/cmsis_psa/CMakeLists.inc
+++ b/secure_fw/spm/cmsis_psa/CMakeLists.inc
@@ -65,6 +65,7 @@
unset(SFW_IPC_SPM_SRC)
#Setting include directories
+embedded_include_directories(PATH ${SFW_SPM_DIR} ABSOLUTE)
embedded_include_directories(PATH ${SFW_IPC_SPM_DIR} ABSOLUTE)
embedded_include_directories(PATH ${SFW_IPC_SPM_DIR}/include ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
diff --git a/secure_fw/spm/cmsis_psa/include/spm_ipc.h b/secure_fw/spm/cmsis_psa/include/spm_ipc.h
index faa4827..9eeef45 100644
--- a/secure_fw/spm/cmsis_psa/include/spm_ipc.h
+++ b/secure_fw/spm/cmsis_psa/include/spm_ipc.h
@@ -683,4 +683,9 @@
*/
struct tfm_conn_handle_t *tfm_spm_to_handle_instance(psa_handle_t user_handle);
+/**
+ * \brief Move to handler mode by a SVC for specific purpose
+ */
+void tfm_core_handler_mode(void);
+
#endif /* __SPM_IPC_H__ */
diff --git a/secure_fw/spm/cmsis_psa/main.c b/secure_fw/spm/cmsis_psa/main.c
index ba7c869..7fe66e6 100644
--- a/secure_fw/spm/cmsis_psa/main.c
+++ b/secure_fw/spm/cmsis_psa/main.c
@@ -5,11 +5,11 @@
*
*/
+#include "common/tfm_boot_data.h"
#include "log/tfm_log.h"
#include "region.h"
#include "spm_ipc.h"
#include "tfm_hal_platform.h"
-#include "tfm_internal.h"
#include "tfm_irq_list.h"
#include "tfm_nspm.h"
#include "tfm_spm_hal.h"
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index 4d3ace0..c823812 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -24,7 +24,6 @@
#include "tfm_core_utils.h"
#include "spm_psa_client_call.h"
#include "tfm_rpc.h"
-#include "tfm_internal.h"
#include "tfm_core_trustzone.h"
#include "tfm_core_mem_check.h"
#include "tfm_list.h"
diff --git a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
index 8583daf..8a62c62 100644
--- a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
+++ b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
@@ -11,10 +11,10 @@
#include "tfm_api.h"
#include "tfm_arch.h"
#include "tfm_core_trustzone.h"
-#include "tfm_internal.h"
#include "tfm_svcalls.h"
#include "utilities.h"
#include "tfm/tfm_core_svc.h"
+#include "common/tfm_boot_data.h"
/* The section names come from the scatter file */
REGION_DECLARE(Image$$, TFM_UNPRIV_CODE, $$RO$$Base);
diff --git a/secure_fw/spm/cmsis_psa/tfm_multi_core.c b/secure_fw/spm/cmsis_psa/tfm_multi_core.c
index f8ef7d6..c40b415 100644
--- a/secure_fw/spm/cmsis_psa/tfm_multi_core.c
+++ b/secure_fw/spm/cmsis_psa/tfm_multi_core.c
@@ -6,7 +6,6 @@
#include "tfm_spm_hal.h"
#include "psa/client.h"
-#include "tfm_internal.h"
#include "tfm_nspm.h"
#include "tfm_spe_mailbox.h"
#include "utilities.h"
diff --git a/secure_fw/spm/cmsis_psa/tfm_multi_core_mem_check.c b/secure_fw/spm/cmsis_psa/tfm_multi_core_mem_check.c
index 1773772..fd21e58 100644
--- a/secure_fw/spm/cmsis_psa/tfm_multi_core_mem_check.c
+++ b/secure_fw/spm/cmsis_psa/tfm_multi_core_mem_check.c
@@ -9,7 +9,6 @@
#include "tfm_spm_hal.h"
#include "region_defs.h"
#include "spm_ipc.h"
-#include "tfm_internal.h"
#include "tfm_multi_core.h"
#include "tfm_secure_api.h"
#include "utilities.h"
diff --git a/secure_fw/spm/cmsis_psa/tfm_nspm_ipc.c b/secure_fw/spm/cmsis_psa/tfm_nspm_ipc.c
index cc6449e..acc8140 100644
--- a/secure_fw/spm/cmsis_psa/tfm_nspm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/tfm_nspm_ipc.c
@@ -10,7 +10,6 @@
#include "psa/error.h"
#include "tfm_nspm.h"
#include "utilities.h"
-#include "tfm_internal.h"
#include "ext/tz_context.h"
#include "log/tfm_assert.h"
#include "log/tfm_log.h"
diff --git a/secure_fw/spm/common/init/tfm_boot_data.c b/secure_fw/spm/common/init/tfm_boot_data.c
index c4b1a29..901d43e 100644
--- a/secure_fw/spm/common/init/tfm_boot_data.c
+++ b/secure_fw/spm/common/init/tfm_boot_data.c
@@ -9,7 +9,6 @@
#include "tfm_boot_status.h"
#include "region_defs.h"
#include "tfm_memory_utils.h"
-#include "tfm_internal.h"
#include "tfm_api.h"
#include "tfm_core_utils.h"
#include "spm_partition_defs.h"
diff --git a/secure_fw/spm/common/tfm_boot_data.h b/secure_fw/spm/common/tfm_boot_data.h
new file mode 100644
index 0000000..3df9fe6
--- /dev/null
+++ b/secure_fw/spm/common/tfm_boot_data.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_BOOT_DATA_H__
+#define __TFM_BOOT_DATA_H__
+
+#include <stdint.h>
+
+/**
+ * \brief Retrieve secure partition related data from shared memory area, which
+ * stores shared data between bootloader and runtime firmware.
+ *
+ * \param[in] args Pointer to stack frame, which carries input parameters.
+ */
+void tfm_core_get_boot_data_handler(uint32_t args[]);
+
+/**
+ * \brief Validate the content of shared memory area, which stores the shared
+ * data between bootloader and runtime firmware.
+ */
+void tfm_core_validate_boot_data(void);
+
+#endif /* __TFM_BOOT_DATA_H__ */
diff --git a/secure_fw/spm/include/tfm_internal.h b/secure_fw/spm/include/tfm_internal.h
deleted file mode 100644
index 36f87ac..0000000
--- a/secure_fw/spm/include/tfm_internal.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_INTERNAL_H__
-#define __TFM_INTERNAL_H__
-
-#include "tfm_arch.h"
-
-#ifndef TFM_PSA_API
-/*
- * This function pointer is meant to only hold non secure function pointers.
- * It will be turned into a non-secure one (LSB cleared) before being called
- * whatever happens anyway (unless cast to another function pointer type).
- * Registers will be cleared before branching so that no information leaks
- * from secure to non-secure world.
- */
-typedef void (*nsfptr_t) (void) __attribute__((cmse_nonsecure_call));
-
-extern nsfptr_t ns_entry;
-
-/**
- * \brief Jumps to non-secure code.
- */
-void jump_to_ns_code(void);
-#else /* !defined(TFM_PSA_API) */
-
-/**
- * \brief Move to handler mode by a SVC for specific purpose
- */
-void tfm_core_handler_mode(void);
-#endif /* !defined(TFM_PSA_API) */
-
-/**
- * \brief Retrieve secure partition related data from shared memory area, which
- * stores shared data between bootloader and runtime firmware.
- *
- * \param[in] args Pointer to stack frame, which carries input parameters.
- */
-void tfm_core_get_boot_data_handler(uint32_t args[]);
-
-/**
- * \brief Validate the content of shared memory area, which stores the shared
- * data between bootloader and runtime firmware.
- */
-void tfm_core_validate_boot_data(void);
-
-#endif /* __TFM_INTERNAL_H__ */
diff --git a/secure_fw/spm/include/tfm_irq_list.h b/secure_fw/spm/include/tfm_irq_list.h
index fbad8f4..c8b842f 100644
--- a/secure_fw/spm/include/tfm_irq_list.h
+++ b/secure_fw/spm/include/tfm_irq_list.h
@@ -8,6 +8,7 @@
#ifndef __TFM_IRQ_LIST_H__
#define __TFM_IRQ_LIST_H__
+#include "tfm_hal_device_header.h"
#include "psa/service.h"
#define TFM_DEFAULT_SECURE_IRQ_PRIOTITY 128