blob: 9ef0a48a5b28196600a780e4f76ec33ab4120c5e [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070017static int intel_fetch_size(void)
18{
19 int i;
20 u16 temp;
21 struct aper_size_info_16 *values;
22
23 pci_read_config_word(agp_bridge->dev, INTEL_APSIZE, &temp);
24 values = A_SIZE_16(agp_bridge->driver->aperture_sizes);
25
26 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
27 if (temp == values[i].size_value) {
28 agp_bridge->previous_size = agp_bridge->current_size = (void *) (values + i);
29 agp_bridge->aperture_size_idx = i;
30 return values[i].size;
31 }
32 }
33
34 return 0;
35}
36
37static int __intel_8xx_fetch_size(u8 temp)
38{
39 int i;
40 struct aper_size_info_8 *values;
41
42 values = A_SIZE_8(agp_bridge->driver->aperture_sizes);
43
44 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
45 if (temp == values[i].size_value) {
46 agp_bridge->previous_size =
47 agp_bridge->current_size = (void *) (values + i);
48 agp_bridge->aperture_size_idx = i;
49 return values[i].size;
50 }
51 }
52 return 0;
53}
54
55static int intel_8xx_fetch_size(void)
56{
57 u8 temp;
58
59 pci_read_config_byte(agp_bridge->dev, INTEL_APSIZE, &temp);
60 return __intel_8xx_fetch_size(temp);
61}
62
63static int intel_815_fetch_size(void)
64{
65 u8 temp;
66
67 /* Intel 815 chipsets have a _weird_ APSIZE register with only
68 * one non-reserved bit, so mask the others out ... */
69 pci_read_config_byte(agp_bridge->dev, INTEL_APSIZE, &temp);
70 temp &= (1 << 3);
71
72 return __intel_8xx_fetch_size(temp);
73}
74
75static void intel_tlbflush(struct agp_memory *mem)
76{
77 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2200);
78 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280);
79}
80
81
82static void intel_8xx_tlbflush(struct agp_memory *mem)
83{
84 u32 temp;
85 pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp);
86 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp & ~(1 << 7));
87 pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp);
88 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp | (1 << 7));
89}
90
91
92static void intel_cleanup(void)
93{
94 u16 temp;
95 struct aper_size_info_16 *previous_size;
96
97 previous_size = A_SIZE_16(agp_bridge->previous_size);
98 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp);
99 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp & ~(1 << 9));
100 pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, previous_size->size_value);
101}
102
103
104static void intel_8xx_cleanup(void)
105{
106 u16 temp;
107 struct aper_size_info_8 *previous_size;
108
109 previous_size = A_SIZE_8(agp_bridge->previous_size);
110 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp);
111 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp & ~(1 << 9));
112 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, previous_size->size_value);
113}
114
115
116static int intel_configure(void)
117{
118 u32 temp;
119 u16 temp2;
120 struct aper_size_info_16 *current_size;
121
122 current_size = A_SIZE_16(agp_bridge->current_size);
123
124 /* aperture size */
125 pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
126
127 /* address to map to */
128 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
129 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
130
131 /* attbase - aperture base */
132 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
133
134 /* agpctrl */
135 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280);
136
137 /* paccfg/nbxcfg */
138 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2);
139 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG,
140 (temp2 & ~(1 << 10)) | (1 << 9));
141 /* clear any possible error conditions */
142 pci_write_config_byte(agp_bridge->dev, INTEL_ERRSTS + 1, 7);
143 return 0;
144}
145
146static int intel_815_configure(void)
147{
148 u32 temp, addr;
149 u8 temp2;
150 struct aper_size_info_8 *current_size;
151
152 /* attbase - aperture base */
153 /* the Intel 815 chipset spec. says that bits 29-31 in the
154 * ATTBASE register are reserved -> try not to write them */
155 if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) {
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700156 dev_emerg(&agp_bridge->dev->dev, "gatt bus addr too high");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 return -EINVAL;
158 }
159
160 current_size = A_SIZE_8(agp_bridge->current_size);
161
162 /* aperture size */
163 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE,
164 current_size->size_value);
165
166 /* address to map to */
167 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
168 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
169
170 pci_read_config_dword(agp_bridge->dev, INTEL_ATTBASE, &addr);
171 addr &= INTEL_815_ATTBASE_MASK;
172 addr |= agp_bridge->gatt_bus_addr;
173 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, addr);
174
175 /* agpctrl */
176 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
177
178 /* apcont */
179 pci_read_config_byte(agp_bridge->dev, INTEL_815_APCONT, &temp2);
180 pci_write_config_byte(agp_bridge->dev, INTEL_815_APCONT, temp2 | (1 << 1));
181
182 /* clear any possible error conditions */
183 /* Oddness : this chipset seems to have no ERRSTS register ! */
184 return 0;
185}
186
187static void intel_820_tlbflush(struct agp_memory *mem)
188{
189 return;
190}
191
192static void intel_820_cleanup(void)
193{
194 u8 temp;
195 struct aper_size_info_8 *previous_size;
196
197 previous_size = A_SIZE_8(agp_bridge->previous_size);
198 pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp);
199 pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR,
200 temp & ~(1 << 1));
201 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE,
202 previous_size->size_value);
203}
204
205
206static int intel_820_configure(void)
207{
208 u32 temp;
209 u8 temp2;
210 struct aper_size_info_8 *current_size;
211
212 current_size = A_SIZE_8(agp_bridge->current_size);
213
214 /* aperture size */
215 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
216
217 /* address to map to */
218 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
219 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
220
221 /* attbase - aperture base */
222 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
223
224 /* agpctrl */
225 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
226
227 /* global enable aperture access */
228 /* This flag is not accessed through MCHCFG register as in */
229 /* i850 chipset. */
230 pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp2);
231 pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR, temp2 | (1 << 1));
232 /* clear any possible AGP-related error conditions */
233 pci_write_config_word(agp_bridge->dev, INTEL_I820_ERRSTS, 0x001c);
234 return 0;
235}
236
237static int intel_840_configure(void)
238{
239 u32 temp;
240 u16 temp2;
241 struct aper_size_info_8 *current_size;
242
243 current_size = A_SIZE_8(agp_bridge->current_size);
244
245 /* aperture size */
246 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
247
248 /* address to map to */
249 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
250 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
251
252 /* attbase - aperture base */
253 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
254
255 /* agpctrl */
256 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
257
258 /* mcgcfg */
259 pci_read_config_word(agp_bridge->dev, INTEL_I840_MCHCFG, &temp2);
260 pci_write_config_word(agp_bridge->dev, INTEL_I840_MCHCFG, temp2 | (1 << 9));
261 /* clear any possible error conditions */
262 pci_write_config_word(agp_bridge->dev, INTEL_I840_ERRSTS, 0xc000);
263 return 0;
264}
265
266static int intel_845_configure(void)
267{
268 u32 temp;
269 u8 temp2;
270 struct aper_size_info_8 *current_size;
271
272 current_size = A_SIZE_8(agp_bridge->current_size);
273
274 /* aperture size */
275 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
276
Matthew Garrettb0825482005-07-29 14:03:39 -0700277 if (agp_bridge->apbase_config != 0) {
278 pci_write_config_dword(agp_bridge->dev, AGP_APBASE,
279 agp_bridge->apbase_config);
280 } else {
281 /* address to map to */
282 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
283 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
284 agp_bridge->apbase_config = temp;
285 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286
287 /* attbase - aperture base */
288 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
289
290 /* agpctrl */
291 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
292
293 /* agpm */
294 pci_read_config_byte(agp_bridge->dev, INTEL_I845_AGPM, &temp2);
295 pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1));
296 /* clear any possible error conditions */
297 pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c);
298 return 0;
299}
300
301static int intel_850_configure(void)
302{
303 u32 temp;
304 u16 temp2;
305 struct aper_size_info_8 *current_size;
306
307 current_size = A_SIZE_8(agp_bridge->current_size);
308
309 /* aperture size */
310 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
311
312 /* address to map to */
313 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
314 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
315
316 /* attbase - aperture base */
317 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
318
319 /* agpctrl */
320 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
321
322 /* mcgcfg */
323 pci_read_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, &temp2);
324 pci_write_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, temp2 | (1 << 9));
325 /* clear any possible AGP-related error conditions */
326 pci_write_config_word(agp_bridge->dev, INTEL_I850_ERRSTS, 0x001c);
327 return 0;
328}
329
330static int intel_860_configure(void)
331{
332 u32 temp;
333 u16 temp2;
334 struct aper_size_info_8 *current_size;
335
336 current_size = A_SIZE_8(agp_bridge->current_size);
337
338 /* aperture size */
339 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
340
341 /* address to map to */
342 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
343 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
344
345 /* attbase - aperture base */
346 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
347
348 /* agpctrl */
349 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
350
351 /* mcgcfg */
352 pci_read_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, &temp2);
353 pci_write_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, temp2 | (1 << 9));
354 /* clear any possible AGP-related error conditions */
355 pci_write_config_word(agp_bridge->dev, INTEL_I860_ERRSTS, 0xf700);
356 return 0;
357}
358
359static int intel_830mp_configure(void)
360{
361 u32 temp;
362 u16 temp2;
363 struct aper_size_info_8 *current_size;
364
365 current_size = A_SIZE_8(agp_bridge->current_size);
366
367 /* aperture size */
368 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
369
370 /* address to map to */
371 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
372 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
373
374 /* attbase - aperture base */
375 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
376
377 /* agpctrl */
378 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
379
380 /* gmch */
381 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2);
382 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp2 | (1 << 9));
383 /* clear any possible AGP-related error conditions */
384 pci_write_config_word(agp_bridge->dev, INTEL_I830_ERRSTS, 0x1c);
385 return 0;
386}
387
388static int intel_7505_configure(void)
389{
390 u32 temp;
391 u16 temp2;
392 struct aper_size_info_8 *current_size;
393
394 current_size = A_SIZE_8(agp_bridge->current_size);
395
396 /* aperture size */
397 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
398
399 /* address to map to */
400 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
401 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
402
403 /* attbase - aperture base */
404 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
405
406 /* agpctrl */
407 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
408
409 /* mchcfg */
410 pci_read_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, &temp2);
411 pci_write_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, temp2 | (1 << 9));
412
413 return 0;
414}
415
416/* Setup function */
Dave Jonese5524f32007-02-22 18:41:28 -0500417static const struct gatt_mask intel_generic_masks[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418{
419 {.mask = 0x00000017, .type = 0}
420};
421
Dave Jonese5524f32007-02-22 18:41:28 -0500422static const struct aper_size_info_8 intel_815_sizes[2] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423{
424 {64, 16384, 4, 0},
425 {32, 8192, 3, 8},
426};
427
Dave Jonese5524f32007-02-22 18:41:28 -0500428static const struct aper_size_info_8 intel_8xx_sizes[7] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429{
430 {256, 65536, 6, 0},
431 {128, 32768, 5, 32},
432 {64, 16384, 4, 48},
433 {32, 8192, 3, 56},
434 {16, 4096, 2, 60},
435 {8, 2048, 1, 62},
436 {4, 1024, 0, 63}
437};
438
Dave Jonese5524f32007-02-22 18:41:28 -0500439static const struct aper_size_info_16 intel_generic_sizes[7] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440{
441 {256, 65536, 6, 0},
442 {128, 32768, 5, 32},
443 {64, 16384, 4, 48},
444 {32, 8192, 3, 56},
445 {16, 4096, 2, 60},
446 {8, 2048, 1, 62},
447 {4, 1024, 0, 63}
448};
449
Dave Jonese5524f32007-02-22 18:41:28 -0500450static const struct aper_size_info_8 intel_830mp_sizes[4] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451{
452 {256, 65536, 6, 0},
453 {128, 32768, 5, 32},
454 {64, 16384, 4, 48},
455 {32, 8192, 3, 56}
456};
457
Dave Jonese5524f32007-02-22 18:41:28 -0500458static const struct agp_bridge_driver intel_generic_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459 .owner = THIS_MODULE,
460 .aperture_sizes = intel_generic_sizes,
461 .size_type = U16_APER_SIZE,
462 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200463 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 .configure = intel_configure,
465 .fetch_size = intel_fetch_size,
466 .cleanup = intel_cleanup,
467 .tlb_flush = intel_tlbflush,
468 .mask_memory = agp_generic_mask_memory,
469 .masks = intel_generic_masks,
470 .agp_enable = agp_generic_enable,
471 .cache_flush = global_cache_flush,
472 .create_gatt_table = agp_generic_create_gatt_table,
473 .free_gatt_table = agp_generic_free_gatt_table,
474 .insert_memory = agp_generic_insert_memory,
475 .remove_memory = agp_generic_remove_memory,
476 .alloc_by_type = agp_generic_alloc_by_type,
477 .free_by_type = agp_generic_free_by_type,
478 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800479 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800481 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100482 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483};
484
Dave Jonese5524f32007-02-22 18:41:28 -0500485static const struct agp_bridge_driver intel_815_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 .owner = THIS_MODULE,
487 .aperture_sizes = intel_815_sizes,
488 .size_type = U8_APER_SIZE,
489 .num_aperture_sizes = 2,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200490 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 .configure = intel_815_configure,
492 .fetch_size = intel_815_fetch_size,
493 .cleanup = intel_8xx_cleanup,
494 .tlb_flush = intel_8xx_tlbflush,
495 .mask_memory = agp_generic_mask_memory,
496 .masks = intel_generic_masks,
497 .agp_enable = agp_generic_enable,
498 .cache_flush = global_cache_flush,
499 .create_gatt_table = agp_generic_create_gatt_table,
500 .free_gatt_table = agp_generic_free_gatt_table,
501 .insert_memory = agp_generic_insert_memory,
502 .remove_memory = agp_generic_remove_memory,
503 .alloc_by_type = agp_generic_alloc_by_type,
504 .free_by_type = agp_generic_free_by_type,
505 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800506 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800508 .agp_destroy_pages = agp_generic_destroy_pages,
Dave Airlie62c96b92008-06-19 14:27:53 +1000509 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510};
511
Dave Jonese5524f32007-02-22 18:41:28 -0500512static const struct agp_bridge_driver intel_820_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513 .owner = THIS_MODULE,
514 .aperture_sizes = intel_8xx_sizes,
515 .size_type = U8_APER_SIZE,
516 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200517 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 .configure = intel_820_configure,
519 .fetch_size = intel_8xx_fetch_size,
520 .cleanup = intel_820_cleanup,
521 .tlb_flush = intel_820_tlbflush,
522 .mask_memory = agp_generic_mask_memory,
523 .masks = intel_generic_masks,
524 .agp_enable = agp_generic_enable,
525 .cache_flush = global_cache_flush,
526 .create_gatt_table = agp_generic_create_gatt_table,
527 .free_gatt_table = agp_generic_free_gatt_table,
528 .insert_memory = agp_generic_insert_memory,
529 .remove_memory = agp_generic_remove_memory,
530 .alloc_by_type = agp_generic_alloc_by_type,
531 .free_by_type = agp_generic_free_by_type,
532 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800533 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800535 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100536 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537};
538
Dave Jonese5524f32007-02-22 18:41:28 -0500539static const struct agp_bridge_driver intel_830mp_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 .owner = THIS_MODULE,
541 .aperture_sizes = intel_830mp_sizes,
542 .size_type = U8_APER_SIZE,
543 .num_aperture_sizes = 4,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200544 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 .configure = intel_830mp_configure,
546 .fetch_size = intel_8xx_fetch_size,
547 .cleanup = intel_8xx_cleanup,
548 .tlb_flush = intel_8xx_tlbflush,
549 .mask_memory = agp_generic_mask_memory,
550 .masks = intel_generic_masks,
551 .agp_enable = agp_generic_enable,
552 .cache_flush = global_cache_flush,
553 .create_gatt_table = agp_generic_create_gatt_table,
554 .free_gatt_table = agp_generic_free_gatt_table,
555 .insert_memory = agp_generic_insert_memory,
556 .remove_memory = agp_generic_remove_memory,
557 .alloc_by_type = agp_generic_alloc_by_type,
558 .free_by_type = agp_generic_free_by_type,
559 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800560 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800562 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100563 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564};
565
Dave Jonese5524f32007-02-22 18:41:28 -0500566static const struct agp_bridge_driver intel_840_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 .owner = THIS_MODULE,
568 .aperture_sizes = intel_8xx_sizes,
569 .size_type = U8_APER_SIZE,
570 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200571 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 .configure = intel_840_configure,
573 .fetch_size = intel_8xx_fetch_size,
574 .cleanup = intel_8xx_cleanup,
575 .tlb_flush = intel_8xx_tlbflush,
576 .mask_memory = agp_generic_mask_memory,
577 .masks = intel_generic_masks,
578 .agp_enable = agp_generic_enable,
579 .cache_flush = global_cache_flush,
580 .create_gatt_table = agp_generic_create_gatt_table,
581 .free_gatt_table = agp_generic_free_gatt_table,
582 .insert_memory = agp_generic_insert_memory,
583 .remove_memory = agp_generic_remove_memory,
584 .alloc_by_type = agp_generic_alloc_by_type,
585 .free_by_type = agp_generic_free_by_type,
586 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800587 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800589 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100590 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591};
592
Dave Jonese5524f32007-02-22 18:41:28 -0500593static const struct agp_bridge_driver intel_845_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 .owner = THIS_MODULE,
595 .aperture_sizes = intel_8xx_sizes,
596 .size_type = U8_APER_SIZE,
597 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200598 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 .configure = intel_845_configure,
600 .fetch_size = intel_8xx_fetch_size,
601 .cleanup = intel_8xx_cleanup,
602 .tlb_flush = intel_8xx_tlbflush,
603 .mask_memory = agp_generic_mask_memory,
604 .masks = intel_generic_masks,
605 .agp_enable = agp_generic_enable,
606 .cache_flush = global_cache_flush,
607 .create_gatt_table = agp_generic_create_gatt_table,
608 .free_gatt_table = agp_generic_free_gatt_table,
609 .insert_memory = agp_generic_insert_memory,
610 .remove_memory = agp_generic_remove_memory,
611 .alloc_by_type = agp_generic_alloc_by_type,
612 .free_by_type = agp_generic_free_by_type,
613 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800614 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800616 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100617 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618};
619
Dave Jonese5524f32007-02-22 18:41:28 -0500620static const struct agp_bridge_driver intel_850_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 .owner = THIS_MODULE,
622 .aperture_sizes = intel_8xx_sizes,
623 .size_type = U8_APER_SIZE,
624 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200625 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626 .configure = intel_850_configure,
627 .fetch_size = intel_8xx_fetch_size,
628 .cleanup = intel_8xx_cleanup,
629 .tlb_flush = intel_8xx_tlbflush,
630 .mask_memory = agp_generic_mask_memory,
631 .masks = intel_generic_masks,
632 .agp_enable = agp_generic_enable,
633 .cache_flush = global_cache_flush,
634 .create_gatt_table = agp_generic_create_gatt_table,
635 .free_gatt_table = agp_generic_free_gatt_table,
636 .insert_memory = agp_generic_insert_memory,
637 .remove_memory = agp_generic_remove_memory,
638 .alloc_by_type = agp_generic_alloc_by_type,
639 .free_by_type = agp_generic_free_by_type,
640 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800641 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800643 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100644 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645};
646
Dave Jonese5524f32007-02-22 18:41:28 -0500647static const struct agp_bridge_driver intel_860_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 .owner = THIS_MODULE,
649 .aperture_sizes = intel_8xx_sizes,
650 .size_type = U8_APER_SIZE,
651 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200652 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 .configure = intel_860_configure,
654 .fetch_size = intel_8xx_fetch_size,
655 .cleanup = intel_8xx_cleanup,
656 .tlb_flush = intel_8xx_tlbflush,
657 .mask_memory = agp_generic_mask_memory,
658 .masks = intel_generic_masks,
659 .agp_enable = agp_generic_enable,
660 .cache_flush = global_cache_flush,
661 .create_gatt_table = agp_generic_create_gatt_table,
662 .free_gatt_table = agp_generic_free_gatt_table,
663 .insert_memory = agp_generic_insert_memory,
664 .remove_memory = agp_generic_remove_memory,
665 .alloc_by_type = agp_generic_alloc_by_type,
666 .free_by_type = agp_generic_free_by_type,
667 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800668 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800670 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100671 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672};
673
Dave Jonese5524f32007-02-22 18:41:28 -0500674static const struct agp_bridge_driver intel_7505_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 .owner = THIS_MODULE,
676 .aperture_sizes = intel_8xx_sizes,
677 .size_type = U8_APER_SIZE,
678 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200679 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 .configure = intel_7505_configure,
681 .fetch_size = intel_8xx_fetch_size,
682 .cleanup = intel_8xx_cleanup,
683 .tlb_flush = intel_8xx_tlbflush,
684 .mask_memory = agp_generic_mask_memory,
685 .masks = intel_generic_masks,
686 .agp_enable = agp_generic_enable,
687 .cache_flush = global_cache_flush,
688 .create_gatt_table = agp_generic_create_gatt_table,
689 .free_gatt_table = agp_generic_free_gatt_table,
690 .insert_memory = agp_generic_insert_memory,
691 .remove_memory = agp_generic_remove_memory,
692 .alloc_by_type = agp_generic_alloc_by_type,
693 .free_by_type = agp_generic_free_by_type,
694 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800695 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800697 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100698 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699};
700
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800701/* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of
702 * driver and gmch_driver must be non-null, and find_gmch will determine
703 * which one should be used if a gmch_chip_id is present.
704 */
Daniel Vetter02c026c2010-08-24 19:39:48 +0200705static const struct intel_agp_driver_description {
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800706 unsigned int chip_id;
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800707 char *name;
708 const struct agp_bridge_driver *driver;
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800709} intel_agp_chipsets[] = {
Daniel Vetter02c026c2010-08-24 19:39:48 +0200710 { PCI_DEVICE_ID_INTEL_82443LX_0, "440LX", &intel_generic_driver },
711 { PCI_DEVICE_ID_INTEL_82443BX_0, "440BX", &intel_generic_driver },
712 { PCI_DEVICE_ID_INTEL_82443GX_0, "440GX", &intel_generic_driver },
713 { PCI_DEVICE_ID_INTEL_82815_MC, "i815", &intel_815_driver },
714 { PCI_DEVICE_ID_INTEL_82820_HB, "i820", &intel_820_driver },
715 { PCI_DEVICE_ID_INTEL_82820_UP_HB, "i820", &intel_820_driver },
716 { PCI_DEVICE_ID_INTEL_82830_HB, "830M", &intel_830mp_driver },
717 { PCI_DEVICE_ID_INTEL_82840_HB, "i840", &intel_840_driver },
Oswald Buddenhagen53371ed2010-06-19 23:08:37 +0200718 { PCI_DEVICE_ID_INTEL_82845_HB, "i845", &intel_845_driver },
719 { PCI_DEVICE_ID_INTEL_82845G_HB, "845G", &intel_845_driver },
Daniel Vetter02c026c2010-08-24 19:39:48 +0200720 { PCI_DEVICE_ID_INTEL_82850_HB, "i850", &intel_850_driver },
721 { PCI_DEVICE_ID_INTEL_82854_HB, "854", &intel_845_driver },
722 { PCI_DEVICE_ID_INTEL_82855PM_HB, "855PM", &intel_845_driver },
723 { PCI_DEVICE_ID_INTEL_82855GM_HB, "855GM", &intel_845_driver },
724 { PCI_DEVICE_ID_INTEL_82860_HB, "i860", &intel_860_driver },
725 { PCI_DEVICE_ID_INTEL_82865_HB, "865", &intel_845_driver },
726 { PCI_DEVICE_ID_INTEL_82875_HB, "i875", &intel_845_driver },
727 { PCI_DEVICE_ID_INTEL_7505_0, "E7505", &intel_7505_driver },
728 { PCI_DEVICE_ID_INTEL_7205_0, "E7205", &intel_7505_driver },
729 { 0, NULL, NULL }
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800730};
731
Greg Kroah-Hartmanbcd29822012-12-21 15:12:08 -0800732static int agp_intel_probe(struct pci_dev *pdev,
733 const struct pci_device_id *ent)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734{
735 struct agp_bridge_data *bridge;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736 u8 cap_ptr = 0;
737 struct resource *r;
Zhenyu Wang1f7a6e32010-02-23 14:05:24 +0800738 int i, err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739
740 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
741
742 bridge = agp_alloc_bridge();
743 if (!bridge)
744 return -ENOMEM;
745
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200746 bridge->capndx = cap_ptr;
747
Daniel Vetter14be93d2012-06-08 15:55:40 +0200748 if (intel_gmch_probe(pdev, NULL, bridge))
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200749 goto found_gmch;
750
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800751 for (i = 0; intel_agp_chipsets[i].name != NULL; i++) {
752 /* In case that multiple models of gfx chip may
753 stand on same host bridge type, this can be
754 sure we detect the right IGD. */
Wang Zhenyu88889852007-06-14 10:01:04 +0800755 if (pdev->device == intel_agp_chipsets[i].chip_id) {
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200756 bridge->driver = intel_agp_chipsets[i].driver;
757 break;
Wang Zhenyu88889852007-06-14 10:01:04 +0800758 }
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800759 }
760
Daniel Vetter02c026c2010-08-24 19:39:48 +0200761 if (!bridge->driver) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762 if (cap_ptr)
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700763 dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n",
764 pdev->vendor, pdev->device);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 agp_put_bridge(bridge);
766 return -ENODEV;
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800767 }
768
Linus Torvalds1da177e2005-04-16 15:20:36 -0700769 bridge->dev = pdev;
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200770 bridge->dev_private_data = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700772 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773
774 /*
775 * The following fixes the case where the BIOS has "forgotten" to
776 * provide an address range for the GART.
777 * 20030610 - hamish@zot.org
Stephen Kitta70b95c2011-01-31 14:25:43 -0800778 * This happens before pci_enable_device() intentionally;
779 * calling pci_enable_device() before assigning the resource
780 * will result in the GART being disabled on machines with such
781 * BIOSs (the GART ends up with a BAR starting at 0, which
782 * conflicts a lot of other devices).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783 */
784 r = &pdev->resource[0];
785 if (!r->start && r->end) {
Dave Jones6a92a4e2006-02-28 00:54:25 -0500786 if (pci_assign_resource(pdev, 0)) {
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700787 dev_err(&pdev->dev, "can't assign resource 0\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700788 agp_put_bridge(bridge);
789 return -ENODEV;
790 }
791 }
792
Stephen Kitta70b95c2011-01-31 14:25:43 -0800793 /*
794 * If the device has not been properly setup, the following will catch
795 * the problem and should stop the system from crashing.
796 * 20030610 - hamish@zot.org
797 */
798 if (pci_enable_device(pdev)) {
799 dev_err(&pdev->dev, "can't enable PCI device\n");
800 agp_put_bridge(bridge);
801 return -ENODEV;
802 }
803
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 /* Fill in the mode register */
805 if (cap_ptr) {
806 pci_read_config_dword(pdev,
807 bridge->capndx+PCI_AGP_STATUS,
808 &bridge->mode);
809 }
810
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200811found_gmch:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 pci_set_drvdata(pdev, bridge);
Zhenyu Wang1f7a6e32010-02-23 14:05:24 +0800813 err = agp_add_bridge(bridge);
Zhenyu Wang1f7a6e32010-02-23 14:05:24 +0800814 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700815}
816
Bill Pemberton39af33f2012-11-19 13:26:26 -0500817static void agp_intel_remove(struct pci_dev *pdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700818{
819 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
820
821 agp_remove_bridge(bridge);
822
Daniel Vetter14be93d2012-06-08 15:55:40 +0200823 intel_gmch_remove();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824
825 agp_put_bridge(bridge);
826}
827
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400828#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700829static int agp_intel_resume(struct pci_dev *pdev)
830{
831 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
832
Daniel Vettere5a04d52010-04-14 00:29:53 +0200833 bridge->driver->configure();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834
835 return 0;
836}
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400837#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838
839static struct pci_device_id agp_intel_pci_table[] = {
840#define ID(x) \
841 { \
842 .class = (PCI_CLASS_BRIDGE_HOST << 8), \
843 .class_mask = ~0, \
844 .vendor = PCI_VENDOR_ID_INTEL, \
845 .device = x, \
846 .subvendor = PCI_ANY_ID, \
847 .subdevice = PCI_ANY_ID, \
848 }
Ben Widawsky6b2d5902012-01-04 14:04:33 -0800849 ID(PCI_DEVICE_ID_INTEL_82441), /* for HAS2 support */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850 ID(PCI_DEVICE_ID_INTEL_82443LX_0),
851 ID(PCI_DEVICE_ID_INTEL_82443BX_0),
852 ID(PCI_DEVICE_ID_INTEL_82443GX_0),
853 ID(PCI_DEVICE_ID_INTEL_82810_MC1),
854 ID(PCI_DEVICE_ID_INTEL_82810_MC3),
855 ID(PCI_DEVICE_ID_INTEL_82810E_MC),
856 ID(PCI_DEVICE_ID_INTEL_82815_MC),
857 ID(PCI_DEVICE_ID_INTEL_82820_HB),
858 ID(PCI_DEVICE_ID_INTEL_82820_UP_HB),
859 ID(PCI_DEVICE_ID_INTEL_82830_HB),
860 ID(PCI_DEVICE_ID_INTEL_82840_HB),
861 ID(PCI_DEVICE_ID_INTEL_82845_HB),
862 ID(PCI_DEVICE_ID_INTEL_82845G_HB),
863 ID(PCI_DEVICE_ID_INTEL_82850_HB),
Stefan Husemann347486b2009-04-13 14:40:10 -0700864 ID(PCI_DEVICE_ID_INTEL_82854_HB),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865 ID(PCI_DEVICE_ID_INTEL_82855PM_HB),
866 ID(PCI_DEVICE_ID_INTEL_82855GM_HB),
867 ID(PCI_DEVICE_ID_INTEL_82860_HB),
868 ID(PCI_DEVICE_ID_INTEL_82865_HB),
869 ID(PCI_DEVICE_ID_INTEL_82875_HB),
870 ID(PCI_DEVICE_ID_INTEL_7505_0),
871 ID(PCI_DEVICE_ID_INTEL_7205_0),
Carlos Martíne914a362008-01-24 10:34:09 +1000872 ID(PCI_DEVICE_ID_INTEL_E7221_HB),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700873 ID(PCI_DEVICE_ID_INTEL_82915G_HB),
874 ID(PCI_DEVICE_ID_INTEL_82915GM_HB),
Alan Hourihaned0de98f2005-05-31 19:50:49 +0100875 ID(PCI_DEVICE_ID_INTEL_82945G_HB),
Alan Hourihane3b0e8ea2006-01-19 14:08:40 +0000876 ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
Zhenyu Wangdde47872007-07-26 09:18:09 +0800877 ID(PCI_DEVICE_ID_INTEL_82945GME_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500878 ID(PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB),
879 ID(PCI_DEVICE_ID_INTEL_PINEVIEW_HB),
Eric Anholt65c25aa2006-09-06 11:57:18 -0400880 ID(PCI_DEVICE_ID_INTEL_82946GZ_HB),
Zhenyu Wang9119f852008-01-23 15:49:26 +1000881 ID(PCI_DEVICE_ID_INTEL_82G35_HB),
Eric Anholt65c25aa2006-09-06 11:57:18 -0400882 ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
883 ID(PCI_DEVICE_ID_INTEL_82965G_HB),
Wang Zhenyu4598af32007-04-09 08:51:36 +0800884 ID(PCI_DEVICE_ID_INTEL_82965GM_HB),
Zhenyu Wangdde47872007-07-26 09:18:09 +0800885 ID(PCI_DEVICE_ID_INTEL_82965GME_HB),
Wang Zhenyu874808c62007-06-06 11:16:25 +0800886 ID(PCI_DEVICE_ID_INTEL_G33_HB),
887 ID(PCI_DEVICE_ID_INTEL_Q35_HB),
888 ID(PCI_DEVICE_ID_INTEL_Q33_HB),
Zhenyu Wang99d32bd2008-07-30 12:26:50 -0700889 ID(PCI_DEVICE_ID_INTEL_GM45_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500890 ID(PCI_DEVICE_ID_INTEL_EAGLELAKE_HB),
Zhenyu Wang25ce77a2008-06-19 14:17:58 +1000891 ID(PCI_DEVICE_ID_INTEL_Q45_HB),
892 ID(PCI_DEVICE_ID_INTEL_G45_HB),
Zhenyu Wanga50ccc62008-11-17 14:39:00 +0800893 ID(PCI_DEVICE_ID_INTEL_G41_HB),
Fabian Henze38d8a952009-09-08 00:59:58 +0800894 ID(PCI_DEVICE_ID_INTEL_B43_HB),
Chris Wilson3dde04b2010-10-14 16:30:41 +0100895 ID(PCI_DEVICE_ID_INTEL_B43_1_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500896 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB),
Eugeni Dodonov67384fe2012-06-06 11:59:06 -0300897 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500898 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB),
899 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB),
Dave Airlie3ff99162009-12-08 14:03:47 +1000900 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700901 { }
902};
903
904MODULE_DEVICE_TABLE(pci, agp_intel_pci_table);
905
906static struct pci_driver agp_intel_pci_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700907 .name = "agpgart-intel",
908 .id_table = agp_intel_pci_table,
909 .probe = agp_intel_probe,
Greg Kroah-Hartmanbcd29822012-12-21 15:12:08 -0800910 .remove = agp_intel_remove,
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400911#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700912 .resume = agp_intel_resume,
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400913#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700914};
915
916static int __init agp_intel_init(void)
917{
918 if (agp_off)
919 return -EINVAL;
920 return pci_register_driver(&agp_intel_pci_driver);
921}
922
923static void __exit agp_intel_cleanup(void)
924{
925 pci_unregister_driver(&agp_intel_pci_driver);
926}
927
928module_init(agp_intel_init);
929module_exit(agp_intel_cleanup);
930
Dave Jonesf4432c52008-10-20 13:31:45 -0400931MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700932MODULE_LICENSE("GPL and additional rights");