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