[PATCH] Fix priority of non-BAR ROM data

From: David Woodhouse
Date: Sun Jul 29 2012 - 17:50:36 EST


If we've obtained the ROM data through other means (such as from EFI),
we don't want to ignore it just because the IORESOURCE_ROM_SHADOW bit has
got set. This fixes the Radeon ROM handling on my MacBookPro8,3 when booted
via grub1-efi.

Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx>
---
This fixes patch 3/4 'PCI: Add support for non-BAR ROMs' for me.

drivers/pci/rom.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 7ebaab6..4d437b5 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -118,6 +118,13 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
void __iomem *rom;

/*
+ * Some devices may provide ROMs via a source other than the BAR
+ */
+ if (pdev->rom && pdev->romlen) {
+ *size = pdev->romlen;
+ return phys_to_virt(pdev->rom);
+ }
+ /*
* IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy
* memory map if the VGA enable bit of the Bridge Control register is
* set for embedded VGA.
@@ -126,12 +133,6 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
/* primary video rom always starts here */
start = (loff_t)0xC0000;
*size = 0x20000; /* cover C000:0 through E000:0 */
- /*
- * Some devices may provide ROMs via a source other than the BAR
- */
- } else if (pdev->rom && pdev->romlen) {
- *size = pdev->romlen;
- return phys_to_virt(pdev->rom);
} else {
if (res->flags &
(IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) {
--
1.7.11.2



--
dwmw2

Attachment: smime.p7s
Description: S/MIME cryptographic signature