mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
ia64/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, include vgaarb.h] Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
d8801e4df9
commit
058a2e1bb0
1 changed files with 14 additions and 11 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <linux/pci.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/vgaarb.h>
|
||||
|
||||
#include <asm/machvec.h>
|
||||
|
||||
|
@ -19,9 +20,10 @@
|
|||
* IORESOURCE_ROM_SHADOW is used to associate the boot video
|
||||
* card with this copy. On laptops this copy has to be used since
|
||||
* the main ROM may be compressed or combined with another image.
|
||||
* See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
|
||||
* is marked here since the boot video device will be the only enabled
|
||||
* video device at this point.
|
||||
* See pci_map_rom() for use of this flag. Before marking the device
|
||||
* with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set
|
||||
* 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)
|
||||
|
@ -35,9 +37,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
|
|||
return;
|
||||
/* Maybe, this machine supports legacy memory map. */
|
||||
|
||||
if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
|
||||
return;
|
||||
|
||||
/* Is VGA routed to us? */
|
||||
bus = pdev->bus;
|
||||
while (bus) {
|
||||
|
@ -60,10 +59,14 @@ static void pci_fixup_video(struct pci_dev *pdev)
|
|||
}
|
||||
bus = bus->parent;
|
||||
}
|
||||
pci_read_config_word(pdev, PCI_COMMAND, &config);
|
||||
if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
|
||||
pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
|
||||
dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
|
||||
if (!vga_default_device() || pdev == vga_default_device()) {
|
||||
pci_read_config_word(pdev, PCI_COMMAND, &config);
|
||||
if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
|
||||
pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
|
||||
dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
|
||||
vga_set_default_device(pdev);
|
||||
}
|
||||
}
|
||||
}
|
||||
DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
|
||||
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
|
||||
PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
|
||||
|
|
Loading…
Reference in a new issue