Ken Liu | 91d44da | 2018-09-20 22:42:31 +0800 | [diff] [blame] | 1 | /* |
Summer Qin | 5fdcf63 | 2020-06-22 16:49:24 +0800 | [diff] [blame^] | 2 | * Copyright (c) 2018-2020, Arm Limited. All rights reserved. |
Ken Liu | 91d44da | 2018-09-20 22:42:31 +0800 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | #include <inttypes.h> |
Summer Qin | 5fdcf63 | 2020-06-22 16:49:24 +0800 | [diff] [blame^] | 8 | #include "utilities.h" |
Edison Ai | 93dabfd | 2019-12-03 13:44:45 +0800 | [diff] [blame] | 9 | #include "tfm_spm_hal.h" |
Ken Liu | 91d44da | 2018-09-20 22:42:31 +0800 | [diff] [blame] | 10 | |
Edison Ai | 9059ea0 | 2019-11-28 13:46:14 +0800 | [diff] [blame] | 11 | void tfm_core_panic(void) |
Ken Liu | 91d44da | 2018-09-20 22:42:31 +0800 | [diff] [blame] | 12 | { |
Edison Ai | 93dabfd | 2019-12-03 13:44:45 +0800 | [diff] [blame] | 13 | /* |
| 14 | * FixMe: In the first stage, the SPM will restart the entire system when a |
| 15 | * programmer error is detected in either the SPE or NSPE. |
| 16 | * In the next stage, the specified error codes are also sent to any NSPE |
| 17 | * management firmware. The NSPE management firmware can then decide to pass |
| 18 | * those error codes back to the calling task or to use its own |
| 19 | * functionality for terminating an execution context. |
| 20 | */ |
| 21 | tfm_spm_hal_system_reset(); |
Ken Liu | 91d44da | 2018-09-20 22:42:31 +0800 | [diff] [blame] | 22 | } |
Summer Qin | 5fdcf63 | 2020-06-22 16:49:24 +0800 | [diff] [blame^] | 23 | |
| 24 | bool tfm_is_one_bit_set(uint32_t n) |
| 25 | { |
| 26 | return ((n && !(n & (n-1))) ? true : false); |
| 27 | } |