summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2016-08-15 16:48:11 +0100
committerSoby Mathew <soby.mathew@arm.com>2016-09-26 14:44:46 +0100
commit93d4f89187e2bf24b1bf64736a7c0084683aebff (patch)
tree4bce26fc3421950523fad3644bc7d0c129e07397
parent58566272c3bceac16ef5c60dd726398aeafd1842 (diff)
Rework the types in PSCI stat & node hw tests
This patch type-casts `u_register` type variables to unsigned long long before print. This is to ensure compatibility in the AArch32 build. Change-Id: I890e3f0548fee4fb9a29a20efbd93d56c44d6709
-rw-r--r--tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c30
-rw-r--r--tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c69
2 files changed, 56 insertions, 43 deletions
diff --git a/tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c b/tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c
index 764b5bd..85ca703 100644
--- a/tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c
+++ b/tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c
@@ -66,7 +66,7 @@ static u_register_t foreign_peer = INVALID_MPID;
static test_result_t cpu_ping(void)
{
- unsigned int mpid = read_mpidr_el1() & MPID_MASK;
+ u_register_t mpid = read_mpidr_el1() & MPID_MASK;
unsigned int core_pos = platform_get_core_pos(mpid);
/* Tell the lead CPU that the calling CPU has entered the test */
@@ -183,8 +183,8 @@ static test_result_t test_invalid_power_level(void)
*/
static test_result_t test_online_all(void)
{
- int cpu_node, mpidr, my_mpidr, pos;
- int state, ret, i;
+ int cpu_node, pos, state, ret, i;
+ u_register_t mpidr, my_mpidr;
/* Initialize all events */
for (i = 0; i < ARRAY_SIZE(cpu_booted); i++)
@@ -194,7 +194,8 @@ static test_result_t test_online_all(void)
DBGMSG("%s: powering cores on...\n", __func__);
my_mpidr = read_mpidr_el1() & MPID_MASK;
- DBGMSG("%s: my mpidr: %x\n", __func__, my_mpidr);
+ DBGMSG("%s: my mpidr: %llx\n", __func__,
+ (unsigned long long) my_mpidr);
for_each_cpu(cpu_node) {
mpidr = tftf_get_mpidr_from_node(cpu_node);
if (mpidr == my_mpidr)
@@ -203,9 +204,9 @@ static test_result_t test_online_all(void)
/* Verify that the other CPU is turned off */
state = tftf_psci_node_hw_state(mpidr, 0);
if (state != PSCI_HW_STATE_OFF) {
- DBGMSG("%s: before: mpidr %x: state %u, expected %u\n",
- __func__, mpidr, state,
- PSCI_HW_STATE_OFF);
+ DBGMSG("%s: before: mpidr %llx: state %u, expected %u\n",
+ __func__, (unsigned long long) mpidr,
+ state, PSCI_HW_STATE_OFF);
return TEST_RESULT_FAIL;
}
@@ -213,7 +214,8 @@ static test_result_t test_online_all(void)
pos = platform_get_core_pos(mpidr);
ret = tftf_cpu_on(mpidr, (uintptr_t) cpu_ping, 0);
if (ret != PSCI_E_SUCCESS) {
- DBGMSG("%s: powering on %x failed", __func__, mpidr);
+ DBGMSG("%s: powering on %llx failed", __func__,
+ (unsigned long long)mpidr);
return TEST_RESULT_FAIL;
}
tftf_wait_for_event(&cpu_booted[pos]);
@@ -221,9 +223,9 @@ static test_result_t test_online_all(void)
/* Verify that the other CPU is turned on */
state = tftf_psci_node_hw_state(mpidr, 0);
if (state != PSCI_HW_STATE_ON) {
- DBGMSG("%s: after: mpidr %x: state %u, expected %u\n",
- __func__, mpidr, state,
- PSCI_HW_STATE_ON);
+ DBGMSG("%s: after: mpidr %llx: state %u, expected %u\n",
+ __func__, (unsigned long long)mpidr,
+ state, PSCI_HW_STATE_ON);
return TEST_RESULT_FAIL;
}
@@ -253,9 +255,9 @@ static test_result_t test_online_all(void)
/* Verify that the other CPU is turned off */
state = tftf_psci_node_hw_state(mpidr, 0);
if (state != PSCI_HW_STATE_OFF) {
- DBGMSG("%s: mpidr %x: state %u, expected %u\n",
- __func__, mpidr, state,
- PSCI_HW_STATE_OFF);
+ DBGMSG("%s: mpidr %llx: state %u, expected %u\n",
+ __func__, (unsigned long long)mpidr,
+ state, PSCI_HW_STATE_OFF);
return TEST_RESULT_FAIL;
}
}
diff --git a/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c b/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c
index b1e5e38..5058b8c 100644
--- a/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c
+++ b/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c
@@ -200,11 +200,13 @@ static int validate_stat_result(unsigned int pstateid_idx[],
*/
ERROR("Precise validation failed. Stats for CPU %d at"
" pwrlvl %d for power state 0x%x : Prev"
- " stats 0x%lx 0x%lx, current stats 0x%lx 0x%lx\n",
+ " stats 0x%llx 0x%llx, current stats"
+ " 0x%llx 0x%llx\n",
cpu_idx, pwrlvl, power_state,
- pstat_data->residency, pstat_data->count,
- current_stat_data.residency,
- current_stat_data.count);
+ (unsigned long long)pstat_data->residency,
+ (unsigned long long)pstat_data->count,
+ (unsigned long long)current_stat_data.residency,
+ (unsigned long long)current_stat_data.count);
return -1;
} else {
/*
@@ -213,9 +215,10 @@ static int validate_stat_result(unsigned int pstateid_idx[],
* previous stat count + 1 == current stat count.
*/
INFO("The difference in programmed time and residency"
- " time in us = %ld at power level %d\n",
- ((current_stat_data.residency - pstat_data->residency)
- - (PLAT_SUSPEND_ENTRY_TIME * 1000)), pwrlvl);
+ " time in us = %lld at power level %d\n",
+ (unsigned long long)
+ ((current_stat_data.residency - pstat_data->residency)
+ - (PLAT_SUSPEND_ENTRY_TIME * 1000)), pwrlvl);
}
local_pstateid_idx[pwrlvl] = PWR_STATE_INIT_INDEX;
@@ -259,12 +262,13 @@ static int validate_stat_result(unsigned int pstateid_idx[],
ERROR("Imprecise validation failed for"
" pwrlvl <= target_pwrlvl. Stats for"
" CPU %d for power state 0x%x. Prev"
- " stats 0x%lx 0x%lx, current stats 0x%lx"
- " 0x%lx\n",
+ " stats 0x%llx 0x%llx, current stats 0x%llx"
+ " 0x%llx\n",
cpu_idx, power_state,
- pstat_data->residency, pstat_data->count,
- current_stat_data.residency,
- current_stat_data.count);
+ (unsigned long long)pstat_data->residency,
+ (unsigned long long)pstat_data->count,
+ (unsigned long long)current_stat_data.residency,
+ (unsigned long long)current_stat_data.count);
return -1;
}
@@ -279,12 +283,13 @@ static int validate_stat_result(unsigned int pstateid_idx[],
ERROR("Imprecise validation failed for pwrlvl >"
" target_pwrlvl. Stats for CPU"
" %d for power state 0x%x. Prev"
- " stats 0x%lx 0x%lx, current stats"
- " 0x%lx 0x%lx\n",
+ " stats 0x%llx 0x%llx, current stats"
+ " 0x%llx 0x%llx\n",
cpu_idx, power_state,
- pstat_data->residency, pstat_data->count,
- current_stat_data.residency,
- current_stat_data.count);
+ (unsigned long long)pstat_data->residency,
+ (unsigned long long)pstat_data->count,
+ (unsigned long long)current_stat_data.residency,
+ (unsigned long long)current_stat_data.count);
return -1;
}
}
@@ -410,14 +415,16 @@ static test_result_t test_psci_stat(void)
tftf_cancel_timer();
if (ret) {
ERROR("PSCI-STAT: Suspend failed. "
- "mpidr:0x%lx pwr_lvl:0x%x powerstate:0x%x\n",
- mpidr, pwrlvl, power_state);
+ "mpidr:0x%llx pwr_lvl:0x%x powerstate:0x%x\n",
+ (unsigned long long)mpidr,
+ pwrlvl, power_state);
return TEST_RESULT_FAIL;
}
- INFO("PSCI-STAT: mpidr:0x%lx pwr_lvl:0x%x powerstate:0x%x\n",
- mpidr, pwrlvl, power_state);
+ INFO("PSCI-STAT: mpidr:0x%llx pwr_lvl:0x%x powerstate:0x%x\n",
+ (unsigned long long)mpidr,
+ pwrlvl, power_state);
ret = validate_stat_result(pstateid_idx, pwrlvl);
if (ret)
@@ -475,12 +482,13 @@ static int validate_stat_result_from_lead(u_register_t target_cpu)
if ((pstat_data->residency != target_stat_data.residency) ||
(pstat_data->count != target_stat_data.count)) {
INFO("Stats for CPU %d for power state 0x%x :"
- " Recorded stats 0x%lx 0x%lx,"
- " Target stats 0x%lx 0x%lx\n",
+ " Recorded stats 0x%llx 0x%llx,"
+ " Target stats 0x%llx 0x%llx\n",
cpu_idx, power_state,
- pstat_data->residency, pstat_data->count,
- target_stat_data.residency,
- target_stat_data.count);
+ (unsigned long long)pstat_data->residency,
+ (unsigned long long)pstat_data->count,
+ (unsigned long long)target_stat_data.residency,
+ (unsigned long long)target_stat_data.count);
return -1;
}
} while (1);
@@ -515,7 +523,8 @@ test_result_t test_psci_stat_all_power_states(void)
ret = tftf_cpu_on(target_mpid, (uintptr_t) test_psci_stat, 0);
if (ret != PSCI_E_SUCCESS) {
- ERROR("CPU ON failed for 0x%lx\n", target_mpid);
+ ERROR("CPU ON failed for 0x%llx\n",
+ (unsigned long long)target_mpid);
return TEST_RESULT_FAIL;
}
}
@@ -657,7 +666,8 @@ test_result_t test_psci_stats_cpu_off(void)
ret = tftf_cpu_on(target_mpid,
(uintptr_t) update_stats_and_power_off, 0);
if (ret != PSCI_E_SUCCESS) {
- ERROR("CPU ON failed for 0x%lx", target_mpid);
+ ERROR("CPU ON failed for 0x%llx",
+ (unsigned long long)target_mpid);
return TEST_RESULT_FAIL;
}
@@ -703,7 +713,8 @@ test_result_t test_psci_stats_cpu_off(void)
ret = tftf_cpu_on(target_mpid,
(uintptr_t) verify_powerdown_stats, 0);
if (ret != PSCI_E_SUCCESS) {
- ERROR("CPU ON failed for 0x%lx", target_mpid);
+ ERROR("CPU ON failed for 0x%llx",
+ (unsigned long long)target_mpid);
return TEST_RESULT_FAIL;
}
}