aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/agp')
-rw-r--r--drivers/char/agp/agp.h2
-rw-r--r--drivers/char/agp/backend.c2
-rw-r--r--drivers/char/agp/efficeon-agp.c16
-rw-r--r--drivers/char/agp/frontend.c27
-rw-r--r--drivers/char/agp/generic.c39
-rw-r--r--drivers/char/agp/intel-agp.c173
-rw-r--r--drivers/char/agp/via-agp.c4
7 files changed, 199 insertions, 64 deletions
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 3c623b67ea1c..8b3317fd46c9 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -117,7 +117,7 @@ struct agp_bridge_driver {
117}; 117};
118 118
119struct agp_bridge_data { 119struct agp_bridge_data {
120 struct agp_version *version; 120 const struct agp_version *version;
121 struct agp_bridge_driver *driver; 121 struct agp_bridge_driver *driver;
122 struct vm_operations_struct *vm_ops; 122 struct vm_operations_struct *vm_ops;
123 void *previous_size; 123 void *previous_size;
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index 509adc403250..d59e037ddd12 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -44,7 +44,7 @@
44 * past 0.99 at all due to some boolean logic error. */ 44 * past 0.99 at all due to some boolean logic error. */
45#define AGPGART_VERSION_MAJOR 0 45#define AGPGART_VERSION_MAJOR 0
46#define AGPGART_VERSION_MINOR 101 46#define AGPGART_VERSION_MINOR 101
47static struct agp_version agp_current_version = 47static const struct agp_version agp_current_version =
48{ 48{
49 .major = AGPGART_VERSION_MAJOR, 49 .major = AGPGART_VERSION_MAJOR,
50 .minor = AGPGART_VERSION_MINOR, 50 .minor = AGPGART_VERSION_MINOR,
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index b788b0a3bbf3..30f730ff81c1 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -337,13 +337,6 @@ static struct agp_bridge_driver efficeon_driver = {
337 .agp_destroy_page = agp_generic_destroy_page, 337 .agp_destroy_page = agp_generic_destroy_page,
338}; 338};
339 339
340
341static int agp_efficeon_resume(struct pci_dev *pdev)
342{
343 printk(KERN_DEBUG PFX "agp_efficeon_resume()\n");
344 return efficeon_configure();
345}
346
347static int __devinit agp_efficeon_probe(struct pci_dev *pdev, 340static int __devinit agp_efficeon_probe(struct pci_dev *pdev,
348 const struct pci_device_id *ent) 341 const struct pci_device_id *ent)
349{ 342{
@@ -414,11 +407,18 @@ static void __devexit agp_efficeon_remove(struct pci_dev *pdev)
414 agp_put_bridge(bridge); 407 agp_put_bridge(bridge);
415} 408}
416 409
410#ifdef CONFIG_PM
417static int agp_efficeon_suspend(struct pci_dev *dev, pm_message_t state) 411static int agp_efficeon_suspend(struct pci_dev *dev, pm_message_t state)
418{ 412{
419 return 0; 413 return 0;
420} 414}
421 415
416static int agp_efficeon_resume(struct pci_dev *pdev)
417{
418 printk(KERN_DEBUG PFX "agp_efficeon_resume()\n");
419 return efficeon_configure();
420}
421#endif
422 422
423static struct pci_device_id agp_efficeon_pci_table[] = { 423static struct pci_device_id agp_efficeon_pci_table[] = {
424 { 424 {
@@ -439,8 +439,10 @@ static struct pci_driver agp_efficeon_pci_driver = {
439 .id_table = agp_efficeon_pci_table, 439 .id_table = agp_efficeon_pci_table,
440 .probe = agp_efficeon_probe, 440 .probe = agp_efficeon_probe,
441 .remove = agp_efficeon_remove, 441 .remove = agp_efficeon_remove,
442#ifdef CONFIG_PM
442 .suspend = agp_efficeon_suspend, 443 .suspend = agp_efficeon_suspend,
443 .resume = agp_efficeon_resume, 444 .resume = agp_efficeon_resume,
445#endif
444}; 446};
445 447
446static int __init agp_efficeon_init(void) 448static int __init agp_efficeon_init(void)
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index d9c5a9142ad1..0f2ed2aa2d81 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -151,35 +151,12 @@ static void agp_add_seg_to_client(struct agp_client *client,
151 client->segments = seg; 151 client->segments = seg;
152} 152}
153 153
154/* Originally taken from linux/mm/mmap.c from the array
155 * protection_map.
156 * The original really should be exported to modules, or
157 * some routine which does the conversion for you
158 */
159
160static const pgprot_t my_protect_map[16] =
161{
162 __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
163 __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
164};
165
166static pgprot_t agp_convert_mmap_flags(int prot) 154static pgprot_t agp_convert_mmap_flags(int prot)
167{ 155{
168#define _trans(x,bit1,bit2) \
169((bit1==bit2)?(x&bit1):(x&bit1)?bit2:0)
170
171 unsigned long prot_bits; 156 unsigned long prot_bits;
172 pgprot_t temp;
173
174 prot_bits = _trans(prot, PROT_READ, VM_READ) |
175 _trans(prot, PROT_WRITE, VM_WRITE) |
176 _trans(prot, PROT_EXEC, VM_EXEC);
177
178 prot_bits |= VM_SHARED;
179 157
180 temp = my_protect_map[prot_bits & 0x0000000f]; 158 prot_bits = calc_vm_prot_bits(prot) | VM_SHARED;
181 159 return vm_get_page_prot(prot_bits);
182 return temp;
183} 160}
184 161
185static int agp_create_segment(struct agp_client *client, struct agp_region *region) 162static int agp_create_segment(struct agp_client *client, struct agp_region *region)
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index cc5ea347a8a7..0dcdb363923f 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -568,25 +568,34 @@ static void agp_v3_parse_one(u32 *requested_mode, u32 *bridge_agpstat, u32 *vga_
568 *bridge_agpstat &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD); 568 *bridge_agpstat &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD);
569 goto done; 569 goto done;
570 570
571 } else if (*requested_mode & AGPSTAT3_4X) {
572 *bridge_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD);
573 *bridge_agpstat |= AGPSTAT3_4X;
574 goto done;
575
571 } else { 576 } else {
572 577
573 /* 578 /*
574 * If we didn't specify AGPx8, we can only do x4. 579 * If we didn't specify an AGP mode, we see if both
575 * If the hardware can't do x4, we're up shit creek, and never 580 * the graphics card, and the bridge can do x8, and use if so.
576 * should have got this far. 581 * If not, we fall back to x4 mode.
577 */ 582 */
578 *bridge_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD); 583 if ((*bridge_agpstat & AGPSTAT3_8X) && (*vga_agpstat & AGPSTAT3_8X)) {
579 if ((*bridge_agpstat & AGPSTAT3_4X) && (*vga_agpstat & AGPSTAT3_4X)) 584 printk(KERN_INFO PFX "No AGP mode specified. Setting to highest mode supported by bridge & card (x8).\n");
580 *bridge_agpstat |= AGPSTAT3_4X; 585 *bridge_agpstat &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD);
581 else { 586 *vga_agpstat &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD);
582 printk(KERN_INFO PFX "Badness. Don't know which AGP mode to set. " 587 } else {
583 "[bridge_agpstat:%x vga_agpstat:%x fell back to:- bridge_agpstat:%x vga_agpstat:%x]\n", 588 printk(KERN_INFO PFX "Fell back to AGPx4 mode because");
584 origbridge, origvga, *bridge_agpstat, *vga_agpstat); 589 if (!(*bridge_agpstat & AGPSTAT3_8X)) {
585 if (!(*bridge_agpstat & AGPSTAT3_4X)) 590 printk("bridge couldn't do x8. bridge_agpstat:%x (orig=%x)\n", *bridge_agpstat, origbridge);
586 printk(KERN_INFO PFX "Bridge couldn't do AGP x4.\n"); 591 *bridge_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD);
587 if (!(*vga_agpstat & AGPSTAT3_4X)) 592 *bridge_agpstat |= AGPSTAT3_4X;
588 printk(KERN_INFO PFX "Graphic card couldn't do AGP x4.\n"); 593 }
589 return; 594 if (!(*vga_agpstat & AGPSTAT3_8X)) {
595 printk("graphics card couldn't do x8. vga_agpstat:%x (orig=%x)\n", *vga_agpstat, origvga);
596 *vga_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD);
597 *vga_agpstat |= AGPSTAT3_4X;
598 }
590 } 599 }
591 } 600 }
592 601
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 61ac3809f997..d1ede7db5a12 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -2,14 +2,6 @@
2 * Intel AGPGART routines. 2 * Intel AGPGART routines.
3 */ 3 */
4 4
5/*
6 * Intel(R) 855GM/852GM and 865G support added by David Dawes
7 * <dawes@tungstengraphics.com>.
8 *
9 * Intel(R) 915G/915GM support added by Alan Hourihane
10 * <alanh@tungstengraphics.com>.
11 */
12
13#include <linux/module.h> 5#include <linux/module.h>
14#include <linux/pci.h> 6#include <linux/pci.h>
15#include <linux/init.h> 7#include <linux/init.h>
@@ -17,6 +9,21 @@
17#include <linux/agp_backend.h> 9#include <linux/agp_backend.h>
18#include "agp.h" 10#include "agp.h"
19 11
12#define PCI_DEVICE_ID_INTEL_82946GZ_HB 0x2970
13#define PCI_DEVICE_ID_INTEL_82946GZ_IG 0x2972
14#define PCI_DEVICE_ID_INTEL_82965G_1_HB 0x2980
15#define PCI_DEVICE_ID_INTEL_82965G_1_IG 0x2982
16#define PCI_DEVICE_ID_INTEL_82965Q_HB 0x2990
17#define PCI_DEVICE_ID_INTEL_82965Q_IG 0x2992
18#define PCI_DEVICE_ID_INTEL_82965G_HB 0x29A0
19#define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2
20
21#define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \
22 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \
23 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \
24 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB)
25
26
20/* Intel 815 register */ 27/* Intel 815 register */
21#define INTEL_815_APCONT 0x51 28#define INTEL_815_APCONT 0x51
22#define INTEL_815_ATTBASE_MASK ~0x1FFFFFFF 29#define INTEL_815_ATTBASE_MASK ~0x1FFFFFFF
@@ -40,6 +47,8 @@
40#define I915_GMCH_GMS_STOLEN_48M (0x6 << 4) 47#define I915_GMCH_GMS_STOLEN_48M (0x6 << 4)
41#define I915_GMCH_GMS_STOLEN_64M (0x7 << 4) 48#define I915_GMCH_GMS_STOLEN_64M (0x7 << 4)
42 49
50/* Intel 965G registers */
51#define I965_MSAC 0x62
43 52
44/* Intel 7505 registers */ 53/* Intel 7505 registers */
45#define INTEL_I7505_APSIZE 0x74 54#define INTEL_I7505_APSIZE 0x74
@@ -354,6 +363,7 @@ static struct aper_size_info_fixed intel_i830_sizes[] =
354 /* The 64M mode still requires a 128k gatt */ 363 /* The 64M mode still requires a 128k gatt */
355 {64, 16384, 5}, 364 {64, 16384, 5},
356 {256, 65536, 6}, 365 {256, 65536, 6},
366 {512, 131072, 7},
357}; 367};
358 368
359static struct _intel_i830_private { 369static struct _intel_i830_private {
@@ -377,7 +387,11 @@ static void intel_i830_init_gtt_entries(void)
377 /* We obtain the size of the GTT, which is also stored (for some 387 /* We obtain the size of the GTT, which is also stored (for some
378 * reason) at the top of stolen memory. Then we add 4KB to that 388 * reason) at the top of stolen memory. Then we add 4KB to that
379 * for the video BIOS popup, which is also stored in there. */ 389 * for the video BIOS popup, which is also stored in there. */
380 size = agp_bridge->driver->fetch_size() + 4; 390
391 if (IS_I965)
392 size = 512 + 4;
393 else
394 size = agp_bridge->driver->fetch_size() + 4;
381 395
382 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || 396 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB ||
383 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { 397 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) {
@@ -423,7 +437,7 @@ static void intel_i830_init_gtt_entries(void)
423 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 437 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
424 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 438 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
425 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || 439 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
426 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB) 440 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || IS_I965 )
427 gtt_entries = MB(48) - KB(size); 441 gtt_entries = MB(48) - KB(size);
428 else 442 else
429 gtt_entries = 0; 443 gtt_entries = 0;
@@ -433,7 +447,7 @@ static void intel_i830_init_gtt_entries(void)
433 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 447 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
434 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 448 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
435 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || 449 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
436 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB) 450 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || IS_I965)
437 gtt_entries = MB(64) - KB(size); 451 gtt_entries = MB(64) - KB(size);
438 else 452 else
439 gtt_entries = 0; 453 gtt_entries = 0;
@@ -791,6 +805,77 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
791 805
792 return 0; 806 return 0;
793} 807}
808static int intel_i965_fetch_size(void)
809{
810 struct aper_size_info_fixed *values;
811 u32 offset = 0;
812 u8 temp;
813
814#define I965_512MB_ADDRESS_MASK (3<<1)
815
816 values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes);
817
818 pci_read_config_byte(intel_i830_private.i830_dev, I965_MSAC, &temp);
819 temp &= I965_512MB_ADDRESS_MASK;
820 switch (temp) {
821 case 0x00:
822 offset = 0; /* 128MB */
823 break;
824 case 0x06:
825 offset = 3; /* 512MB */
826 break;
827 default:
828 case 0x02:
829 offset = 2; /* 256MB */
830 break;
831 }
832
833 agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset);
834
835 return values[offset].size;
836}
837
838/* The intel i965 automatically initializes the agp aperture during POST.
839+ * Use the memory already set aside for in the GTT.
840+ */
841static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge)
842{
843 int page_order;
844 struct aper_size_info_fixed *size;
845 int num_entries;
846 u32 temp;
847
848 size = agp_bridge->current_size;
849 page_order = size->page_order;
850 num_entries = size->num_entries;
851 agp_bridge->gatt_table_real = NULL;
852
853 pci_read_config_dword(intel_i830_private.i830_dev, I915_MMADDR, &temp);
854
855 temp &= 0xfff00000;
856 intel_i830_private.gtt = ioremap((temp + (512 * 1024)) , 512 * 1024);
857
858 if (!intel_i830_private.gtt)
859 return -ENOMEM;
860
861
862 intel_i830_private.registers = ioremap(temp,128 * 4096);
863 if (!intel_i830_private.registers)
864 return -ENOMEM;
865
866 temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000;
867 global_cache_flush(); /* FIXME: ? */
868
869 /* we have to call this as early as possible after the MMIO base address is known */
870 intel_i830_init_gtt_entries();
871
872 agp_bridge->gatt_table = NULL;
873
874 agp_bridge->gatt_bus_addr = temp;
875
876 return 0;
877}
878
794 879
795static int intel_fetch_size(void) 880static int intel_fetch_size(void)
796{ 881{
@@ -1307,7 +1392,7 @@ static struct agp_bridge_driver intel_830_driver = {
1307 .owner = THIS_MODULE, 1392 .owner = THIS_MODULE,
1308 .aperture_sizes = intel_i830_sizes, 1393 .aperture_sizes = intel_i830_sizes,
1309 .size_type = FIXED_APER_SIZE, 1394 .size_type = FIXED_APER_SIZE,
1310 .num_aperture_sizes = 3, 1395 .num_aperture_sizes = 4,
1311 .needs_scratch_page = TRUE, 1396 .needs_scratch_page = TRUE,
1312 .configure = intel_i830_configure, 1397 .configure = intel_i830_configure,
1313 .fetch_size = intel_i830_fetch_size, 1398 .fetch_size = intel_i830_fetch_size,
@@ -1469,7 +1554,7 @@ static struct agp_bridge_driver intel_915_driver = {
1469 .owner = THIS_MODULE, 1554 .owner = THIS_MODULE,
1470 .aperture_sizes = intel_i830_sizes, 1555 .aperture_sizes = intel_i830_sizes,
1471 .size_type = FIXED_APER_SIZE, 1556 .size_type = FIXED_APER_SIZE,
1472 .num_aperture_sizes = 3, 1557 .num_aperture_sizes = 4,
1473 .needs_scratch_page = TRUE, 1558 .needs_scratch_page = TRUE,
1474 .configure = intel_i915_configure, 1559 .configure = intel_i915_configure,
1475 .fetch_size = intel_i915_fetch_size, 1560 .fetch_size = intel_i915_fetch_size,
@@ -1489,6 +1574,29 @@ static struct agp_bridge_driver intel_915_driver = {
1489 .agp_destroy_page = agp_generic_destroy_page, 1574 .agp_destroy_page = agp_generic_destroy_page,
1490}; 1575};
1491 1576
1577static struct agp_bridge_driver intel_i965_driver = {
1578 .owner = THIS_MODULE,
1579 .aperture_sizes = intel_i830_sizes,
1580 .size_type = FIXED_APER_SIZE,
1581 .num_aperture_sizes = 4,
1582 .needs_scratch_page = TRUE,
1583 .configure = intel_i915_configure,
1584 .fetch_size = intel_i965_fetch_size,
1585 .cleanup = intel_i915_cleanup,
1586 .tlb_flush = intel_i810_tlbflush,
1587 .mask_memory = intel_i810_mask_memory,
1588 .masks = intel_i810_masks,
1589 .agp_enable = intel_i810_agp_enable,
1590 .cache_flush = global_cache_flush,
1591 .create_gatt_table = intel_i965_create_gatt_table,
1592 .free_gatt_table = intel_i830_free_gatt_table,
1593 .insert_memory = intel_i915_insert_entries,
1594 .remove_memory = intel_i915_remove_entries,
1595 .alloc_by_type = intel_i830_alloc_by_type,
1596 .free_by_type = intel_i810_free_by_type,
1597 .agp_alloc_page = agp_generic_alloc_page,
1598 .agp_destroy_page = agp_generic_destroy_page,
1599};
1492 1600
1493static struct agp_bridge_driver intel_7505_driver = { 1601static struct agp_bridge_driver intel_7505_driver = {
1494 .owner = THIS_MODULE, 1602 .owner = THIS_MODULE,
@@ -1684,6 +1792,35 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
1684 bridge->driver = &intel_845_driver; 1792 bridge->driver = &intel_845_driver;
1685 name = "945GM"; 1793 name = "945GM";
1686 break; 1794 break;
1795 case PCI_DEVICE_ID_INTEL_82946GZ_HB:
1796 if (find_i830(PCI_DEVICE_ID_INTEL_82946GZ_IG))
1797 bridge->driver = &intel_i965_driver;
1798 else
1799 bridge->driver = &intel_845_driver;
1800 name = "946GZ";
1801 break;
1802 case PCI_DEVICE_ID_INTEL_82965G_1_HB:
1803 if (find_i830(PCI_DEVICE_ID_INTEL_82965G_1_IG))
1804 bridge->driver = &intel_i965_driver;
1805 else
1806 bridge->driver = &intel_845_driver;
1807 name = "965G";
1808 break;
1809 case PCI_DEVICE_ID_INTEL_82965Q_HB:
1810 if (find_i830(PCI_DEVICE_ID_INTEL_82965Q_IG))
1811 bridge->driver = &intel_i965_driver;
1812 else
1813 bridge->driver = &intel_845_driver;
1814 name = "965Q";
1815 break;
1816 case PCI_DEVICE_ID_INTEL_82965G_HB:
1817 if (find_i830(PCI_DEVICE_ID_INTEL_82965G_IG))
1818 bridge->driver = &intel_i965_driver;
1819 else
1820 bridge->driver = &intel_845_driver;
1821 name = "965G";
1822 break;
1823
1687 case PCI_DEVICE_ID_INTEL_7505_0: 1824 case PCI_DEVICE_ID_INTEL_7505_0:
1688 bridge->driver = &intel_7505_driver; 1825 bridge->driver = &intel_7505_driver;
1689 name = "E7505"; 1826 name = "E7505";
@@ -1766,6 +1903,7 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev)
1766 agp_put_bridge(bridge); 1903 agp_put_bridge(bridge);
1767} 1904}
1768 1905
1906#ifdef CONFIG_PM
1769static int agp_intel_resume(struct pci_dev *pdev) 1907static int agp_intel_resume(struct pci_dev *pdev)
1770{ 1908{
1771 struct agp_bridge_data *bridge = pci_get_drvdata(pdev); 1909 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
@@ -1786,9 +1924,12 @@ static int agp_intel_resume(struct pci_dev *pdev)
1786 intel_i830_configure(); 1924 intel_i830_configure();
1787 else if (bridge->driver == &intel_810_driver) 1925 else if (bridge->driver == &intel_810_driver)
1788 intel_i810_configure(); 1926 intel_i810_configure();
1927 else if (bridge->driver == &intel_i965_driver)
1928 intel_i915_configure();
1789 1929
1790 return 0; 1930 return 0;
1791} 1931}
1932#endif
1792 1933
1793static struct pci_device_id agp_intel_pci_table[] = { 1934static struct pci_device_id agp_intel_pci_table[] = {
1794#define ID(x) \ 1935#define ID(x) \
@@ -1825,6 +1966,10 @@ static struct pci_device_id agp_intel_pci_table[] = {
1825 ID(PCI_DEVICE_ID_INTEL_82915GM_HB), 1966 ID(PCI_DEVICE_ID_INTEL_82915GM_HB),
1826 ID(PCI_DEVICE_ID_INTEL_82945G_HB), 1967 ID(PCI_DEVICE_ID_INTEL_82945G_HB),
1827 ID(PCI_DEVICE_ID_INTEL_82945GM_HB), 1968 ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
1969 ID(PCI_DEVICE_ID_INTEL_82946GZ_HB),
1970 ID(PCI_DEVICE_ID_INTEL_82965G_1_HB),
1971 ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
1972 ID(PCI_DEVICE_ID_INTEL_82965G_HB),
1828 { } 1973 { }
1829}; 1974};
1830 1975
@@ -1835,7 +1980,9 @@ static struct pci_driver agp_intel_pci_driver = {
1835 .id_table = agp_intel_pci_table, 1980 .id_table = agp_intel_pci_table,
1836 .probe = agp_intel_probe, 1981 .probe = agp_intel_probe,
1837 .remove = __devexit_p(agp_intel_remove), 1982 .remove = __devexit_p(agp_intel_remove),
1983#ifdef CONFIG_PM
1838 .resume = agp_intel_resume, 1984 .resume = agp_intel_resume,
1985#endif
1839}; 1986};
1840 1987
1841static int __init agp_intel_init(void) 1988static int __init agp_intel_init(void)
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index b8ec25d17478..c149ac9ce9a7 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -9,7 +9,7 @@
9#include <linux/agp_backend.h> 9#include <linux/agp_backend.h>
10#include "agp.h" 10#include "agp.h"
11 11
12static struct pci_device_id agp_via_pci_table[]; 12static const struct pci_device_id agp_via_pci_table[];
13 13
14#define VIA_GARTCTRL 0x80 14#define VIA_GARTCTRL 0x80
15#define VIA_APSIZE 0x84 15#define VIA_APSIZE 0x84
@@ -485,7 +485,7 @@ static int agp_via_resume(struct pci_dev *pdev)
485#endif /* CONFIG_PM */ 485#endif /* CONFIG_PM */
486 486
487/* must be the same order as name table above */ 487/* must be the same order as name table above */
488static struct pci_device_id agp_via_pci_table[] = { 488static const struct pci_device_id agp_via_pci_table[] = {
489#define ID(x) \ 489#define ID(x) \
490 { \ 490 { \
491 .class = (PCI_CLASS_BRIDGE_HOST << 8), \ 491 .class = (PCI_CLASS_BRIDGE_HOST << 8), \