diff options
Diffstat (limited to 'drivers/pci/rom.c')
-rw-r--r-- | drivers/pci/rom.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index 0b3037ab8b93..ab886b7ee327 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(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))) |