mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-05-03 01:06:13 +00:00
refactor: panic after calling psci_power_down_wfi()
This function doesn't return and its callers that don't return either rely on this. Drop the dead attribute and add a panic() after it to make this expectation explicit. Calling `wfi` in the powerdown sequence is terminal so even if the function was made to return, there would be no functional change. This is useful for a following patch that makes psci_power_down_wfi() return. Change-Id: I62ca1ee058b1eaeb046966c795081e01bf45a2eb Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
This commit is contained in:
parent
cc94e71b3a
commit
2bd3b39767
10 changed files with 33 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2019, Arm Limited and Contributors. All rights reserved.
|
* Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
|
||||||
* Copyright (c) 2023, NVIDIA Corporation. All rights reserved.
|
* Copyright (c) 2023, NVIDIA Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
@ -376,7 +376,7 @@ int psci_features(unsigned int psci_fid);
|
||||||
#if PSCI_OS_INIT_MODE
|
#if PSCI_OS_INIT_MODE
|
||||||
int psci_set_suspend_mode(unsigned int mode);
|
int psci_set_suspend_mode(unsigned int mode);
|
||||||
#endif
|
#endif
|
||||||
void __dead2 psci_power_down_wfi(void);
|
void psci_power_down_wfi(void);
|
||||||
void psci_arch_setup(void);
|
void psci_arch_setup(void);
|
||||||
|
|
||||||
#endif /*__ASSEMBLER__*/
|
#endif /*__ASSEMBLER__*/
|
||||||
|
|
|
@ -49,6 +49,8 @@ static void __dead2 sunxi_system_off(void)
|
||||||
sunxi_cpu_power_off_others();
|
sunxi_cpu_power_off_others();
|
||||||
sunxi_cpu_power_off_self();
|
sunxi_cpu_power_off_self();
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __dead2 sunxi_system_reset(void)
|
static void __dead2 sunxi_system_reset(void)
|
||||||
|
|
|
@ -108,6 +108,8 @@ static void __dead2 sunxi_system_off(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __dead2 sunxi_system_reset(void)
|
static void __dead2 sunxi_system_reset(void)
|
||||||
|
@ -123,6 +125,8 @@ static void __dead2 sunxi_system_reset(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sunxi_system_reset2(int is_vendor, int reset_type, u_register_t cookie)
|
static int sunxi_system_reset2(int is_vendor, int reset_type, u_register_t cookie)
|
||||||
|
@ -142,6 +146,8 @@ static int sunxi_system_reset2(int is_vendor, int reset_type, u_register_t cooki
|
||||||
}
|
}
|
||||||
|
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Should not reach here.
|
* Should not reach here.
|
||||||
|
|
|
@ -78,7 +78,7 @@ struct plat_pm_pwr_ctrl {
|
||||||
psci_power_state_t *req_state);
|
psci_power_state_t *req_state);
|
||||||
void (*get_sys_suspend_power_state)(
|
void (*get_sys_suspend_power_state)(
|
||||||
psci_power_state_t *req_state);
|
psci_power_state_t *req_state);
|
||||||
__dead2 void (*pwr_domain_pwr_down_wfi)(
|
void (*pwr_domain_pwr_down_wfi)(
|
||||||
const psci_power_state_t *req_state);
|
const psci_power_state_t *req_state);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ static void get_sys_suspend_power_state(psci_power_state_t *req_state)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void __dead2 pwr_domain_pwr_down_wfi(const psci_power_state_t *req_state)
|
static void pwr_domain_pwr_down_wfi(const psci_power_state_t *req_state)
|
||||||
{
|
{
|
||||||
unsigned int cpu = plat_my_core_pos();
|
unsigned int cpu = plat_my_core_pos();
|
||||||
int ret = MTK_CPUPM_E_NOT_SUPPORT;
|
int ret = MTK_CPUPM_E_NOT_SUPPORT;
|
||||||
|
@ -382,6 +382,8 @@ static void __dead2 pwr_domain_pwr_down_wfi(const psci_power_state_t *req_state)
|
||||||
plat_panic_handler();
|
plat_panic_handler();
|
||||||
else
|
else
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pm_smp_init(unsigned int cpu_id, uintptr_t entry_point)
|
static void pm_smp_init(unsigned int cpu_id, uintptr_t entry_point)
|
||||||
|
|
|
@ -217,6 +217,7 @@ __dead2 void qti_domain_power_down_wfi(const psci_power_state_t *target_state)
|
||||||
/* For now just do WFI - add any target specific handling if needed */
|
/* For now just do WFI - add any target specific handling if needed */
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
/* We should never reach here */
|
/* We should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
static __dead2 void assert_ps_hold(void)
|
static __dead2 void assert_ps_hold(void)
|
||||||
|
|
|
@ -118,11 +118,15 @@ void __dead2 rockchip_soc_cores_pd_pwr_dn_wfi(
|
||||||
const psci_power_state_t *target_state)
|
const psci_power_state_t *target_state)
|
||||||
{
|
{
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __dead2 rockchip_soc_sys_pd_pwr_dn_wfi(void)
|
void __dead2 rockchip_soc_sys_pd_pwr_dn_wfi(void)
|
||||||
{
|
{
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
|
@ -1000,6 +1000,8 @@ void __dead2 rockchip_soc_soft_reset(void)
|
||||||
* so we do not hope the core to execute valid codes.
|
* so we do not hope the core to execute valid codes.
|
||||||
*/
|
*/
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __dead2 rockchip_soc_system_off(void)
|
void __dead2 rockchip_soc_system_off(void)
|
||||||
|
@ -1025,6 +1027,8 @@ void __dead2 rockchip_soc_system_off(void)
|
||||||
* so we do not hope the core to execute valid codes.
|
* so we do not hope the core to execute valid codes.
|
||||||
*/
|
*/
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
void rockchip_plat_mmu_el3(void)
|
void rockchip_plat_mmu_el3(void)
|
||||||
|
|
|
@ -619,6 +619,8 @@ void __dead2 rockchip_soc_sys_pd_pwr_dn_wfi(void)
|
||||||
|
|
||||||
/* should never reach here */
|
/* should never reach here */
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
int rockchip_soc_sys_pwr_dm_suspend(void)
|
int rockchip_soc_sys_pwr_dm_suspend(void)
|
||||||
|
|
|
@ -1319,12 +1319,16 @@ void __dead2 rockchip_soc_cores_pd_pwr_dn_wfi(const
|
||||||
psci_power_state_t *target_state)
|
psci_power_state_t *target_state)
|
||||||
{
|
{
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __dead2 rockchip_soc_sys_pd_pwr_dn_wfi(void)
|
void __dead2 rockchip_soc_sys_pd_pwr_dn_wfi(void)
|
||||||
{
|
{
|
||||||
cpus_pd_req_enter_wfi();
|
cpus_pd_req_enter_wfi();
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __dead2 rockchip_soc_soft_reset(void)
|
void __dead2 rockchip_soc_soft_reset(void)
|
||||||
|
@ -1352,6 +1356,8 @@ void __dead2 rockchip_soc_soft_reset(void)
|
||||||
* so we do not hope the core to execute valid codes.
|
* so we do not hope the core to execute valid codes.
|
||||||
*/
|
*/
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __dead2 rockchip_soc_system_off(void)
|
void __dead2 rockchip_soc_system_off(void)
|
||||||
|
@ -1373,6 +1379,8 @@ void __dead2 rockchip_soc_system_off(void)
|
||||||
* so we do not hope the core to execute valid codes.
|
* so we do not hope the core to execute valid codes.
|
||||||
*/
|
*/
|
||||||
psci_power_down_wfi();
|
psci_power_down_wfi();
|
||||||
|
/* should never reach here */
|
||||||
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rockchip_pmu_pd_init(void)
|
static void rockchip_pmu_pd_init(void)
|
||||||
|
|
Loading…
Add table
Reference in a new issue