From d118f9f864267670fb9cb1790d7d6dd620e0f6ed Mon Sep 17 00:00:00 2001 From: Vikram Kanigiri Date: Fri, 21 Mar 2014 11:57:10 +0000 Subject: Add standby state support in PSCI cpu_suspend api This patch adds support in the generic PSCI implementation to call a platform specific function to enter a standby state using an example implementation in ARM FVP port Fixes ARM-software/tf-issues#94 Change-Id: Ic1263fcf25f28e09162ad29dca954125f9aa8cc9 --- services/std_svc/psci/psci_main.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'services/std_svc/psci/psci_main.c') diff --git a/services/std_svc/psci/psci_main.c b/services/std_svc/psci/psci_main.c index 6bf05830..2d61ec08 100644 --- a/services/std_svc/psci/psci_main.c +++ b/services/std_svc/psci/psci_main.c @@ -85,31 +85,28 @@ int psci_cpu_suspend(unsigned int power_state, unsigned long mpidr; unsigned int target_afflvl, pstate_type; - /* TODO: Standby states are not supported at the moment */ - pstate_type = psci_get_pstate_type(power_state); - if (pstate_type == 0) { - rc = PSCI_E_INVALID_PARAMS; - goto exit; - } - /* Sanity check the requested state */ target_afflvl = psci_get_pstate_afflvl(power_state); - if (target_afflvl > MPIDR_MAX_AFFLVL) { - rc = PSCI_E_INVALID_PARAMS; - goto exit; - } + if (target_afflvl > MPIDR_MAX_AFFLVL) + return PSCI_E_INVALID_PARAMS; - mpidr = read_mpidr(); - rc = psci_afflvl_suspend(mpidr, - entrypoint, - context_id, - power_state, - MPIDR_AFFLVL0, - target_afflvl); + pstate_type = psci_get_pstate_type(power_state); + if (pstate_type == PSTATE_TYPE_STANDBY) { + if (psci_plat_pm_ops->affinst_standby) + rc = psci_plat_pm_ops->affinst_standby(power_state); + else + return PSCI_E_INVALID_PARAMS; + } else { + mpidr = read_mpidr(); + rc = psci_afflvl_suspend(mpidr, + entrypoint, + context_id, + power_state, + MPIDR_AFFLVL0, + target_afflvl); + } -exit: - if (rc != PSCI_E_SUCCESS) - assert(rc == PSCI_E_INVALID_PARAMS); + assert(rc == PSCI_E_INVALID_PARAMS || rc == PSCI_E_SUCCESS); return rc; } -- cgit