From 9989fb18bd5b6e2afe5f296b4c414f8d1c73d527 Mon Sep 17 00:00:00 2001 From: Ralph Siemsen Date: Wed, 9 Sep 2020 12:10:00 -0400 Subject: cmd: mem: fix range of bitflip test The bitflip test uses two equal sized memory buffers. This is achieved by splitting the range of memory into two pieces. The address of the second buffer, as well as the length of each buffer, were not correctly calculated. This caused bitflip test to access beyond the end of range. This patch fixes the pointer arithmetic problem. A second problem arises because u-boot "mtest" command expects the ending address to be inclusive. When computing (end - start) this results in missing 1 byte of the requested length. The bitflip test expects a count rather than an "ending" address. Thus it fails to test the last word of the requested range. Fixed by using (end - start + 1). Added Kconfig option to optionally disable the bitflip test, since it does add significantly to the time taken for "mtest". Fixes: 8e434cb705d463bc8cff935160e4fb4c77cb99ab ("cmd: mem: Add bitflip memory test to alternate mtest") Signed-off-by: Ralph Siemsen Reviewed-by: Stefan Roese --- cmd/Kconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cmd/Kconfig') diff --git a/cmd/Kconfig b/cmd/Kconfig index 0761dbb746..0c984d735d 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -777,6 +777,18 @@ config SYS_ALT_MEMTEST help Use a more complete alternative memory test. +if SYS_ALT_MEMTEST + +config SYS_ALT_MEMTEST_BITFLIP + bool "Bitflip test" + default y + help + The alternative memory test includes bitflip test since 2020.07. + The bitflip test significantly increases the overall test time. + Bitflip test can optionally be disabled here. + +endif + config SYS_MEMTEST_START hex "default start address for mtest" default 0 -- cgit v1.2.3