Skip to contentSkip to conversation

cmd: pci: Adjust display of digits for 64bit address and size

PATCH New Kunihiko Hayashi 3 participants 5 messages Aug 23, 2019 – Aug 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: pci: Adjust display of digits for 64bit address and size

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 <[email protected]>
Cc Simon Glass <[email protected]>
---
 cmd/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
cmd/pci.c +3 -3
index 2c5ee2a..0043471 100644
@@ -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);
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 cmd: pci: Adjust display of digits for 64bit address and size

Hi Kunihiko,

Quoted 10 lines · Kunihiko Hayashi

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

I am not sure why the ID 0 line has 14 digits while the ID 1 line has 16 digits.

Shouldn't both lines be either 14 digits so that's what you are fixing in this patch?

Quoted 28 lines

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

Cc Yehuda Yitschak <[email protected]>
Cc Simon Glass <[email protected]>
---
 cmd/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
cmd/pci.c +1 -1
index 2c5ee2a..0043471 100644
@@ -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;
        }
 

cmd/pci.c static void pci_show_regions(struct udevice *bus)

Quoted 10 lines
cmd/pci.c +2 -3
-       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);
--

Regards,
Bin

#2 lore raw

PATCH 1/1 cmd: pci: Adjust display of digits for 64bit address and size

Hi Bin,

Quoted 15 lines · On Fri, 23 Aug 2019 11:43:55 +0800 <[email protected]> wrote:

Hi Kunihiko,

Quoted 10 lines · Kunihiko Hayashi

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
Quoted 4 lines

I am not sure why the ID 0 line has 14 digits while the ID 1 line has 16 digits.

Shouldn't both lines be either 14 digits so that's what you are fixing in this patch?

The original format is "%#016llx".
The base address of ID 1, "0xffff000080000000", is greater than 16 characters. So the result value is displayed as it is in 16 digits.

However, the other values are less than 16 characters, and the values are zero padded. The padded values including "0x" are displayed in 16 characters. As a result, the values are displayed in 14 digits.

After applying this patch, the values including "0x" are displayed in 18 characters, so the values are always displayed in 16 digits.

Thank you,

---
Best Regards,
Kunihiko Hayashi

#3 lore raw

PATCH 1/1 cmd: pci: Adjust display of digits for 64bit address and size

Hi Kunihiko,

Quoted 29 lines · Kunihiko Hayashi

Hi Bin,

Quoted 15 lines · On Fri, 23 Aug 2019 11:43:55 +0800 <[email protected]> wrote:

Hi Kunihiko,

Quoted 10 lines · Kunihiko Hayashi

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
Quoted 4 lines

I am not sure why the ID 0 line has 14 digits while the ID 1 line has 16 digits.

Shouldn't both lines be either 14 digits so that's what you are fixing in this patch?

The original format is "%#016llx".
The base address of ID 1, "0xffff000080000000", is greater than 16 characters. So the result value is displayed as it is in 16 digits.

Quoted 7 lines

However, the other values are less than 16 characters, and the values are zero padded. The padded values including "0x" are displayed in 16 characters. As a result, the values are displayed in 14 digits.

After applying this patch, the values including "0x" are displayed in 18 characters, so the values are always displayed in 16 digits.

Ah, I missed that. Thanks.

Regards,
Bin

#4 lore raw

PATCH 1/1 cmd: pci: Adjust display of digits for 64bit address and size

In reply to Kunihiko Hayashi
Quoted 10 lines · Kunihiko Hayashi

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
Quoted 7 lines

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

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190826/c9325252/attachment.sig>