diff mbox

Fix priority of non-BAR ROM data

Message ID 1343598582.15288.4.camel@shinybook.infradead.org
State Superseded
Headers show

Commit Message

David Woodhouse July 29, 2012, 9:49 p.m. UTC
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@intel.com>
---
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(-)

Comments

Matthew Garrett July 29, 2012, 9:53 p.m. UTC | #1
On Sun, Jul 29, 2012 at 10:49:42PM +0100, David Woodhouse wrote:
> +	 * 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);

Needs casting. My mistake.
Bjorn Helgaas Aug. 1, 2012, 2:20 p.m. UTC | #2
On Sun, Jul 29, 2012 at 3:53 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Sun, Jul 29, 2012 at 10:49:42PM +0100, David Woodhouse wrote:
>> +      * 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);
>
> Needs casting. My mistake.

Matthew, are you going to fold this into your patch and repost your
series, or is this a logically separate issue?
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Matthew Garrett Aug. 1, 2012, 2:26 p.m. UTC | #3
On Wed, Aug 01, 2012 at 08:20:15AM -0600, Bjorn Helgaas wrote:
> On Sun, Jul 29, 2012 at 3:53 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> > On Sun, Jul 29, 2012 at 10:49:42PM +0100, David Woodhouse wrote:
> >> +      * 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);
> >
> > Needs casting. My mistake.
> 
> Matthew, are you going to fold this into your patch and repost your
> series, or is this a logically separate issue?

I can fold it in.
diff mbox

Patch

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)) {