X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=lib%2Fdisplay_options.c;h=d5d17b2818ea243598bb7fa32d8046a2e143b97e;hb=f4ed36964a7ab4e729d62e96dac15a674dcc2668;hp=4a972b08a493b7f257dde0a332ad0816cbe576bd;hpb=326ea986ac150acdc7656d57fca647db80b50158;p=karo-tx-uboot.git diff --git a/lib/display_options.c b/lib/display_options.c index 4a972b08a4..d5d17b2818 100644 --- a/lib/display_options.c +++ b/lib/display_options.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -21,15 +22,10 @@ int display_options (void) return 0; } -/* - * print sizes as "xxx KiB", "xxx.y KiB", "xxx MiB", "xxx.y MiB", - * xxx GiB, xxx.y GiB, etc as needed; allow for optional trailing string - * (like "\n") - */ -void print_size(unsigned long long size, const char *s) +void print_size(uint64_t size, const char *s) { unsigned long m = 0, n; - unsigned long long f; + uint64_t f; static const char names[] = {'E', 'P', 'T', 'G', 'M', 'K'}; unsigned long d = 10 * ARRAY_SIZE(names); char c = 0; @@ -43,7 +39,7 @@ void print_size(unsigned long long size, const char *s) } if (!c) { - printf("%llu Bytes%s", size, s); + printf("%" PRIu64 " Bytes%s", size, s); return; } @@ -87,11 +83,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 +112,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*" PRIx64, width * 2, x); +#else printf(" %0*x", width * 2, x); +#endif data += width; }