mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
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. Signed-off-by: York Sun <yorksun@freescale.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user