[U-Boot] [PATCH] cmd: pci: Adjust display of digits for 64bit address and size

Kunihiko Hayashi hayashi.kunihiko at socionext.com
Fri Aug 23 01:56:55 UTC 2019


The command "pci bar" and "pci region" display the address and size in
16 characters including "0x", so the command can only display
14 hexadecimal digits if the number of digits in the address and size is
less than 14.

    ID   Base                Size                Width  Type
    ----------------------------------------------------------
     0   0x00000020000000  0x00000000100000  64     MEM   Prefetchable
     1   0xffff000080000000  0x00000000100000  64     MEM   Prefetchable

The 64-bit address and size should be displayed in 18(= 16+2) digits,
so this patch adjusts them.

Cc: Yehuda Yitschak <yehuday at marvell.com>
Cc: Simon Glass <sjg at chromium.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko at socionext.com>
---
 cmd/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmd/pci.c b/cmd/pci.c
index 2c5ee2a..0043471 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -148,7 +148,7 @@ int pci_bar_show(struct udevice *dev)
 
 		if ((!is_64 && size_low) || (is_64 && size)) {
 			size = ~size + 1;
-			printf(" %d   %#016llx  %#016llx  %d     %s   %s\n",
+			printf(" %d   %#018llx  %#018llx  %d     %s   %s\n",
 			       bar_id, (unsigned long long)base,
 			       (unsigned long long)size, is_64 ? 64 : 32,
 			       is_io ? "I/O" : "MEM",
@@ -629,10 +629,10 @@ static void pci_show_regions(struct udevice *bus)
 		return;
 	}
 
-	printf("#   %-16s %-16s %-16s  %s\n", "Bus start", "Phys start", "Size",
+	printf("#   %-18s %-18s %-18s  %s\n", "Bus start", "Phys start", "Size",
 	       "Flags");
 	for (i = 0, reg = hose->regions; i < hose->region_count; i++, reg++) {
-		printf("%d   %#016llx %#016llx %#016llx  ", i,
+		printf("%d   %#018llx %#018llx %#018llx  ", i,
 		       (unsigned long long)reg->bus_start,
 		       (unsigned long long)reg->phys_start,
 		       (unsigned long long)reg->size);
-- 
2.7.4



More information about the U-Boot mailing list