Added optional iteration limit for alternative memory test.
PATCH 1/1 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.
--- common/cmd_mem.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
common/cmd_mem.c +19 -0
@@ -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" );
Signature · 1 line
1.5.6.5
PATCH 1/1 Added optional iteration limit for alternative memory test.
Dear Dirk Eibach,
Quoted 2 lines · In message <[email protected]> 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).
Quoted 4 lines
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).
common/cmd_mem.c int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 732
Quoted 7 lines
#if
defined(CONFIG_SYS_ALT_MEMTEST)common/cmd_mem.c +6
-0+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.
common/cmd_mem.c U_BOOT_CMD( · line 1301
Quoted 10 lines
U_BOOT_CMD(
common/cmd_mem.c +6
-0+#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
Signature · 9 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Do you know the one -- "All I ask is a tall ship, and a star to steer her by ..." You could feel the wind at your back, about you ... the sounds of the sea beneath you. And even if you take away the wind and the water, it's still the same. The ship is yours ... you can feel her ... and the stars are still there. -- Kirk, "The Ultimate Computer", stardate 4729.4