Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sander Eikelenboom and committed by
Bjorn Helgaas
058a2e1b d8801e4d

+14 -11
+14 -11
arch/ia64/pci/fixup.c
··· 5 5 6 6 #include <linux/pci.h> 7 7 #include <linux/init.h> 8 + #include <linux/vgaarb.h> 8 9 9 10 #include <asm/machvec.h> 10 11 ··· 20 19 * IORESOURCE_ROM_SHADOW is used to associate the boot video 21 20 * card with this copy. On laptops this copy has to be used since 22 21 * the main ROM may be compressed or combined with another image. 23 - * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW 24 - * is marked here since the boot video device will be the only enabled 25 - * video device at this point. 22 + * See pci_map_rom() for use of this flag. Before marking the device 23 + * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set 24 + * by either arch cde or vga-arbitration, if so only apply the fixup to this 25 + * already determined primary video card. 26 26 */ 27 27 28 28 static void pci_fixup_video(struct pci_dev *pdev) ··· 36 34 && (strcmp(ia64_platform_name, "hpzx1") != 0)) 37 35 return; 38 36 /* Maybe, this machine supports legacy memory map. */ 39 - 40 - if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) 41 - return; 42 37 43 38 /* Is VGA routed to us? */ 44 39 bus = pdev->bus; ··· 59 60 } 60 61 bus = bus->parent; 61 62 } 62 - pci_read_config_word(pdev, PCI_COMMAND, &config); 63 - if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 64 - pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 65 - dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 63 + if (!vga_default_device() || pdev == vga_default_device()) { 64 + pci_read_config_word(pdev, PCI_COMMAND, &config); 65 + if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 66 + pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 67 + dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 68 + vga_set_default_device(pdev); 69 + } 66 70 } 67 71 } 68 - DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video); 72 + DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, 73 + PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);