aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreiichiro.oiwa.nm@hitachi.com <eiichiro.oiwa.nm@hitachi.com>2006-09-28 00:55:47 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-10-18 14:36:11 -0400
commitb5e4efe7e061ff52ac97b9fa45acca529d8daeea (patch)
tree39937f2f6c50525abc0111dca1de91030568e6d5
parentbacedce32b171cd461a7da3160ad794e2240c67a (diff)
PCI: Turn pci_fixup_video into generic for embedded VGA
pci_fixup_video turns into generic code because there are many platforms need this fixup for embedded VGA as well as x86. The Video BIOS integrates into System BIOS on a machine has embedded VGA although embedded VGA generally don't have PCI ROM. As a result, embedded VGA need the way that the sysfs rom points to the Video BIOS of System RAM (0xC0000). PCI-to-PCI Bridge Architecture specification describes the condition whether or not PCI ROM forwards VGA compatible memory address. fixup_video suits this specification. Although the Video ROM generally implements in x86 code regardless of platform, some application such as X Window System can run this code by dosemu86. Therefore, pci_fixup_video should turn into generic code. Signed-off-by: Eiichiro Oiwa <eiichiro.oiwa.nm@hitachi.com> Acked-by: Alan Cox <alan@redhat.com> Acked-by: Jesse Barnes <jesse.barnes@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--arch/i386/pci/fixup.c45
-rw-r--r--drivers/pci/quirks.c45
-rw-r--r--drivers/pci/rom.c5
3 files changed, 49 insertions, 46 deletions
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
index b60d7e8689ed..908b410f4c93 100644
--- a/arch/i386/pci/fixup.c
+++ b/arch/i386/pci/fixup.c
@@ -343,51 +343,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC, pcie_ro
343DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_rootport_aspm_quirk ); 343DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_rootport_aspm_quirk );
344 344
345/* 345/*
346 * Fixup to mark boot BIOS video selected by BIOS before it changes
347 *
348 * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
349 *
350 * The standard boot ROM sequence for an x86 machine uses the BIOS
351 * to select an initial video card for boot display. This boot video
352 * card will have it's BIOS copied to C0000 in system RAM.
353 * IORESOURCE_ROM_SHADOW is used to associate the boot video
354 * card with this copy. On laptops this copy has to be used since
355 * the main ROM may be compressed or combined with another image.
356 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
357 * is marked here since the boot video device will be the only enabled
358 * video device at this point.
359 */
360
361static void __devinit pci_fixup_video(struct pci_dev *pdev)
362{
363 struct pci_dev *bridge;
364 struct pci_bus *bus;
365 u16 config;
366
367 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
368 return;
369
370 /* Is VGA routed to us? */
371 bus = pdev->bus;
372 while (bus) {
373 bridge = bus->self;
374 if (bridge) {
375 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
376 &config);
377 if (!(config & PCI_BRIDGE_CTL_VGA))
378 return;
379 }
380 bus = bus->parent;
381 }
382 pci_read_config_word(pdev, PCI_COMMAND, &config);
383 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
384 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
385 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
386 }
387}
388DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
389
390/*
391 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A. 346 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A.
392 * 347 *
393 * We pretend to bring them out of full D3 state, and restore the proper 348 * We pretend to bring them out of full D3 state, and restore the proper
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 1d2ccda946fd..371ab8821f10 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1619,6 +1619,51 @@ static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
1619} 1619}
1620DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); 1620DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
1621 1621
1622/*
1623 * Fixup to mark boot BIOS video selected by BIOS before it changes
1624 *
1625 * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
1626 *
1627 * The standard boot ROM sequence for an x86 machine uses the BIOS
1628 * to select an initial video card for boot display. This boot video
1629 * card will have it's BIOS copied to C0000 in system RAM.
1630 * IORESOURCE_ROM_SHADOW is used to associate the boot video
1631 * card with this copy. On laptops this copy has to be used since
1632 * the main ROM may be compressed or combined with another image.
1633 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
1634 * is marked here since the boot video device will be the only enabled
1635 * video device at this point.
1636 */
1637
1638static void __devinit fixup_video(struct pci_dev *pdev)
1639{
1640 struct pci_dev *bridge;
1641 struct pci_bus *bus;
1642 u16 config;
1643
1644 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
1645 return;
1646
1647 /* Is VGA routed to us? */
1648 bus = pdev->bus;
1649 while (bus) {
1650 bridge = bus->self;
1651 if (bridge) {
1652 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
1653 &config);
1654 if (!(config & PCI_BRIDGE_CTL_VGA))
1655 return;
1656 }
1657 bus = bus->parent;
1658 }
1659 pci_read_config_word(pdev, PCI_COMMAND, &config);
1660 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
1661 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
1662 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
1663 }
1664}
1665DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, fixup_video);
1666
1622 1667
1623static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end) 1668static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end)
1624{ 1669{
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index f5ee7ce16fa6..43e4a49f2cc4 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -71,7 +71,10 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
71 void __iomem *image; 71 void __iomem *image;
72 int last_image; 72 int last_image;
73 73
74 /* IORESOURCE_ROM_SHADOW only set on x86 */ 74 /*
75 * IORESOURCE_ROM_SHADOW set if the VGA enable bit of the Bridge Control
76 * register is set for embedded VGA.
77 */
75 if (res->flags & IORESOURCE_ROM_SHADOW) { 78 if (res->flags & IORESOURCE_ROM_SHADOW) {
76 /* primary video rom always starts here */ 79 /* primary video rom always starts here */
77 start = (loff_t)0xC0000; 80 start = (loff_t)0xC0000;