blob: a7c276585a9f4f38b8dc510ea0c2fc6742f5b296 [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{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 u16 temp2;
122 struct aper_size_info_16 *current_size;
123
124 current_size = A_SIZE_16(agp_bridge->current_size);
125
126 /* aperture size */
127 pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
128
129 /* address to map to */
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700130 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
131 AGP_APERTURE_BAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132
133 /* attbase - aperture base */
134 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
135
136 /* agpctrl */
137 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280);
138
139 /* paccfg/nbxcfg */
140 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2);
141 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG,
142 (temp2 & ~(1 << 10)) | (1 << 9));
143 /* clear any possible error conditions */
144 pci_write_config_byte(agp_bridge->dev, INTEL_ERRSTS + 1, 7);
145 return 0;
146}
147
148static int intel_815_configure(void)
149{
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700150 u32 addr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 u8 temp2;
152 struct aper_size_info_8 *current_size;
153
154 /* attbase - aperture base */
155 /* the Intel 815 chipset spec. says that bits 29-31 in the
156 * ATTBASE register are reserved -> try not to write them */
157 if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) {
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700158 dev_emerg(&agp_bridge->dev->dev, "gatt bus addr too high");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 return -EINVAL;
160 }
161
162 current_size = A_SIZE_8(agp_bridge->current_size);
163
164 /* aperture size */
165 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE,
166 current_size->size_value);
167
168 /* address to map to */
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700169 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
170 AGP_APERTURE_BAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171
172 pci_read_config_dword(agp_bridge->dev, INTEL_ATTBASE, &addr);
173 addr &= INTEL_815_ATTBASE_MASK;
174 addr |= agp_bridge->gatt_bus_addr;
175 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, addr);
176
177 /* agpctrl */
178 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
179
180 /* apcont */
181 pci_read_config_byte(agp_bridge->dev, INTEL_815_APCONT, &temp2);
182 pci_write_config_byte(agp_bridge->dev, INTEL_815_APCONT, temp2 | (1 << 1));
183
184 /* clear any possible error conditions */
185 /* Oddness : this chipset seems to have no ERRSTS register ! */
186 return 0;
187}
188
189static void intel_820_tlbflush(struct agp_memory *mem)
190{
191 return;
192}
193
194static void intel_820_cleanup(void)
195{
196 u8 temp;
197 struct aper_size_info_8 *previous_size;
198
199 previous_size = A_SIZE_8(agp_bridge->previous_size);
200 pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp);
201 pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR,
202 temp & ~(1 << 1));
203 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE,
204 previous_size->size_value);
205}
206
207
208static int intel_820_configure(void)
209{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 u8 temp2;
211 struct aper_size_info_8 *current_size;
212
213 current_size = A_SIZE_8(agp_bridge->current_size);
214
215 /* aperture size */
216 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
217
218 /* address to map to */
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700219 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
220 AGP_APERTURE_BAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221
222 /* attbase - aperture base */
223 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
224
225 /* agpctrl */
226 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
227
228 /* global enable aperture access */
229 /* This flag is not accessed through MCHCFG register as in */
230 /* i850 chipset. */
231 pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp2);
232 pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR, temp2 | (1 << 1));
233 /* clear any possible AGP-related error conditions */
234 pci_write_config_word(agp_bridge->dev, INTEL_I820_ERRSTS, 0x001c);
235 return 0;
236}
237
238static int intel_840_configure(void)
239{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240 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 */
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700249 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
250 AGP_APERTURE_BAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251
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{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 u8 temp2;
269 struct aper_size_info_8 *current_size;
270
271 current_size = A_SIZE_8(agp_bridge->current_size);
272
273 /* aperture size */
274 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
275
Matthew Garrettb0825482005-07-29 14:03:39 -0700276 if (agp_bridge->apbase_config != 0) {
277 pci_write_config_dword(agp_bridge->dev, AGP_APBASE,
278 agp_bridge->apbase_config);
279 } else {
280 /* address to map to */
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700281 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
282 AGP_APERTURE_BAR);
283 agp_bridge->apbase_config = agp_bridge->gart_bus_addr;
Matthew Garrettb0825482005-07-29 14:03:39 -0700284 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285
286 /* attbase - aperture base */
287 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
288
289 /* agpctrl */
290 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
291
292 /* agpm */
293 pci_read_config_byte(agp_bridge->dev, INTEL_I845_AGPM, &temp2);
294 pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1));
295 /* clear any possible error conditions */
296 pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c);
297 return 0;
298}
299
300static int intel_850_configure(void)
301{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302 u16 temp2;
303 struct aper_size_info_8 *current_size;
304
305 current_size = A_SIZE_8(agp_bridge->current_size);
306
307 /* aperture size */
308 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
309
310 /* address to map to */
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700311 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
312 AGP_APERTURE_BAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313
314 /* attbase - aperture base */
315 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
316
317 /* agpctrl */
318 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
319
320 /* mcgcfg */
321 pci_read_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, &temp2);
322 pci_write_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, temp2 | (1 << 9));
323 /* clear any possible AGP-related error conditions */
324 pci_write_config_word(agp_bridge->dev, INTEL_I850_ERRSTS, 0x001c);
325 return 0;
326}
327
328static int intel_860_configure(void)
329{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 u16 temp2;
331 struct aper_size_info_8 *current_size;
332
333 current_size = A_SIZE_8(agp_bridge->current_size);
334
335 /* aperture size */
336 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
337
338 /* address to map to */
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700339 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
340 AGP_APERTURE_BAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341
342 /* attbase - aperture base */
343 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
344
345 /* agpctrl */
346 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
347
348 /* mcgcfg */
349 pci_read_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, &temp2);
350 pci_write_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, temp2 | (1 << 9));
351 /* clear any possible AGP-related error conditions */
352 pci_write_config_word(agp_bridge->dev, INTEL_I860_ERRSTS, 0xf700);
353 return 0;
354}
355
356static int intel_830mp_configure(void)
357{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 u16 temp2;
359 struct aper_size_info_8 *current_size;
360
361 current_size = A_SIZE_8(agp_bridge->current_size);
362
363 /* aperture size */
364 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
365
366 /* address to map to */
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700367 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
368 AGP_APERTURE_BAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369
370 /* attbase - aperture base */
371 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
372
373 /* agpctrl */
374 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
375
376 /* gmch */
377 pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2);
378 pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp2 | (1 << 9));
379 /* clear any possible AGP-related error conditions */
380 pci_write_config_word(agp_bridge->dev, INTEL_I830_ERRSTS, 0x1c);
381 return 0;
382}
383
384static int intel_7505_configure(void)
385{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 u16 temp2;
387 struct aper_size_info_8 *current_size;
388
389 current_size = A_SIZE_8(agp_bridge->current_size);
390
391 /* aperture size */
392 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
393
394 /* address to map to */
Bjorn Helgaase501b3d2014-01-03 18:26:58 -0700395 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
396 AGP_APERTURE_BAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397
398 /* attbase - aperture base */
399 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
400
401 /* agpctrl */
402 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
403
404 /* mchcfg */
405 pci_read_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, &temp2);
406 pci_write_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, temp2 | (1 << 9));
407
408 return 0;
409}
410
411/* Setup function */
Dave Jonese5524f32007-02-22 18:41:28 -0500412static const struct gatt_mask intel_generic_masks[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413{
414 {.mask = 0x00000017, .type = 0}
415};
416
Dave Jonese5524f32007-02-22 18:41:28 -0500417static const struct aper_size_info_8 intel_815_sizes[2] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418{
419 {64, 16384, 4, 0},
420 {32, 8192, 3, 8},
421};
422
Dave Jonese5524f32007-02-22 18:41:28 -0500423static const struct aper_size_info_8 intel_8xx_sizes[7] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424{
425 {256, 65536, 6, 0},
426 {128, 32768, 5, 32},
427 {64, 16384, 4, 48},
428 {32, 8192, 3, 56},
429 {16, 4096, 2, 60},
430 {8, 2048, 1, 62},
431 {4, 1024, 0, 63}
432};
433
Dave Jonese5524f32007-02-22 18:41:28 -0500434static const struct aper_size_info_16 intel_generic_sizes[7] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435{
436 {256, 65536, 6, 0},
437 {128, 32768, 5, 32},
438 {64, 16384, 4, 48},
439 {32, 8192, 3, 56},
440 {16, 4096, 2, 60},
441 {8, 2048, 1, 62},
442 {4, 1024, 0, 63}
443};
444
Dave Jonese5524f32007-02-22 18:41:28 -0500445static const struct aper_size_info_8 intel_830mp_sizes[4] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446{
447 {256, 65536, 6, 0},
448 {128, 32768, 5, 32},
449 {64, 16384, 4, 48},
450 {32, 8192, 3, 56}
451};
452
Dave Jonese5524f32007-02-22 18:41:28 -0500453static const struct agp_bridge_driver intel_generic_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 .owner = THIS_MODULE,
455 .aperture_sizes = intel_generic_sizes,
456 .size_type = U16_APER_SIZE,
457 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200458 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459 .configure = intel_configure,
460 .fetch_size = intel_fetch_size,
461 .cleanup = intel_cleanup,
462 .tlb_flush = intel_tlbflush,
463 .mask_memory = agp_generic_mask_memory,
464 .masks = intel_generic_masks,
465 .agp_enable = agp_generic_enable,
466 .cache_flush = global_cache_flush,
467 .create_gatt_table = agp_generic_create_gatt_table,
468 .free_gatt_table = agp_generic_free_gatt_table,
469 .insert_memory = agp_generic_insert_memory,
470 .remove_memory = agp_generic_remove_memory,
471 .alloc_by_type = agp_generic_alloc_by_type,
472 .free_by_type = agp_generic_free_by_type,
473 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800474 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800476 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100477 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478};
479
Dave Jonese5524f32007-02-22 18:41:28 -0500480static const struct agp_bridge_driver intel_815_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 .owner = THIS_MODULE,
482 .aperture_sizes = intel_815_sizes,
483 .size_type = U8_APER_SIZE,
484 .num_aperture_sizes = 2,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200485 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 .configure = intel_815_configure,
487 .fetch_size = intel_815_fetch_size,
488 .cleanup = intel_8xx_cleanup,
489 .tlb_flush = intel_8xx_tlbflush,
490 .mask_memory = agp_generic_mask_memory,
491 .masks = intel_generic_masks,
492 .agp_enable = agp_generic_enable,
493 .cache_flush = global_cache_flush,
494 .create_gatt_table = agp_generic_create_gatt_table,
495 .free_gatt_table = agp_generic_free_gatt_table,
496 .insert_memory = agp_generic_insert_memory,
497 .remove_memory = agp_generic_remove_memory,
498 .alloc_by_type = agp_generic_alloc_by_type,
499 .free_by_type = agp_generic_free_by_type,
500 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800501 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800503 .agp_destroy_pages = agp_generic_destroy_pages,
Dave Airlie62c96b92008-06-19 14:27:53 +1000504 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505};
506
Dave Jonese5524f32007-02-22 18:41:28 -0500507static const struct agp_bridge_driver intel_820_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 .owner = THIS_MODULE,
509 .aperture_sizes = intel_8xx_sizes,
510 .size_type = U8_APER_SIZE,
511 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200512 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513 .configure = intel_820_configure,
514 .fetch_size = intel_8xx_fetch_size,
515 .cleanup = intel_820_cleanup,
516 .tlb_flush = intel_820_tlbflush,
517 .mask_memory = agp_generic_mask_memory,
518 .masks = intel_generic_masks,
519 .agp_enable = agp_generic_enable,
520 .cache_flush = global_cache_flush,
521 .create_gatt_table = agp_generic_create_gatt_table,
522 .free_gatt_table = agp_generic_free_gatt_table,
523 .insert_memory = agp_generic_insert_memory,
524 .remove_memory = agp_generic_remove_memory,
525 .alloc_by_type = agp_generic_alloc_by_type,
526 .free_by_type = agp_generic_free_by_type,
527 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800528 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800530 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100531 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532};
533
Dave Jonese5524f32007-02-22 18:41:28 -0500534static const struct agp_bridge_driver intel_830mp_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535 .owner = THIS_MODULE,
536 .aperture_sizes = intel_830mp_sizes,
537 .size_type = U8_APER_SIZE,
538 .num_aperture_sizes = 4,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200539 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 .configure = intel_830mp_configure,
541 .fetch_size = intel_8xx_fetch_size,
542 .cleanup = intel_8xx_cleanup,
543 .tlb_flush = intel_8xx_tlbflush,
544 .mask_memory = agp_generic_mask_memory,
545 .masks = intel_generic_masks,
546 .agp_enable = agp_generic_enable,
547 .cache_flush = global_cache_flush,
548 .create_gatt_table = agp_generic_create_gatt_table,
549 .free_gatt_table = agp_generic_free_gatt_table,
550 .insert_memory = agp_generic_insert_memory,
551 .remove_memory = agp_generic_remove_memory,
552 .alloc_by_type = agp_generic_alloc_by_type,
553 .free_by_type = agp_generic_free_by_type,
554 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800555 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800557 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100558 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559};
560
Dave Jonese5524f32007-02-22 18:41:28 -0500561static const struct agp_bridge_driver intel_840_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562 .owner = THIS_MODULE,
563 .aperture_sizes = intel_8xx_sizes,
564 .size_type = U8_APER_SIZE,
565 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200566 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 .configure = intel_840_configure,
568 .fetch_size = intel_8xx_fetch_size,
569 .cleanup = intel_8xx_cleanup,
570 .tlb_flush = intel_8xx_tlbflush,
571 .mask_memory = agp_generic_mask_memory,
572 .masks = intel_generic_masks,
573 .agp_enable = agp_generic_enable,
574 .cache_flush = global_cache_flush,
575 .create_gatt_table = agp_generic_create_gatt_table,
576 .free_gatt_table = agp_generic_free_gatt_table,
577 .insert_memory = agp_generic_insert_memory,
578 .remove_memory = agp_generic_remove_memory,
579 .alloc_by_type = agp_generic_alloc_by_type,
580 .free_by_type = agp_generic_free_by_type,
581 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800582 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800584 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100585 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586};
587
Dave Jonese5524f32007-02-22 18:41:28 -0500588static const struct agp_bridge_driver intel_845_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589 .owner = THIS_MODULE,
590 .aperture_sizes = intel_8xx_sizes,
591 .size_type = U8_APER_SIZE,
592 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200593 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 .configure = intel_845_configure,
595 .fetch_size = intel_8xx_fetch_size,
596 .cleanup = intel_8xx_cleanup,
597 .tlb_flush = intel_8xx_tlbflush,
598 .mask_memory = agp_generic_mask_memory,
599 .masks = intel_generic_masks,
600 .agp_enable = agp_generic_enable,
601 .cache_flush = global_cache_flush,
602 .create_gatt_table = agp_generic_create_gatt_table,
603 .free_gatt_table = agp_generic_free_gatt_table,
604 .insert_memory = agp_generic_insert_memory,
605 .remove_memory = agp_generic_remove_memory,
606 .alloc_by_type = agp_generic_alloc_by_type,
607 .free_by_type = agp_generic_free_by_type,
608 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800609 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800611 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100612 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613};
614
Dave Jonese5524f32007-02-22 18:41:28 -0500615static const struct agp_bridge_driver intel_850_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 .owner = THIS_MODULE,
617 .aperture_sizes = intel_8xx_sizes,
618 .size_type = U8_APER_SIZE,
619 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200620 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 .configure = intel_850_configure,
622 .fetch_size = intel_8xx_fetch_size,
623 .cleanup = intel_8xx_cleanup,
624 .tlb_flush = intel_8xx_tlbflush,
625 .mask_memory = agp_generic_mask_memory,
626 .masks = intel_generic_masks,
627 .agp_enable = agp_generic_enable,
628 .cache_flush = global_cache_flush,
629 .create_gatt_table = agp_generic_create_gatt_table,
630 .free_gatt_table = agp_generic_free_gatt_table,
631 .insert_memory = agp_generic_insert_memory,
632 .remove_memory = agp_generic_remove_memory,
633 .alloc_by_type = agp_generic_alloc_by_type,
634 .free_by_type = agp_generic_free_by_type,
635 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800636 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800638 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100639 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640};
641
Dave Jonese5524f32007-02-22 18:41:28 -0500642static const struct agp_bridge_driver intel_860_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643 .owner = THIS_MODULE,
644 .aperture_sizes = intel_8xx_sizes,
645 .size_type = U8_APER_SIZE,
646 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200647 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 .configure = intel_860_configure,
649 .fetch_size = intel_8xx_fetch_size,
650 .cleanup = intel_8xx_cleanup,
651 .tlb_flush = intel_8xx_tlbflush,
652 .mask_memory = agp_generic_mask_memory,
653 .masks = intel_generic_masks,
654 .agp_enable = agp_generic_enable,
655 .cache_flush = global_cache_flush,
656 .create_gatt_table = agp_generic_create_gatt_table,
657 .free_gatt_table = agp_generic_free_gatt_table,
658 .insert_memory = agp_generic_insert_memory,
659 .remove_memory = agp_generic_remove_memory,
660 .alloc_by_type = agp_generic_alloc_by_type,
661 .free_by_type = agp_generic_free_by_type,
662 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800663 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800665 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100666 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667};
668
Dave Jonese5524f32007-02-22 18:41:28 -0500669static const struct agp_bridge_driver intel_7505_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 .owner = THIS_MODULE,
671 .aperture_sizes = intel_8xx_sizes,
672 .size_type = U8_APER_SIZE,
673 .num_aperture_sizes = 7,
Jerome Glisse61cf0592010-04-20 17:43:34 +0200674 .needs_scratch_page = true,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 .configure = intel_7505_configure,
676 .fetch_size = intel_8xx_fetch_size,
677 .cleanup = intel_8xx_cleanup,
678 .tlb_flush = intel_8xx_tlbflush,
679 .mask_memory = agp_generic_mask_memory,
680 .masks = intel_generic_masks,
681 .agp_enable = agp_generic_enable,
682 .cache_flush = global_cache_flush,
683 .create_gatt_table = agp_generic_create_gatt_table,
684 .free_gatt_table = agp_generic_free_gatt_table,
685 .insert_memory = agp_generic_insert_memory,
686 .remove_memory = agp_generic_remove_memory,
687 .alloc_by_type = agp_generic_alloc_by_type,
688 .free_by_type = agp_generic_free_by_type,
689 .agp_alloc_page = agp_generic_alloc_page,
Shaohua Li37acee12008-08-21 10:46:11 +0800690 .agp_alloc_pages = agp_generic_alloc_pages,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691 .agp_destroy_page = agp_generic_destroy_page,
Shaohua Libd079282008-08-21 10:46:17 +0800692 .agp_destroy_pages = agp_generic_destroy_pages,
Thomas Hellstroma030ce42007-01-23 10:33:43 +0100693 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694};
695
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800696/* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of
697 * driver and gmch_driver must be non-null, and find_gmch will determine
698 * which one should be used if a gmch_chip_id is present.
699 */
Daniel Vetter02c026c2010-08-24 19:39:48 +0200700static const struct intel_agp_driver_description {
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800701 unsigned int chip_id;
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800702 char *name;
703 const struct agp_bridge_driver *driver;
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800704} intel_agp_chipsets[] = {
Daniel Vetter02c026c2010-08-24 19:39:48 +0200705 { PCI_DEVICE_ID_INTEL_82443LX_0, "440LX", &intel_generic_driver },
706 { PCI_DEVICE_ID_INTEL_82443BX_0, "440BX", &intel_generic_driver },
707 { PCI_DEVICE_ID_INTEL_82443GX_0, "440GX", &intel_generic_driver },
708 { PCI_DEVICE_ID_INTEL_82815_MC, "i815", &intel_815_driver },
709 { PCI_DEVICE_ID_INTEL_82820_HB, "i820", &intel_820_driver },
710 { PCI_DEVICE_ID_INTEL_82820_UP_HB, "i820", &intel_820_driver },
711 { PCI_DEVICE_ID_INTEL_82830_HB, "830M", &intel_830mp_driver },
712 { PCI_DEVICE_ID_INTEL_82840_HB, "i840", &intel_840_driver },
Oswald Buddenhagen53371ed2010-06-19 23:08:37 +0200713 { PCI_DEVICE_ID_INTEL_82845_HB, "i845", &intel_845_driver },
714 { PCI_DEVICE_ID_INTEL_82845G_HB, "845G", &intel_845_driver },
Daniel Vetter02c026c2010-08-24 19:39:48 +0200715 { PCI_DEVICE_ID_INTEL_82850_HB, "i850", &intel_850_driver },
716 { PCI_DEVICE_ID_INTEL_82854_HB, "854", &intel_845_driver },
717 { PCI_DEVICE_ID_INTEL_82855PM_HB, "855PM", &intel_845_driver },
718 { PCI_DEVICE_ID_INTEL_82855GM_HB, "855GM", &intel_845_driver },
719 { PCI_DEVICE_ID_INTEL_82860_HB, "i860", &intel_860_driver },
720 { PCI_DEVICE_ID_INTEL_82865_HB, "865", &intel_845_driver },
721 { PCI_DEVICE_ID_INTEL_82875_HB, "i875", &intel_845_driver },
722 { PCI_DEVICE_ID_INTEL_7505_0, "E7505", &intel_7505_driver },
723 { PCI_DEVICE_ID_INTEL_7205_0, "E7205", &intel_7505_driver },
724 { 0, NULL, NULL }
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800725};
726
Greg Kroah-Hartmanbcd29822012-12-21 15:12:08 -0800727static int agp_intel_probe(struct pci_dev *pdev,
728 const struct pci_device_id *ent)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700729{
730 struct agp_bridge_data *bridge;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731 u8 cap_ptr = 0;
732 struct resource *r;
Zhenyu Wang1f7a6e32010-02-23 14:05:24 +0800733 int i, err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734
735 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
736
737 bridge = agp_alloc_bridge();
738 if (!bridge)
739 return -ENOMEM;
740
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200741 bridge->capndx = cap_ptr;
742
Daniel Vetter14be93d2012-06-08 15:55:40 +0200743 if (intel_gmch_probe(pdev, NULL, bridge))
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200744 goto found_gmch;
745
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800746 for (i = 0; intel_agp_chipsets[i].name != NULL; i++) {
747 /* In case that multiple models of gfx chip may
748 stand on same host bridge type, this can be
749 sure we detect the right IGD. */
Wang Zhenyu88889852007-06-14 10:01:04 +0800750 if (pdev->device == intel_agp_chipsets[i].chip_id) {
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200751 bridge->driver = intel_agp_chipsets[i].driver;
752 break;
Wang Zhenyu88889852007-06-14 10:01:04 +0800753 }
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800754 }
755
Daniel Vetter02c026c2010-08-24 19:39:48 +0200756 if (!bridge->driver) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757 if (cap_ptr)
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700758 dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n",
759 pdev->vendor, pdev->device);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760 agp_put_bridge(bridge);
761 return -ENODEV;
Wang Zhenyu9614ece2007-05-30 09:45:58 +0800762 }
763
Linus Torvalds1da177e2005-04-16 15:20:36 -0700764 bridge->dev = pdev;
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200765 bridge->dev_private_data = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700766
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700767 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768
769 /*
770 * The following fixes the case where the BIOS has "forgotten" to
771 * provide an address range for the GART.
772 * 20030610 - hamish@zot.org
Stephen Kitta70b95c2011-01-31 14:25:43 -0800773 * This happens before pci_enable_device() intentionally;
774 * calling pci_enable_device() before assigning the resource
775 * will result in the GART being disabled on machines with such
776 * BIOSs (the GART ends up with a BAR starting at 0, which
777 * conflicts a lot of other devices).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778 */
779 r = &pdev->resource[0];
780 if (!r->start && r->end) {
Dave Jones6a92a4e2006-02-28 00:54:25 -0500781 if (pci_assign_resource(pdev, 0)) {
Bjorn Helgaase3cf6952008-07-30 12:26:51 -0700782 dev_err(&pdev->dev, "can't assign resource 0\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783 agp_put_bridge(bridge);
784 return -ENODEV;
785 }
786 }
787
Stephen Kitta70b95c2011-01-31 14:25:43 -0800788 /*
789 * If the device has not been properly setup, the following will catch
790 * the problem and should stop the system from crashing.
791 * 20030610 - hamish@zot.org
792 */
793 if (pci_enable_device(pdev)) {
794 dev_err(&pdev->dev, "can't enable PCI device\n");
795 agp_put_bridge(bridge);
796 return -ENODEV;
797 }
798
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799 /* Fill in the mode register */
800 if (cap_ptr) {
801 pci_read_config_dword(pdev,
802 bridge->capndx+PCI_AGP_STATUS,
803 &bridge->mode);
804 }
805
Daniel Vetter22dd82a2010-04-14 00:29:55 +0200806found_gmch:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 pci_set_drvdata(pdev, bridge);
Zhenyu Wang1f7a6e32010-02-23 14:05:24 +0800808 err = agp_add_bridge(bridge);
809 if (!err)
810 intel_agp_enabled = 1;
811 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812}
813
Bill Pemberton39af33f2012-11-19 13:26:26 -0500814static void agp_intel_remove(struct pci_dev *pdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700815{
816 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
817
818 agp_remove_bridge(bridge);
819
Daniel Vetter14be93d2012-06-08 15:55:40 +0200820 intel_gmch_remove();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821
822 agp_put_bridge(bridge);
823}
824
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400825#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700826static int agp_intel_resume(struct pci_dev *pdev)
827{
828 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
829
Daniel Vettere5a04d52010-04-14 00:29:53 +0200830 bridge->driver->configure();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700831
832 return 0;
833}
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400834#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835
836static struct pci_device_id agp_intel_pci_table[] = {
837#define ID(x) \
838 { \
839 .class = (PCI_CLASS_BRIDGE_HOST << 8), \
840 .class_mask = ~0, \
841 .vendor = PCI_VENDOR_ID_INTEL, \
842 .device = x, \
843 .subvendor = PCI_ANY_ID, \
844 .subdevice = PCI_ANY_ID, \
845 }
Ben Widawsky6b2d5902012-01-04 14:04:33 -0800846 ID(PCI_DEVICE_ID_INTEL_82441), /* for HAS2 support */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847 ID(PCI_DEVICE_ID_INTEL_82443LX_0),
848 ID(PCI_DEVICE_ID_INTEL_82443BX_0),
849 ID(PCI_DEVICE_ID_INTEL_82443GX_0),
850 ID(PCI_DEVICE_ID_INTEL_82810_MC1),
851 ID(PCI_DEVICE_ID_INTEL_82810_MC3),
852 ID(PCI_DEVICE_ID_INTEL_82810E_MC),
853 ID(PCI_DEVICE_ID_INTEL_82815_MC),
854 ID(PCI_DEVICE_ID_INTEL_82820_HB),
855 ID(PCI_DEVICE_ID_INTEL_82820_UP_HB),
856 ID(PCI_DEVICE_ID_INTEL_82830_HB),
857 ID(PCI_DEVICE_ID_INTEL_82840_HB),
858 ID(PCI_DEVICE_ID_INTEL_82845_HB),
859 ID(PCI_DEVICE_ID_INTEL_82845G_HB),
860 ID(PCI_DEVICE_ID_INTEL_82850_HB),
Stefan Husemann347486b2009-04-13 14:40:10 -0700861 ID(PCI_DEVICE_ID_INTEL_82854_HB),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700862 ID(PCI_DEVICE_ID_INTEL_82855PM_HB),
863 ID(PCI_DEVICE_ID_INTEL_82855GM_HB),
864 ID(PCI_DEVICE_ID_INTEL_82860_HB),
865 ID(PCI_DEVICE_ID_INTEL_82865_HB),
866 ID(PCI_DEVICE_ID_INTEL_82875_HB),
867 ID(PCI_DEVICE_ID_INTEL_7505_0),
868 ID(PCI_DEVICE_ID_INTEL_7205_0),
Carlos Martíne914a362008-01-24 10:34:09 +1000869 ID(PCI_DEVICE_ID_INTEL_E7221_HB),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700870 ID(PCI_DEVICE_ID_INTEL_82915G_HB),
871 ID(PCI_DEVICE_ID_INTEL_82915GM_HB),
Alan Hourihaned0de98f2005-05-31 19:50:49 +0100872 ID(PCI_DEVICE_ID_INTEL_82945G_HB),
Alan Hourihane3b0e8ea2006-01-19 14:08:40 +0000873 ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
Zhenyu Wangdde47872007-07-26 09:18:09 +0800874 ID(PCI_DEVICE_ID_INTEL_82945GME_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500875 ID(PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB),
876 ID(PCI_DEVICE_ID_INTEL_PINEVIEW_HB),
Eric Anholt65c25aa2006-09-06 11:57:18 -0400877 ID(PCI_DEVICE_ID_INTEL_82946GZ_HB),
Zhenyu Wang9119f852008-01-23 15:49:26 +1000878 ID(PCI_DEVICE_ID_INTEL_82G35_HB),
Eric Anholt65c25aa2006-09-06 11:57:18 -0400879 ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
880 ID(PCI_DEVICE_ID_INTEL_82965G_HB),
Wang Zhenyu4598af32007-04-09 08:51:36 +0800881 ID(PCI_DEVICE_ID_INTEL_82965GM_HB),
Zhenyu Wangdde47872007-07-26 09:18:09 +0800882 ID(PCI_DEVICE_ID_INTEL_82965GME_HB),
Wang Zhenyu874808c62007-06-06 11:16:25 +0800883 ID(PCI_DEVICE_ID_INTEL_G33_HB),
884 ID(PCI_DEVICE_ID_INTEL_Q35_HB),
885 ID(PCI_DEVICE_ID_INTEL_Q33_HB),
Zhenyu Wang99d32bd2008-07-30 12:26:50 -0700886 ID(PCI_DEVICE_ID_INTEL_GM45_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500887 ID(PCI_DEVICE_ID_INTEL_EAGLELAKE_HB),
Zhenyu Wang25ce77a2008-06-19 14:17:58 +1000888 ID(PCI_DEVICE_ID_INTEL_Q45_HB),
889 ID(PCI_DEVICE_ID_INTEL_G45_HB),
Zhenyu Wanga50ccc62008-11-17 14:39:00 +0800890 ID(PCI_DEVICE_ID_INTEL_G41_HB),
Fabian Henze38d8a952009-09-08 00:59:58 +0800891 ID(PCI_DEVICE_ID_INTEL_B43_HB),
Chris Wilson3dde04b2010-10-14 16:30:41 +0100892 ID(PCI_DEVICE_ID_INTEL_B43_1_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500893 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB),
Eugeni Dodonov67384fe2012-06-06 11:59:06 -0300894 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB),
Adam Jackson107f5172009-12-03 17:14:41 -0500895 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB),
896 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB),
Dave Airlie3ff99162009-12-08 14:03:47 +1000897 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700898 { }
899};
900
901MODULE_DEVICE_TABLE(pci, agp_intel_pci_table);
902
903static struct pci_driver agp_intel_pci_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700904 .name = "agpgart-intel",
905 .id_table = agp_intel_pci_table,
906 .probe = agp_intel_probe,
Greg Kroah-Hartmanbcd29822012-12-21 15:12:08 -0800907 .remove = agp_intel_remove,
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400908#ifdef CONFIG_PM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700909 .resume = agp_intel_resume,
Alexey Dobriyan85be7d62006-08-12 02:02:02 +0400910#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700911};
912
913static int __init agp_intel_init(void)
914{
915 if (agp_off)
916 return -EINVAL;
917 return pci_register_driver(&agp_intel_pci_driver);
918}
919
920static void __exit agp_intel_cleanup(void)
921{
922 pci_unregister_driver(&agp_intel_pci_driver);
923}
924
925module_init(agp_intel_init);
926module_exit(agp_intel_cleanup);
927
Dave Jonesf4432c52008-10-20 13:31:45 -0400928MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700929MODULE_LICENSE("GPL and additional rights");