Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 1 | /* |
Gergely Korcsák | 9710269 | 2024-02-09 15:23:33 +0100 | [diff] [blame^] | 2 | * Copyright (c) 2021-2024, Arm Limited. All rights reserved. |
Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
Gergely Korcsák | 9710269 | 2024-02-09 15:23:33 +0100 | [diff] [blame^] | 8 | #include "tfm_hal_device_header.h" |
Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 9 | #include "fih.h" |
Kevin Peng | aaf994d | 2021-07-20 17:38:18 +0800 | [diff] [blame] | 10 | #include "psa/service.h" |
Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 11 | |
| 12 | void tfm_idle_thread(void) |
| 13 | { |
| 14 | while (1) { |
Kevin Peng | aaf994d | 2021-07-20 17:38:18 +0800 | [diff] [blame] | 15 | /* |
| 16 | * There could be other Partitions becoming RUNABLE after wake up. |
| 17 | * This is a dummy psa_wait to let SPM check possible scheduling. |
| 18 | * It does not expect any signals. |
| 19 | */ |
| 20 | if (psa_wait(PSA_WAIT_ANY, PSA_POLL) == 0) { |
chesun01 | 8c29224 | 2023-03-02 11:25:49 +0800 | [diff] [blame] | 21 | __DSB(); |
Kevin Peng | aaf994d | 2021-07-20 17:38:18 +0800 | [diff] [blame] | 22 | __WFI(); |
| 23 | } |
Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | #ifdef TFM_FIH_PROFILE_ON |
| 27 | fih_delay(); |
| 28 | |
| 29 | while (1) { |
Kevin Peng | aaf994d | 2021-07-20 17:38:18 +0800 | [diff] [blame] | 30 | /* |
| 31 | * There could be other Partitions becoming RUNABLE after wake up. |
| 32 | * This is a dummy psa_wait to let SPM check possible scheduling. |
| 33 | * It does not expect any signals. |
| 34 | */ |
| 35 | if (psa_wait(PSA_WAIT_ANY, PSA_POLL) == 0) { |
chesun01 | 8c29224 | 2023-03-02 11:25:49 +0800 | [diff] [blame] | 36 | __DSB(); |
Kevin Peng | aaf994d | 2021-07-20 17:38:18 +0800 | [diff] [blame] | 37 | __WFI(); |
| 38 | } |
Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 39 | } |
| 40 | #endif |
| 41 | } |