aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMyron Stowe <mstowe@redhat.com>2011-11-21 13:54:07 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-02-14 11:44:45 -0500
commit351fc6d1a5175d587d4f2b00ec7bff79b13ec48a (patch)
tree7f75b60c3a010e5699e43b38853fbd33f85d9267 /drivers
parent3682a3946d2b0bad621db871e3bead83e523a238 (diff)
PCI: Fix starting basis for resource requests
pci_revert_fw_address() is used to reinstate a PCI device's original FW-assigned BIOS BAR value(s) if normal resource assignment fails. When attempting to reinstate an address, the point within the resource tree from which to attempt the new resource request should be the parent resource corresponding to the device, not the base of the resource tree (ioport_resource or iomem_resource). For PCI devices this would typically be the resource corresponding to the upstream PCI host bridge or P2P bridge aperture. This patch sets the point within the resource tree to attempt a new resource assignment request to the PCI device's parent resource and only if that fails does it fall back to the base ioport_resource or iomem_resource. Signed-off-by: Myron Stowe <myron.stowe@redhat.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/setup-res.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index b66bfdbd21f7..3cf47d34becf 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -165,15 +165,19 @@ static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
165 resource_size_t start, end; 165 resource_size_t start, end;
166 int ret = 0; 166 int ret = 0;
167 167
168 if (res->flags & IORESOURCE_IO)
169 root = &ioport_resource;
170 else
171 root = &iomem_resource;
172
173 start = res->start; 168 start = res->start;
174 end = res->end; 169 end = res->end;
175 res->start = dev->fw_addr[resno]; 170 res->start = dev->fw_addr[resno];
176 res->end = res->start + size - 1; 171 res->end = res->start + size - 1;
172
173 root = pci_find_parent_resource(dev, res);
174 if (!root) {
175 if (res->flags & IORESOURCE_IO)
176 root = &ioport_resource;
177 else
178 root = &iomem_resource;
179 }
180
177 dev_info(&dev->dev, "BAR %d: trying firmware assignment %pR\n", 181 dev_info(&dev->dev, "BAR %d: trying firmware assignment %pR\n",
178 resno, res); 182 resno, res);
179 conflict = request_resource_conflict(root, res); 183 conflict = request_resource_conflict(root, res);