From: Bjorn Helgaas <helgaas@kernel.org>
To: linux-pci@vger.kernel.org
Cc: Puranjay Mohan <puranjay12@gmail.com>,
linux-kernel@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH 6/7] PCI: Log bridge windows conditionally
Date: Tue, 5 Dec 2023 11:11:18 -0600 [thread overview]
Message-ID: <20231205171119.680358-7-helgaas@kernel.org> (raw)
In-Reply-To: <20231205171119.680358-1-helgaas@kernel.org>
From: Bjorn Helgaas <bhelgaas@google.com>
Previously pci_read_bridge_io(), pci_read_bridge_mmio(), and
pci_read_bridge_mmio_pref() unconditionally logged the bridge window
resource. A future change will call these functions earlier and more
often. Add a "log" parameter so callers can control whether to generate
the log message. No functional change intended.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/probe.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5ac9c150e68b..485d8c7aae04 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -344,7 +344,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
}
}
-static void pci_read_bridge_io(struct pci_dev *dev, struct resource *res)
+static void pci_read_bridge_io(struct pci_dev *dev, struct resource *res,
+ bool log)
{
u8 io_base_lo, io_limit_lo;
unsigned long io_mask, io_granularity, base, limit;
@@ -377,11 +378,13 @@ static void pci_read_bridge_io(struct pci_dev *dev, struct resource *res)
region.start = base;
region.end = limit + io_granularity - 1;
pcibios_bus_to_resource(dev->bus, res, ®ion);
- pci_info(dev, " bridge window %pR\n", res);
+ if (log)
+ pci_info(dev, " bridge window %pR\n", res);
}
}
-static void pci_read_bridge_mmio(struct pci_dev *dev, struct resource *res)
+static void pci_read_bridge_mmio(struct pci_dev *dev, struct resource *res,
+ bool log)
{
u16 mem_base_lo, mem_limit_lo;
unsigned long base, limit;
@@ -396,11 +399,13 @@ static void pci_read_bridge_mmio(struct pci_dev *dev, struct resource *res)
region.start = base;
region.end = limit + 0xfffff;
pcibios_bus_to_resource(dev->bus, res, ®ion);
- pci_info(dev, " bridge window %pR\n", res);
+ if (log)
+ pci_info(dev, " bridge window %pR\n", res);
}
}
-static void pci_read_bridge_mmio_pref(struct pci_dev *dev, struct resource *res)
+static void pci_read_bridge_mmio_pref(struct pci_dev *dev, struct resource *res,
+ bool log)
{
u16 mem_base_lo, mem_limit_lo;
u64 base64, limit64;
@@ -446,7 +451,8 @@ static void pci_read_bridge_mmio_pref(struct pci_dev *dev, struct resource *res)
region.start = base;
region.end = limit + 0xfffff;
pcibios_bus_to_resource(dev->bus, res, ®ion);
- pci_info(dev, " bridge window %pR\n", res);
+ if (log)
+ pci_info(dev, " bridge window %pR\n", res);
}
}
@@ -518,9 +524,9 @@ void pci_read_bridge_bases(struct pci_bus *child)
for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++)
child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES+i];
- pci_read_bridge_io(child->self, child->resource[0]);
- pci_read_bridge_mmio(child->self, child->resource[1]);
- pci_read_bridge_mmio_pref(child->self, child->resource[2]);
+ pci_read_bridge_io(child->self, child->resource[0], true);
+ pci_read_bridge_mmio(child->self, child->resource[1], true);
+ pci_read_bridge_mmio_pref(child->self, child->resource[2], true);
if (dev->transparent) {
pci_bus_for_each_resource(child->parent, res) {
--
2.34.1
next prev parent reply other threads:[~2023-12-05 17:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 17:11 [PATCH 0/7] PCI: Improve enumeration logging Bjorn Helgaas
2023-12-05 17:11 ` [PATCH 1/7] PCI: Log device type during enumeration Bjorn Helgaas
2023-12-06 0:31 ` Bjorn Helgaas
2023-12-05 17:11 ` [PATCH 2/7] PCI: Update BAR # and window messages Bjorn Helgaas
2023-12-05 17:11 ` [PATCH 3/7] PCI: Use resource names in PCI log messages Bjorn Helgaas
2023-12-05 17:11 ` [PATCH 4/7] PCI: Move pci_read_bridge_windows() below individual window accessors Bjorn Helgaas
2023-12-05 17:11 ` [PATCH 5/7] PCI: Supply bridge device, not secondary bus, to read window details Bjorn Helgaas
2023-12-05 17:11 ` Bjorn Helgaas [this message]
2023-12-05 17:11 ` [PATCH 7/7] PCI: Log bridge info when first enumerating bridge Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231205171119.680358-7-helgaas@kernel.org \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=puranjay12@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox