aboutsummaryrefslogtreecommitdiff
path: root/common/cmd_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/cmd_mem.c')
-rw-r--r--common/cmd_mem.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 3f85c1a..5d8c9e6 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -20,6 +20,7 @@
#endif
#include <hash.h>
#include <inttypes.h>
+#include <mapmem.h>
#include <watchdog.h>
#include <asm/io.h>
#include <linux/compiler.h>
@@ -35,9 +36,9 @@ static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
/* Display values from last command.
* Memory modify remembered values are different from display memory.
*/
-static uint dp_last_addr, dp_last_size;
-static uint dp_last_length = 0x40;
-static uint mm_last_addr, mm_last_size;
+static ulong dp_last_addr, dp_last_size;
+static ulong dp_last_length = 0x40;
+static ulong mm_last_addr, mm_last_size;
static ulong base_address = 0;
@@ -165,7 +166,7 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif
ulong addr, count;
int size;
- void *buf;
+ void *buf, *start;
ulong bytes;
if ((argc < 3) || (argc > 4))
@@ -197,7 +198,8 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
bytes = size * count;
- buf = map_sysmem(addr, bytes);
+ start = map_sysmem(addr, bytes);
+ buf = start;
while (count-- > 0) {
if (size == 4)
*((u32 *)buf) = (u32)writeval;
@@ -211,7 +213,7 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*((u8 *)buf) = (u8)writeval;
buf += size;
}
- unmap_sysmem(buf);
+ unmap_sysmem(start);
return 0;
}