From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mem_mtest: fix error reporting, allow escape with ^C
Date: Fri, 2 Oct 2009 18:18:33 -0400 [thread overview]
Message-ID: <1254521913-25655-1-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <4AC5438B.903@windriver.com>
The basic memtest function tries to watch for ^C after each
pattern pass as an escape mechanism, but if things are horribly
wrong, we'll be stuck in an inner loop flooding the console with
error messages and never check for ^C. To make matters worse,
if the user waits for all the error messages to complete, we
then incorrectly report the test passed without errors.
Adding a check for ^C after any error is printed will give
the end user an escape mechanism from a console flood without
slowing down the overall test speed on a slow processor.
Also, the more extensive memtest quit after just a single error,
which is inconsistent with the normal memtest, and not useful if
if you are doing dynamic environmental impact testing, such as
heating/cooling etc.
Both tests now track the error count and report it properly
at test completion.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
Changes: fixed return values since prev. version.
common/cmd_mem.c | 58 ++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 44 insertions(+), 14 deletions(-)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 9850800..a34b342 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -631,7 +631,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
vu_long *addr, *start, *end;
ulong val;
ulong readback;
- int rcode = 0;
+ ulong errs = 0;
int iterations = 1;
int iteration_limit;
@@ -698,9 +698,9 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (iteration_limit && iterations > iteration_limit) {
- printf("Tested %d iteration(s) without errors.\n",
- iterations-1);
- return 0;
+ printf("Tested %d iteration(s) with %lu errors.\n",
+ iterations-1, errs);
+ return errs != 0;
}
printf("Iteration: %6d\r", iterations);
@@ -732,9 +732,14 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
*dummy = ~val; /* clear the test data off of the bus */
readback = *addr;
if(readback != val) {
- printf ("FAILURE (data line): "
+ printf ("FAILURE (data line): "
"expected %08lx, actual %08lx\n",
val, readback);
+ errs++;
+ if (ctrlc()) {
+ putc ('\n');
+ return 1;
+ }
}
*addr = ~val;
*dummy = val;
@@ -743,6 +748,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("FAILURE (data line): "
"Is %08lx, should be %08lx\n",
readback, ~val);
+ errs++;
+ if (ctrlc()) {
+ putc ('\n');
+ return 1;
+ }
}
}
}
@@ -808,7 +818,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
" expected 0x%.8lx, actual 0x%.8lx\n",
(ulong)&start[offset], pattern, temp);
- return 1;
+ errs++;
+ if (ctrlc()) {
+ putc ('\n');
+ return 1;
+ }
}
}
start[test_offset] = pattern;
@@ -826,7 +840,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("\nFAILURE: Address bit stuck low or shorted @"
" 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
(ulong)&start[offset], pattern, temp);
- return 1;
+ errs++;
+ if (ctrlc()) {
+ putc ('\n');
+ return 1;
+ }
}
}
start[test_offset] = pattern;
@@ -864,7 +882,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("\nFAILURE (read/write) @ 0x%.8lx:"
" expected 0x%.8lx, actual 0x%.8lx)\n",
(ulong)&start[offset], pattern, temp);
- return 1;
+ errs++;
+ if (ctrlc()) {
+ putc ('\n');
+ return 1;
+ }
}
anti_pattern = ~pattern;
@@ -882,7 +904,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("\nFAILURE (read/write): @ 0x%.8lx:"
" expected 0x%.8lx, actual 0x%.8lx)\n",
(ulong)&start[offset], anti_pattern, temp);
- return 1;
+ errs++;
+ if (ctrlc()) {
+ putc ('\n');
+ return 1;
+ }
}
start[offset] = 0;
}
@@ -897,9 +923,9 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
if (iteration_limit && iterations > iteration_limit) {
- printf("Tested %d iteration(s) without errors.\n",
- iterations-1);
- return 0;
+ printf("Tested %d iteration(s) with %lu errors.\n",
+ iterations-1, errs);
+ return errs != 0;
}
++iterations;
@@ -923,7 +949,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("\nMem error @ 0x%08X: "
"found %08lX, expected %08lX\n",
(uint)addr, readback, val);
- rcode = 1;
+ errs++;
+ if (ctrlc()) {
+ putc ('\n');
+ return 1;
+ }
}
val += incr;
}
@@ -943,7 +973,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
incr = -incr;
}
#endif
- return rcode;
+ return 0; /* not reached */
}
--
1.6.5.rc1
next prev parent reply other threads:[~2009-10-02 22:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-30 19:21 [U-Boot] [PATCH] mem_mtest: bail out after finding 1st memory error Paul Gortmaker
2009-09-30 20:23 ` Wolfgang Denk
2009-09-30 20:53 ` Paul Gortmaker
2009-09-30 21:46 ` Wolfgang Denk
2009-10-01 14:00 ` Paul Gortmaker
2009-10-01 18:33 ` Wolfgang Denk
2009-10-01 23:52 ` [U-Boot] [PATCH] mem_mtest: fix error reporting, allow escape with ^C Paul Gortmaker
2009-10-01 23:57 ` Mike Frysinger
2009-10-02 0:04 ` Paul Gortmaker
2009-10-02 22:18 ` Paul Gortmaker [this message]
2009-10-03 6:19 ` Mike Frysinger
2009-10-18 20:57 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1254521913-25655-1-git-send-email-paul.gortmaker@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox