blob: 38ae349822a97af245ae610891b7d432ebcd8c24 [file] [log] [blame]
Kevin Peng33d03942021-06-08 11:28:41 +08001/*
Gergely Korcsák97102692024-02-09 15:23:33 +01002 * Copyright (c) 2021-2024, Arm Limited. All rights reserved.
Kevin Peng33d03942021-06-08 11:28:41 +08003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
Gergely Korcsák97102692024-02-09 15:23:33 +01008#include "tfm_hal_device_header.h"
Kevin Peng33d03942021-06-08 11:28:41 +08009#include "fih.h"
Kevin Pengaaf994d2021-07-20 17:38:18 +080010#include "psa/service.h"
Kevin Peng33d03942021-06-08 11:28:41 +080011
12void tfm_idle_thread(void)
13{
14 while (1) {
Kevin Pengaaf994d2021-07-20 17:38:18 +080015 /*
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) {
chesun018c292242023-03-02 11:25:49 +080021 __DSB();
Kevin Pengaaf994d2021-07-20 17:38:18 +080022 __WFI();
23 }
Kevin Peng33d03942021-06-08 11:28:41 +080024 }
25
26#ifdef TFM_FIH_PROFILE_ON
27 fih_delay();
28
29 while (1) {
Kevin Pengaaf994d2021-07-20 17:38:18 +080030 /*
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) {
chesun018c292242023-03-02 11:25:49 +080036 __DSB();
Kevin Pengaaf994d2021-07-20 17:38:18 +080037 __WFI();
38 }
Kevin Peng33d03942021-06-08 11:28:41 +080039 }
40#endif
41}