Skip to contentSkip to conversation

sandbox: Change md command to use map_physmem

PATCH Superseded Simon Glass 4 participants 5 messages Oct 25, 2011 – Nov 3, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sandbox: Change md command to use map_physmem

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

---
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(-)
common/cmd_mem.c +7 -2
index 28476d7..461ee19 100644
@@ -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
 
Signature · 1 line
1.7.3.1
#3 lore raw

PATCH v2 1/1 sandbox: Change md command to use map_physmem

Hi Matthias,

Quoted 11 lines · Matthias Weisser

Am 26.10.2011 01:51, schrieb Simon Glass:

Quoted 5 lines

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

After fixing malloc problem:

Thanks - I tracked this down to 2d01dd9 which puts dlmalloc.o in the Makefile twice. It is fixed by your 'sandbox: Add improved RAM simulation' so I will not submit a patch.

Regards,
Simon

Quoted 2 lines

Regards Matthias

#4 lore raw

PATCH v2 1/1 sandbox: Change md command to use map_physmem

In reply to Simon Glass

Dear Simon Glass,

Quoted 11 lines · In message <[email protected]> you wrote:

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

---
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(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Unix: Some say the learning curve is steep,  but  you  only  have  to
climb it once.                                      - Karl Lehenbauer