bk://linux-dj.bkbits.net/agpgart
davej@redhat.com|ChangeSet|20040512105018|00279 davej

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/05/12 11:50:18+01:00 davej@redhat.com 
#   [AGPGART] Various Intel/EM64T AGP fixes.
#   
#   From Andi Kleen.
#   
#   - Add full PCI IDs to the module table for intel-agp and intel-mch-agp.
#   Don't use PCI_ANY_ID for device, since the drivers cannot handle unknown
#   devices anyways.
#   This fixes the problems with them loading both when compiled in and
#   also helps external tools that use the module PCI table to find the
#   correct driver.
#   - Remove wrong hack in intel-mch-agp that checked for long mode.
#   EM64T capability has nothing to do with the MCH version.
#   To avoid double probing the fix above is better.
#   - Handle the case of no AGP capability (unlikely, but better to handle it)
# 
# drivers/char/agp/intel-mch-agp.c
#   2004/05/12 11:50:12+01:00 davej@redhat.com +11 -4
#   [AGPGART] Various Intel/EM64T AGP fixes.
#   
#   From Andi Kleen.
#   
#   - Add full PCI IDs to the module table for intel-agp and intel-mch-agp.
#   Don't use PCI_ANY_ID for device, since the drivers cannot handle unknown
#   devices anyways.
#   This fixes the problems with them loading both when compiled in and
#   also helps external tools that use the module PCI table to find the
#   correct driver.
#   - Remove wrong hack in intel-mch-agp that checked for long mode.
#   EM64T capability has nothing to do with the MCH version.
#   To avoid double probing the fix above is better.
#   - Handle the case of no AGP capability (unlikely, but better to handle it)
# 
# drivers/char/agp/intel-agp.c
#   2004/05/12 11:50:12+01:00 davej@redhat.com +32 -8
#   [AGPGART] Various Intel/EM64T AGP fixes.
#   
#   From Andi Kleen.
#   
#   - Add full PCI IDs to the module table for intel-agp and intel-mch-agp.
#   Don't use PCI_ANY_ID for device, since the drivers cannot handle unknown
#   devices anyways.
#   This fixes the problems with them loading both when compiled in and
#   also helps external tools that use the module PCI table to find the
#   correct driver.
#   - Remove wrong hack in intel-mch-agp that checked for long mode.
#   EM64T capability has nothing to do with the MCH version.
#   To avoid double probing the fix above is better.
#   - Handle the case of no AGP capability (unlikely, but better to handle it)
# 
# ChangeSet
#   2004/04/16 20:16:10+01:00 davej@redhat.com 
#   [AGPGART] If ati_create_gatt_pages() fails, don't propagate an address we've freed.
# 
# drivers/char/agp/ati-agp.c
#   2004/04/16 20:16:04+01:00 davej@redhat.com +1 -0
#   [AGPGART] If ati_create_gatt_pages() fails, don't propagate an address we've freed.
# 
diff -Nru a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
--- a/drivers/char/agp/ati-agp.c	Wed May 12 20:25:30 2004
+++ b/drivers/char/agp/ati-agp.c	Wed May 12 20:25:30 2004
@@ -131,6 +131,7 @@
 				i--;
 			}
 			kfree (tables);
+			tables = NULL;
 			retval = -ENOMEM;
 			break;
 		}
diff -Nru a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
--- a/drivers/char/agp/intel-agp.c	Wed May 12 20:25:30 2004
+++ b/drivers/char/agp/intel-agp.c	Wed May 12 20:25:30 2004
@@ -1264,6 +1264,8 @@
 	struct resource *r;
 
 	cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
+	if (!cap_ptr)
+		return -ENODEV;
 
 	bridge = agp_alloc_bridge();
 	if (!bridge)
@@ -1462,14 +1464,36 @@
 }
 
 static struct pci_device_id agp_intel_pci_table[] = {
-	{
-	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
-	.class_mask	= ~0,
-	.vendor		= PCI_VENDOR_ID_INTEL,
-	.device		= PCI_ANY_ID,
-	.subvendor	= PCI_ANY_ID,
-	.subdevice	= PCI_ANY_ID,
-	},
+#define ID(x)						\
+	{ 						\
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),	\
+	.class_mask	= ~0,				\
+	.vendor		= PCI_VENDOR_ID_INTEL,		\
+	.device		= x,				\
+	.subvendor	= PCI_ANY_ID,			\
+	.subdevice	= PCI_ANY_ID,			\
+	}
+	ID(PCI_DEVICE_ID_INTEL_82443LX_0),
+	ID(PCI_DEVICE_ID_INTEL_82443BX_0),
+	ID(PCI_DEVICE_ID_INTEL_82443GX_0),
+	ID(PCI_DEVICE_ID_INTEL_82810_MC1),
+	ID(PCI_DEVICE_ID_INTEL_82810_MC3),
+	ID(PCI_DEVICE_ID_INTEL_82810E_MC),
+	ID(PCI_DEVICE_ID_INTEL_82815_MC),
+	ID(PCI_DEVICE_ID_INTEL_82820_HB),
+	ID(PCI_DEVICE_ID_INTEL_82820_UP_HB),
+	ID(PCI_DEVICE_ID_INTEL_82830_HB),
+	ID(PCI_DEVICE_ID_INTEL_82840_HB),
+	ID(PCI_DEVICE_ID_INTEL_82845_HB),
+	ID(PCI_DEVICE_ID_INTEL_82845G_HB),
+	ID(PCI_DEVICE_ID_INTEL_82850_HB),
+	ID(PCI_DEVICE_ID_INTEL_82855PM_HB),
+	ID(PCI_DEVICE_ID_INTEL_82855GM_HB),
+	ID(PCI_DEVICE_ID_INTEL_82860_HB),
+	ID(PCI_DEVICE_ID_INTEL_82865_HB),
+	ID(PCI_DEVICE_ID_INTEL_82875_HB),
+	ID(PCI_DEVICE_ID_INTEL_7505_0),
+	ID(PCI_DEVICE_ID_INTEL_7205_0),	
 	{ }
 };
 
diff -Nru a/drivers/char/agp/intel-mch-agp.c b/drivers/char/agp/intel-mch-agp.c
--- a/drivers/char/agp/intel-mch-agp.c	Wed May 12 20:25:30 2004
+++ b/drivers/char/agp/intel-mch-agp.c	Wed May 12 20:25:30 2004
@@ -491,10 +491,9 @@
 	char *name = "(unknown)";
 	u8 cap_ptr = 0;
 
-	if (!boot_cpu_has(X86_FEATURE_LM))
-		return -ENODEV;
-
 	cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
+	if (!cap_ptr) 
+		return -ENODEV;
 
 	bridge = agp_alloc_bridge();
 	if (!bridge)
@@ -590,7 +589,15 @@
 	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
 	.class_mask	= ~0,
 	.vendor		= PCI_VENDOR_ID_INTEL,
-	.device		= PCI_ANY_ID,
+	.device		= PCI_DEVICE_ID_INTEL_82865_HB,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_INTEL,
+	.device		= PCI_DEVICE_ID_INTEL_82875_HB,
 	.subvendor	= PCI_ANY_ID,
 	.subdevice	= PCI_ANY_ID,
 	},