linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH pciutils 1/4] lspci: Show 16/32/64 bit width for address ranges behind bridge
@ 2021-12-20 15:54 Pali Rohár
  2021-12-20 15:54 ` [PATCH pciutils 2/4] lspci: Simplify printing range in show_range() Pali Rohár
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Pali Rohár @ 2021-12-20 15:54 UTC (permalink / raw)
  To: Martin Mares, Bjorn Helgaas, Krzysztof Wilczyński,
	Matthew Wilcox, linux-pci

Type of address range is encoded in lower bits.
---
 lspci.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lspci.c b/lspci.c
index aba2745a9192..17649a0540fa 100644
--- a/lspci.c
+++ b/lspci.c
@@ -374,12 +374,12 @@ show_size(u64 x)
 }
 
 static void
-show_range(char *prefix, u64 base, u64 limit, int is_64bit)
+show_range(char *prefix, u64 base, u64 limit, int bits)
 {
   printf("%s:", prefix);
   if (base <= limit || verbose > 2)
     {
-      if (is_64bit)
+      if (bits > 32)
         printf(" %016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit);
       else
         printf(" %08x-%08x", (unsigned) base, (unsigned) limit);
@@ -388,6 +388,7 @@ show_range(char *prefix, u64 base, u64 limit, int is_64bit)
     show_size(limit - base + 1);
   else
     printf(" [disabled]");
+  printf(" [%d-bit]", bits);
   putchar('\n');
 }
 
@@ -578,7 +579,7 @@ show_htype1(struct device *d)
 	  io_base |= (get_conf_word(d, PCI_IO_BASE_UPPER16) << 16);
 	  io_limit |= (get_conf_word(d, PCI_IO_LIMIT_UPPER16) << 16);
 	}
-      show_range("\tI/O behind bridge", io_base, io_limit+0xfff, 0);
+      show_range("\tI/O behind bridge", io_base, io_limit+0xfff, (io_type == PCI_IO_RANGE_TYPE_32) ? 32 : 16);
     }
 
   if (mem_type != (mem_limit & PCI_MEMORY_RANGE_TYPE_MASK) ||
@@ -588,7 +589,7 @@ show_htype1(struct device *d)
     {
       mem_base = (mem_base & PCI_MEMORY_RANGE_MASK) << 16;
       mem_limit = (mem_limit & PCI_MEMORY_RANGE_MASK) << 16;
-      show_range("\tMemory behind bridge", mem_base, mem_limit + 0xfffff, 0);
+      show_range("\tMemory behind bridge", mem_base, mem_limit + 0xfffff, 32);
     }
 
   if (pref_type != (pref_limit & PCI_PREF_RANGE_TYPE_MASK) ||
@@ -603,7 +604,7 @@ show_htype1(struct device *d)
 	  pref_base_64 |= (u64) get_conf_long(d, PCI_PREF_BASE_UPPER32) << 32;
 	  pref_limit_64 |= (u64) get_conf_long(d, PCI_PREF_LIMIT_UPPER32) << 32;
 	}
-      show_range("\tPrefetchable memory behind bridge", pref_base_64, pref_limit_64 + 0xfffff, (pref_type == PCI_PREF_RANGE_TYPE_64));
+      show_range("\tPrefetchable memory behind bridge", pref_base_64, pref_limit_64 + 0xfffff, (pref_type == PCI_PREF_RANGE_TYPE_64) ? 64 : 32);
     }
 
   if (verbose > 1)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-11-15 22:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 15:54 [PATCH pciutils 1/4] lspci: Show 16/32/64 bit width for address ranges behind bridge Pali Rohár
2021-12-20 15:54 ` [PATCH pciutils 2/4] lspci: Simplify printing range in show_range() Pali Rohár
2021-12-20 15:54 ` [PATCH pciutils 3/4] libpci: Add support for filling bridge resources Pali Rohár
2021-12-26 22:13   ` Martin Mareš
2021-12-26 22:20     ` Pali Rohár
2021-12-31 22:27       ` Pali Rohár
2022-01-20 20:33         ` Bjorn Helgaas
2022-01-20 20:45           ` Pali Rohár
2022-01-20 21:02             ` Bjorn Helgaas
2022-01-20 21:19               ` Pali Rohár
2022-11-11 20:09               ` IORESOURCE_WINDOW for PCI-to-PCI bridges Pali Rohár
2022-11-11 21:05                 ` Bjorn Helgaas
2022-11-11 21:48                   ` Pali Rohár
2022-11-15 22:15                     ` Bjorn Helgaas
2021-12-20 15:54 ` [PATCH pciutils 4/4] lspci: Use PCI_FILL_BRIDGE_BASES to detect if range behind bridge is disabled or unsupported Pali Rohár

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).