HAL: Rename platform reset function
Align with HAL design document:
- Rename 'tfm_spm_hal_system_reset' to 'tfm_hal_system_reset'.
- Create 'tfm_hal_platform.h' for HAL APIs.
Change-Id: Ic9cc92350aac41ee80a4e474425cdfe23795b69e
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/platform/ext/common/tfm_platform.c b/platform/ext/common/tfm_platform.c
index 5e5ffed..fc9ecb7 100644
--- a/platform/ext/common/tfm_platform.c
+++ b/platform/ext/common/tfm_platform.c
@@ -27,7 +27,7 @@
return TFM_PLAT_ERR_SUCCESS;
}
-__WEAK void tfm_spm_hal_system_reset(void)
+__WEAK void tfm_hal_system_reset(void)
{
NVIC_SystemReset();
}
diff --git a/platform/ext/target/musca_b1/spm_hal.c b/platform/ext/target/musca_b1/spm_hal.c
index 44cd49c..034eb86 100644
--- a/platform/ext/target/musca_b1/spm_hal.c
+++ b/platform/ext/target/musca_b1/spm_hal.c
@@ -15,6 +15,7 @@
#include "region_defs.h"
#include "utilities.h"
#include "region.h"
+#include "tfm_hal_platform.h"
/* Import MPC driver */
extern ARM_DRIVER_MPC Driver_EFLASH0_MPC;
@@ -267,7 +268,7 @@
ERROR_MSG("Oops... NMI fault!!!");
/* Trigger warm-reset */
- tfm_spm_hal_system_reset();
+ tfm_hal_system_reset();
}
uint32_t tfm_spm_hal_get_ns_VTOR(void)
@@ -337,7 +338,7 @@
return system_reset_cfg();
}
-void tfm_spm_hal_system_reset(void)
+void tfm_hal_system_reset(void)
{
__disable_irq();
mpc_revert_non_secure_to_secure_cfg();
diff --git a/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c b/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c
index 1786821..a13e5f8 100644
--- a/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c
+++ b/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -40,7 +40,7 @@
return TFM_PLAT_ERR_SUCCESS;
}
-__WEAK void tfm_spm_hal_system_reset(void)
+__WEAK void tfm_hal_system_reset(void)
{
NVIC_SystemReset();
}
diff --git a/platform/include/tfm_hal_platform.h b/platform/include/tfm_hal_platform.h
new file mode 100644
index 0000000..bf61a84
--- /dev/null
+++ b/platform/include/tfm_hal_platform.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_HAL_PLATFORM_H__
+#define __TFM_HAL_PLATFORM_H__
+
+/**
+ * \brief System reset
+ */
+void tfm_hal_system_reset(void);
+
+#endif /* __TFM_HAL_PLATFORM_H__ */
diff --git a/platform/include/tfm_spm_hal.h b/platform/include/tfm_spm_hal.h
index f96dd57..82d297a 100644
--- a/platform/include/tfm_spm_hal.h
+++ b/platform/include/tfm_spm_hal.h
@@ -164,11 +164,6 @@
enum tfm_plat_err_t tfm_spm_hal_system_reset_cfg(void);
/**
- * \brief System reset
- */
-void tfm_spm_hal_system_reset(void);
-
-/**
* \brief Configures all external interrupts to target the
* NS state, apart for the ones associated to secure
* peripherals (plus MPC and PPC)
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index 2fb51fc..4d3ace0 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -37,6 +37,7 @@
#include "secure_fw/partitions/tfm_service_list.inc"
#include "tfm_spm_db_ipc.inc"
+#include "tfm_hal_platform.h"
/* Extern service variable */
extern struct tfm_spm_service_t service[];
@@ -1482,7 +1483,7 @@
* PSA FF recommends that the SPM causes the system to restart when a secure
* partition panics.
*/
- tfm_spm_hal_system_reset();
+ tfm_hal_system_reset();
}
/**
diff --git a/secure_fw/spm/common/runtime/utilities.c b/secure_fw/spm/common/runtime/utilities.c
index c601311..2aab6d9 100644
--- a/secure_fw/spm/common/runtime/utilities.c
+++ b/secure_fw/spm/common/runtime/utilities.c
@@ -6,7 +6,7 @@
*/
#include <inttypes.h>
#include "utilities.h"
-#include "tfm_spm_hal.h"
+#include "tfm_hal_platform.h"
void tfm_core_panic(void)
{
@@ -18,7 +18,7 @@
* those error codes back to the calling task or to use its own
* functionality for terminating an execution context.
*/
- tfm_spm_hal_system_reset();
+ tfm_hal_system_reset();
}
bool tfm_is_one_bit_set(uint32_t n)