summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorDouglas Raillard <douglas.raillard@arm.com>2016-11-15 16:35:56 +0000
committerDouglas Raillard <douglas.raillard@arm.com>2016-12-06 13:08:50 +0000
commit2dfe84a96527ab843e75cba312b5be4e77ffd143 (patch)
treea0137e33955ce9b4fb2f40acb68aa34123044fae /framework
parent6f234d2d5c65b6f82b93fd39d68427c51a09bc86 (diff)
Add return code details to tftf_program_timer_and_suspend
Add output parameters to tftf_program_timer_and_suspend to expose the return code of tftf_program_timer and tftf_cpu_suspend. Also do better error reporting than the original function. Change-Id: I4999106137515e7056848c703825ee01483e8e89 Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/timer/timer_framework.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/framework/timer/timer_framework.c b/framework/timer/timer_framework.c
index 178f67c..7928378 100644
--- a/framework/timer/timer_framework.c
+++ b/framework/timer/timer_framework.c
@@ -227,11 +227,16 @@ int tftf_program_timer(unsigned long time_out_ms)
}
int tftf_program_timer_and_suspend(unsigned long milli_secs,
- unsigned int pwr_state)
+ unsigned int pwr_state,
+ int *timer_rc, int *suspend_rc)
{
- int rc;
+ int rc = 0;
u_register_t flags;
+ /* Default to successful return codes */
+ int timer_rc_val = 0;
+ int suspend_rc_val = PSCI_E_SUCCESS;
+
/* Preserve DAIF flags. IRQs need to be disabled for this to work. */
flags = read_daif();
disable_irq();
@@ -245,23 +250,27 @@ int tftf_program_timer_and_suspend(unsigned long milli_secs,
* pending will prevent the CPU from entering suspend mode and not being
* able to wake up.
*/
- rc = tftf_program_timer(milli_secs);
- if (rc == 0) {
- rc = tftf_cpu_suspend(pwr_state);
- if (rc != PSCI_E_SUCCESS) {
- ERROR("%s %d: rc = %d\n", __func__, __LINE__, rc);
+ timer_rc_val = tftf_program_timer(milli_secs);
+ if (timer_rc_val == 0) {
+ suspend_rc_val = tftf_cpu_suspend(pwr_state);
+ if (suspend_rc_val != PSCI_E_SUCCESS) {
rc = -1;
- } else {
- rc = 0;
+ INFO("%s %d: suspend_rc = %d\n", __func__, __LINE__,
+ suspend_rc_val);
}
} else {
- ERROR("%s %d: rc = %d\n", __func__, __LINE__, rc);
+ rc = -1;
+ INFO("%s %d: timer_rc = %d\n", __func__, __LINE__, timer_rc_val);
}
/* Restore previous DAIF flags */
write_daif(flags);
isb();
+ if (timer_rc)
+ *timer_rc = timer_rc_val;
+ if (suspend_rc)
+ *suspend_rc = suspend_rc_val;
/*
* If IRQs were disabled when calling this function, the timer IRQ
* handler won't be called and the timer interrupt will be pending, but
@@ -336,7 +345,8 @@ int tftf_timer_sleep(unsigned long milli_secs)
power_state = tftf_make_psci_pstate(MPIDR_AFFLVL0, PSTATE_TYPE_STANDBY,
stateid);
- ret = tftf_program_timer_and_suspend(milli_secs, power_state);
+ ret = tftf_program_timer_and_suspend(milli_secs, power_state,
+ NULL, NULL);
if (ret != 0)
return -1;