Commit ed3c0ef8 authored by Roberto Vargas's avatar Roberto Vargas
Browse files

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: default avatarRoberto Vargas <roberto.vargas@arm.com>
parent 36a8f8fd
...@@ -259,10 +259,7 @@ int css_scp_get_power_state(u_register_t mpidr, unsigned int power_level) ...@@ -259,10 +259,7 @@ int css_scp_get_power_state(u_register_t mpidr, unsigned int power_level)
return HW_OFF; return HW_OFF;
} }
/* void __dead2 css_scp_system_off(int state)
* Helper function to shutdown the system via SCMI.
*/
void __dead2 css_scp_sys_shutdown(void)
{ {
int ret; int ret;
...@@ -273,52 +270,37 @@ void __dead2 css_scp_sys_shutdown(void) ...@@ -273,52 +270,37 @@ void __dead2 css_scp_sys_shutdown(void)
plat_arm_gic_cpuif_disable(); 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. * request and if that fails force the request.
*/ */
ret = scmi_sys_pwr_state_set(scmi_handle, ret = scmi_sys_pwr_state_set(scmi_handle,
SCMI_SYS_PWR_FORCEFUL_REQ, SCMI_SYS_PWR_FORCEFUL_REQ,
SCMI_SYS_PWR_SHUTDOWN); state);
if (ret != SCMI_E_SUCCESS) { if (ret != SCMI_E_SUCCESS) {
ERROR("SCMI system power domain shutdown return 0x%x unexpected\n", ERROR("SCMI system power state set 0x%x returns unexpected 0x%x\n",
ret); state, ret);
panic(); panic();
} }
wfi(); wfi();
ERROR("CSS System Shutdown: operation not handled.\n"); ERROR("CSS set power state: operation not handled.\n");
panic(); panic();
} }
/* /*
* Helper function to reset the system via SCMI. * Helper function to shutdown the system via SCMI.
*/ */
void __dead2 css_scp_sys_reboot(void) void __dead2 css_scp_sys_shutdown(void)
{ {
int ret; css_scp_system_off(SCMI_SYS_PWR_SHUTDOWN);
}
/*
* 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 * Helper function to reset the system via SCMI.
* request and if that fails force the request.
*/ */
ret = scmi_sys_pwr_state_set(scmi_handle, void __dead2 css_scp_sys_reboot(void)
SCMI_SYS_PWR_FORCEFUL_REQ, {
SCMI_SYS_PWR_COLD_RESET); css_scp_system_off(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();
} }
scmi_channel_plat_info_t plat_css_scmi_plat_info = { scmi_channel_plat_info_t plat_css_scmi_plat_info = {
......
...@@ -21,6 +21,7 @@ void css_scp_on(u_register_t mpidr); ...@@ -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); 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_shutdown(void);
void __dead2 css_scp_sys_reboot(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 */ /* 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); int css_scp_boot_image_xfer(void *image, unsigned int image_size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment