summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrent Piepho <trent.piepho@igorinstitute.com>2021-10-11 12:07:25 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2021-10-12 09:45:48 +0200
commit8105c22d5736b0b15cc144ad3d7b0e6059ff5b95 (patch)
tree23a30471c3f6b9d50fc3d07c7583b1be3f6d6108
parent7d5378b3333a6abe86434636e921d19a0fc1e1a6 (diff)
downloadbarebox-8105c22d5736b0b15cc144ad3d7b0e6059ff5b95.tar.gz
barebox-8105c22d5736b0b15cc144ad3d7b0e6059ff5b95.tar.xz
nandtest: Add more fields when bad byte found
This can help to determine what is causing the problem. E.g., is the bad byte always in the same eraseblock? Is it always 513 bytes into a page with a hardware ECC chunk size of 512 bytes? Example before and after (error at absolute address 123456 with 128kB eraseblock and 2kB page sizes): Byte 0xe240 is 12 should be 34 Block 0x1 byte 0xe240 (page 0x1c offset 0x240) is 0x12 should be 0x34 Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com> Link: https://lore.barebox.org/20211011190725.856597-1-trent.piepho@igorinstitute.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--commands/nandtest.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/commands/nandtest.c b/commands/nandtest.c
index 1bb59c7fdb..4a7db9cc74 100644
--- a/commands/nandtest.c
+++ b/commands/nandtest.c
@@ -169,8 +169,10 @@ static int erase_and_write(loff_t ofs, unsigned char *data,
printf("\ncompare failed. seed %d\n", seed);
for (i = 0; i < meminfo.erasesize; i++) {
if (data[i] != rbuf[i])
- printf("Byte 0x%x is %02x should be %02x\n",
- i, rbuf[i], data[i]);
+ printf("Block 0x%llx byte 0x%0x (page 0x%x offset 0x%x) is %02x should be %02x\n",
+ div64_ul(ofs, meminfo.erasesize), i,
+ i / meminfo.writesize, i % meminfo.writesize,
+ rbuf[i], data[i]);
}
return ret;
}