diff options
author | Soby Mathew <soby.mathew@arm.com> | 2015-08-17 18:10:38 +0100 |
---|---|---|
committer | Soby Mathew <soby.mathew@arm.com> | 2015-10-27 15:16:39 +0000 |
commit | 09cc32a5e2b1e8ecb18b5c478afe815b15903495 (patch) | |
tree | cf35dd7165cd744ac8ef4560c9cd6640ac573221 /tests/runtime_services | |
parent | e8f96b5986caea2563e97f0115848a57aa839047 (diff) |
Rework the composite state ID helpers
This patch reworks the composite state-ID helper function
'tftf_psci_make_composite_state_id()' so that it returns the expected
return value when the State-ID is used as argument to PSCI CPU SUSPEND API.
The test cases are also modified to use the new function accordingly.
Change-Id: Ifd3e6c5604d40da3d00bbf199153e431924b4c2b
Diffstat (limited to 'tests/runtime_services')
2 files changed, 26 insertions, 55 deletions
diff --git a/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c b/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c index 0574b5d..262c8c9 100644 --- a/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c +++ b/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c @@ -359,7 +359,7 @@ test_result_t test_affinity_info_level3(void) static test_result_t suspend_to_powerdown(void) { uint32_t power_state, stateid; - int psci_ret; + int psci_ret, expected_return_val; /* * Enable reception of SGI 0 on the calling CPU. @@ -367,8 +367,12 @@ static test_result_t suspend_to_powerdown(void) */ tftf_irq_enable(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY); - stateid = tftf_psci_make_composite_state_id(PSTATE_AFF_LVL_0, - PSTATE_TYPE_POWERDOWN); + expected_return_val = tftf_psci_make_composite_state_id( + PSTATE_AFF_LVL_0, PSTATE_TYPE_POWERDOWN, &stateid); + + /* Need at least 1 power down state defined at level 0 */ + if (expected_return_val != PSCI_E_SUCCESS) + return TEST_RESULT_SKIPPED; /* * Suspend the calling CPU to the desired affinity level and power state diff --git a/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c b/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c index 5b38f1f..8499491 100644 --- a/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c +++ b/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c @@ -77,50 +77,6 @@ static int requested_irq_handler(void *data) } /* - * Determine the test result based on the return value of the CPU suspend - * operation and the power management capabilities of the platform. - * If the power management requested by the test is supported on this platform - * expect the suspend operation to have succeeded. Otherwise, print an error - * message in the test report and expect the suspend operation to have failed. - */ -static test_result_t get_test_result(unsigned int aff_level, - unsigned int suspend_type, - int psci_ret) -{ - int expected_value; - - if (suspend_type == PSTATE_TYPE_STANDBY) { - /* - * TODO: Query suspend capabilities of the platform. - * On both FVP and Juno, it's possible to enter standby only on - * affinity level 0. All other affinity levels are ignored. So - * for now, hard-code this behaviour without any input from the - * platform. - */ - expected_value = (aff_level != 0) - ? PSCI_E_INVALID_PARAMS - : PSCI_E_SUCCESS; - } else /* PSTATE_TYPE_POWERDOWN */ { - assert(suspend_type == PSTATE_TYPE_POWERDOWN); - /* - * TODO: Query powerdown capabilities of the platform. - * For now, rely on PLATFORM_MAX_AFFLVL to get the maximum - * affinity level that the powerdown operation should apply to. - */ - expected_value = (aff_level > PLATFORM_MAX_AFFLVL) - ? PSCI_E_INVALID_PARAMS - : PSCI_E_SUCCESS; - } - - if (psci_ret != expected_value) { - tftf_testcase_printf("Wrong value: expected %i, got %i\n", - expected_value, psci_ret); - return TEST_RESULT_FAIL; - } - return TEST_RESULT_SUCCESS; -} - -/* * Suspend the calling (non-lead) CPU. * 1) Program a wake-up event to come out of suspend state * 2) Suspend the CPU to the desired affinity level and power state (standby or @@ -132,7 +88,7 @@ static test_result_t suspend_non_lead_cpu(void) unsigned int mpid = read_mpidr_el1(); unsigned int core_pos = platform_get_core_pos(mpid); uint32_t power_state, stateid; - int rc; + int rc, expected_return_val; tftf_timer_register_handler(requested_irq_handler); @@ -141,8 +97,8 @@ static test_result_t suspend_non_lead_cpu(void) tftf_program_timer(PLAT_SUSPEND_ENTRY_TIME); - stateid = tftf_psci_make_composite_state_id(test_aff_level, - test_suspend_type); + expected_return_val = tftf_psci_make_composite_state_id(test_aff_level, + test_suspend_type, &stateid); /* * Suspend the calling CPU to the desired affinity level and power state @@ -159,7 +115,13 @@ static test_result_t suspend_non_lead_cpu(void) tftf_send_event(&event_received_wake_irq[core_pos]); tftf_timer_unregister_handler(); - return get_test_result(test_aff_level, test_suspend_type, rc); + + if (rc == expected_return_val) + return TEST_RESULT_SUCCESS; + + tftf_testcase_printf("Wrong value: expected %i, got %i\n", + expected_return_val, rc); + return TEST_RESULT_FAIL; } /* @@ -178,7 +140,7 @@ static test_result_t test_psci_suspend(unsigned int aff_level, unsigned int target_mpid, target_node; unsigned int core_pos; uint32_t power_state, stateid; - int rc; + int rc, expected_return_val; assert(aff_level <= MPIDR_MAX_AFFLVL); assert((suspend_type == PSTATE_TYPE_POWERDOWN) || @@ -237,8 +199,8 @@ static test_result_t test_psci_suspend(unsigned int aff_level, */ tftf_program_timer(PLAT_SUSPEND_ENTRY_TIME); - stateid = tftf_psci_make_composite_state_id(test_aff_level, - test_suspend_type); + expected_return_val = tftf_psci_make_composite_state_id(test_aff_level, + test_suspend_type, &stateid); /* * Suspend the calling CPU to the desired affinity level and power state @@ -264,7 +226,12 @@ static test_result_t test_psci_suspend(unsigned int aff_level, tftf_wait_for_event(&event_received_wake_irq[core_pos]); } - return get_test_result(aff_level, suspend_type, rc); + if (rc == expected_return_val) + return TEST_RESULT_SUCCESS; + + tftf_testcase_printf("Wrong value: expected %i, got %i\n", + expected_return_val, rc); + return TEST_RESULT_FAIL; } /* |