[U-Boot] [PATCH] Added optional iteration limit for alternative memory test.

We want to use mtest for production memory test. I implemented an iteration limit, so expect can parse the results.
The iteration limit is passed to mtest as a fourth parameter: [start [end [pattern [iterations]]]] If no fourth parameter is supplied, there is no iteration limit and the test will loop forever.
Signed-off-by: Dirk Eibach eibach@gdsys.de --- common/cmd_mem.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c index d7666c2..c26e15d 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -674,6 +674,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int rcode = 0;
#if defined(CONFIG_SYS_ALT_MEMTEST) + int iteration_limit; vu_long len; vu_long offset; vu_long test_offset; @@ -723,6 +724,12 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) }
#if defined(CONFIG_SYS_ALT_MEMTEST) + if (argc > 4) { + iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16); + } else { + iteration_limit = 0; + } + printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end); PRINTF("%s:%d: start 0x%p end 0x%p\n", __FUNCTION__, __LINE__, start, end); @@ -733,6 +740,12 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; }
+ + if (iteration_limit && iterations > iteration_limit) { + printf("Tested %d iteration(s) without errors.\n", iterations-1); + return 0; + } + printf("Iteration: %6d\r", iterations); PRINTF("Iteration: %6d\n", iterations); iterations++; @@ -1277,9 +1290,15 @@ U_BOOT_CMD( #endif /* CONFIG_LOOPW */
U_BOOT_CMD( +#ifdef CONFIG_SYS_ALT_MEMTEST + mtest, 5, 1, do_mem_mtest, + "mtest - simple RAM test\n", + "[start [end [pattern [iterations]]]]\n" +#else mtest, 4, 1, do_mem_mtest, "mtest - simple RAM test\n", "[start [end [pattern]]]\n" +#endif /* CONFIG_SYS_ALT_MEMTEST */ " - simple RAM read/write test\n" );

Dear Dirk Eibach,
In message 1227791865-8843-1-git-send-email-eibach@gdsys.de you wrote:
We want to use mtest for production memory test. I implemented an iteration limit, so expect can parse the results.
mtest is definitely NOT a good enough memory test for any production tests. You should rather use the much stronger POST memory tests (see post/drivers/memory.c).
The iteration limit is passed to mtest as a fourth parameter: [start [end [pattern [iterations]]]] If no fourth parameter is supplied, there is no iteration limit and the test will loop forever.
If you want to add this feature, then please do so for both configuratione (with and without CONFIG_SYS_ALT_MEMTEST selected).
#if defined(CONFIG_SYS_ALT_MEMTEST)
- if (argc > 4) {
iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16);
- } else {
iteration_limit = 0;
- }
This can then be moved up intot he generic part.
U_BOOT_CMD( +#ifdef CONFIG_SYS_ALT_MEMTEST
- mtest, 5, 1, do_mem_mtest,
- "mtest - simple RAM test\n",
- "[start [end [pattern [iterations]]]]\n"
+#else mtest, 4, 1, do_mem_mtest, "mtest - simple RAM test\n", "[start [end [pattern]]]\n" +#endif /* CONFIG_SYS_ALT_MEMTEST */
And this #ifdef can be avoided alltogether.
Best regards,
Wolfgang Denk
participants (2)
-
Dirk Eibach
-
Wolfgang Denk