SPM: Sort out tfm_secure_api.c file
- Rename 'tfm_utils.h' to 'utilities.h'.
- Rename 'tfm_spm_services_api.h'to 'tfm_spm_services.h'.
- Move 'tfm_secure_api.c' from spm/runtime to spm/model_func and
sort out the content
Change-Id: Ie8831e2b1430eab6a2edc9b6c0487ef14f2fafc6
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/secure_fw/spm/runtime/utilities.c b/secure_fw/spm/runtime/utilities.c
new file mode 100644
index 0000000..c601311
--- /dev/null
+++ b/secure_fw/spm/runtime/utilities.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+#include <inttypes.h>
+#include "utilities.h"
+#include "tfm_spm_hal.h"
+
+void tfm_core_panic(void)
+{
+ /*
+ * FixMe: In the first stage, the SPM will restart the entire system when a
+ * programmer error is detected in either the SPE or NSPE.
+ * In the next stage, the specified error codes are also sent to any NSPE
+ * management firmware. The NSPE management firmware can then decide to pass
+ * those error codes back to the calling task or to use its own
+ * functionality for terminating an execution context.
+ */
+ tfm_spm_hal_system_reset();
+}
+
+bool tfm_is_one_bit_set(uint32_t n)
+{
+ return ((n && !(n & (n-1))) ? true : false);
+}