Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1704584
| Path | csiph.com!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Yinghai Lu <yinghai@kernel.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 02/10] PCI: introduce ioport_res/iomem_res for PCI_TEST |
| Date | Sat, 05 Aug 2017 08:40:04 +0200 |
| Message-ID | <ub0UI-189-5@gated-at.bofh.it> (permalink) |
| References | <ub0UF-189-3@gated-at.bofh.it> |
| X-Original-To | Bjorn Helgaas <bhelgaas@google.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=VEOzeO/8fsyXCQZoDBLto7PS+U5kV8ImIl8iTrh3rgA=; b=gZ+04TfllEuonVleyZrdbDKXL/zL534xc/ioJuTQzWCNCWt9NbD+JreVoYSjWFyIn5 ZtDVQtPlvhuvj5QWbCySn1LRaQ3CWUMJoqJ06d62gz2Ykt/be48/n5IKBGD7V3bfyXg3 gslVKMpiPKJU3y1LNk0NYLEzaKNpPUSM919rc1YbUZai7YbCF87HJ/kJXaR6nUIGS0nF MU0+Wzi3VdoD8QzfShfY0Q9ZoQW61KqmkAFkRTzFD7p/xCYnreV8W0O94yo79mzOzD3e lm4SKrsQM3WjC+1Bf/f7COLZz6Xy+TyFLL8+SaOohFPQiidFNJo/4lW/OeIDzPFbJmb2 30rw== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=VEOzeO/8fsyXCQZoDBLto7PS+U5kV8ImIl8iTrh3rgA=; b=TGUiuoJ9XmhZhODaCUXKfgVb6v7vmr7+Y3XT3ElvNQ2Hc+pFywF234nrBb58x/+rmb ru9oBBfnHFwKHeLp3mdWZ8Wux8f84ol+cFjx49Jw+GLd+c/yk7mO6+Ev4yZv9cYVuUQj A1euek9lCm4K6w6g7Tfvfvg0lm62JmhEf7QjygtRN0iVj4UIvVDjcI45gnSGMAs4aUIh gp53ekBi1N2ukLhqFhdUPqB/hd+6FVKFs/QELMFej9Y/fZyNP1i7NTzeQ1UtYNYHenLR 5wxGUSo6S77a9oc0qDIh2AJ1+MQrP10JlsEFuKEmoWAm5x8ZAZJHeWNvVTbAHZgfJfg2 EiIA== |
| X-Gm-Message-State | AIVw1111RKMbNcSY+eYbDlSBgqFk4fO+SUlDFWNxIG7d1w1UyGS9rBN5 ssyoKRQM6rW+UA== |
| X-Received | by 10.98.65.220 with SMTP id g89mr4956530pfd.122.1501915107495; Fri, 04 Aug 2017 23:38:27 -0700 (PDT) |
| X-Mailer | git-send-email 2.9.4 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 102 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Linus Torvalds <torvalds@linux-foundation.org>, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu <yinghai@kernel.org> |
| X-Original-Date | Fri, 4 Aug 2017 23:37:53 -0700 |
| X-Original-Message-ID | <20170805063801.15880-3-yinghai@kernel.org> |
| X-Original-References | <20170805063801.15880-1-yinghai@kernel.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1704584 |
Show key headers only | View raw
Make every bus to take the pointer to correct iomem_res instead of
using iomem_resource directly.
So PCI_TEST could use different iomem_res later.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/pci/probe.c | 2 ++
drivers/pci/quirks.c | 2 +-
drivers/pci/setup-bus.c | 2 +-
drivers/pci/setup-res.c | 4 ++--
include/linux/pci.h | 13 +++++++++++++
5 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index c31310d..1811016 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -881,6 +881,8 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
child->msi = parent->msi;
child->sysdata = parent->sysdata;
child->bus_flags = parent->bus_flags;
+ child->iomem_res = parent->iomem_res;
+ child->ioport_res = parent->ioport_res;
/* initialize some portions of the bus device, but don't register it
* now as the parent is not properly set up yet.
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 6967c6b..dc31098 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1617,7 +1617,7 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)
* not touch this (and it's already covered by the fixmap), so
* forcibly insert it into the resource tree */
if (pci_resource_start(pdev, 0) && pci_resource_len(pdev, 0))
- insert_resource(&iomem_resource, &pdev->resource[0]);
+ insert_resource(iomem_res(pdev->bus), &pdev->resource[0]);
/* The next five BARs all seem to be rubbish, so just clean
* them out */
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 958da7d..1c30102 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -805,7 +805,7 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus,
struct resource *r;
pci_bus_for_each_resource(bus, r, i) {
- if (r == &ioport_resource || r == &iomem_resource)
+ if (r == ioport_res(bus) || r == iomem_res(bus))
continue;
if (r && (r->flags & type_mask) == type && !r->parent)
return r;
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 85774b7..43921a4 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -215,9 +215,9 @@ static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
root = pci_find_parent_resource(dev, res);
if (!root) {
if (res->flags & IORESOURCE_IO)
- root = &ioport_resource;
+ root = ioport_res(dev->bus);
else
- root = &iomem_resource;
+ root = iomem_res(dev->bus);
}
dev_info(&dev->dev, "BAR %d: trying firmware assignment %pR\n",
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 4869e66..c58a635 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -524,6 +524,9 @@ struct pci_bus {
void *sysdata; /* hook for sys-specific extension */
struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */
+ struct resource *iomem_res; /* pointer to root iomem_resource */
+ struct resource *ioport_res; /* pointer to root ioport_resource */
+
unsigned char number; /* bus number */
unsigned char primary; /* number of primary bridge */
unsigned char max_bus_speed; /* enum pci_bus_speed */
@@ -545,6 +548,16 @@ struct pci_bus {
#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
+static inline struct resource *iomem_res(struct pci_bus *bus)
+{
+ return bus->iomem_res ? : &iomem_resource;
+}
+
+static inline struct resource *ioport_res(struct pci_bus *bus)
+{
+ return bus->ioport_res ? : &ioport_resource;
+}
+
/*
* Returns true if the PCI bus is root (behind host-PCI bridge),
* false otherwise
--
2.9.4
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 02/10] PCI: introduce ioport_res/iomem_res for PCI_TEST Yinghai Lu <yinghai@kernel.org> - 2017-08-05 08:40 +0200
csiph-web