aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorMyron Stowe <mstowe@redhat.com>2011-11-21 13:54:19 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-02-14 11:44:46 -0500
commit6535943fbf25c8e9419a6b20ca992633baa0bf99 (patch)
treead7eab22b1a193b37a47b804f49451bd7405833d /drivers/pci
parent925845bd49c6de437dfab3bf8dc654ea3ae21d74 (diff)
x86/PCI: Convert maintaining FW-assigned BIOS BAR values to use a list
This patch converts the underlying maintenance aspects of FW-assigned BIOS BAR values from a statically allocated array within struct pci_dev to a list of temporary, stand alone, entries. Signed-off-by: Myron Stowe <myron.stowe@redhat.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/setup-res.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 3cf47d34becf..85c8470c35e2 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -158,16 +158,34 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
158 return ret; 158 return ret;
159} 159}
160 160
161/*
162 * Generic function that returns a value indicating that the device's
163 * original BIOS BAR address was not saved and so is not available for
164 * reinstatement.
165 *
166 * Can be over-ridden by architecture specific code that implements
167 * reinstatement functionality rather than leaving it disabled when
168 * normal allocation attempts fail.
169 */
170resource_size_t __weak pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx)
171{
172 return 0;
173}
174
161static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev, 175static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
162 int resno, resource_size_t size) 176 int resno, resource_size_t size)
163{ 177{
164 struct resource *root, *conflict; 178 struct resource *root, *conflict;
165 resource_size_t start, end; 179 resource_size_t fw_addr, start, end;
166 int ret = 0; 180 int ret = 0;
167 181
182 fw_addr = pcibios_retrieve_fw_addr(dev, resno);
183 if (!fw_addr)
184 return 1;
185
168 start = res->start; 186 start = res->start;
169 end = res->end; 187 end = res->end;
170 res->start = dev->fw_addr[resno]; 188 res->start = fw_addr;
171 res->end = res->start + size - 1; 189 res->end = res->start + size - 1;
172 190
173 root = pci_find_parent_resource(dev, res); 191 root = pci_find_parent_resource(dev, res);
@@ -271,7 +289,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
271 * where firmware left it. That at least has a chance of 289 * where firmware left it. That at least has a chance of
272 * working, which is better than just leaving it disabled. 290 * working, which is better than just leaving it disabled.
273 */ 291 */
274 if (ret < 0 && dev->fw_addr[resno]) 292 if (ret < 0)
275 ret = pci_revert_fw_address(res, dev, resno, size); 293 ret = pci_revert_fw_address(res, dev, resno, size);
276 294
277 if (!ret) { 295 if (!ret) {