Index: agp.h =================================================================== RCS file: /home/tg-cvs/agpgart/agp.h,v retrieving revision 1.1.1.2.2.2 diff -u -r1.1.1.2.2.2 agp.h --- agp.h 2003/01/15 19:23:58 1.1.1.2.2.2 +++ agp.h 2003/02/06 03:53:08 @@ -236,6 +236,34 @@ /* This one is for I830MP w. an external graphic card */ #define INTEL_I830_ERRSTS 0x92 +/* Intel 855GM/852GM registers */ +#define I855_GMCH_GMS_STOLEN_0M 0x0 +#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4) +#define I855_GMCH_GMS_STOLEN_4M (0x2 << 4) +#define I855_GMCH_GMS_STOLEN_8M (0x3 << 4) +#define I855_GMCH_GMS_STOLEN_16M (0x4 << 4) +#define I855_GMCH_GMS_STOLEN_32M (0x5 << 4) +#define I85X_CAPID 0x44 +#define I85X_VARIANT_MASK 0x7 +#define I85X_VARIANT_SHIFT 5 +#define I855_GME 0x0 +#define I855_GM 0x4 +#define I852_GME 0x2 +#define I852_GM 0x5 + +#ifndef PCI_DEVICE_ID_INTEL_82855_HB +#define PCI_DEVICE_ID_INTEL_82855_HB 0x3580 +#endif +#ifndef PCI_DEVICE_ID_INTEL_82855_IG +#define PCI_DEVICE_ID_INTEL_82855_IG 0x3582 +#endif +#ifndef PCI_DEVICE_ID_INTEL_82865_HB +#define PCI_DEVICE_ID_INTEL_82865_HB 0x2570 +#endif +#ifndef PCI_DEVICE_ID_INTEL_82865_IG +#define PCI_DEVICE_ID_INTEL_82865_IG 0x2572 +#endif + /* intel 815 register */ #define INTEL_815_APCONT 0x51 #define INTEL_815_ATTBASE_MASK ~0x1FFFFFFF Index: intel-agp.c =================================================================== RCS file: /home/tg-cvs/agpgart/Attic/intel-agp.c,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 intel-agp.c --- intel-agp.c 2003/01/15 19:23:59 1.1.2.1 +++ intel-agp.c 2003/02/06 03:50:12 @@ -2,6 +2,11 @@ * Intel AGPGART routines. */ +/* + * Intel(R) 855GM/852GM and 865G support added by David Dawes + * . + */ + #include #include #include @@ -297,34 +302,62 @@ u16 gmch_ctrl; int gtt_entries; u8 rdct; + int local = 0; static const int ddt[4] = { 0, 16, 32, 64 }; pci_read_config_word(agp_bridge.dev,I830_GMCH_CTRL,&gmch_ctrl); - switch (gmch_ctrl & I830_GMCH_GMS_MASK) { - case I830_GMCH_GMS_STOLEN_512: - gtt_entries = KB(512) - KB(132); - printk(KERN_INFO PFX "detected %dK stolen memory.\n",gtt_entries / KB(1)); - break; - case I830_GMCH_GMS_STOLEN_1024: - gtt_entries = MB(1) - KB(132); - printk(KERN_INFO PFX "detected %dK stolen memory.\n",gtt_entries / KB(1)); - break; - case I830_GMCH_GMS_STOLEN_8192: - gtt_entries = MB(8) - KB(132); - printk(KERN_INFO PFX "detected %dK stolen memory.\n",gtt_entries / KB(1)); - break; - case I830_GMCH_GMS_LOCAL: - rdct = INREG8(intel_i830_private.registers,I830_RDRAM_CHANNEL_TYPE); - gtt_entries = (I830_RDRAM_ND(rdct) + 1) * MB(ddt[I830_RDRAM_DDT(rdct)]); - printk(KERN_INFO PFX "detected %dK local memory.\n",gtt_entries / KB(1)); - break; - default: - printk(KERN_INFO PFX "no video memory detected.\n"); - gtt_entries = 0; - break; + if (agp_bridge.dev->device == PCI_DEVICE_ID_INTEL_82830_HB || + agp_bridge.dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { + switch (gmch_ctrl & I830_GMCH_GMS_MASK) { + case I830_GMCH_GMS_STOLEN_512: + gtt_entries = KB(512) - KB(132); + break; + case I830_GMCH_GMS_STOLEN_1024: + gtt_entries = MB(1) - KB(132); + break; + case I830_GMCH_GMS_STOLEN_8192: + gtt_entries = MB(8) - KB(132); + break; + case I830_GMCH_GMS_LOCAL: + rdct = INREG8(intel_i830_private.registers, + I830_RDRAM_CHANNEL_TYPE); + gtt_entries = (I830_RDRAM_ND(rdct) + 1) * + MB(ddt[I830_RDRAM_DDT(rdct)]); + local = 1; + break; + default: + gtt_entries = 0; + break; + } + } else { + switch (gmch_ctrl & I830_GMCH_GMS_MASK) { + case I855_GMCH_GMS_STOLEN_1M: + gtt_entries = MB(1) - KB(132); + break; + case I855_GMCH_GMS_STOLEN_4M: + gtt_entries = MB(4) - KB(132); + break; + case I855_GMCH_GMS_STOLEN_8M: + gtt_entries = MB(8) - KB(132); + break; + case I855_GMCH_GMS_STOLEN_16M: + gtt_entries = MB(16) - KB(132); + break; + case I855_GMCH_GMS_STOLEN_32M: + gtt_entries = MB(32) - KB(132); + break; + default: + gtt_entries = 0; + break; + } } - + if (gtt_entries > 0) + printk(KERN_INFO PFX "Detected %dK %s memory.\n", + gtt_entries / KB(1), local ? "local" : "stolen"); + else + printk(KERN_INFO PFX + "No pre-allocated video memory detected.\n"); gtt_entries /= KB(4); intel_i830_private.gtt_entries = gtt_entries; @@ -377,9 +410,18 @@ u16 gmch_ctrl; struct aper_size_info_fixed *values; - pci_read_config_word(agp_bridge.dev,I830_GMCH_CTRL,&gmch_ctrl); values = A_SIZE_FIX(agp_bridge.aperture_sizes); + if (agp_bridge.dev->device != PCI_DEVICE_ID_INTEL_82830_HB && + agp_bridge.dev->device != PCI_DEVICE_ID_INTEL_82845G_HB) { + /* 855GM/852GM/865G has 128MB aperture size */ + agp_bridge.previous_size = agp_bridge.current_size = (void *) values; + agp_bridge.aperture_size_idx = 0; + return(values[0].size); + } + + pci_read_config_word(agp_bridge.dev,I830_GMCH_CTRL,&gmch_ctrl); + if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { agp_bridge.previous_size = agp_bridge.current_size = (void *) values; agp_bridge.aperture_size_idx = 0; @@ -562,6 +604,7 @@ return(0); } + static int intel_fetch_size(void) { int i; @@ -1242,7 +1285,7 @@ { .device_id = PCI_DEVICE_ID_INTEL_82830_HB, .chipset = INTEL_I830_M, - .chipset_name = "i830M", + .chipset_name = "830M", .chipset_setup = intel_830mp_setup }, { @@ -1260,7 +1303,7 @@ { .device_id = PCI_DEVICE_ID_INTEL_82845G_HB, .chipset = INTEL_I845_G, - .chipset_name = "i845G", + .chipset_name = "845G", .chipset_setup = intel_845_setup }, { @@ -1270,11 +1313,23 @@ .chipset_setup = intel_850_setup }, { + .device_id = PCI_DEVICE_ID_INTEL_82855_HB, + .chipset = INTEL_I855_PM, + .chipset_name = "855PM", + .chipset_setup = intel_845_setup + }, + { .device_id = PCI_DEVICE_ID_INTEL_82860_HB, .chipset = INTEL_I860, .chipset_name = "i860", .chipset_setup = intel_860_setup }, + { + .device_id = PCI_DEVICE_ID_INTEL_82865G_HB, + .chipset = INTEL_I865_G, + .chipset_name = "865G", + .chipset_setup = intel_845_setup + }, { }, /* dummy final entry, always present */ }; @@ -1388,13 +1443,13 @@ if (i810_dev == NULL) { /* - * We probably have a I845MP chipset with an external graphics + * We probably have a I845G chipset with an external graphics * card. It will be initialized later */ agp_bridge.type = INTEL_I845_G; break; } - printk(KERN_INFO PFX "Detected an Intel 845G Chipset.\n"); + printk(KERN_INFO PFX "Detected an Intel(R) 845G Chipset.\n"); agp_bridge.type = INTEL_I810; return intel_i830_setup(i810_dev); @@ -1408,8 +1463,64 @@ /* It will be initialized later */ agp_bridge.type = INTEL_I830_M; break; + } + printk(KERN_INFO PFX "Detected an Intel(R) 830M Chipset.\n"); + agp_bridge.type = INTEL_I810; + return intel_i830_setup(i810_dev); + + case PCI_DEVICE_ID_INTEL_82855_HB: + i810_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855_IG, NULL); + if(i810_dev && PCI_FUNC(i810_dev->devfn) != 0) + i810_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855_IG, i810_dev); + + if (i810_dev == NULL) { + /* Intel 855PM with external graphic card */ + /* It will be initialized later */ + agp_bridge.type = INTEL_I855_PM; + break; + } + { + u32 capval = 0; + const char *name = "855GM/852GM"; + pci_read_config_dword(dev, I85X_CAPID, &capval); + switch ((capval >> I85X_VARIANT_SHIFT) & + I85X_VARIANT_MASK) { + case I855_GME: + name = "855GME"; + break; + case I855_GM: + name = "855GM"; + break; + case I852_GME: + name = "852GME"; + break; + case I852_GM: + name = "852GM"; + break; + } + printk(KERN_INFO PFX + "Detected an Intel(R) %s Chipset.\n", name); + } + agp_bridge.type = INTEL_I810; + return intel_i830_setup(i810_dev); + + case PCI_DEVICE_ID_INTEL_82865G_HB: + i810_dev = pci_find_device(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_82865G_IG, NULL); + if (i810_dev && PCI_FUNC(i810_dev->devfn) != 0) { + i810_dev = pci_find_device(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_82865G_IG, i810_dev); + } + + if (i810_dev == NULL) { + /* + * We probably have a 865G chipset with an external graphics + * card. It will be initialized later + */ + agp_bridge.type = INTEL_I865_G; + break; } - printk(KERN_INFO PFX "Detected an Intel 830M Chipset.\n"); + printk(KERN_INFO PFX "Detected an Intel(R) 865G Chipset.\n"); agp_bridge.type = INTEL_I810; return intel_i830_setup(i810_dev); Index: include/agp_backend.h =================================================================== RCS file: /home/tg-cvs/agpgart/include/Attic/agp_backend.h,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 agp_backend.h --- include/agp_backend.h 2003/01/15 19:24:00 1.1.2.2 +++ include/agp_backend.h 2003/02/06 03:49:31 @@ -46,6 +46,8 @@ INTEL_I820, INTEL_I830_M, INTEL_I845_G, + INTEL_I855_PM, + INTEL_I865_G, INTEL_I840, INTEL_I845, INTEL_I850,