Revert "sandbox: Change md command to use map_physmem"
PATCH 1/1 Revert "sandbox: Change md command to use map_physmem"
This reverts commit 355a835747c6f7c5071ead295a7dfc489c73cb03.
The original commit broke long standing assumption that md commands work on effective addresses. This normally isn't an issue for most systems that map 1:1, however on systems with a 36-bit address map it breaks.
--- common/cmd_mem.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
common/cmd_mem.c +2 -7
@@ -33,7 +33,6 @@#include <dataflash.h> #endif #include <watchdog.h> -#include <asm/io.h> #ifdef CMD_MEM_DEBUG #define PRINTF(fmt,args...) printf (fmt ,##args)
@@ -142,13 +141,9 @@ 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, buf, size, length,DISP_LINE_LEN / size); - addr += bytes; -unmap_physmem (buf, bytes); +print_buffer (addr, (void *)addr, size, length,DISP_LINE_LEN /size); + addr += size*length; }#endif
Signature · 1 line
1.7.3.4
PATCH 1/1 Revert "sandbox: Change md command to use map_physmem"
Hi Kumar,
Quoted 5 lines · Kumar Gala
This reverts commit
355a835747c6f7c5071ead295a7dfc489c73cb03.The original commit broke long standing assumption that md commands work on effective addresses. ?This normally isn't an issue for most systems that map 1:1, however on systems with a 36-bit address map it breaks.
What is the system that shows this problem?
With sandbox we need some sort of mapping here - what do you suggest? map_virtmem?
It would be good to get a solution to this rather than just reverting.
Regards,
Simon
Quoted 38 lines
Signed-off-by Kumar Gala <[email protected]>---
?common/cmd_mem.c | ? ?9 ++-------
?1 files changed, 2 insertions(+), 7 deletions(-)common/cmd_mem.c +0
-0@@ -33,7 +33,6 @@?#include <
dataflash.h>
?#endif
?#include <watchdog.h>
-#include <asm/io.h>?#ifdef
CMD_MEM_DEBUG
?#define ? ? ? ?PRINTF(fmt,args...) ? ? printf (fmt ,##args)common/cmd_mem.c +0
-0@@ -142,13 +141,9 @@ 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, buf, size, length, DISP_LINE_LEN / size);
- ? ? ? ? ? ? ? addr += bytes;
- ? ? ? ? ? ? ?unmap_physmem(buf, bytes);
+ ? ? ? ? ? ? ?print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
+ ? ? ? ? ? ? ? addr += size*length;
? ? ? ?}
?#endif--
1.7.3.4
PATCH 1/1 Revert "sandbox: Change md command to use map_physmem"
Quoted 10 lines · Simon Glass
Hi Kumar,
Quoted 5 lines · Kumar Gala
This reverts commit
355a835747c6f7c5071ead295a7dfc489c73cb03.The original commit broke long standing assumption that md commands work on effective addresses. This normally isn't an issue for most systems that map 1:1, however on systems with a 36-bit address map it breaks.
What is the system that shows this problem?
Any PPC system that have _36BIT and some that imply it in boards.cfg
Quoted 2 lines
With sandbox we need some sort of mapping here - what do you suggest?
map_virtmem?
Not sure, what the need is w/sandbox so hard to suggest a solution.
Quoted 1 line
It would be good to get a solution to this rather than just reverting.
Sure, but I'd rather revert in short term so the mainline tree works for all existing boards, rather than for the new feature until we come up with a solution.
Quoted 42 lines
Regards,
SimonQuoted 38 lines
Signed-off-by Kumar Gala <[email protected]>---
common/cmd_mem.c| 9 ++-------1 files changed, 2 insertions(+), 7 deletions(-)common/cmd_mem.c +2
-8@@ -33,7 +33,6 @@#include <dataflash.h> #endif #include <watchdog.h> -#include <asm/io.h> #ifdef CMD_MEM_DEBUG #define PRINTF(fmt,args...) printf (fmt ,##args)@@ -142,13 +141,9 @@ 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, buf, size, length,DISP_LINE_LEN / size); - addr += bytes; -unmap_physmem (buf, bytes); +print_buffer (addr, (void *)addr, size, length,DISP_LINE_LEN /size); + addr += size*length; }#endif --1.7.3.4
PATCH 1/1 Revert "sandbox: Change md command to use map_physmem"
Hi Kumar,
Quoted 12 lines · Kumar Gala
Quoted 9 lines · Simon Glass
Hi Kumar,
Quoted 5 lines · Kumar Gala
This reverts commit
355a835747c6f7c5071ead295a7dfc489c73cb03.The original commit broke long standing assumption that md commands work on effective addresses. ?This normally isn't an issue for most systems that map 1:1, however on systems with a 36-bit address map it breaks.
Quoted 8 lines
Quoted 1 line
What is the system that shows this problem?
Any PPC system that have
_36BITand some that imply it in boards.cfgQuoted 2 lines
With sandbox we need some sort of mapping here - what do you suggest?
map_virtmem?Not sure, what the need is w/sandbox so hard to suggest a solution.
OK well please go ahead with the revert.
I could do a little patch, but perhaps we should clarify a few things first. Let me try to explain how I understand it now.
We have physical and virtual address and I assume from your email that an effective address is the same as virtual. My assumption that the two are generally the same in U-Boot is false.
Sandbox needs to provide a simulated memory bank to U-Boot. This can be thought of as physical memory, hence my implementation. In fact sandbox only sees part of the memory of its process, in this case 128MB of memory mmap'd from the OS.
We cannot use a simple address in sandbox - we could request one but there is no real guarantee that we will get it, and it might lead to people hard-coding addresses in the header file leading to inexplicable failures. It is preferably to provide a simulated memory bank that starts at zero and extends for 128MB, say. Then the addresses for 'md' and the like are mapped into the mmap'd area.
I wonder whether something like this might work?
ptr = map_mem(addr, bytes, MAP_WRBACK);
<do things with ptr>unmap_mem()
These could be macros which #define to nothing for normal architectures. It is a little ugly, but there are not that many places which read/write memory without going through read/write macros.
Regards,
Simon
Quoted 49 lines
Quoted 2 lines
It would be good to get a solution to this rather than just reverting.
Sure, but I'd rather revert in short term so the mainline tree works for all existing boards, rather than for the new feature until we come up with a solution.
Quoted 42 lines
Regards,
SimonQuoted 38 lines
Signed-off-by Kumar Gala <[email protected]>---
common/cmd_mem.c| ? ?9 ++-------1 files changed, 2 insertions(+), 7 deletions(-)common/cmd_mem.c +0
-4@@ -33,7 +33,6 @@#include <dataflash.h> #endif #include <watchdog.h> -#include <asm/io.h> #ifdef CMD_MEM_DEBUG #define ? ? ? ?PRINTF(fmt,args...) ? ? printf (fmt ,##args)@@ -142,13 +141,9 @@ 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, buf, size, length, DISP_LINE_LEN / size);
- ? ? ? ? ? ? ? addr += bytes;
- ? ? ? ? ? ? ?unmap_physmem(buf, bytes);
+ ? ? ? ? ? ? ?print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
+ ? ? ? ? ? ? ? addr += size*length;
? ? ? }
#endif--
1.7.3.4
Wolfgang Denk
AppliedPATCH 1/1 Revert "sandbox: Change md command to use map_physmem"
In reply to Kumar GalaDear Kumar Gala,
Quoted 10 lines · In message <[email protected]> you…
This reverts commit
355a835747c6f7c5071ead295a7dfc489c73cb03.The original commit broke long standing assumption that md commands work on effective addresses. This normally isn't an issue for most systems that map 1:1, however on systems with a 36-bit address map it breaks.
Signed-off-by Kumar Gala <[email protected]>--- common/cmd_mem.c | 9 ++------- 1 files changed, 2 insertions(+), 7 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 Just because your doctor has a name for your condition doesn't mean he knows what it is.