summaryrefslogtreecommitdiff
path: root/services/std_svc
diff options
context:
space:
mode:
authorAchin Gupta <achin.gupta@arm.com>2015-09-07 20:43:27 +0100
committerAchin Gupta <achin.gupta@arm.com>2015-09-10 15:16:45 +0100
commitf1054c93ccf892f79e340e03201d4a25c119831c (patch)
treed6cc375ac2ffd0988a9d8db439e6152d8eeb2ff1 /services/std_svc
parent604d5da6f2aa837326d5eda7735c8dac9a127ccd (diff)
Pass the target suspend level to SPD suspend hooks
In certain Trusted OS implementations it is a requirement to pass them the highest power level which will enter a power down state during a PSCI CPU_SUSPEND or SYSTEM_SUSPEND API invocation. This patch passes this power level to the SPD in the "max_off_pwrlvl" parameter of the svc_suspend() hook. Currently, the highest power level which was requested to be placed in a low power state (retention or power down) is passed to the SPD svc_suspend_finish() hook. This hook is called after emerging from the low power state. It is more useful to pass the highest power level which was powered down instead. This patch does this by changing the semantics of the parameter passed to an SPD's svc_suspend_finish() hook. The name of the parameter has been changed from "suspend_level" to "max_off_pwrlvl" as well. Same changes have been made to the parameter passed to the tsp_cpu_resume_main() function. NOTE: THIS PATCH CHANGES THE SEMANTICS OF THE EXISTING "svc_suspend_finish()" API BETWEEN THE PSCI AND SPD/SP IMPLEMENTATIONS. THE LATTER MIGHT NEED UPDATES TO ENSURE CORRECT BEHAVIOUR. Change-Id: If3a9d39b13119bbb6281f508a91f78a2f46a8b90
Diffstat (limited to 'services/std_svc')
-rw-r--r--services/std_svc/psci/psci_suspend.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/services/std_svc/psci/psci_suspend.c b/services/std_svc/psci/psci_suspend.c
index a158e36f..675ef9e2 100644
--- a/services/std_svc/psci/psci_suspend.c
+++ b/services/std_svc/psci/psci_suspend.c
@@ -76,6 +76,8 @@ static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl,
entry_point_info_t *ep,
psci_power_state_t *state_info)
{
+ unsigned int max_off_lvl = psci_find_max_off_lvl(state_info);
+
/* Save PSCI target power level for the suspend finisher handler */
psci_set_suspend_pwrlvl(end_pwrlvl);
@@ -91,7 +93,7 @@ static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl,
* error, it's expected to assert within
*/
if (psci_spd_pm && psci_spd_pm->svc_suspend)
- psci_spd_pm->svc_suspend(0);
+ psci_spd_pm->svc_suspend(max_off_lvl);
/*
* Store the re-entry information for the non-secure world.
@@ -105,7 +107,7 @@ static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl,
* TODO : Introduce a mechanism to query the cache level to flush
* and the cpu-ops power down to perform from the platform.
*/
- psci_do_pwrdown_cache_maintenance(psci_find_max_off_lvl(state_info));
+ psci_do_pwrdown_cache_maintenance(max_off_lvl);
}
/*******************************************************************************
@@ -213,7 +215,7 @@ void psci_cpu_suspend_finish(unsigned int cpu_idx,
psci_power_state_t *state_info)
{
unsigned long long counter_freq;
- unsigned int suspend_level;
+ unsigned int max_off_lvl;
/* Ensure we have been woken up from a suspended state */
assert(psci_get_aff_info_state() == AFF_STATE_ON && is_local_state_off(\
@@ -245,9 +247,9 @@ void psci_cpu_suspend_finish(unsigned int cpu_idx,
* error, it's expected to assert within
*/
if (psci_spd_pm && psci_spd_pm->svc_suspend) {
- suspend_level = psci_get_suspend_pwrlvl();
- assert (suspend_level != PSCI_INVALID_PWR_LVL);
- psci_spd_pm->svc_suspend_finish(suspend_level);
+ max_off_lvl = psci_find_max_off_lvl(state_info);
+ assert (max_off_lvl != PSCI_INVALID_PWR_LVL);
+ psci_spd_pm->svc_suspend_finish(max_off_lvl);
}
/* Invalidate the suspend level for the cpu */