Jesse Keating 2f82dda
--- linux-2.6.20/arch/ia64/kernel/quirks.c	1969-12-31 19:00:00.000000000 -0500
Jesse Keating 2f82dda
+++ linux-2.6.20_fix/arch/ia64/kernel/quirks.c	2007-02-13 13:56:34.000000000 -0500
Jesse Keating 2f82dda
@@ -0,0 +1,45 @@
Jesse Keating 2f82dda
+/*
Jesse Keating 2f82dda
+ * This file contains work-arounds for ia64 platform bugs.
Jesse Keating 2f82dda
+ */
Jesse Keating 2f82dda
+#include <linux/pci.h>
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/*
Jesse Keating 2f82dda
+ * quirk_intel_ide_controller: If an ide/ata controller is
Jesse Keating 2f82dda
+ * at legacy mode, BIOS might initiates BAR(bar 0~3 and 5)
Jesse Keating 2f82dda
+ * with incorrect value. This quirk will reset the incorrect
Jesse Keating 2f82dda
+ * value to 0.
Jesse Keating 2f82dda
+ */
Jesse Keating 2f82dda
+static void __devinit quirk_intel_ide_controller(struct pci_dev *dev)
Jesse Keating 2f82dda
+{
Jesse Keating 2f82dda
+	unsigned int pos;
Jesse Keating 2f82dda
+	struct resource *res;
Jesse Keating 2f82dda
+	int fixed = 0;
Jesse Keating 2f82dda
+	u8 tmp8;
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+	if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
Jesse Keating 2f82dda
+		return;
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+	/* TODO: What if one channel is in native mode ... */
Jesse Keating 2f82dda
+	pci_read_config_byte(dev, PCI_CLASS_PROG, &tmp8);
Jesse Keating 2f82dda
+	if ((tmp8 & 5) == 5)
Jesse Keating 2f82dda
+		return;
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+	for( pos = 0; pos < 6; pos ++ ) {
Jesse Keating 2f82dda
+		res = &dev->resource[pos];
Jesse Keating 2f82dda
+		if (!(res->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
Jesse Keating 2f82dda
+			continue;
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+		if (!res->start && res->end) {
Jesse Keating 2f82dda
+			res->start = res->end = 0;
Jesse Keating 2f82dda
+			res->flags = 0;
Jesse Keating 2f82dda
+			fixed = 1;
Jesse Keating 2f82dda
+		}
Jesse Keating 2f82dda
+	}
Jesse Keating 2f82dda
+	if (fixed)
Jesse Keating 2f82dda
+		printk(KERN_WARNING
Jesse Keating 2f82dda
+			"PCI device %s: BIOS resource configuration fixed.\n",
Jesse Keating 2f82dda
+			pci_name(dev));
Jesse Keating 2f82dda
+}
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_11, quirk_intel_ide_controller);
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
--- linux-2.6.21.noarch/arch/ia64/kernel/Makefile~	2007-05-27 23:23:36.000000000 -0400
Jesse Keating 2f82dda
+++ linux-2.6.21.noarch/arch/ia64/kernel/Makefile	2007-05-27 23:23:48.000000000 -0400
Jesse Keating 2f82dda
@@ -33,6 +33,7 @@ obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
Jesse Keating 2f82dda
 obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR)	+= uncached.o
Jesse Keating 2f82dda
 obj-$(CONFIG_AUDIT)		+= audit.o
Jesse Keating 2f82dda
 obj-$(CONFIG_PCI_MSI)		+= msi_ia64.o
Jesse Keating 2f82dda
+obj-$(CONFIG_PCI)		+= quirks.o
Jesse Keating 2f82dda
 mca_recovery-y			+= mca_drv.o mca_drv_asm.o
Jesse Keating 2f82dda
 obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o
Jesse Keating 2f82dda