blob: a426ee1f57a6fd71b30fbd80429cac7c97aa1b4c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Intel AGPGART routines.
3 */
4
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <linux/module.h>
6#include <linux/pci.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +09007#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <linux/init.h>
Ahmed S. Darwish1eaf1222007-02-06 18:08:28 +02009#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/pagemap.h>
11#include <linux/agp_backend.h>
Borislav Petkov48a719c2010-01-22 16:01:04 +010012#include <asm/smp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include "agp.h"
Daniel Vetterff7cdd62010-04-14 00:29:51 +020014#include "intel-agp.h"
Daniel Vetter14be93d2012-06-08 15:55:40 +020015#include <drm/intel-gtt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Zhenyu Wang1f7a6e32010-02-23 14:05:24 +080017int intel_agp_enabled;
18EXPORT_SYMBOL(intel_agp_enabled);
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020static int intel_fetch_size(void)
21{
22 int i;
23 u16 temp;
24 struct aper_size_info_16 *values;
25
26 pci_read_config_word(agp_bridge->dev, INTEL_APSIZE, &temp);
27 values = A_SIZE_16(agp_bridge->driver->aperture_sizes);
28
29 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
30 if (temp == values[i].size_value) {
31 agp_bridge->previous_size = agp_bridge->current_size = (void *) (values + i);
32 agp_bridge->aperture_size_idx = i;
33 return values[i].size;
34 }
35 }
36
37 return 0;
38}
39
40static int __intel_8xx_fetch_size(u8 temp)
41{
42 int i;
43 struct aper_size_info_8 *values;
44
45 values = A_SIZE_8(agp_bridge->driver->aperture_sizes);
46
47 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
48 if (temp == values[i].size_value) {
49 agp_bridge->previous_size =
50 agp_bridge->current_size = (void *) (values + i);
51 agp_bridge->aperture_size_idx = i;
52 return values[i].size;
53 }
54 }
55 return 0;
56}
57
58static int intel_8xx_fetch_size(void)
59{
60 u8 temp;
61
62 pci_read_config_byte(agp_bridge->dev, INTEL_APSIZE, &temp);
63 return __intel_8xx_fetch_size(temp);
64}
65
66static int intel_815_fetch_size(void)
67{
68 u8 temp;
69
70 /* Intel 815 chipsets have a _weird_ APSIZE register with only
71 * one non-reserved bit, so mask the others out ... */
72 pci_read_config_byte(agp_bridge->dev, INTEL_APSIZE, &temp);
73 temp &= (1 << 3);
74
75 return __intel_8xx_fetch_size(temp);
76}
77
78static void intel_tlbflush(struct agp_memory *mem)
79{
80 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2200);
81 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280);
82}
83
84
85static void intel_8xx_tlbflush(struct agp_memory *mem)
86{
87 u32 temp;
88 pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp);
89 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp & ~(1 << 7));
90 pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp);
91 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp | (1 << 7));
92}
93
94
95static void intel_cleanup(void)
96{
97 u16 temp;
98 struct aper_size_info_16 *previous_size;
99
100 previous_size = A_SIZE_16(agp_bridge->previous_size);
101 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp);
102 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp & ~(1 << 9));
103 pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, previous_size->size_value);
104}
105
106
107static void intel_8xx_cleanup(void)
108{
109 u16 temp;
110 struct aper_size_info_8 *previous_size;
111
112 previous_size = A_SIZE_8(agp_bridge->previous_size);
113 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp);
114 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp & ~(1 << 9));
115 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, previous_size->size_value);
116}
117
118
119static int intel_configure(void)
120{
121 u32 temp;
122 u16 temp2;
123 struct aper_size_info_16 *current_size;
124
125 current_size = A_SIZE_16(agp_bridge->current_size);
126
127 /* aperture size */
128 pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
129
130 /* address to map to */
131 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
132 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
133
134 /* attbase - aperture base */
135 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
136
137 /* agpctrl */
138 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280);
139
140 /* paccfg/nbxcfg */
141 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2);
142 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG,
143 (temp2 & ~(1 << 10)) | (1 << 9));
144 /* clear any possible error conditions */
145 pci_write_config_byte(agp_bridge->dev, INTEL_ERRSTS + 1, 7);
146 return 0;
147}
148
149static int intel_815_configure(void)
150{
151 u32 temp, addr;
152 u8 temp2;
153 struct aper_size_info_8 *current_size;
154
155 /* attbase - aperture base */
156 /* the Intel 815 chipset spec. says that bits 29-31 in the
157 * ATTBASE register are reserved -> try not to write them */
158 if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) {
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700159 dev_emerg(&agp_bridge->dev->dev, "gatt bus addr too high");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 return -EINVAL;
161 }
162
163 current_size = A_SIZE_8(agp_bridge->current_size);
164
165 /* aperture size */
166 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE,
167 current_size->size_value);
168
169 /* address to map to */
170 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
171 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
172
173 pci_read_config_dword(agp_bridge->dev, INTEL_ATTBASE, &addr);
174 addr &= INTEL_815_ATTBASE_MASK;
175 addr |= agp_bridge->gatt_bus_addr;
176 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, addr);
177
178 /* agpctrl */
179 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
180
181 /* apcont */
182 pci_read_config_byte(agp_bridge->dev, INTEL_815_APCONT, &temp2);
183 pci_write_config_byte(agp_bridge->dev, INTEL_815_APCONT, temp2 | (1 << 1));
184
185 /* clear any possible error conditions */
186 /* Oddness : this chipset seems to have no ERRSTS register ! */
187 return 0;
188}
189
190static void intel_820_tlbflush(struct agp_memory *mem)
191{
192 return;
193}
194
195static void intel_820_cleanup(void)
196{
197 u8 temp;
198 struct aper_size_info_8 *previous_size;
199
200 previous_size = A_SIZE_8(agp_bridge->previous_size);
201 pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp);
202 pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR,
203 temp & ~(1 << 1));
204 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE,
205 previous_size->size_value);
206}
207
208
209static int intel_820_configure(void)
210{
211 u32 temp;
212 u8 temp2;
213 struct aper_size_info_8 *current_size;
214
215 current_size = A_SIZE_8(agp_bridge->current_size);
216
217 /* aperture size */
218 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
219
220 /* address to map to */
221 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
222 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
223
224 /* attbase - aperture base */
225 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
226
227 /* agpctrl */
228 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
229
230 /* global enable aperture access */
231 /* This flag is not accessed through MCHCFG register as in */
232 /* i850 chipset. */
233 pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp2);
234 pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR, temp2 | (1 << 1));
235 /* clear any possible AGP-related error conditions */
236 pci_write_config_word(agp_bridge->dev, INTEL_I820_ERRSTS, 0x001c);
237 return 0;
238}
239
240static int intel_840_configure(void)
241{
242 u32 temp;
243 u16 temp2;
244 struct aper_size_info_8 *current_size;
245
246 current_size = A_SIZE_8(agp_bridge->current_size);
247
248 /* aperture size */
249 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
250
251 /* address to map to */
252 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
253 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
254
255 /* attbase - aperture base */
256 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
257
258 /* agpctrl */
259 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
260
261 /* mcgcfg */
262 pci_read_config_word(agp_bridge->dev, INTEL_I840_MCHCFG, &temp2);
263 pci_write_config_word(agp_bridge->dev, INTEL_I840_MCHCFG, temp2 | (1 << 9));
264 /* clear any possible error conditions */
265 pci_write_config_word(agp_bridge->dev, INTEL_I840_ERRSTS, 0xc000);
266 return 0;
267}
268
269static int intel_845_configure(void)
270{
271 u32 temp;
272 u8 temp2;
273 struct aper_size_info_8 *current_size;
274
275 current_size = A_SIZE_8(agp_bridge->current_size);
276
277 /* aperture size */
278 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
279
Matthew Garrettb0825482005-07-29 14:03:39 -0700280 if (agp_bridge->apbase_config != 0) {
281 pci_write_config_dword(agp_bridge->dev, AGP_APBASE,
282 agp_bridge->apbase_config);
283 } else {
284 /* address to map to */
285 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
286 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
287 agp_bridge->apbase_config = temp;
288 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289
290 /* attbase - aperture base */
291 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
292
293 /* agpctrl */
294 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
295
296 /* agpm */
297 pci_read_config_byte(agp_bridge->dev, INTEL_I845_AGPM, &temp2);
298 pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1));
299 /* clear any possible error conditions */
300 pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c);
301 return 0;
302}
303
304static int intel_850_configure(void)
305{
306 u32 temp;
307 u16 temp2;
308 struct aper_size_info_8 *current_size;
309
310 current_size = A_SIZE_8(agp_bridge->current_size);
311
312 /* aperture size */
313 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
314
315 /* address to map to */
316 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
317 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
318
319 /* attbase - aperture base */
320 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
321
322 /* agpctrl */
323 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
324
325 /* mcgcfg */
326 pci_read_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, &temp2);
327 pci_write_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, temp2 | (1 << 9));
328 /* clear any possible AGP-related error conditions */
329 pci_write_config_word(agp_bridge->dev, INTEL_I850_ERRSTS, 0x001c);
330 return 0;
331}
332
333static int intel_860_configure(void)
334{
335 u32 temp;
336 u16 temp2;
337 struct aper_size_info_8 *current_size;
338
339 current_size = A_SIZE_8(agp_bridge->current_size);
340
341 /* aperture size */
342 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
343
344 /* address to map to */
345 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
346 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
347
348 /* attbase - aperture base */
349 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
350
351 /* agpctrl */
352 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
353
354 /* mcgcfg */
355 pci_read_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, &temp2);
356 pci_write_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, temp2 | (1 << 9));
357 /* clear any possible AGP-related error conditions */
358 pci_write_config_word(agp_bridge->dev, INTEL_I860_ERRSTS, 0xf700);
359 return 0;
360}
361
362static int intel_830mp_configure(void)
363{
364 u32 temp;
365 u16 temp2;
366 struct aper_size_info_8 *current_size;
367
368 current_size = A_SIZE_8(agp_bridge->current_size);
369
370 /* aperture size */
371 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
372
373 /* address to map to */
374 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
375 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
376
377 /* attbase - aperture base */
378 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
379
380 /* agpctrl */
381 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
382
383 /* gmch */
384 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2);
385 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp2 | (1 << 9));
386 /* clear any possible AGP-related error conditions */
387 pci_write_config_word(agp_bridge->dev, INTEL_I830_ERRSTS, 0x1c);
388 return 0;
389}
390
391static int intel_7505_configure(void)
392{
393 u32 temp;
394 u16 temp2;
395 struct aper_size_info_8 *current_size;
396
397 current_size = A_SIZE_8(agp_bridge->current_size);
398
399 /* aperture size */
400 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
401
402 /* address to map to */
403 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
404 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
405
406 /* attbase - aperture base */
407 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
408
409 /* agpctrl */
410 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
411
412 /* mchcfg */
413 pci_read_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, &temp2);
414 pci_write_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, temp2 | (1 << 9));
415
416 return 0;
417}
418
419/* Setup function */
Dave Jonese5524f32007-02-22 18:41:28 -0500420static const struct gatt_mask intel_generic_masks[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421{
422 {.mask = 0x00000017, .type = 0}
423};
424
Dave Jonese5524f32007-02-22 18:41:28 -0500425static const struct aper_size_info_8 intel_815_sizes[2] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426{
427 {64, 16384, 4, 0},
428 {32, 8192, 3, 8},
429};
430
Dave Jonese5524f32007-02-22 18:41:28 -0500431static const struct aper_size_info_8 intel_8xx_sizes[7] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432{
433 {256, 65536, 6, 0},
434 {128, 32768, 5, 32},
435 {64, 16384, 4, 48},
436 {32, 8192, 3, 56},
437 {16, 4096, 2, 60},
438 {8, 2048, 1, 62},
439 {4, 1024, 0, 63}
440};
441
Dave Jonese5524f32007-02-22 18:41:28 -0500442static const struct aper_size_info_16 intel_generic_sizes[7] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443{
444 {256, 65536, 6, 0},
445 {128, 32768, 5, 32},
446 {64, 16384, 4, 48},
447 {32, 8192, 3, 56},
448 {16, 4096, 2, 60},
449 {8, 2048, 1, 62},
450 {4, 1024, 0, 63}
451};
452
Dave Jonese5524f32007-02-22 18:41:28 -0500453static const struct aper_size_info_8 intel_830mp_sizes[4] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454{
455 {256, 65536, 6, 0},
456 {128, 32768, 5, 32},
457 {64, 16384, 4, 48},
458 {32, 8192, 3, 56}
459};
460
Dave Jonese5524f32007-02-22 18:41:28 -0500461static const struct agp_bridge_driver intel_generic_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 .owner = THIS_MODULE,
463 .aperture_sizes = intel_generic_sizes,
464 .size_type = U16_APER_SIZE,
465 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200466 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467 .configure = intel_configure,
468 .fetch_size = intel_fetch_size,
469 .cleanup = intel_cleanup,
470 .tlb_flush = intel_tlbflush,
471 .mask_memory = agp_generic_mask_memory,
472 .masks = intel_generic_masks,
473 .agp_enable = agp_generic_enable,
474 .cache_flush = global_cache_flush,
475 .create_gatt_table = agp_generic_create_gatt_table,
476 .free_gatt_table = agp_generic_free_gatt_table,
477 .insert_memory = agp_generic_insert_memory,
478 .remove_memory = agp_generic_remove_memory,
479 .alloc_by_type = agp_generic_alloc_by_type,
480 .free_by_type = agp_generic_free_by_type,
481 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800482 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800484 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100485 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486};
487
Dave Jonese5524f32007-02-22 18:41:28 -0500488static const struct agp_bridge_driver intel_815_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489 .owner = THIS_MODULE,
490 .aperture_sizes = intel_815_sizes,
491 .size_type = U8_APER_SIZE,
492 .num_aperture_sizes = 2,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200493 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 .configure = intel_815_configure,
495 .fetch_size = intel_815_fetch_size,
496 .cleanup = intel_8xx_cleanup,
497 .tlb_flush = intel_8xx_tlbflush,
498 .mask_memory = agp_generic_mask_memory,
499 .masks = intel_generic_masks,
500 .agp_enable = agp_generic_enable,
501 .cache_flush = global_cache_flush,
502 .create_gatt_table = agp_generic_create_gatt_table,
503 .free_gatt_table = agp_generic_free_gatt_table,
504 .insert_memory = agp_generic_insert_memory,
505 .remove_memory = agp_generic_remove_memory,
506 .alloc_by_type = agp_generic_alloc_by_type,
507 .free_by_type = agp_generic_free_by_type,
508 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800509 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800511 .agp_destroy_pages = agp_generic_destroy_pages,
Dave Airlie62c96b92008-06-19 14:27:53 +1000512 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513};
514
Dave Jonese5524f32007-02-22 18:41:28 -0500515static const struct agp_bridge_driver intel_820_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 .owner = THIS_MODULE,
517 .aperture_sizes = intel_8xx_sizes,
518 .size_type = U8_APER_SIZE,
519 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200520 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521 .configure = intel_820_configure,
522 .fetch_size = intel_8xx_fetch_size,
523 .cleanup = intel_820_cleanup,
524 .tlb_flush = intel_820_tlbflush,
525 .mask_memory = agp_generic_mask_memory,
526 .masks = intel_generic_masks,
527 .agp_enable = agp_generic_enable,
528 .cache_flush = global_cache_flush,
529 .create_gatt_table = agp_generic_create_gatt_table,
530 .free_gatt_table = agp_generic_free_gatt_table,
531 .insert_memory = agp_generic_insert_memory,
532 .remove_memory = agp_generic_remove_memory,
533 .alloc_by_type = agp_generic_alloc_by_type,
534 .free_by_type = agp_generic_free_by_type,
535 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800536 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800538 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100539 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540};
541
Dave Jonese5524f32007-02-22 18:41:28 -0500542static const struct agp_bridge_driver intel_830mp_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 .owner = THIS_MODULE,
544 .aperture_sizes = intel_830mp_sizes,
545 .size_type = U8_APER_SIZE,
546 .num_aperture_sizes = 4,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200547 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 .configure = intel_830mp_configure,
549 .fetch_size = intel_8xx_fetch_size,
550 .cleanup = intel_8xx_cleanup,
551 .tlb_flush = intel_8xx_tlbflush,
552 .mask_memory = agp_generic_mask_memory,
553 .masks = intel_generic_masks,
554 .agp_enable = agp_generic_enable,
555 .cache_flush = global_cache_flush,
556 .create_gatt_table = agp_generic_create_gatt_table,
557 .free_gatt_table = agp_generic_free_gatt_table,
558 .insert_memory = agp_generic_insert_memory,
559 .remove_memory = agp_generic_remove_memory,
560 .alloc_by_type = agp_generic_alloc_by_type,
561 .free_by_type = agp_generic_free_by_type,
562 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800563 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800565 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100566 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567};
568
Dave Jonese5524f32007-02-22 18:41:28 -0500569static const struct agp_bridge_driver intel_840_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 .owner = THIS_MODULE,
571 .aperture_sizes = intel_8xx_sizes,
572 .size_type = U8_APER_SIZE,
573 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200574 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 .configure = intel_840_configure,
576 .fetch_size = intel_8xx_fetch_size,
577 .cleanup = intel_8xx_cleanup,
578 .tlb_flush = intel_8xx_tlbflush,
579 .mask_memory = agp_generic_mask_memory,
580 .masks = intel_generic_masks,
581 .agp_enable = agp_generic_enable,
582 .cache_flush = global_cache_flush,
583 .create_gatt_table = agp_generic_create_gatt_table,
584 .free_gatt_table = agp_generic_free_gatt_table,
585 .insert_memory = agp_generic_insert_memory,
586 .remove_memory = agp_generic_remove_memory,
587 .alloc_by_type = agp_generic_alloc_by_type,
588 .free_by_type = agp_generic_free_by_type,
589 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800590 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800592 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100593 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594};
595
Dave Jonese5524f32007-02-22 18:41:28 -0500596static const struct agp_bridge_driver intel_845_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 .owner = THIS_MODULE,
598 .aperture_sizes = intel_8xx_sizes,
599 .size_type = U8_APER_SIZE,
600 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200601 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 .configure = intel_845_configure,
603 .fetch_size = intel_8xx_fetch_size,
604 .cleanup = intel_8xx_cleanup,
605 .tlb_flush = intel_8xx_tlbflush,
606 .mask_memory = agp_generic_mask_memory,
607 .masks = intel_generic_masks,
608 .agp_enable = agp_generic_enable,
609 .cache_flush = global_cache_flush,
610 .create_gatt_table = agp_generic_create_gatt_table,
611 .free_gatt_table = agp_generic_free_gatt_table,
612 .insert_memory = agp_generic_insert_memory,
613 .remove_memory = agp_generic_remove_memory,
614 .alloc_by_type = agp_generic_alloc_by_type,
615 .free_by_type = agp_generic_free_by_type,
616 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800617 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800619 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100620 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621};
622
Dave Jonese5524f32007-02-22 18:41:28 -0500623static const struct agp_bridge_driver intel_850_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 .owner = THIS_MODULE,
625 .aperture_sizes = intel_8xx_sizes,
626 .size_type = U8_APER_SIZE,
627 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200628 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 .configure = intel_850_configure,
630 .fetch_size = intel_8xx_fetch_size,
631 .cleanup = intel_8xx_cleanup,
632 .tlb_flush = intel_8xx_tlbflush,
633 .mask_memory = agp_generic_mask_memory,
634 .masks = intel_generic_masks,
635 .agp_enable = agp_generic_enable,
636 .cache_flush = global_cache_flush,
637 .create_gatt_table = agp_generic_create_gatt_table,
638 .free_gatt_table = agp_generic_free_gatt_table,
639 .insert_memory = agp_generic_insert_memory,
640 .remove_memory = agp_generic_remove_memory,
641 .alloc_by_type = agp_generic_alloc_by_type,
642 .free_by_type = agp_generic_free_by_type,
643 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800644 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800646 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100647 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648};
649
Dave Jonese5524f32007-02-22 18:41:28 -0500650static const struct agp_bridge_driver intel_860_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 .owner = THIS_MODULE,
652 .aperture_sizes = intel_8xx_sizes,
653 .size_type = U8_APER_SIZE,
654 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200655 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700656 .configure = intel_860_configure,
657 .fetch_size = intel_8xx_fetch_size,
658 .cleanup = intel_8xx_cleanup,
659 .tlb_flush = intel_8xx_tlbflush,
660 .mask_memory = agp_generic_mask_memory,
661 .masks = intel_generic_masks,
662 .agp_enable = agp_generic_enable,
663 .cache_flush = global_cache_flush,
664 .create_gatt_table = agp_generic_create_gatt_table,
665 .free_gatt_table = agp_generic_free_gatt_table,
666 .insert_memory = agp_generic_insert_memory,
667 .remove_memory = agp_generic_remove_memory,
668 .alloc_by_type = agp_generic_alloc_by_type,
669 .free_by_type = agp_generic_free_by_type,
670 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800671 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800673 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100674 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675};
676
Dave Jonese5524f32007-02-22 18:41:28 -0500677static const struct agp_bridge_driver intel_7505_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 .owner = THIS_MODULE,
679 .aperture_sizes = intel_8xx_sizes,
680 .size_type = U8_APER_SIZE,
681 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200682 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 .configure = intel_7505_configure,
684 .fetch_size = intel_8xx_fetch_size,
685 .cleanup = intel_8xx_cleanup,
686 .tlb_flush = intel_8xx_tlbflush,
687 .mask_memory = agp_generic_mask_memory,
688 .masks = intel_generic_masks,
689 .agp_enable = agp_generic_enable,
690 .cache_flush = global_cache_flush,
691 .create_gatt_table = agp_generic_create_gatt_table,
692 .free_gatt_table = agp_generic_free_gatt_table,
693 .insert_memory = agp_generic_insert_memory,
694 .remove_memory = agp_generic_remove_memory,
695 .alloc_by_type = agp_generic_alloc_by_type,
696 .free_by_type = agp_generic_free_by_type,
697 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800698 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800700 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100701 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702};
703
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800704/* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of
705 * driver and gmch_driver must be non-null, and find_gmch will determine
706 * which one should be used if a gmch_chip_id is present.
707 */
Daniel Vetter02c026c2010-08-24 19:39:48 +0200708static const struct intel_agp_driver_description {
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800709 unsigned int chip_id;
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800710 char *name;
711 const struct agp_bridge_driver *driver;
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800712} intel_agp_chipsets[] = {
Daniel Vetter02c026c2010-08-24 19:39:48 +0200713 { PCI_DEVICE_ID_INTEL_82443LX_0, "440LX", &intel_generic_driver },
714 { PCI_DEVICE_ID_INTEL_82443BX_0, "440BX", &intel_generic_driver },
715 { PCI_DEVICE_ID_INTEL_82443GX_0, "440GX", &intel_generic_driver },
716 { PCI_DEVICE_ID_INTEL_82815_MC, "i815", &intel_815_driver },
717 { PCI_DEVICE_ID_INTEL_82820_HB, "i820", &intel_820_driver },
718 { PCI_DEVICE_ID_INTEL_82820_UP_HB, "i820", &intel_820_driver },
719 { PCI_DEVICE_ID_INTEL_82830_HB, "830M", &intel_830mp_driver },
720 { PCI_DEVICE_ID_INTEL_82840_HB, "i840", &intel_840_driver },
Oswald Buddenhagen53371ed2010-06-19 23:08:37 +0200721 { PCI_DEVICE_ID_INTEL_82845_HB, "i845", &intel_845_driver },
722 { PCI_DEVICE_ID_INTEL_82845G_HB, "845G", &intel_845_driver },
Daniel Vetter02c026c2010-08-24 19:39:48 +0200723 { PCI_DEVICE_ID_INTEL_82850_HB, "i850", &intel_850_driver },
724 { PCI_DEVICE_ID_INTEL_82854_HB, "854", &intel_845_driver },
725 { PCI_DEVICE_ID_INTEL_82855PM_HB, "855PM", &intel_845_driver },
726 { PCI_DEVICE_ID_INTEL_82855GM_HB, "855GM", &intel_845_driver },
727 { PCI_DEVICE_ID_INTEL_82860_HB, "i860", &intel_860_driver },
728 { PCI_DEVICE_ID_INTEL_82865_HB, "865", &intel_845_driver },
729 { PCI_DEVICE_ID_INTEL_82875_HB, "i875", &intel_845_driver },
730 { PCI_DEVICE_ID_INTEL_7505_0, "E7505", &intel_7505_driver },
731 { PCI_DEVICE_ID_INTEL_7205_0, "E7205", &intel_7505_driver },
732 { 0, NULL, NULL }
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800733};
734
Greg Kroah-Hartmanbcd29822012-12-21 15:12:08 -0800735static int agp_intel_probe(struct pci_dev *pdev,
736 const struct pci_device_id *ent)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700737{
738 struct agp_bridge_data *bridge;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739 u8 cap_ptr = 0;
740 struct resource *r;
Zhenyu Wang1f7a6e32010-02-23 14:05:24 +0800741 int i, err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742
743 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
744
745 bridge = agp_alloc_bridge();
746 if (!bridge)
747 return -ENOMEM;
748
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200749 bridge->capndx = cap_ptr;
750
Daniel Vetter14be93d2012-06-08 15:55:40 +0200751 if (intel_gmch_probe(pdev, NULL, bridge))
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200752 goto found_gmch;
753
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800754 for (i = 0; intel_agp_chipsets[i].name != NULL; i++) {
755 /* In case that multiple models of gfx chip may
756 stand on same host bridge type, this can be
757 sure we detect the right IGD. */
Wang Zhenyu88889852007-06-14 10:01:04 +0800758 if (pdev->device == intel_agp_chipsets[i].chip_id) {
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200759 bridge->driver = intel_agp_chipsets[i].driver;
760 break;
Wang Zhenyu88889852007-06-14 10:01:04 +0800761 }
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800762 }
763
Daniel Vetter02c026c2010-08-24 19:39:48 +0200764 if (!bridge->driver) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 if (cap_ptr)
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700766 dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n",
767 pdev->vendor, pdev->device);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768 agp_put_bridge(bridge);
769 return -ENODEV;
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800770 }
771
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772 bridge->dev = pdev;
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200773 bridge->dev_private_data = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700775 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776
777 /*
778 * The following fixes the case where the BIOS has "forgotten" to
779 * provide an address range for the GART.
780 * 20030610 - hamish@zot.org
Stephen Kitta70b95c2011-01-31 14:25:43 -0800781 * This happens before pci_enable_device() intentionally;
782 * calling pci_enable_device() before assigning the resource
783 * will result in the GART being disabled on machines with such
784 * BIOSs (the GART ends up with a BAR starting at 0, which
785 * conflicts a lot of other devices).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786 */
787 r = &pdev->resource[0];
788 if (!r->start && r->end) {
Dave Jones6a92a4e2006-02-28 00:54:25 -0500789 if (pci_assign_resource(pdev, 0)) {
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700790 dev_err(&pdev->dev, "can't assign resource 0\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791 agp_put_bridge(bridge);
792 return -ENODEV;
793 }
794 }
795
Stephen Kitta70b95c2011-01-31 14:25:43 -0800796 /*
797 * If the device has not been properly setup, the following will catch
798 * the problem and should stop the system from crashing.
799 * 20030610 - hamish@zot.org
800 */
801 if (pci_enable_device(pdev)) {
802 dev_err(&pdev->dev, "can't enable PCI device\n");
803 agp_put_bridge(bridge);
804 return -ENODEV;
805 }
806
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 /* Fill in the mode register */
808 if (cap_ptr) {
809 pci_read_config_dword(pdev,
810 bridge->capndx+PCI_AGP_STATUS,
811 &bridge->mode);
812 }
813
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200814found_gmch:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700815 pci_set_drvdata(pdev, bridge);
Zhenyu Wang1f7a6e32010-02-23 14:05:24 +0800816 err = agp_add_bridge(bridge);
817 if (!err)
818 intel_agp_enabled = 1;
819 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820}
821
Bill Pemberton39af33f2012-11-19 13:26:26 -0500822static void agp_intel_remove(struct pci_dev *pdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700823{
824 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
825
826 agp_remove_bridge(bridge);
827
Daniel Vetter14be93d2012-06-08 15:55:40 +0200828 intel_gmch_remove();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700829
830 agp_put_bridge(bridge);
831}
832
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400833#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834static int agp_intel_resume(struct pci_dev *pdev)
835{
836 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
837
Daniel Vettere5a04d52010-04-14 00:29:53 +0200838 bridge->driver->configure();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839
840 return 0;
841}
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400842#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700843
844static struct pci_device_id agp_intel_pci_table[] = {
845#define ID(x) \
846 { \
847 .class = (PCI_CLASS_BRIDGE_HOST << 8), \
848 .class_mask = ~0, \
849 .vendor = PCI_VENDOR_ID_INTEL, \
850 .device = x, \
851 .subvendor = PCI_ANY_ID, \
852 .subdevice = PCI_ANY_ID, \
853 }
Ben Widawsky6b2d5902012-01-04 14:04:33 -0800854 ID(PCI_DEVICE_ID_INTEL_82441), /* for HAS2 support */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855 ID(PCI_DEVICE_ID_INTEL_82443LX_0),
856 ID(PCI_DEVICE_ID_INTEL_82443BX_0),
857 ID(PCI_DEVICE_ID_INTEL_82443GX_0),
858 ID(PCI_DEVICE_ID_INTEL_82810_MC1),
859 ID(PCI_DEVICE_ID_INTEL_82810_MC3),
860 ID(PCI_DEVICE_ID_INTEL_82810E_MC),
861 ID(PCI_DEVICE_ID_INTEL_82815_MC),
862 ID(PCI_DEVICE_ID_INTEL_82820_HB),
863 ID(PCI_DEVICE_ID_INTEL_82820_UP_HB),
864 ID(PCI_DEVICE_ID_INTEL_82830_HB),
865 ID(PCI_DEVICE_ID_INTEL_82840_HB),
866 ID(PCI_DEVICE_ID_INTEL_82845_HB),
867 ID(PCI_DEVICE_ID_INTEL_82845G_HB),
868 ID(PCI_DEVICE_ID_INTEL_82850_HB),
Stefan Husemann347486b2009-04-13 14:40:10 -0700869 ID(PCI_DEVICE_ID_INTEL_82854_HB),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700870 ID(PCI_DEVICE_ID_INTEL_82855PM_HB),
871 ID(PCI_DEVICE_ID_INTEL_82855GM_HB),
872 ID(PCI_DEVICE_ID_INTEL_82860_HB),
873 ID(PCI_DEVICE_ID_INTEL_82865_HB),
874 ID(PCI_DEVICE_ID_INTEL_82875_HB),
875 ID(PCI_DEVICE_ID_INTEL_7505_0),
876 ID(PCI_DEVICE_ID_INTEL_7205_0),
Carlos Martíne914a362008-01-24 10:34:09 +1000877 ID(PCI_DEVICE_ID_INTEL_E7221_HB),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878 ID(PCI_DEVICE_ID_INTEL_82915G_HB),
879 ID(PCI_DEVICE_ID_INTEL_82915GM_HB),
Alan Hourihaned0de98f2005-05-31 19:50:49 +0100880 ID(PCI_DEVICE_ID_INTEL_82945G_HB),
Alan Hourihane3b0e8ea2006-01-19 14:08:40 +0000881 ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
Zhenyu Wangdde47872007-07-26 09:18:09 +0800882 ID(PCI_DEVICE_ID_INTEL_82945GME_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500883 ID(PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB),
884 ID(PCI_DEVICE_ID_INTEL_PINEVIEW_HB),
Eric Anholt65c25aa2006-09-06 11:57:18 -0400885 ID(PCI_DEVICE_ID_INTEL_82946GZ_HB),
Zhenyu Wang9119f852008-01-23 15:49:26 +1000886 ID(PCI_DEVICE_ID_INTEL_82G35_HB),
Eric Anholt65c25aa2006-09-06 11:57:18 -0400887 ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
888 ID(PCI_DEVICE_ID_INTEL_82965G_HB),
Wang Zhenyu4598af32007-04-09 08:51:36 +0800889 ID(PCI_DEVICE_ID_INTEL_82965GM_HB),
Zhenyu Wangdde47872007-07-26 09:18:09 +0800890 ID(PCI_DEVICE_ID_INTEL_82965GME_HB),
Wang Zhenyu874808c62007-06-06 11:16:25 +0800891 ID(PCI_DEVICE_ID_INTEL_G33_HB),
892 ID(PCI_DEVICE_ID_INTEL_Q35_HB),
893 ID(PCI_DEVICE_ID_INTEL_Q33_HB),
Zhenyu Wang99d32bd2008-07-30 12:26:50 -0700894 ID(PCI_DEVICE_ID_INTEL_GM45_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500895 ID(PCI_DEVICE_ID_INTEL_EAGLELAKE_HB),
Zhenyu Wang25ce77a2008-06-19 14:17:58 +1000896 ID(PCI_DEVICE_ID_INTEL_Q45_HB),
897 ID(PCI_DEVICE_ID_INTEL_G45_HB),
Zhenyu Wanga50ccc62008-11-17 14:39:00 +0800898 ID(PCI_DEVICE_ID_INTEL_G41_HB),
Fabian Henze38d8a952009-09-08 00:59:58 +0800899 ID(PCI_DEVICE_ID_INTEL_B43_HB),
Chris Wilson3dde04b2010-10-14 16:30:41 +0100900 ID(PCI_DEVICE_ID_INTEL_B43_1_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500901 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB),
Eugeni Dodonov67384fe2012-06-06 11:59:06 -0300902 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500903 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB),
904 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB),
Dave Airlie3ff99162009-12-08 14:03:47 +1000905 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700906 { }
907};
908
909MODULE_DEVICE_TABLE(pci, agp_intel_pci_table);
910
911static struct pci_driver agp_intel_pci_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700912 .name = "agpgart-intel",
913 .id_table = agp_intel_pci_table,
914 .probe = agp_intel_probe,
Greg Kroah-Hartmanbcd29822012-12-21 15:12:08 -0800915 .remove = agp_intel_remove,
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400916#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700917 .resume = agp_intel_resume,
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400918#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700919};
920
921static int __init agp_intel_init(void)
922{
923 if (agp_off)
924 return -EINVAL;
925 return pci_register_driver(&agp_intel_pci_driver);
926}
927
928static void __exit agp_intel_cleanup(void)
929{
930 pci_unregister_driver(&agp_intel_pci_driver);
931}
932
933module_init(agp_intel_init);
934module_exit(agp_intel_cleanup);
935
Dave Jonesf4432c52008-10-20 13:31:45 -0400936MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700937MODULE_LICENSE("GPL and additional rights");