Commit d8801e4d authored by Sander Eikelenboom's avatar Sander Eikelenboom Committed by Bjorn Helgaas

x86/PCI: Set IORESOURCE_ROM_SHADOW only for the default VGA device

Setting the IORESOURCE_ROM_SHADOW flag on a VGA card other than the primary
prevents it from reading its own ROM.  It will get the content of the
shadow ROM at C000 instead, which is of the primary VGA card and the driver
of the secondary card will bail out.

Fix this by checking if the arch code or vga-arbitration has already
determined the vga_default_device, if so only apply the fix to this primary
video device and let the comment reflect this.

[bhelgaas: add subject, split x86 & ia64 into separate patches]
Signed-off-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 5ee09efe
...@@ -313,9 +313,10 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_r ...@@ -313,9 +313,10 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_r
* IORESOURCE_ROM_SHADOW is used to associate the boot video * IORESOURCE_ROM_SHADOW is used to associate the boot video
* card with this copy. On laptops this copy has to be used since * card with this copy. On laptops this copy has to be used since
* the main ROM may be compressed or combined with another image. * the main ROM may be compressed or combined with another image.
* See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW * See pci_map_rom() for use of this flag. Before marking the device
* is marked here since the boot video device will be the only enabled * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set
* video device at this point. * by either arch cde or vga-arbitration, if so only apply the fixup to this
* already determined primary video card.
*/ */
static void pci_fixup_video(struct pci_dev *pdev) static void pci_fixup_video(struct pci_dev *pdev)
...@@ -346,13 +347,14 @@ static void pci_fixup_video(struct pci_dev *pdev) ...@@ -346,13 +347,14 @@ static void pci_fixup_video(struct pci_dev *pdev)
} }
bus = bus->parent; bus = bus->parent;
} }
if (!vga_default_device() || pdev == vga_default_device()) {
pci_read_config_word(pdev, PCI_COMMAND, &config); pci_read_config_word(pdev, PCI_COMMAND, &config);
if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
if (!vga_default_device())
vga_set_default_device(pdev); vga_set_default_device(pdev);
} }
}
} }
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment