mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-26 23:04:50 +00:00
feat(arm): convert arm platforms to expect a wakeup
Newer cores in upcoming platforms may refuse to power down. The PSCI library is already prepared for this so convert platform code to also allow this. This is simple - drop the `wfi` + panic and let common code deal with the fallout. The end result will be the same (sans the message) except the platform will have fewer responsibilities. The only exception is for cores being signalled to power off gracefully ahead of system reset. That path must also be terminal so replace the end with the same psci_pwrdown_cpu_end() to behave the same as the generic implementation. It will handle wakeups and panic, hoping that the system gets reset from under it. The dmb is upgraded to a dsb so no functional change. Change-Id: I381f96bec8532bda6ccdac65de57971aac42e7e8 Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
This commit is contained in:
parent
45c7328c0b
commit
da305ec75d
7 changed files with 19 additions and 43 deletions
drivers/arm/css/scp
include
plat/arm
|
@ -298,7 +298,7 @@ static void css_raise_pwr_down_interrupt(u_register_t mpidr)
|
|||
#endif
|
||||
}
|
||||
|
||||
void __dead2 css_scp_system_off(int state)
|
||||
void css_scp_system_off(int state)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -340,15 +340,12 @@ void __dead2 css_scp_system_off(int state)
|
|||
|
||||
/* Powerdown of primary core */
|
||||
psci_pwrdown_cpu_start(PLAT_MAX_PWR_LVL);
|
||||
wfi();
|
||||
ERROR("CSS set power state: operation not handled.\n");
|
||||
panic();
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function to shutdown the system via SCMI.
|
||||
*/
|
||||
void __dead2 css_scp_sys_shutdown(void)
|
||||
void css_scp_sys_shutdown(void)
|
||||
{
|
||||
css_scp_system_off(SCMI_SYS_PWR_SHUTDOWN);
|
||||
}
|
||||
|
@ -356,7 +353,7 @@ void __dead2 css_scp_sys_shutdown(void)
|
|||
/*
|
||||
* Helper function to reset the system via SCMI.
|
||||
*/
|
||||
void __dead2 css_scp_sys_reboot(void)
|
||||
void css_scp_sys_reboot(void)
|
||||
{
|
||||
css_scp_system_off(SCMI_SYS_PWR_COLD_RESET);
|
||||
}
|
||||
|
@ -472,12 +469,8 @@ int css_system_reset2(int is_vendor, int reset_type, u_register_t cookie)
|
|||
return PSCI_E_INVALID_PARAMS;
|
||||
|
||||
css_scp_system_off(SCMI_SYS_PWR_WARM_RESET);
|
||||
/*
|
||||
* css_scp_system_off cannot return (it is a __dead function),
|
||||
* but css_system_reset2 has to return some value, even in
|
||||
* this case.
|
||||
*/
|
||||
return 0;
|
||||
/* return SUCCESS to finish the powerdown */
|
||||
return PSCI_E_SUCCESS;
|
||||
}
|
||||
|
||||
#if PROGRAMMABLE_RESET_ADDRESS
|
||||
|
|
|
@ -117,7 +117,7 @@ int css_scp_get_power_state(u_register_t mpidr, unsigned int power_level)
|
|||
/*
|
||||
* Helper function to shutdown the system via SCPI.
|
||||
*/
|
||||
void __dead2 css_scp_sys_shutdown(void)
|
||||
void css_scp_sys_shutdown(void)
|
||||
{
|
||||
uint32_t response;
|
||||
|
||||
|
@ -134,15 +134,12 @@ void __dead2 css_scp_sys_shutdown(void)
|
|||
ERROR("CSS System Off: SCP error %u.\n", response);
|
||||
panic();
|
||||
}
|
||||
wfi();
|
||||
ERROR("CSS System Off: operation not handled.\n");
|
||||
panic();
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function to reset the system via SCPI.
|
||||
*/
|
||||
void __dead2 css_scp_sys_reboot(void)
|
||||
void css_scp_sys_reboot(void)
|
||||
{
|
||||
uint32_t response;
|
||||
|
||||
|
@ -159,7 +156,4 @@ void __dead2 css_scp_sys_reboot(void)
|
|||
ERROR("CSS System Reset: SCP error %u.\n", response);
|
||||
panic();
|
||||
}
|
||||
wfi();
|
||||
ERROR("CSS System Reset: operation not handled.\n");
|
||||
panic();
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ void css_scp_suspend(const struct psci_power_state *target_state);
|
|||
void css_scp_off(const struct psci_power_state *target_state);
|
||||
void css_scp_on(u_register_t mpidr);
|
||||
int css_scp_get_power_state(u_register_t mpidr, unsigned int power_level);
|
||||
void __dead2 css_scp_sys_shutdown(void);
|
||||
void __dead2 css_scp_sys_reboot(void);
|
||||
void __dead2 css_scp_system_off(int state);
|
||||
void css_scp_sys_shutdown(void);
|
||||
void css_scp_sys_reboot(void);
|
||||
void css_scp_system_off(int state);
|
||||
|
||||
/* API for SCP Boot Image transfer. Return 0 on success, -1 on error */
|
||||
int css_scp_boot_image_xfer(void *image, unsigned int image_size);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -35,8 +35,8 @@ void css_pwr_domain_off(const psci_power_state_t *target_state);
|
|||
void css_pwr_domain_suspend(const psci_power_state_t *target_state);
|
||||
void css_pwr_domain_suspend_finish(
|
||||
const psci_power_state_t *target_state);
|
||||
void __dead2 css_system_off(void);
|
||||
void __dead2 css_system_reset(void);
|
||||
void css_system_off(void);
|
||||
void css_system_reset(void);
|
||||
void css_cpu_standby(plat_local_state_t cpu_state);
|
||||
void css_get_sys_suspend_power_state(psci_power_state_t *req_state);
|
||||
int css_node_hw_state(u_register_t mpidr, unsigned int power_level);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* platform layer will take care of registering the handlers with PSCI.
|
||||
******************************************************************************/
|
||||
|
||||
static void __dead2 corstone1000_system_reset(void)
|
||||
static void corstone1000_system_reset(void)
|
||||
{
|
||||
|
||||
uint32_t volatile * const watchdog_ctrl_reg = (uint32_t *) SECURE_WATCHDOG_ADDR_CTRL_REG;
|
||||
|
@ -31,9 +31,6 @@ static void __dead2 corstone1000_system_reset(void)
|
|||
|
||||
*(watchdog_val_reg) = SECURE_WATCHDOG_COUNTDOWN_VAL;
|
||||
*watchdog_ctrl_reg = SECURE_WATCHDOG_MASK_ENABLE;
|
||||
while (1) {
|
||||
wfi();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CORSTONE1000_FVP_MULTICORE)
|
||||
|
|
|
@ -295,28 +295,22 @@ static void fvp_pwr_domain_suspend_finish(const psci_power_state_t *target_state
|
|||
/*******************************************************************************
|
||||
* FVP handlers to shutdown/reboot the system
|
||||
******************************************************************************/
|
||||
static void __dead2 fvp_system_off(void)
|
||||
static void fvp_system_off(void)
|
||||
{
|
||||
/* Write the System Configuration Control Register */
|
||||
mmio_write_32(V2M_SYSREGS_BASE + V2M_SYS_CFGCTRL,
|
||||
V2M_CFGCTRL_START |
|
||||
V2M_CFGCTRL_RW |
|
||||
V2M_CFGCTRL_FUNC(V2M_FUNC_SHUTDOWN));
|
||||
wfi();
|
||||
ERROR("FVP System Off: operation not handled.\n");
|
||||
panic();
|
||||
}
|
||||
|
||||
static void __dead2 fvp_system_reset(void)
|
||||
static void fvp_system_reset(void)
|
||||
{
|
||||
/* Write the System Configuration Control Register */
|
||||
mmio_write_32(V2M_SYSREGS_BASE + V2M_SYS_CFGCTRL,
|
||||
V2M_CFGCTRL_START |
|
||||
V2M_CFGCTRL_RW |
|
||||
V2M_CFGCTRL_FUNC(V2M_FUNC_REBOOT));
|
||||
wfi();
|
||||
ERROR("FVP System Reset: operation not handled.\n");
|
||||
panic();
|
||||
}
|
||||
|
||||
static int fvp_node_hw_state(u_register_t target_cpu,
|
||||
|
|
|
@ -217,12 +217,12 @@ void css_pwr_domain_suspend_finish(
|
|||
/*******************************************************************************
|
||||
* Handlers to shutdown/reboot the system
|
||||
******************************************************************************/
|
||||
void __dead2 css_system_off(void)
|
||||
void css_system_off(void)
|
||||
{
|
||||
css_scp_sys_shutdown();
|
||||
}
|
||||
|
||||
void __dead2 css_system_reset(void)
|
||||
void css_system_reset(void)
|
||||
{
|
||||
css_scp_sys_reboot();
|
||||
}
|
||||
|
@ -366,9 +366,7 @@ int css_reboot_interrupt_handler(uint32_t intr_raw, uint32_t flags,
|
|||
|
||||
psci_pwrdown_cpu_start(PLAT_MAX_PWR_LVL);
|
||||
|
||||
dmbsy();
|
||||
|
||||
wfi();
|
||||
psci_pwrdown_cpu_end_terminal();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue