Add 64-bit data support for memory commands
PATCH 1/1 Add 64-bit data support for memory commands
Add 64-bit data for memory commands, such as md, mw, mm, cmp. The new size ".q " is introduced.
For 64-bit architecture, 64-bit data is enabled by default, by detecting compiler __LP64__. It is optional for other architectures.
---
Please comment if using __LP64__ is the right way to detect 64-bit systems.
README | 3 + common/cmd_mem.c | 157 +++++++++++++++++++++++++++++++++++++++++++++---- common/command.c | 4 ++ include/common.h | 4 ++ lib/display_options.c | 17 +++++- 5 files changed, 174 insertions(+), 11 deletions(-)
README +3 -0
@@ -3470,6 +3470,9 @@ typically in board_init_f() and board_init_r(). Configuration Settings: ----------------------- +- CONFIG_SYS_SUPPORT_64BIT_DATA: Defined automatically if compiled as 64-bit. + Optionally it can be defined to support 64-bit memory commands. + - CONFIG_SYS_LONGHELP: Defined when you want long help messages included; undefine this when you're short of memory.
common/cmd_mem.c +147 -10
361 lines not on this page · raw message
common/command.c +4 -0
@@ -421,6 +421,10 @@ int cmd_get_data_size(char* arg, int default_size)return 2 ;case 'l' :return 4 ; +#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA +case 'q' : +return 8 ; +#endif case 's' :return -2 ;default :
include/common.h +4 -0
@@ -96,6 +96,10 @@ typedef volatile unsigned char vu_char;#include <flash.h> #include <image.h> +#ifdef __LP64__ +#define CONFIG_SYS_SUPPORT_64BIT_DATA +#endif +#ifdef DEBUG #define _DEBUG 1#else
lib/display_options.c +16 -1
@@ -87,11 +87,19 @@ int print_buffer(ulong addr, const void *data, uint width, uint count, {/* linebuf as a union causes proper alignment */ union linebuf { +#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA +uint64_t uq[MAX_LINE_LENGTH_BYTES /sizeof (uint64_t ) +1 ]; +#endif uint32_t ui[MAX_LINE_LENGTH_BYTES /sizeof (uint32_t ) +1 ];uint16_t us[MAX_LINE_LENGTH_BYTES /sizeof (uint16_t ) +1 ];uint8_t uc[MAX_LINE_LENGTH_BYTES /sizeof (uint8_t ) +1 ]; } lb;int i; +#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA +uint64_t x; +#else +uint32_t x; +#endif if (linelen*width >MAX_LINE_LENGTH_BYTES ) linelen =MAX_LINE_LENGTH_BYTES / width;
@@ -108,14 +116,21 @@ int print_buffer(ulong addr, const void *data, uint width, uint count,/* Copy from memory into linebuf and print hex values */ for (i =0 ; i < thislinelen; i++) { -uint32_t x;if (width ==4 ) x = lb.ui[i] = *(volatile uint32_t *)data; +#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA + else if (width == 8) + x = lb.uq[i] = *(volatile uint64_t *)data; +#endif else if (width == 2) x = lb.us[i] = *(volatile uint16_t *)data; else x = lb.uc[i] = *(volatile uint8_t *)data; +#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA +printf (" %0*llx" , width *2 , x); +#else printf (" %0*x" , width *2 , x); +#endif data += width; }
Signature · 1 line
1.7.9.5
Quoted 7 lines · York Sun
Add 64-bit data for memory commands, such as md, mw, mm, cmp. The new size ".q " is introduced.
For 64-bit architecture, 64-bit data is enabled by default, by detecting compiler
__LP64__. It is optional for other architectures.Signed-off-by York Sun <[email protected]>
Applied to u-boot/master, thanks! Please note this introduces warnings on mips64 boards because we can now better support 64bitness. Or we need to discuss things more but, lets get that started. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140304/a1c1e38d/attachment.pgp>