To be compatible with Xorg's handling of PCI, we need pci_fixup_video on IA64
platform like x86 platform. There are also machines, which have VGA embedded
into main board, among IA64 platform. Embedded VGA generally don't have PCI ROM,
and there are VGA ROM image in System BIOS. Therefore, these machines need
pci_fixup_video for the sysfs rom. pci_fixup_video already exists in x86 Linux
kernel. However since this function doesn't exist in IA64 kernel, we could not
run X server on IA64 box has embedded-VGA.
I tested pci_fixup_video on IA64 box has embedded-VGA. I confirmed we can read
VGA BIOS from the sysfs rom regardless of embedded-VGA.
Signed-off-by: Eiichiro Oiwa <[email protected]>
---
diff -dupNr linux-2.6.18.orig/arch/ia64/pci/Makefile linux-2.6.18/arch/ia64/pci/Makefile
--- linux-2.6.18.orig/arch/ia64/pci/Makefile 2006-09-20 12:42:06.000000000 +0900
+++ linux-2.6.18/arch/ia64/pci/Makefile 2006-09-25 18:36:50.000000000 +0900
@@ -1,4 +1,4 @@
#
# Makefile for the ia64-specific parts of the pci bus
#
-obj-y := pci.o
+obj-y := pci.o fixup.o
diff -dupNr linux-2.6.18.orig/arch/ia64/pci/fixup.c linux-2.6.18/arch/ia64/pci/fixup.c
--- linux-2.6.18.orig/arch/ia64/pci/fixup.c 1970-01-01 09:00:00.000000000 +0900
+++ linux-2.6.18/arch/ia64/pci/fixup.c 2006-09-25 18:35:12.000000000 +0900
@@ -0,0 +1,56 @@
+/*
+ * Exceptions for specific devices. Usually work-arounds for fatal design flaws.
+ *
+ * Derived from fixup.c of i386 tree.
+ */
+
+#include <linux/delay.h>
+#include <linux/dmi.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+
+
+/*
+ * Fixup to mark boot BIOS video selected by BIOS before it changes
+ *
+ * From information provided by "Jon Smirl" <[email protected]>
+ *
+ * The standard boot ROM sequence for an x86 machine uses the BIOS
+ * to select an initial video card for boot display. This boot video
+ * card will have it's BIOS copied to C0000 in system RAM.
+ * IORESOURCE_ROM_SHADOW is used to associate the boot video
+ * card with this copy. On laptops this copy has to be used since
+ * the main ROM may be compressed or combined with another image.
+ * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
+ * is marked here since the boot video device will be the only enabled
+ * video device at this point.
+ */
+
+static void __devinit pci_fixup_video(struct pci_dev *pdev)
+{
+ struct pci_dev *bridge;
+ struct pci_bus *bus;
+ u16 config;
+
+ if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
+ return;
+
+ /* Is VGA routed to us? */
+ bus = pdev->bus;
+ while (bus) {
+ bridge = bus->self;
+ if (bridge) {
+ pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
+ &config);
+ if (!(config & PCI_BRIDGE_CTL_VGA))
+ return;
+ }
+ bus = bus->parent;
+ }
+ pci_read_config_word(pdev, PCI_COMMAND, &config);
+ if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
+ pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
+ printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
+ }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
On Tuesday 26 September 2006 01:42, [email protected] wrote:
> To be compatible with Xorg's handling of PCI, we need pci_fixup_video on IA64
> platform like x86 platform. There are also machines, which have VGA embedded
> into main board, among IA64 platform. Embedded VGA generally don't have PCI ROM,
> and there are VGA ROM image in System BIOS. Therefore, these machines need
> pci_fixup_video for the sysfs rom. pci_fixup_video already exists in x86 Linux
> kernel. However since this function doesn't exist in IA64 kernel, we could not
> run X server on IA64 box has embedded-VGA.
>
> I tested pci_fixup_video on IA64 box has embedded-VGA. I confirmed we can read
> VGA BIOS from the sysfs rom regardless of embedded-VGA.
What other architectures will need this? There's nothing ia64-specific
in the patch below. Can it be put somewhere more generic?
> diff -dupNr linux-2.6.18.orig/arch/ia64/pci/Makefile linux-2.6.18/arch/ia64/pci/Makefile
> --- linux-2.6.18.orig/arch/ia64/pci/Makefile 2006-09-20 12:42:06.000000000 +0900
> +++ linux-2.6.18/arch/ia64/pci/Makefile 2006-09-25 18:36:50.000000000 +0900
> @@ -1,4 +1,4 @@
> #
> # Makefile for the ia64-specific parts of the pci bus
> #
> -obj-y := pci.o
> +obj-y := pci.o fixup.o
> diff -dupNr linux-2.6.18.orig/arch/ia64/pci/fixup.c linux-2.6.18/arch/ia64/pci/fixup.c
> --- linux-2.6.18.orig/arch/ia64/pci/fixup.c 1970-01-01 09:00:00.000000000 +0900
> +++ linux-2.6.18/arch/ia64/pci/fixup.c 2006-09-25 18:35:12.000000000 +0900
> @@ -0,0 +1,56 @@
> +/*
> + * Exceptions for specific devices. Usually work-arounds for fatal design flaws.
> + *
> + * Derived from fixup.c of i386 tree.
> + */
> +
> +#include <linux/delay.h>
> +#include <linux/dmi.h>
> +#include <linux/pci.h>
> +#include <linux/init.h>
> +
> +
> +/*
> + * Fixup to mark boot BIOS video selected by BIOS before it changes
> + *
> + * From information provided by "Jon Smirl" <[email protected]>
> + *
> + * The standard boot ROM sequence for an x86 machine uses the BIOS
> + * to select an initial video card for boot display. This boot video
> + * card will have it's BIOS copied to C0000 in system RAM.
> + * IORESOURCE_ROM_SHADOW is used to associate the boot video
> + * card with this copy. On laptops this copy has to be used since
> + * the main ROM may be compressed or combined with another image.
> + * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
> + * is marked here since the boot video device will be the only enabled
> + * video device at this point.
> + */
> +
> +static void __devinit pci_fixup_video(struct pci_dev *pdev)
> +{
> + struct pci_dev *bridge;
> + struct pci_bus *bus;
> + u16 config;
> +
> + if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
> + return;
> +
> + /* Is VGA routed to us? */
> + bus = pdev->bus;
> + while (bus) {
> + bridge = bus->self;
> + if (bridge) {
> + pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
> + &config);
> + if (!(config & PCI_BRIDGE_CTL_VGA))
> + return;
> + }
> + bus = bus->parent;
> + }
> + pci_read_config_word(pdev, PCI_COMMAND, &config);
> + if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
> + pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
> + printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
> + }
> +}
> +DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
On Tuesday, September 26, 2006 8:09 am, Bjorn Helgaas wrote:
> On Tuesday 26 September 2006 01:42, [email protected] wrote:
> > To be compatible with Xorg's handling of PCI, we need pci_fixup_video
> > on IA64 platform like x86 platform. There are also machines, which
> > have VGA embedded into main board, among IA64 platform. Embedded VGA
> > generally don't have PCI ROM, and there are VGA ROM image in System
> > BIOS. Therefore, these machines need pci_fixup_video for the sysfs
> > rom. pci_fixup_video already exists in x86 Linux kernel. However since
> > this function doesn't exist in IA64 kernel, we could not run X server
> > on IA64 box has embedded-VGA.
> >
> > I tested pci_fixup_video on IA64 box has embedded-VGA. I confirmed we
> > can read VGA BIOS from the sysfs rom regardless of embedded-VGA.
>
> What other architectures will need this? There's nothing ia64-specific
> in the patch below. Can it be put somewhere more generic?
It could go into drivers/pci, but setting the flag implies that the ROM is
at 0xc0000, so it does have some arch dependencies (though at least x86,
x86_64 and ia64 have machines that do this).
Jesse
On Tuesday, September 26, 2006 12:42 am, [email protected]
wrote:
> To be compatible with Xorg's handling of PCI, we need pci_fixup_video on
> IA64 platform like x86 platform. There are also machines, which have VGA
> embedded into main board, among IA64 platform. Embedded VGA generally
> don't have PCI ROM, and there are VGA ROM image in System BIOS.
> Therefore, these machines need pci_fixup_video for the sysfs rom.
> pci_fixup_video already exists in x86 Linux kernel. However since this
> function doesn't exist in IA64 kernel, we could not run X server on IA64
> box has embedded-VGA.
>
> I tested pci_fixup_video on IA64 box has embedded-VGA. I confirmed we
> can read VGA BIOS from the sysfs rom regardless of embedded-VGA.
Looks good, Eiichiro, thanks for posting this.
> +#include <linux/delay.h>
> +#include <linux/dmi.h>
> +#include <linux/pci.h>
> +#include <linux/init.h>
For this version, I don't think you need delay.h or dmi.h. And like Bjorn
mentioned, this could probably be turned into generic code in drivers/pci
so we don't have too much duplication with x86 (and like I mentioned,
x86_64 could probably use this too).
Jesse
>>On Tuesday, September 26, 2006 12:42 am, [email protected]
>>wrote:
>>> To be compatible with Xorg's handling of PCI, we need pci_fixup_video on
>>> IA64 platform like x86 platform. There are also machines, which have VGA
>>> embedded into main board, among IA64 platform. Embedded VGA generally
>>> don't have PCI ROM, and there are VGA ROM image in System BIOS.
>>> Therefore, these machines need pci_fixup_video for the sysfs rom.
>>> pci_fixup_video already exists in x86 Linux kernel. However since this
>>> function doesn't exist in IA64 kernel, we could not run X server on IA64
>>> box has embedded-VGA.
>>>
>>> I tested pci_fixup_video on IA64 box has embedded-VGA. I confirmed we
>>> can read VGA BIOS from the sysfs rom regardless of embedded-VGA.
>>
>>Looks good, Eiichiro, thanks for posting this.
>>
>>> +#include <linux/delay.h>
>>> +#include <linux/dmi.h>
>>> +#include <linux/pci.h>
>>> +#include <linux/init.h>
>>
>>For this version, I don't think you need delay.h or dmi.h. And like Bjorn
>>mentioned, this could probably be turned into generic code in drivers/pci
>>so we don't have too much duplication with x86 (and like I mentioned,
>>x86_64 could probably use this too).
>>
>>Jesse
>>
>
>"PCI-to-PCI Bridge Architecture Specification" describes how to support VGA.
>And pci_fixup_video suits this specification because this function checks the
>Bridge Control register. I also think pci_fixup_video should be turned into
>generic quirks.c in drivers/pci.
>
>Ok, I will modify code and test.
>
>Thanks,
>Eiichiro
I moved pci_fixup_video to generic location (driver/pci/quirks.c).
I tested generic fixup_video on x86, x86_64 and IA64, and confirmed
we can read Video BIOS from the sysfs rom with embedded VGA.
Eiichiro
diff -dupNr linux-2.6.18.orig/arch/i386/pci/fixup.c linux-2.6.18/arch/i386/pci/fixup.c
--- linux-2.6.18.orig/arch/i386/pci/fixup.c 2006-09-20 12:42:06.000000000 +0900
+++ linux-2.6.18/arch/i386/pci/fixup.c 2006-09-27 14:18:55.000000000 +0900
@@ -343,51 +343,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_rootport_aspm_quirk );
/*
- * Fixup to mark boot BIOS video selected by BIOS before it changes
- *
- * From information provided by "Jon Smirl" <[email protected]>
- *
- * The standard boot ROM sequence for an x86 machine uses the BIOS
- * to select an initial video card for boot display. This boot video
- * card will have it's BIOS copied to C0000 in system RAM.
- * IORESOURCE_ROM_SHADOW is used to associate the boot video
- * card with this copy. On laptops this copy has to be used since
- * the main ROM may be compressed or combined with another image.
- * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
- * is marked here since the boot video device will be the only enabled
- * video device at this point.
- */
-
-static void __devinit pci_fixup_video(struct pci_dev *pdev)
-{
- struct pci_dev *bridge;
- struct pci_bus *bus;
- u16 config;
-
- if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
- return;
-
- /* Is VGA routed to us? */
- bus = pdev->bus;
- while (bus) {
- bridge = bus->self;
- if (bridge) {
- pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
- &config);
- if (!(config & PCI_BRIDGE_CTL_VGA))
- return;
- }
- bus = bus->parent;
- }
- pci_read_config_word(pdev, PCI_COMMAND, &config);
- if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
- pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
- printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
- }
-}
-DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
-
-/*
* Some Toshiba laptops need extra code to enable their TI TSB43AB22/A.
*
* We pretend to bring them out of full D3 state, and restore the proper
diff -dupNr linux-2.6.18.orig/drivers/pci/quirks.c linux-2.6.18/drivers/pci/quirks.c
--- linux-2.6.18.orig/drivers/pci/quirks.c 2006-09-20 12:42:06.000000000 +0900
+++ linux-2.6.18/drivers/pci/quirks.c 2006-09-27 14:46:40.000000000 +0900
@@ -1590,6 +1590,51 @@ static void __devinit fixup_rev1_53c810(
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
+/*
+ * Fixup to mark boot BIOS video selected by BIOS before it changes
+ *
+ * From information provided by "Jon Smirl" <[email protected]>
+ *
+ * The standard boot ROM sequence for an x86 machine uses the BIOS
+ * to select an initial video card for boot display. This boot video
+ * card will have it's BIOS copied to C0000 in system RAM.
+ * IORESOURCE_ROM_SHADOW is used to associate the boot video
+ * card with this copy. On laptops this copy has to be used since
+ * the main ROM may be compressed or combined with another image.
+ * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
+ * is marked here since the boot video device will be the only enabled
+ * video device at this point.
+ */
+
+static void __devinit fixup_video(struct pci_dev *pdev)
+{
+ struct pci_dev *bridge;
+ struct pci_bus *bus;
+ u16 config;
+
+ if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
+ return;
+
+ /* Is VGA routed to us? */
+ bus = pdev->bus;
+ while (bus) {
+ bridge = bus->self;
+ if (bridge) {
+ pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
+ &config);
+ if (!(config & PCI_BRIDGE_CTL_VGA))
+ return;
+ }
+ bus = bus->parent;
+ }
+ pci_read_config_word(pdev, PCI_COMMAND, &config);
+ if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
+ pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
+ printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
+ }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, fixup_video);
+
static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end)
{
Ar Mer, 2006-09-27 am 20:23 +0900, ysgrifennodd
[email protected]:
> I moved pci_fixup_video to generic location (driver/pci/quirks.c).
> I tested generic fixup_video on x86, x86_64 and IA64, and confirmed
> we can read Video BIOS from the sysfs rom with embedded VGA.
Lots of embedded systems don't have a PCI bios in the usual sense, and
cannot run the x86 code in the ROM firmware either. That doesn't appear
to be a big problem when setting PCI_ROM_SHADOW but those platforms may
not all be able to access the shadow rom if one exists.
Can you fix the comment in drivers/pci/rom.c to reflect the changes.
Otherwise looks good.
Alan