summaryrefslogtreecommitdiff
path: root/cmd/mem.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-09-18 13:07:19 -0600
committerTom Rini <trini@konsulko.com>2024-09-18 13:07:19 -0600
commitc17805e19b9335e1fb5295c81b59eddf88d1b9ec (patch)
tree0e4cbc44f392b9f2e53d1e38e107ec630c0267c9 /cmd/mem.c
parent650883a568653f37ee4ff43beda56152b594a49c (diff)
parent017b441b2e3c879b20bcac496369f1213c4bdbcd (diff)
Merge patch series "Fix various bugs"
Simon Glass <sjg@chromium.org> says: This series includes the patches needed to make make the EFI 'boot' test work. That test has now been split off into a separate series along with the EFI patches. This series fixes these problems: - sandbox memory-mapping conflict with PCI - the fix for that causes the mbr test to crash as it sets up pointers instead of addresses for its 'mmc' commands - the mmc and read commands which cast addresses to pointers - a tricky bug to do with USB keyboard and stdio - a few other minor things
Diffstat (limited to 'cmd/mem.c')
-rw-r--r--cmd/mem.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/cmd/mem.c b/cmd/mem.c
index 274348068c2..4d6fde28531 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -245,7 +245,7 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc,
int size;
int rcode = 0;
const char *type;
- const void *buf1, *buf2, *base;
+ const void *buf1, *buf2, *base, *ptr1, *ptr2;
ulong word1, word2; /* 64-bit if MEM_SUPPORT_64BIT_DATA */
if (argc != 4)
@@ -270,22 +270,22 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc,
bytes = size * count;
base = buf1 = map_sysmem(addr1, bytes);
buf2 = map_sysmem(addr2, bytes);
- for (ngood = 0; ngood < count; ++ngood) {
+ for (ngood = 0, ptr1 = buf1, ptr2 = buf2; ngood < count; ++ngood) {
if (size == 4) {
- word1 = *(u32 *)buf1;
- word2 = *(u32 *)buf2;
+ word1 = *(u32 *)ptr1;
+ word2 = *(u32 *)ptr2;
} else if (MEM_SUPPORT_64BIT_DATA && size == 8) {
- word1 = *(ulong *)buf1;
- word2 = *(ulong *)buf2;
+ word1 = *(ulong *)ptr1;
+ word2 = *(ulong *)ptr2;
} else if (size == 2) {
- word1 = *(u16 *)buf1;
- word2 = *(u16 *)buf2;
+ word1 = *(u16 *)ptr1;
+ word2 = *(u16 *)ptr2;
} else {
- word1 = *(u8 *)buf1;
- word2 = *(u8 *)buf2;
+ word1 = *(u8 *)ptr1;
+ word2 = *(u8 *)ptr2;
}
if (word1 != word2) {
- ulong offset = buf1 - base;
+ ulong offset = ptr1 - base;
printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
type, (ulong)(addr1 + offset), size, word1,
type, (ulong)(addr2 + offset), size, word2);
@@ -293,8 +293,8 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc,
break;
}
- buf1 += size;
- buf2 += size;
+ ptr1 += size;
+ ptr2 += size;
/* reset watchdog from time to time */
if ((ngood % (64 << 10)) == 0)