[PATCH] drivers/char/agp i845 support

GOTO Masanori (gotom@debian.org)
Wed, 31 Oct 2001 00:56:26 +0900


Hi,

Here's a patch which supports agp i845 for 2.4.13-ac5
(Current 2.4.14-pre* does not support new patch i860,
so I made only for -ac).

-- gotom

diff -Nuar linux-2.4.13-ac5/Documentation/Configure.help linux-2.4.13-ac5.agp/Documentation/Configure.help
--- linux-2.4.13-ac5/Documentation/Configure.help Tue Oct 30 22:14:12 2001
+++ linux-2.4.13-ac5.agp/Documentation/Configure.help Wed Oct 31 00:20:45 2001
@@ -3098,10 +3098,10 @@
a module, say M here and read <file:Documentation/modules.txt>. The
module will be called agpgart.o.

-Intel 440LX/BX/GX/815/830/840/850/860 support
+Intel 440LX/BX/GX/815/830/840/845/850/860 support
CONFIG_AGP_INTEL
This option gives you AGP support for the GLX component of the
- XFree86 4.x on Intel 440LX/BX/GX, 815, 830, 840, 850 and 860 chipsets.
+ XFree86 4.x on Intel 440LX/BX/GX, 815, 830, 840, 845, 850 and 860 chipsets.

You should say Y here if you use XFree86 3.3.6 or 4.x and want to
use GLX or DRI. If unsure, say N.
diff -Nuar linux-2.4.13-ac5/drivers/char/Config.in linux-2.4.13-ac5.agp/drivers/char/Config.in
--- linux-2.4.13-ac5/drivers/char/Config.in Tue Oct 30 22:14:16 2001
+++ linux-2.4.13-ac5.agp/drivers/char/Config.in Tue Oct 30 23:36:02 2001
@@ -213,7 +213,7 @@
bool ' ALI chipset support' CONFIG_AGP_ALI
bool ' AMD Irongate, 761, and 762 support' CONFIG_AGP_AMD
bool ' Generic SiS support' CONFIG_AGP_SIS
- bool ' Intel 440LX/BX/GX and I815/I830/I840/I850/I860 support' CONFIG_AGP_INTEL
+ bool ' Intel 440LX/BX/GX and I815/I830/I840/I845/I850/I860 support' CONFIG_AGP_INTEL
bool ' Intel I810/I815/I830M (on-board) support' CONFIG_AGP_I810
bool ' Serverworks LE/HE support' CONFIG_AGP_SWORKS
bool ' VIA chipset support' CONFIG_AGP_VIA
diff -Nuar linux-2.4.13-ac5/drivers/char/agp/agp.h linux-2.4.13-ac5.agp/drivers/char/agp/agp.h
--- linux-2.4.13-ac5/drivers/char/agp/agp.h Tue Oct 30 22:14:16 2001
+++ linux-2.4.13-ac5.agp/drivers/char/agp/agp.h Tue Oct 30 23:32:50 2001
@@ -156,16 +156,16 @@
#define PGE_EMPTY(p) (!(p) || (p) == (unsigned long) agp_bridge.scratch_page)

#ifndef PCI_DEVICE_ID_VIA_82C691_0
-#define PCI_DEVICE_ID_VIA_82C691_0 0x0691
+#define PCI_DEVICE_ID_VIA_82C691_0 0x0691
#endif
#ifndef PCI_DEVICE_ID_VIA_8371_0
-#define PCI_DEVICE_ID_VIA_8371_0 0x0391
+#define PCI_DEVICE_ID_VIA_8371_0 0x0391
#endif
#ifndef PCI_DEVICE_ID_VIA_8363_0
-#define PCI_DEVICE_ID_VIA_8363_0 0x0305
+#define PCI_DEVICE_ID_VIA_8363_0 0x0305
#endif
#ifndef PCI_DEVICE_ID_VIA_82C694X_0
-#define PCI_DEVICE_ID_VIA_82C694X_0 0x0605
+#define PCI_DEVICE_ID_VIA_82C694X_0 0x0605
#endif
#ifndef PCI_DEVICE_ID_INTEL_810_0
#define PCI_DEVICE_ID_INTEL_810_0 0x7120
@@ -177,10 +177,13 @@
#define PCI_DEVICE_ID_INTEL_830_M_1 0x3577
#endif
#ifndef PCI_DEVICE_ID_INTEL_840_0
-#define PCI_DEVICE_ID_INTEL_840_0 0x1a21
+#define PCI_DEVICE_ID_INTEL_840_0 0x1a21
+#endif
+#ifndef PCI_DEVICE_ID_INTEL_845_0
+#define PCI_DEVICE_ID_INTEL_845_0 0x1a30
#endif
#ifndef PCI_DEVICE_ID_INTEL_850_0
-#define PCI_DEVICE_ID_INTEL_850_0 0x2530
+#define PCI_DEVICE_ID_INTEL_850_0 0x2530
#endif
#ifndef PCI_DEVICE_ID_INTEL_860_0
#define PCI_DEVICE_ID_INTEL_860_0 0x2532
@@ -271,12 +274,16 @@
#define I830_RDRAM_DDT(x) (((x) & 0x18) >> 3)

/* intel i840 registers */
-#define INTEL_I840_MCHCFG 0x50
+#define INTEL_I840_MCHCFG 0x50
#define INTEL_I840_ERRSTS 0xc8

+/* intel i845 registers */
+#define INTEL_I845_MCHCFG 0x51
+#define INTEL_I845_ERRSTS 0xc8
+
/* intel i850 registers */
-#define INTEL_I850_MCHCFG 0x50
-#define INTEL_I850_ERRSTS 0xc8
+#define INTEL_I850_MCHCFG 0x50
+#define INTEL_I850_ERRSTS 0xc8

/* intel i860 registers */
#define INTEL_I860_MCHCFG 0x50
diff -Nuar linux-2.4.13-ac5/drivers/char/agp/agpgart_be.c linux-2.4.13-ac5.agp/drivers/char/agp/agpgart_be.c
--- linux-2.4.13-ac5/drivers/char/agp/agpgart_be.c Tue Oct 30 22:14:16 2001
+++ linux-2.4.13-ac5.agp/drivers/char/agp/agpgart_be.c Tue Oct 30 23:32:50 2001
@@ -387,8 +387,8 @@
/*
* Driver routines - start
* Currently this module supports the following chipsets:
- * i810, i815, 440lx, 440bx, 440gx, i830, i840, i850, i860, via vp3, via mvp3,
- * via kx133, via kt133, amd irongate, amd 761, amd 762, ALi M1541,
+ * i810, i815, 440lx, 440bx, 440gx, i830, i840, i845, i850, i860, via vp3,
+ * via mvp3, via kx133, via kt133, amd irongate, amd 761, amd 762, ALi M1541,
* and generic support for the SiS chipsets.
*/

@@ -1509,6 +1509,38 @@
return 0;
}

+static int intel_845_configure(void)
+{
+ u32 temp;
+ u16 temp2;
+ aper_size_info_16 *current_size;
+
+ current_size = A_SIZE_16(agp_bridge.current_size);
+
+ /* aperture size */
+ pci_write_config_byte(agp_bridge.dev, INTEL_APSIZE,
+ (char)current_size->size_value);
+
+ /* address to map to */
+ pci_read_config_dword(agp_bridge.dev, INTEL_APBASE, &temp);
+ agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
+
+ /* attbase - aperture base */
+ pci_write_config_dword(agp_bridge.dev, INTEL_ATTBASE,
+ agp_bridge.gatt_bus_addr);
+
+ /* agpctrl */
+ pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, 0x0000);
+
+ /* mcgcfg */
+ pci_read_config_word(agp_bridge.dev, INTEL_I845_MCHCFG, &temp2);
+ pci_write_config_word(agp_bridge.dev, INTEL_I845_MCHCFG,
+ temp2 | (1 << 9));
+ /* clear any possible error conditions */
+ pci_write_config_word(agp_bridge.dev, INTEL_I845_ERRSTS, 0x001c);
+ return 0;
+}
+
static int intel_850_configure(void)
{
u32 temp;
@@ -1668,6 +1700,39 @@
(void) pdev; /* unused */
}

+static int __init intel_845_setup (struct pci_dev *pdev)
+{
+ agp_bridge.masks = intel_generic_masks;
+ agp_bridge.num_of_masks = 1;
+ agp_bridge.aperture_sizes = (void *) intel_generic_sizes;
+ agp_bridge.size_type = U16_APER_SIZE;
+ agp_bridge.num_aperture_sizes = 7;
+ agp_bridge.dev_private_data = NULL;
+ agp_bridge.needs_scratch_page = FALSE;
+ agp_bridge.configure = intel_845_configure;
+ agp_bridge.fetch_size = intel_fetch_size;
+ agp_bridge.cleanup = intel_cleanup;
+ agp_bridge.tlb_flush = intel_tlbflush;
+ agp_bridge.mask_memory = intel_mask_memory;
+ agp_bridge.agp_enable = agp_generic_agp_enable;
+ agp_bridge.cache_flush = global_cache_flush;
+ agp_bridge.create_gatt_table = agp_generic_create_gatt_table;
+ agp_bridge.free_gatt_table = agp_generic_free_gatt_table;
+ agp_bridge.insert_memory = agp_generic_insert_memory;
+ agp_bridge.remove_memory = agp_generic_remove_memory;
+ agp_bridge.alloc_by_type = agp_generic_alloc_by_type;
+ agp_bridge.free_by_type = agp_generic_free_by_type;
+ agp_bridge.agp_alloc_page = agp_generic_alloc_page;
+ agp_bridge.agp_destroy_page = agp_generic_destroy_page;
+ agp_bridge.suspend = agp_generic_suspend;
+ agp_bridge.resume = agp_generic_resume;
+ agp_bridge.cant_use_aperture = 0;
+
+ return 0;
+
+ (void) pdev; /* unused */
+}
+
static int __init intel_850_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
@@ -3350,6 +3415,12 @@
"Intel",
"i840",
intel_840_setup },
+ { PCI_DEVICE_ID_INTEL_845_0,
+ PCI_VENDOR_ID_INTEL,
+ INTEL_I845,
+ "Intel",
+ "i845",
+ intel_845_setup },
{ PCI_DEVICE_ID_INTEL_850_0,
PCI_VENDOR_ID_INTEL,
INTEL_I850,
diff -Nuar linux-2.4.13-ac5/drivers/char/drm/drm_agpsupport.h linux-2.4.13-ac5.agp/drivers/char/drm/drm_agpsupport.h
--- linux-2.4.13-ac5/drivers/char/drm/drm_agpsupport.h Fri Sep 28 05:07:25 2001
+++ linux-2.4.13-ac5.agp/drivers/char/drm/drm_agpsupport.h Tue Oct 30 23:48:24 2001
@@ -274,6 +274,7 @@
#if LINUX_VERSION_CODE >= 0x020400
case INTEL_I815: head->chipset = "Intel i815"; break;
case INTEL_I840: head->chipset = "Intel i840"; break;
+ case INTEL_I845: head->chipset = "Intel i845"; break;
case INTEL_I850: head->chipset = "Intel i850"; break;
#endif

diff -Nuar linux-2.4.13-ac5/include/linux/agp_backend.h linux-2.4.13-ac5.agp/include/linux/agp_backend.h
--- linux-2.4.13-ac5/include/linux/agp_backend.h Tue Oct 30 22:14:35 2001
+++ linux-2.4.13-ac5.agp/include/linux/agp_backend.h Tue Oct 30 23:46:11 2001
@@ -48,6 +48,7 @@
INTEL_I815,
INTEL_I830_M,
INTEL_I840,
+ INTEL_I845,
INTEL_I850,
INTEL_I860,
VIA_GENERIC,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/