2 * Exceptions for specific devices. Usually work-arounds for fatal design flaws.
3 * Derived from fixup.c of i386 tree.
7 #include <linux/init.h>
8 #include <linux/vgaarb.h>
9 #include <linux/screen_info.h>
11 #include <asm/machvec.h>
14 * Fixup to mark boot BIOS video selected by BIOS before it changes
16 * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
18 * The standard boot ROM sequence for an x86 machine uses the BIOS
19 * to select an initial video card for boot display. This boot video
20 * card will have it's BIOS copied to C0000 in system RAM.
21 * IORESOURCE_ROM_SHADOW is used to associate the boot video
22 * card with this copy. On laptops this copy has to be used since
23 * the main ROM may be compressed or combined with another image.
24 * See pci_map_rom() for use of this flag. Before marking the device
25 * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set
26 * by either arch cde or vga-arbitration, if so only apply the fixup to this
27 * already determined primary video card.
30 static void pci_fixup_video(struct pci_dev
*pdev
)
32 struct pci_dev
*bridge
;
36 if ((strcmp(ia64_platform_name
, "dig") != 0)
37 && (strcmp(ia64_platform_name
, "hpzx1") != 0))
39 /* Maybe, this machine supports legacy memory map. */
41 /* Is VGA routed to us? */
47 * From information provided by
48 * "David Miller" <davem@davemloft.net>
49 * The bridge control register is valid for PCI header
50 * type BRIDGE, or CARDBUS. Host to PCI controllers use
51 * PCI header type NORMAL.
53 if (bridge
&& (pci_is_bridge(bridge
))) {
54 pci_read_config_word(bridge
, PCI_BRIDGE_CONTROL
,
56 if (!(config
& PCI_BRIDGE_CTL_VGA
))
61 if (!vga_default_device() || pdev
== vga_default_device()) {
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
, "Video device with shadowed ROM\n");
69 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID
, PCI_ANY_ID
,
70 PCI_CLASS_DISPLAY_VGA
, 8, pci_fixup_video
);