aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2012-12-06 16:37:32 -0500
committerBjorn Helgaas <bhelgaas@google.com>2012-12-06 16:37:32 -0500
commit72e1e868ca8f14ef34c95e0e8b73f64b6acf5934 (patch)
treed3bc99f121693ab8f09c03ea555254c9314ff98d /drivers/pci
parentedb1daab8e91338b7e2a6c41faec695891ccda35 (diff)
parentf9a37be0f02a943d63e3346b19f9c9d8d91826cb (diff)
Merge branch 'pci/mjg-pci-roms-from-efi' into next
* pci/mjg-pci-roms-from-efi: x86: Use PCI setup data PCI: Add support for non-BAR ROMs PCI: Add pcibios_add_device EFI: Stash ROMs if they're not in the PCI BAR
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/bus.c5
-rw-r--r--drivers/pci/pci.c13
-rw-r--r--drivers/pci/rom.c11
3 files changed, 27 insertions, 2 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index a543746fb354..ad6a8b635692 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -170,6 +170,11 @@ int pci_bus_add_device(struct pci_dev *dev)
170 int retval; 170 int retval;
171 171
172 pci_fixup_device(pci_fixup_final, dev); 172 pci_fixup_device(pci_fixup_final, dev);
173
174 retval = pcibios_add_device(dev);
175 if (retval)
176 return retval;
177
173 retval = device_add(&dev->dev); 178 retval = device_add(&dev->dev);
174 if (retval) 179 if (retval)
175 return retval; 180 return retval;
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5b862b1c93c6..7c2e25ee2c5a 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1333,6 +1333,19 @@ void pcim_pin_device(struct pci_dev *pdev)
1333 dr->pinned = 1; 1333 dr->pinned = 1;
1334} 1334}
1335 1335
1336/*
1337 * pcibios_add_device - provide arch specific hooks when adding device dev
1338 * @dev: the PCI device being added
1339 *
1340 * Permits the platform to provide architecture specific functionality when
1341 * devices are added. This is the default implementation. Architecture
1342 * implementations can override this.
1343 */
1344int __weak pcibios_add_device (struct pci_dev *dev)
1345{
1346 return 0;
1347}
1348
1336/** 1349/**
1337 * pcibios_disable_device - disable arch specific PCI resources for device dev 1350 * pcibios_disable_device - disable arch specific PCI resources for device dev
1338 * @dev: the PCI device to disable 1351 * @dev: the PCI device to disable
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 0b3037ab8b93..3a3828fbc879 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -118,11 +118,17 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
118 void __iomem *rom; 118 void __iomem *rom;
119 119
120 /* 120 /*
121 * Some devices may provide ROMs via a source other than the BAR
122 */
123 if (pdev->rom && pdev->romlen) {
124 *size = pdev->romlen;
125 return phys_to_virt((phys_addr_t)pdev->rom);
126 /*
121 * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy 127 * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy
122 * memory map if the VGA enable bit of the Bridge Control register is 128 * memory map if the VGA enable bit of the Bridge Control register is
123 * set for embedded VGA. 129 * set for embedded VGA.
124 */ 130 */
125 if (res->flags & IORESOURCE_ROM_SHADOW) { 131 } else if (res->flags & IORESOURCE_ROM_SHADOW) {
126 /* primary video rom always starts here */ 132 /* primary video rom always starts here */
127 start = (loff_t)0xC0000; 133 start = (loff_t)0xC0000;
128 *size = 0x20000; /* cover C000:0 through E000:0 */ 134 *size = 0x20000; /* cover C000:0 through E000:0 */
@@ -181,7 +187,8 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom)
181 if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) 187 if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY))
182 return; 188 return;
183 189
184 iounmap(rom); 190 if (!pdev->rom || !pdev->romlen)
191 iounmap(rom);
185 192
186 /* Disable again before continuing, leave enabled if pci=rom */ 193 /* Disable again before continuing, leave enabled if pci=rom */
187 if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) 194 if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW)))