diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2018-09-17 22:03:42 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-09-19 09:31:16 +0200 |
commit | 589bbbeccdc574d4c964d3f404a2e0605a545a4e (patch) | |
tree | eaf00ef4b57a7f806846be11b29132d64bb2c1f2 /common | |
parent | 37bc0b2daf75a11fe7ae94c574be6ca2d053126d (diff) | |
download | barebox-589bbbeccdc574d4c964d3f404a2e0605a545a4e.tar.gz barebox-589bbbeccdc574d4c964d3f404a2e0605a545a4e.tar.xz |
memtest: Adjust code for 64-bit architectures
Make use of %pa specifier to avoid warnings when building against
64-bit CPU (specifically AArch64) as well as adjust a number of
patterns to be 64-bits wide.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/memtest.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/common/memtest.c b/common/memtest.c index 0fc2046758..5c96d46e9a 100644 --- a/common/memtest.c +++ b/common/memtest.c @@ -160,24 +160,29 @@ static void mem_test_report_failure(const char *failure_description, resource_size_t actual_value, volatile resource_size_t *address) { + /* + * expected_value and actual_value below are not really + * pointers, but we want them to be printed exactly the same + * as pointers would, so we use %pa regardless + */ printf("FAILURE (%s): " - "expected 0x%08x, actual 0x%08x at address 0x%08x.\n", - failure_description, expected_value, actual_value, - (resource_size_t)address); + "expected %pa, actual %pa at address %pa.\n", + failure_description, &expected_value, &actual_value, + &address); } int mem_test_bus_integrity(resource_size_t _start, resource_size_t _end) { - static const resource_size_t bitpattern[] = { - 0x00000001, /* single bit */ - 0x00000003, /* two adjacent bits */ - 0x00000007, /* three adjacent bits */ - 0x0000000F, /* four adjacent bits */ - 0x00000005, /* two non-adjacent bits */ - 0x00000015, /* three non-adjacent bits */ - 0x00000055, /* four non-adjacent bits */ - 0xAAAAAAAA, /* alternating 1/0 */ + static const uint64_t bitpattern[] = { + 0x0000000000000001ULL, /* single bit */ + 0x0000000000000003ULL, /* two adjacent bits */ + 0x0000000000000007ULL, /* three adjacent bits */ + 0x000000000000000FULL, /* four adjacent bits */ + 0x0000000000000005ULL, /* two non-adjacent bits */ + 0x0000000000000015ULL, /* three non-adjacent bits */ + 0x0000000000000055ULL, /* four non-adjacent bits */ + 0xAAAAAAAAAAAAAAAAULL, /* alternating 1/0 */ }; volatile resource_size_t *start, *dummy, num_words, val, readback, offset, @@ -217,7 +222,7 @@ int mem_test_bus_integrity(resource_size_t _start, * pattern and ~pattern). */ for (i = 0; i < ARRAY_SIZE(bitpattern); i++) { - val = bitpattern[i]; + val = (resource_size_t)bitpattern[i]; for (; val != 0; val <<= 1) { *start = val; @@ -282,8 +287,8 @@ int mem_test_bus_integrity(resource_size_t _start, * 01ffffff is perfect. */ - pattern = 0xAAAAAAAA; - anti_pattern = 0x55555555; + pattern = (resource_size_t)0xAAAAAAAAAAAAAAAAULL; + anti_pattern = (resource_size_t)0x5555555555555555ULL; /* * Write the default pattern at each of the |