aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorSander Eikelenboom <linux@eikelenboom.it>2014-02-14 13:55:13 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-02-14 15:25:45 -0500
commit058a2e1bb065f143a291fa0df88274cecd228f28 (patch)
tree0761623c9598f983fcd4c913dd9bf669dd048979 /arch/ia64
parentd8801e4df91ee788486a11b36f45aa04784f7b4a (diff)
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>
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/pci/fixup.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index 5dc969dd4ac0..eee069a0b539 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/vgaarb.h>
8 9
9#include <asm/machvec.h> 10#include <asm/machvec.h>
10 11
@@ -19,9 +20,10 @@
19 * IORESOURCE_ROM_SHADOW is used to associate the boot video 20 * IORESOURCE_ROM_SHADOW is used to associate the boot video
20 * card with this copy. On laptops this copy has to be used since 21 * card with this copy. On laptops this copy has to be used since
21 * the main ROM may be compressed or combined with another image. 22 * the main ROM may be compressed or combined with another image.
22 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW 23 * See pci_map_rom() for use of this flag. Before marking the device
23 * is marked here since the boot video device will be the only enabled 24 * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set
24 * video device at this point. 25 * by either arch cde or vga-arbitration, if so only apply the fixup to this
26 * already determined primary video card.
25 */ 27 */
26 28
27static void pci_fixup_video(struct pci_dev *pdev) 29static void pci_fixup_video(struct pci_dev *pdev)
@@ -35,9 +37,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
35 return; 37 return;
36 /* Maybe, this machine supports legacy memory map. */ 38 /* Maybe, this machine supports legacy memory map. */
37 39
38 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
39 return;
40
41 /* Is VGA routed to us? */ 40 /* Is VGA routed to us? */
42 bus = pdev->bus; 41 bus = pdev->bus;
43 while (bus) { 42 while (bus) {
@@ -60,10 +59,14 @@ static void pci_fixup_video(struct pci_dev *pdev)
60 } 59 }
61 bus = bus->parent; 60 bus = bus->parent;
62 } 61 }
63 pci_read_config_word(pdev, PCI_COMMAND, &config); 62 if (!vga_default_device() || pdev == vga_default_device()) {
64 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 63 pci_read_config_word(pdev, PCI_COMMAND, &config);
65 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 64 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
66 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 65 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
66 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
67 vga_set_default_device(pdev);
68 }
67 } 69 }
68} 70}
69DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video); 71DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
72 PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);