aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/pci/fixup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/pci/fixup.c')
-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);