scp: Introduce css_scp_system_off() function

The common implementation of css_scp_sys_shutdown and
css_scp_warm_reset is refactored into a new function,
css_scp_system_off() that allows the desired power state to be
specified.

The css_scp_system_off can be used in the implementation of
SYSTEM_RESET2 for PSCI v1.1.

Change-Id: I161e62354d3d75f969b8436d794335237520a9a4
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
This commit is contained in:
Roberto Vargas 2017-07-31 09:45:10 +01:00
parent 36a8f8fd47
commit ed3c0ef8ac
2 changed files with 17 additions and 34 deletions

View File

@ -259,10 +259,7 @@ int css_scp_get_power_state(u_register_t mpidr, unsigned int power_level)
return HW_OFF;
}
/*
* Helper function to shutdown the system via SCMI.
*/
void __dead2 css_scp_sys_shutdown(void)
void __dead2 css_scp_system_off(int state)
{
int ret;
@ -273,52 +270,37 @@ void __dead2 css_scp_sys_shutdown(void)
plat_arm_gic_cpuif_disable();
/*
* Issue SCMI command for SYSTEM_SHUTDOWN. First issue a graceful
* Issue SCMI command. First issue a graceful
* request and if that fails force the request.
*/
ret = scmi_sys_pwr_state_set(scmi_handle,
SCMI_SYS_PWR_FORCEFUL_REQ,
SCMI_SYS_PWR_SHUTDOWN);
state);
if (ret != SCMI_E_SUCCESS) {
ERROR("SCMI system power domain shutdown return 0x%x unexpected\n",
ret);
ERROR("SCMI system power state set 0x%x returns unexpected 0x%x\n",
state, ret);
panic();
}
wfi();
ERROR("CSS System Shutdown: operation not handled.\n");
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)
{
css_scp_system_off(SCMI_SYS_PWR_SHUTDOWN);
}
/*
* Helper function to reset the system via SCMI.
*/
void __dead2 css_scp_sys_reboot(void)
{
int ret;
/*
* Disable GIC CPU interface to prevent pending interrupt from waking
* up the AP from WFI.
*/
plat_arm_gic_cpuif_disable();
/*
* Issue SCMI command for SYSTEM_REBOOT. First issue a graceful
* request and if that fails force the request.
*/
ret = scmi_sys_pwr_state_set(scmi_handle,
SCMI_SYS_PWR_FORCEFUL_REQ,
SCMI_SYS_PWR_COLD_RESET);
if (ret != SCMI_E_SUCCESS) {
ERROR("SCMI system power domain reset return 0x%x unexpected\n",
ret);
panic();
}
wfi();
ERROR("CSS System Reset: operation not handled.\n");
panic();
css_scp_system_off(SCMI_SYS_PWR_COLD_RESET);
}
scmi_channel_plat_info_t plat_css_scmi_plat_info = {

View File

@ -21,6 +21,7 @@ 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);
/* 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);