[PATCH 3/4] pci: improve debug output

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Fri Apr 13 16:30:52 PDT 2018


Print a single line per bar with all relevant information and indent it
by a space to group them together per device.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 drivers/pci/pci.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 87359b6de82c..837e17aa8397 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -181,7 +181,7 @@ static void setup_device(struct pci_dev *dev, int max_bar)
 		pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, orig);
 
 		if (barval == 0 || barval == 0xffffffff) {
-			pr_debug("pbar%d set bad mask\n", bar);
+			pr_debug(" pbar%d: set bad mask (%08x)\n", bar, barval);
 			continue;
 		}
 
@@ -208,20 +208,21 @@ static void setup_device(struct pci_dev *dev, int max_bar)
 
 		size = pci_size(orig, barval, mask);
 		if (!size) {
-			pr_debug("pbar%d bad %s mask\n", bar, type);
+			pr_debug(" pbar%d: bad %s size (orig=%08x, barval=%08x, type=%s)\n",
+				 bar, type, orig, barval, type);
 			continue;
 		}
 
-		pr_debug("pbar%d: barval=%08x type=%s size=0x%x\n",
-			 bar, barval, type, size);
-
 		if (ALIGN(*last, size) + size > dev->bus->resource[restype]->end) {
-			pr_debug("BAR does not fit within bus %s res\n", type);
+			pr_debug(" pbar%d: !! type=%s allocbase=0x%08x + size=0x%08x > resource_end=%pa (barval=%08x)\n",
+				 bar, type, ALIGN(*last, size), size, &dev->bus->resource[restype]->end, barval);
 			return;
 		}
 
 		*last = ALIGN(*last, size);
-		pr_debug("pbar%d: allocated at 0x%08x\n", bar, *last);
+		pr_debug(" pbar%d: type=%s allocbase=0x%08x size=0x%08x (barval=%08x)\n",
+			 bar, type, *last, size, barval);
+
 		pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, *last);
 		dev->resource[bar].flags = resflags;
 		dev->resource[bar].start = *last;
-- 
2.16.3




More information about the barebox mailing list