summaryrefslogtreecommitdiff
path: root/lib/psci
diff options
context:
space:
mode:
authorldts <jorge.ramirez.ortiz@gmail.com>2018-10-11 08:40:32 +0200
committerldts <jorge.ramirez.ortiz@gmail.com>2018-10-11 12:57:49 +0200
commita4065abdfb28147bede85d1dac983f01ff6a0247 (patch)
treeb691a3d6e0b0d5417ea3d2b93e0936396319dd4a /lib/psci
parent3d3619c6dfcfd79685b92eb1190fbb1968a7d217 (diff)
psci: platform control of SYSTEM_SUSPEND entry
Some platforms can only resume from system suspend from the boot CPU, hence they should only enter that state from that same core. The following commit presents an interface that allows the platform to reject system suspend entry near its very last stage (last CPU).
Diffstat (limited to 'lib/psci')
-rw-r--r--lib/psci/psci_main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/psci/psci_main.c b/lib/psci/psci_main.c
index fd822bcf..b4a25fb0 100644
--- a/lib/psci/psci_main.c
+++ b/lib/psci/psci_main.c
@@ -167,8 +167,14 @@ int psci_system_suspend(uintptr_t entrypoint, u_register_t context_id)
/* Query the psci_power_state for system suspend */
psci_query_sys_suspend_pwrstate(&state_info);
+ /*
+ * Check if platform allows suspend to Highest power level
+ * (System level)
+ */
+ if (psci_find_target_suspend_lvl(&state_info) < PLAT_MAX_PWR_LVL)
+ return PSCI_E_DENIED;
+
/* Ensure that the psci_power_state makes sense */
- assert(psci_find_target_suspend_lvl(&state_info) == PLAT_MAX_PWR_LVL);
assert(psci_validate_suspend_req(&state_info, PSTATE_TYPE_POWERDOWN)
== PSCI_E_SUCCESS);
assert(is_local_state_off(