[U-Boot] [PATCH v2] sandbox: Change md command to use map_physmem

Simon Glass sjg at chromium.org
Wed Oct 26 01:51:09 CEST 2011


Sandbox wants to support commands which use memory. The map_physmen()
call provides this feature, so should be used more consistently in
U-Boot.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2:
- Remove check for NULL pointer since map_physmem apparently cannot fail

 common/cmd_mem.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 28476d7..461ee19 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -33,6 +33,7 @@
 #include <dataflash.h>
 #endif
 #include <watchdog.h>
+#include <asm/io.h>
 
 #ifdef	CMD_MEM_DEBUG
 #define	PRINTF(fmt,args...)	printf (fmt ,##args)
@@ -141,9 +142,13 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 # endif
 
 	{
+		ulong bytes = size * length;
+		void *buf = map_physmem(addr, bytes, MAP_WRBACK);
+
 		/* Print the lines. */
-		print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
-		addr += size*length;
+		print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
+		addr += bytes;
+		unmap_physmem(buf, bytes);
 	}
 #endif
 
-- 
1.7.3.1



More information about the U-Boot mailing list