mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
Bring mtest putc() into common code
If we get a Ctrl-C abort, we always print a newline. Move this repeated code out of the functions and into a single place in the caller. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -684,11 +684,9 @@ static ulong mem_test_alt(vu_long *start, vu_long *end)
|
|||||||
"expected %08lx, actual %08lx\n",
|
"expected %08lx, actual %08lx\n",
|
||||||
val, readback);
|
val, readback);
|
||||||
errs++;
|
errs++;
|
||||||
if (ctrlc()) {
|
if (ctrlc())
|
||||||
putc('\n');
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
*addr = ~val;
|
*addr = ~val;
|
||||||
*dummy = val;
|
*dummy = val;
|
||||||
readback = *addr;
|
readback = *addr;
|
||||||
@@ -697,13 +695,11 @@ static ulong mem_test_alt(vu_long *start, vu_long *end)
|
|||||||
"Is %08lx, should be %08lx\n",
|
"Is %08lx, should be %08lx\n",
|
||||||
readback, ~val);
|
readback, ~val);
|
||||||
errs++;
|
errs++;
|
||||||
if (ctrlc()) {
|
if (ctrlc())
|
||||||
putc('\n');
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Based on code whose Original Author and Copyright
|
* Based on code whose Original Author and Copyright
|
||||||
@@ -765,12 +761,10 @@ static ulong mem_test_alt(vu_long *start, vu_long *end)
|
|||||||
" expected 0x%.8lx, actual 0x%.8lx\n",
|
" expected 0x%.8lx, actual 0x%.8lx\n",
|
||||||
(ulong)&start[offset], pattern, temp);
|
(ulong)&start[offset], pattern, temp);
|
||||||
errs++;
|
errs++;
|
||||||
if (ctrlc()) {
|
if (ctrlc())
|
||||||
putc('\n');
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
start[test_offset] = pattern;
|
start[test_offset] = pattern;
|
||||||
WATCHDOG_RESET();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
@@ -788,12 +782,10 @@ static ulong mem_test_alt(vu_long *start, vu_long *end)
|
|||||||
" actual 0x%.8lx\n",
|
" actual 0x%.8lx\n",
|
||||||
(ulong)&start[offset], pattern, temp);
|
(ulong)&start[offset], pattern, temp);
|
||||||
errs++;
|
errs++;
|
||||||
if (ctrlc()) {
|
if (ctrlc())
|
||||||
putc('\n');
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
start[test_offset] = pattern;
|
start[test_offset] = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,11 +822,9 @@ static ulong mem_test_alt(vu_long *start, vu_long *end)
|
|||||||
" expected 0x%.8lx, actual 0x%.8lx)\n",
|
" expected 0x%.8lx, actual 0x%.8lx)\n",
|
||||||
(ulong)&start[offset], pattern, temp);
|
(ulong)&start[offset], pattern, temp);
|
||||||
errs++;
|
errs++;
|
||||||
if (ctrlc()) {
|
if (ctrlc())
|
||||||
putc('\n');
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
anti_pattern = ~pattern;
|
anti_pattern = ~pattern;
|
||||||
start[offset] = anti_pattern;
|
start[offset] = anti_pattern;
|
||||||
@@ -852,11 +842,9 @@ static ulong mem_test_alt(vu_long *start, vu_long *end)
|
|||||||
" expected 0x%.8lx, actual 0x%.8lx)\n",
|
" expected 0x%.8lx, actual 0x%.8lx)\n",
|
||||||
(ulong)&start[offset], anti_pattern, temp);
|
(ulong)&start[offset], anti_pattern, temp);
|
||||||
errs++;
|
errs++;
|
||||||
if (ctrlc()) {
|
if (ctrlc())
|
||||||
putc('\n');
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
start[offset] = 0;
|
start[offset] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -907,11 +895,9 @@ static ulong mem_test_quick(vu_long *start, vu_long *end, vu_long pattern,
|
|||||||
"found %08lX, expected %08lX\n",
|
"found %08lX, expected %08lX\n",
|
||||||
(uint)(uintptr_t)addr, readback, val);
|
(uint)(uintptr_t)addr, readback, val);
|
||||||
errs++;
|
errs++;
|
||||||
if (ctrlc()) {
|
if (ctrlc())
|
||||||
putc('\n');
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
val += incr;
|
val += incr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -967,7 +953,6 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||||||
!iteration_limit || iteration < iteration_limit;
|
!iteration_limit || iteration < iteration_limit;
|
||||||
iteration++) {
|
iteration++) {
|
||||||
if (ctrlc()) {
|
if (ctrlc()) {
|
||||||
putc('\n');
|
|
||||||
errs = -1UL;
|
errs = -1UL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -981,7 +966,8 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (errs == -1UL) {
|
if (errs == -1UL) {
|
||||||
/* Memory test was aborted */
|
/* Memory test was aborted - write a newline to finish off */
|
||||||
|
putc('\n');
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
printf("Tested %d iteration(s) with %lu errors.\n",
|
printf("Tested %d iteration(s) with %lu errors.\n",
|
||||||
|
Reference in New Issue
Block a user