Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Intel AGPGART routines. |
| 3 | */ |
| 4 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <linux/module.h> |
| 6 | #include <linux/pci.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 7 | #include <linux/slab.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <linux/init.h> |
Ahmed S. Darwish | 1eaf122 | 2007-02-06 18:08:28 +0200 | [diff] [blame] | 9 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <linux/pagemap.h> |
| 11 | #include <linux/agp_backend.h> |
Borislav Petkov | 48a719c | 2010-01-22 16:01:04 +0100 | [diff] [blame] | 12 | #include <asm/smp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include "agp.h" |
Daniel Vetter | ff7cdd6 | 2010-04-14 00:29:51 +0200 | [diff] [blame] | 14 | #include "intel-agp.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
Daniel Vetter | f51b766 | 2010-04-14 00:29:52 +0200 | [diff] [blame] | 16 | #include "intel-gtt.c" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Zhenyu Wang | 1f7a6e3 | 2010-02-23 14:05:24 +0800 | [diff] [blame] | 18 | int intel_agp_enabled; |
| 19 | EXPORT_SYMBOL(intel_agp_enabled); |
| 20 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | static int intel_fetch_size(void) |
| 22 | { |
| 23 | int i; |
| 24 | u16 temp; |
| 25 | struct aper_size_info_16 *values; |
| 26 | |
| 27 | pci_read_config_word(agp_bridge->dev, INTEL_APSIZE, &temp); |
| 28 | values = A_SIZE_16(agp_bridge->driver->aperture_sizes); |
| 29 | |
| 30 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { |
| 31 | if (temp == values[i].size_value) { |
| 32 | agp_bridge->previous_size = agp_bridge->current_size = (void *) (values + i); |
| 33 | agp_bridge->aperture_size_idx = i; |
| 34 | return values[i].size; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | static int __intel_8xx_fetch_size(u8 temp) |
| 42 | { |
| 43 | int i; |
| 44 | struct aper_size_info_8 *values; |
| 45 | |
| 46 | values = A_SIZE_8(agp_bridge->driver->aperture_sizes); |
| 47 | |
| 48 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { |
| 49 | if (temp == values[i].size_value) { |
| 50 | agp_bridge->previous_size = |
| 51 | agp_bridge->current_size = (void *) (values + i); |
| 52 | agp_bridge->aperture_size_idx = i; |
| 53 | return values[i].size; |
| 54 | } |
| 55 | } |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | static int intel_8xx_fetch_size(void) |
| 60 | { |
| 61 | u8 temp; |
| 62 | |
| 63 | pci_read_config_byte(agp_bridge->dev, INTEL_APSIZE, &temp); |
| 64 | return __intel_8xx_fetch_size(temp); |
| 65 | } |
| 66 | |
| 67 | static int intel_815_fetch_size(void) |
| 68 | { |
| 69 | u8 temp; |
| 70 | |
| 71 | /* Intel 815 chipsets have a _weird_ APSIZE register with only |
| 72 | * one non-reserved bit, so mask the others out ... */ |
| 73 | pci_read_config_byte(agp_bridge->dev, INTEL_APSIZE, &temp); |
| 74 | temp &= (1 << 3); |
| 75 | |
| 76 | return __intel_8xx_fetch_size(temp); |
| 77 | } |
| 78 | |
| 79 | static void intel_tlbflush(struct agp_memory *mem) |
| 80 | { |
| 81 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2200); |
| 82 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280); |
| 83 | } |
| 84 | |
| 85 | |
| 86 | static void intel_8xx_tlbflush(struct agp_memory *mem) |
| 87 | { |
| 88 | u32 temp; |
| 89 | pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp); |
| 90 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp & ~(1 << 7)); |
| 91 | pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp); |
| 92 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp | (1 << 7)); |
| 93 | } |
| 94 | |
| 95 | |
| 96 | static void intel_cleanup(void) |
| 97 | { |
| 98 | u16 temp; |
| 99 | struct aper_size_info_16 *previous_size; |
| 100 | |
| 101 | previous_size = A_SIZE_16(agp_bridge->previous_size); |
| 102 | pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp); |
| 103 | pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp & ~(1 << 9)); |
| 104 | pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, previous_size->size_value); |
| 105 | } |
| 106 | |
| 107 | |
| 108 | static void intel_8xx_cleanup(void) |
| 109 | { |
| 110 | u16 temp; |
| 111 | struct aper_size_info_8 *previous_size; |
| 112 | |
| 113 | previous_size = A_SIZE_8(agp_bridge->previous_size); |
| 114 | pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp); |
| 115 | pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp & ~(1 << 9)); |
| 116 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, previous_size->size_value); |
| 117 | } |
| 118 | |
| 119 | |
| 120 | static int intel_configure(void) |
| 121 | { |
| 122 | u32 temp; |
| 123 | u16 temp2; |
| 124 | struct aper_size_info_16 *current_size; |
| 125 | |
| 126 | current_size = A_SIZE_16(agp_bridge->current_size); |
| 127 | |
| 128 | /* aperture size */ |
| 129 | pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
| 130 | |
| 131 | /* address to map to */ |
| 132 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); |
| 133 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
| 134 | |
| 135 | /* attbase - aperture base */ |
| 136 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
| 137 | |
| 138 | /* agpctrl */ |
| 139 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280); |
| 140 | |
| 141 | /* paccfg/nbxcfg */ |
| 142 | pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2); |
| 143 | pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, |
| 144 | (temp2 & ~(1 << 10)) | (1 << 9)); |
| 145 | /* clear any possible error conditions */ |
| 146 | pci_write_config_byte(agp_bridge->dev, INTEL_ERRSTS + 1, 7); |
| 147 | return 0; |
| 148 | } |
| 149 | |
| 150 | static int intel_815_configure(void) |
| 151 | { |
| 152 | u32 temp, addr; |
| 153 | u8 temp2; |
| 154 | struct aper_size_info_8 *current_size; |
| 155 | |
| 156 | /* attbase - aperture base */ |
| 157 | /* the Intel 815 chipset spec. says that bits 29-31 in the |
| 158 | * ATTBASE register are reserved -> try not to write them */ |
| 159 | if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) { |
Bjorn Helgaas | e3cf695 | 2008-07-30 12:26:51 -0700 | [diff] [blame] | 160 | dev_emerg(&agp_bridge->dev->dev, "gatt bus addr too high"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | return -EINVAL; |
| 162 | } |
| 163 | |
| 164 | current_size = A_SIZE_8(agp_bridge->current_size); |
| 165 | |
| 166 | /* aperture size */ |
| 167 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, |
| 168 | current_size->size_value); |
| 169 | |
| 170 | /* address to map to */ |
| 171 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); |
| 172 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
| 173 | |
| 174 | pci_read_config_dword(agp_bridge->dev, INTEL_ATTBASE, &addr); |
| 175 | addr &= INTEL_815_ATTBASE_MASK; |
| 176 | addr |= agp_bridge->gatt_bus_addr; |
| 177 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, addr); |
| 178 | |
| 179 | /* agpctrl */ |
| 180 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000); |
| 181 | |
| 182 | /* apcont */ |
| 183 | pci_read_config_byte(agp_bridge->dev, INTEL_815_APCONT, &temp2); |
| 184 | pci_write_config_byte(agp_bridge->dev, INTEL_815_APCONT, temp2 | (1 << 1)); |
| 185 | |
| 186 | /* clear any possible error conditions */ |
| 187 | /* Oddness : this chipset seems to have no ERRSTS register ! */ |
| 188 | return 0; |
| 189 | } |
| 190 | |
| 191 | static void intel_820_tlbflush(struct agp_memory *mem) |
| 192 | { |
| 193 | return; |
| 194 | } |
| 195 | |
| 196 | static void intel_820_cleanup(void) |
| 197 | { |
| 198 | u8 temp; |
| 199 | struct aper_size_info_8 *previous_size; |
| 200 | |
| 201 | previous_size = A_SIZE_8(agp_bridge->previous_size); |
| 202 | pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp); |
| 203 | pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR, |
| 204 | temp & ~(1 << 1)); |
| 205 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, |
| 206 | previous_size->size_value); |
| 207 | } |
| 208 | |
| 209 | |
| 210 | static int intel_820_configure(void) |
| 211 | { |
| 212 | u32 temp; |
| 213 | u8 temp2; |
| 214 | struct aper_size_info_8 *current_size; |
| 215 | |
| 216 | current_size = A_SIZE_8(agp_bridge->current_size); |
| 217 | |
| 218 | /* aperture size */ |
| 219 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
| 220 | |
| 221 | /* address to map to */ |
| 222 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); |
| 223 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
| 224 | |
| 225 | /* attbase - aperture base */ |
| 226 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
| 227 | |
| 228 | /* agpctrl */ |
| 229 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000); |
| 230 | |
| 231 | /* global enable aperture access */ |
| 232 | /* This flag is not accessed through MCHCFG register as in */ |
| 233 | /* i850 chipset. */ |
| 234 | pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp2); |
| 235 | pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR, temp2 | (1 << 1)); |
| 236 | /* clear any possible AGP-related error conditions */ |
| 237 | pci_write_config_word(agp_bridge->dev, INTEL_I820_ERRSTS, 0x001c); |
| 238 | return 0; |
| 239 | } |
| 240 | |
| 241 | static int intel_840_configure(void) |
| 242 | { |
| 243 | u32 temp; |
| 244 | u16 temp2; |
| 245 | struct aper_size_info_8 *current_size; |
| 246 | |
| 247 | current_size = A_SIZE_8(agp_bridge->current_size); |
| 248 | |
| 249 | /* aperture size */ |
| 250 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
| 251 | |
| 252 | /* address to map to */ |
| 253 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); |
| 254 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
| 255 | |
| 256 | /* attbase - aperture base */ |
| 257 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
| 258 | |
| 259 | /* agpctrl */ |
| 260 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000); |
| 261 | |
| 262 | /* mcgcfg */ |
| 263 | pci_read_config_word(agp_bridge->dev, INTEL_I840_MCHCFG, &temp2); |
| 264 | pci_write_config_word(agp_bridge->dev, INTEL_I840_MCHCFG, temp2 | (1 << 9)); |
| 265 | /* clear any possible error conditions */ |
| 266 | pci_write_config_word(agp_bridge->dev, INTEL_I840_ERRSTS, 0xc000); |
| 267 | return 0; |
| 268 | } |
| 269 | |
| 270 | static int intel_845_configure(void) |
| 271 | { |
| 272 | u32 temp; |
| 273 | u8 temp2; |
| 274 | struct aper_size_info_8 *current_size; |
| 275 | |
| 276 | current_size = A_SIZE_8(agp_bridge->current_size); |
| 277 | |
| 278 | /* aperture size */ |
| 279 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
| 280 | |
Matthew Garrett | b082548 | 2005-07-29 14:03:39 -0700 | [diff] [blame] | 281 | if (agp_bridge->apbase_config != 0) { |
| 282 | pci_write_config_dword(agp_bridge->dev, AGP_APBASE, |
| 283 | agp_bridge->apbase_config); |
| 284 | } else { |
| 285 | /* address to map to */ |
| 286 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); |
| 287 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
| 288 | agp_bridge->apbase_config = temp; |
| 289 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | |
| 291 | /* attbase - aperture base */ |
| 292 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
| 293 | |
| 294 | /* agpctrl */ |
| 295 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000); |
| 296 | |
| 297 | /* agpm */ |
| 298 | pci_read_config_byte(agp_bridge->dev, INTEL_I845_AGPM, &temp2); |
| 299 | pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1)); |
| 300 | /* clear any possible error conditions */ |
| 301 | pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c); |
| 302 | return 0; |
| 303 | } |
| 304 | |
| 305 | static int intel_850_configure(void) |
| 306 | { |
| 307 | u32 temp; |
| 308 | u16 temp2; |
| 309 | struct aper_size_info_8 *current_size; |
| 310 | |
| 311 | current_size = A_SIZE_8(agp_bridge->current_size); |
| 312 | |
| 313 | /* aperture size */ |
| 314 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
| 315 | |
| 316 | /* address to map to */ |
| 317 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); |
| 318 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
| 319 | |
| 320 | /* attbase - aperture base */ |
| 321 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
| 322 | |
| 323 | /* agpctrl */ |
| 324 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000); |
| 325 | |
| 326 | /* mcgcfg */ |
| 327 | pci_read_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, &temp2); |
| 328 | pci_write_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, temp2 | (1 << 9)); |
| 329 | /* clear any possible AGP-related error conditions */ |
| 330 | pci_write_config_word(agp_bridge->dev, INTEL_I850_ERRSTS, 0x001c); |
| 331 | return 0; |
| 332 | } |
| 333 | |
| 334 | static int intel_860_configure(void) |
| 335 | { |
| 336 | u32 temp; |
| 337 | u16 temp2; |
| 338 | struct aper_size_info_8 *current_size; |
| 339 | |
| 340 | current_size = A_SIZE_8(agp_bridge->current_size); |
| 341 | |
| 342 | /* aperture size */ |
| 343 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
| 344 | |
| 345 | /* address to map to */ |
| 346 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); |
| 347 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
| 348 | |
| 349 | /* attbase - aperture base */ |
| 350 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
| 351 | |
| 352 | /* agpctrl */ |
| 353 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000); |
| 354 | |
| 355 | /* mcgcfg */ |
| 356 | pci_read_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, &temp2); |
| 357 | pci_write_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, temp2 | (1 << 9)); |
| 358 | /* clear any possible AGP-related error conditions */ |
| 359 | pci_write_config_word(agp_bridge->dev, INTEL_I860_ERRSTS, 0xf700); |
| 360 | return 0; |
| 361 | } |
| 362 | |
| 363 | static int intel_830mp_configure(void) |
| 364 | { |
| 365 | u32 temp; |
| 366 | u16 temp2; |
| 367 | struct aper_size_info_8 *current_size; |
| 368 | |
| 369 | current_size = A_SIZE_8(agp_bridge->current_size); |
| 370 | |
| 371 | /* aperture size */ |
| 372 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
| 373 | |
| 374 | /* address to map to */ |
| 375 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); |
| 376 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
| 377 | |
| 378 | /* attbase - aperture base */ |
| 379 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
| 380 | |
| 381 | /* agpctrl */ |
| 382 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000); |
| 383 | |
| 384 | /* gmch */ |
| 385 | pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2); |
| 386 | pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp2 | (1 << 9)); |
| 387 | /* clear any possible AGP-related error conditions */ |
| 388 | pci_write_config_word(agp_bridge->dev, INTEL_I830_ERRSTS, 0x1c); |
| 389 | return 0; |
| 390 | } |
| 391 | |
| 392 | static int intel_7505_configure(void) |
| 393 | { |
| 394 | u32 temp; |
| 395 | u16 temp2; |
| 396 | struct aper_size_info_8 *current_size; |
| 397 | |
| 398 | current_size = A_SIZE_8(agp_bridge->current_size); |
| 399 | |
| 400 | /* aperture size */ |
| 401 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
| 402 | |
| 403 | /* address to map to */ |
| 404 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); |
| 405 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
| 406 | |
| 407 | /* attbase - aperture base */ |
| 408 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
| 409 | |
| 410 | /* agpctrl */ |
| 411 | pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000); |
| 412 | |
| 413 | /* mchcfg */ |
| 414 | pci_read_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, &temp2); |
| 415 | pci_write_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, temp2 | (1 << 9)); |
| 416 | |
| 417 | return 0; |
| 418 | } |
| 419 | |
| 420 | /* Setup function */ |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 421 | static const struct gatt_mask intel_generic_masks[] = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | { |
| 423 | {.mask = 0x00000017, .type = 0} |
| 424 | }; |
| 425 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 426 | static const struct aper_size_info_8 intel_815_sizes[2] = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | { |
| 428 | {64, 16384, 4, 0}, |
| 429 | {32, 8192, 3, 8}, |
| 430 | }; |
| 431 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 432 | static const struct aper_size_info_8 intel_8xx_sizes[7] = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | { |
| 434 | {256, 65536, 6, 0}, |
| 435 | {128, 32768, 5, 32}, |
| 436 | {64, 16384, 4, 48}, |
| 437 | {32, 8192, 3, 56}, |
| 438 | {16, 4096, 2, 60}, |
| 439 | {8, 2048, 1, 62}, |
| 440 | {4, 1024, 0, 63} |
| 441 | }; |
| 442 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 443 | static const struct aper_size_info_16 intel_generic_sizes[7] = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | { |
| 445 | {256, 65536, 6, 0}, |
| 446 | {128, 32768, 5, 32}, |
| 447 | {64, 16384, 4, 48}, |
| 448 | {32, 8192, 3, 56}, |
| 449 | {16, 4096, 2, 60}, |
| 450 | {8, 2048, 1, 62}, |
| 451 | {4, 1024, 0, 63} |
| 452 | }; |
| 453 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 454 | static const struct aper_size_info_8 intel_830mp_sizes[4] = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | { |
| 456 | {256, 65536, 6, 0}, |
| 457 | {128, 32768, 5, 32}, |
| 458 | {64, 16384, 4, 48}, |
| 459 | {32, 8192, 3, 56} |
| 460 | }; |
| 461 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 462 | static const struct agp_bridge_driver intel_generic_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | .owner = THIS_MODULE, |
| 464 | .aperture_sizes = intel_generic_sizes, |
| 465 | .size_type = U16_APER_SIZE, |
| 466 | .num_aperture_sizes = 7, |
| 467 | .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 Li | 37acee1 | 2008-08-21 10:46:11 +0800 | [diff] [blame] | 482 | .agp_alloc_pages = agp_generic_alloc_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | .agp_destroy_page = agp_generic_destroy_page, |
Shaohua Li | bd07928 | 2008-08-21 10:46:17 +0800 | [diff] [blame] | 484 | .agp_destroy_pages = agp_generic_destroy_pages, |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 485 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | }; |
| 487 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 488 | static const struct agp_bridge_driver intel_815_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | .owner = THIS_MODULE, |
| 490 | .aperture_sizes = intel_815_sizes, |
| 491 | .size_type = U8_APER_SIZE, |
| 492 | .num_aperture_sizes = 2, |
| 493 | .configure = intel_815_configure, |
| 494 | .fetch_size = intel_815_fetch_size, |
| 495 | .cleanup = intel_8xx_cleanup, |
| 496 | .tlb_flush = intel_8xx_tlbflush, |
| 497 | .mask_memory = agp_generic_mask_memory, |
| 498 | .masks = intel_generic_masks, |
| 499 | .agp_enable = agp_generic_enable, |
| 500 | .cache_flush = global_cache_flush, |
| 501 | .create_gatt_table = agp_generic_create_gatt_table, |
| 502 | .free_gatt_table = agp_generic_free_gatt_table, |
| 503 | .insert_memory = agp_generic_insert_memory, |
| 504 | .remove_memory = agp_generic_remove_memory, |
| 505 | .alloc_by_type = agp_generic_alloc_by_type, |
| 506 | .free_by_type = agp_generic_free_by_type, |
| 507 | .agp_alloc_page = agp_generic_alloc_page, |
Shaohua Li | 37acee1 | 2008-08-21 10:46:11 +0800 | [diff] [blame] | 508 | .agp_alloc_pages = agp_generic_alloc_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | .agp_destroy_page = agp_generic_destroy_page, |
Shaohua Li | bd07928 | 2008-08-21 10:46:17 +0800 | [diff] [blame] | 510 | .agp_destroy_pages = agp_generic_destroy_pages, |
Dave Airlie | 62c96b9 | 2008-06-19 14:27:53 +1000 | [diff] [blame] | 511 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | }; |
| 513 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 514 | static const struct agp_bridge_driver intel_820_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | .owner = THIS_MODULE, |
| 516 | .aperture_sizes = intel_8xx_sizes, |
| 517 | .size_type = U8_APER_SIZE, |
| 518 | .num_aperture_sizes = 7, |
| 519 | .configure = intel_820_configure, |
| 520 | .fetch_size = intel_8xx_fetch_size, |
| 521 | .cleanup = intel_820_cleanup, |
| 522 | .tlb_flush = intel_820_tlbflush, |
| 523 | .mask_memory = agp_generic_mask_memory, |
| 524 | .masks = intel_generic_masks, |
| 525 | .agp_enable = agp_generic_enable, |
| 526 | .cache_flush = global_cache_flush, |
| 527 | .create_gatt_table = agp_generic_create_gatt_table, |
| 528 | .free_gatt_table = agp_generic_free_gatt_table, |
| 529 | .insert_memory = agp_generic_insert_memory, |
| 530 | .remove_memory = agp_generic_remove_memory, |
| 531 | .alloc_by_type = agp_generic_alloc_by_type, |
| 532 | .free_by_type = agp_generic_free_by_type, |
| 533 | .agp_alloc_page = agp_generic_alloc_page, |
Shaohua Li | 37acee1 | 2008-08-21 10:46:11 +0800 | [diff] [blame] | 534 | .agp_alloc_pages = agp_generic_alloc_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | .agp_destroy_page = agp_generic_destroy_page, |
Shaohua Li | bd07928 | 2008-08-21 10:46:17 +0800 | [diff] [blame] | 536 | .agp_destroy_pages = agp_generic_destroy_pages, |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 537 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | }; |
| 539 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 540 | static const struct agp_bridge_driver intel_830mp_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | .owner = THIS_MODULE, |
| 542 | .aperture_sizes = intel_830mp_sizes, |
| 543 | .size_type = U8_APER_SIZE, |
| 544 | .num_aperture_sizes = 4, |
| 545 | .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 Li | 37acee1 | 2008-08-21 10:46:11 +0800 | [diff] [blame] | 560 | .agp_alloc_pages = agp_generic_alloc_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | .agp_destroy_page = agp_generic_destroy_page, |
Shaohua Li | bd07928 | 2008-08-21 10:46:17 +0800 | [diff] [blame] | 562 | .agp_destroy_pages = agp_generic_destroy_pages, |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 563 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 564 | }; |
| 565 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 566 | static const struct agp_bridge_driver intel_840_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | .owner = THIS_MODULE, |
| 568 | .aperture_sizes = intel_8xx_sizes, |
| 569 | .size_type = U8_APER_SIZE, |
| 570 | .num_aperture_sizes = 7, |
| 571 | .configure = intel_840_configure, |
| 572 | .fetch_size = intel_8xx_fetch_size, |
| 573 | .cleanup = intel_8xx_cleanup, |
| 574 | .tlb_flush = intel_8xx_tlbflush, |
| 575 | .mask_memory = agp_generic_mask_memory, |
| 576 | .masks = intel_generic_masks, |
| 577 | .agp_enable = agp_generic_enable, |
| 578 | .cache_flush = global_cache_flush, |
| 579 | .create_gatt_table = agp_generic_create_gatt_table, |
| 580 | .free_gatt_table = agp_generic_free_gatt_table, |
| 581 | .insert_memory = agp_generic_insert_memory, |
| 582 | .remove_memory = agp_generic_remove_memory, |
| 583 | .alloc_by_type = agp_generic_alloc_by_type, |
| 584 | .free_by_type = agp_generic_free_by_type, |
| 585 | .agp_alloc_page = agp_generic_alloc_page, |
Shaohua Li | 37acee1 | 2008-08-21 10:46:11 +0800 | [diff] [blame] | 586 | .agp_alloc_pages = agp_generic_alloc_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 587 | .agp_destroy_page = agp_generic_destroy_page, |
Shaohua Li | bd07928 | 2008-08-21 10:46:17 +0800 | [diff] [blame] | 588 | .agp_destroy_pages = agp_generic_destroy_pages, |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 589 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | }; |
| 591 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 592 | static const struct agp_bridge_driver intel_845_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | .owner = THIS_MODULE, |
| 594 | .aperture_sizes = intel_8xx_sizes, |
| 595 | .size_type = U8_APER_SIZE, |
| 596 | .num_aperture_sizes = 7, |
| 597 | .configure = intel_845_configure, |
| 598 | .fetch_size = intel_8xx_fetch_size, |
| 599 | .cleanup = intel_8xx_cleanup, |
| 600 | .tlb_flush = intel_8xx_tlbflush, |
| 601 | .mask_memory = agp_generic_mask_memory, |
| 602 | .masks = intel_generic_masks, |
| 603 | .agp_enable = agp_generic_enable, |
| 604 | .cache_flush = global_cache_flush, |
| 605 | .create_gatt_table = agp_generic_create_gatt_table, |
| 606 | .free_gatt_table = agp_generic_free_gatt_table, |
| 607 | .insert_memory = agp_generic_insert_memory, |
| 608 | .remove_memory = agp_generic_remove_memory, |
| 609 | .alloc_by_type = agp_generic_alloc_by_type, |
| 610 | .free_by_type = agp_generic_free_by_type, |
| 611 | .agp_alloc_page = agp_generic_alloc_page, |
Shaohua Li | 37acee1 | 2008-08-21 10:46:11 +0800 | [diff] [blame] | 612 | .agp_alloc_pages = agp_generic_alloc_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 613 | .agp_destroy_page = agp_generic_destroy_page, |
Shaohua Li | bd07928 | 2008-08-21 10:46:17 +0800 | [diff] [blame] | 614 | .agp_destroy_pages = agp_generic_destroy_pages, |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 615 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 616 | }; |
| 617 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 618 | static const struct agp_bridge_driver intel_850_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | .owner = THIS_MODULE, |
| 620 | .aperture_sizes = intel_8xx_sizes, |
| 621 | .size_type = U8_APER_SIZE, |
| 622 | .num_aperture_sizes = 7, |
| 623 | .configure = intel_850_configure, |
| 624 | .fetch_size = intel_8xx_fetch_size, |
| 625 | .cleanup = intel_8xx_cleanup, |
| 626 | .tlb_flush = intel_8xx_tlbflush, |
| 627 | .mask_memory = agp_generic_mask_memory, |
| 628 | .masks = intel_generic_masks, |
| 629 | .agp_enable = agp_generic_enable, |
| 630 | .cache_flush = global_cache_flush, |
| 631 | .create_gatt_table = agp_generic_create_gatt_table, |
| 632 | .free_gatt_table = agp_generic_free_gatt_table, |
| 633 | .insert_memory = agp_generic_insert_memory, |
| 634 | .remove_memory = agp_generic_remove_memory, |
| 635 | .alloc_by_type = agp_generic_alloc_by_type, |
| 636 | .free_by_type = agp_generic_free_by_type, |
| 637 | .agp_alloc_page = agp_generic_alloc_page, |
Shaohua Li | 37acee1 | 2008-08-21 10:46:11 +0800 | [diff] [blame] | 638 | .agp_alloc_pages = agp_generic_alloc_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 639 | .agp_destroy_page = agp_generic_destroy_page, |
Shaohua Li | bd07928 | 2008-08-21 10:46:17 +0800 | [diff] [blame] | 640 | .agp_destroy_pages = agp_generic_destroy_pages, |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 641 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 642 | }; |
| 643 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 644 | static const struct agp_bridge_driver intel_860_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | .owner = THIS_MODULE, |
| 646 | .aperture_sizes = intel_8xx_sizes, |
| 647 | .size_type = U8_APER_SIZE, |
| 648 | .num_aperture_sizes = 7, |
| 649 | .configure = intel_860_configure, |
| 650 | .fetch_size = intel_8xx_fetch_size, |
| 651 | .cleanup = intel_8xx_cleanup, |
| 652 | .tlb_flush = intel_8xx_tlbflush, |
| 653 | .mask_memory = agp_generic_mask_memory, |
| 654 | .masks = intel_generic_masks, |
| 655 | .agp_enable = agp_generic_enable, |
| 656 | .cache_flush = global_cache_flush, |
| 657 | .create_gatt_table = agp_generic_create_gatt_table, |
| 658 | .free_gatt_table = agp_generic_free_gatt_table, |
| 659 | .insert_memory = agp_generic_insert_memory, |
| 660 | .remove_memory = agp_generic_remove_memory, |
| 661 | .alloc_by_type = agp_generic_alloc_by_type, |
| 662 | .free_by_type = agp_generic_free_by_type, |
| 663 | .agp_alloc_page = agp_generic_alloc_page, |
Shaohua Li | 37acee1 | 2008-08-21 10:46:11 +0800 | [diff] [blame] | 664 | .agp_alloc_pages = agp_generic_alloc_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 665 | .agp_destroy_page = agp_generic_destroy_page, |
Shaohua Li | bd07928 | 2008-08-21 10:46:17 +0800 | [diff] [blame] | 666 | .agp_destroy_pages = agp_generic_destroy_pages, |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 667 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 668 | }; |
| 669 | |
Dave Jones | e5524f3 | 2007-02-22 18:41:28 -0500 | [diff] [blame] | 670 | static const struct agp_bridge_driver intel_7505_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 671 | .owner = THIS_MODULE, |
| 672 | .aperture_sizes = intel_8xx_sizes, |
| 673 | .size_type = U8_APER_SIZE, |
| 674 | .num_aperture_sizes = 7, |
| 675 | .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 Li | 37acee1 | 2008-08-21 10:46:11 +0800 | [diff] [blame] | 690 | .agp_alloc_pages = agp_generic_alloc_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | .agp_destroy_page = agp_generic_destroy_page, |
Shaohua Li | bd07928 | 2008-08-21 10:46:17 +0800 | [diff] [blame] | 692 | .agp_destroy_pages = agp_generic_destroy_pages, |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 693 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 694 | }; |
| 695 | |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 696 | static int find_gmch(u16 device) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | { |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 698 | struct pci_dev *gmch_device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 700 | gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); |
| 701 | if (gmch_device && PCI_FUNC(gmch_device->devfn) != 0) { |
| 702 | gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, |
Dave Airlie | f011ae7 | 2008-01-25 11:23:04 +1000 | [diff] [blame] | 703 | device, gmch_device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 704 | } |
| 705 | |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 706 | if (!gmch_device) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | return 0; |
| 708 | |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 709 | intel_private.pcidev = gmch_device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 710 | return 1; |
| 711 | } |
| 712 | |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 713 | /* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of |
| 714 | * driver and gmch_driver must be non-null, and find_gmch will determine |
| 715 | * which one should be used if a gmch_chip_id is present. |
| 716 | */ |
| 717 | static const struct intel_driver_description { |
| 718 | unsigned int chip_id; |
| 719 | unsigned int gmch_chip_id; |
| 720 | char *name; |
| 721 | const struct agp_bridge_driver *driver; |
| 722 | const struct agp_bridge_driver *gmch_driver; |
| 723 | } intel_agp_chipsets[] = { |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 724 | { PCI_DEVICE_ID_INTEL_82443LX_0, 0, "440LX", &intel_generic_driver, NULL }, |
| 725 | { PCI_DEVICE_ID_INTEL_82443BX_0, 0, "440BX", &intel_generic_driver, NULL }, |
| 726 | { PCI_DEVICE_ID_INTEL_82443GX_0, 0, "440GX", &intel_generic_driver, NULL }, |
| 727 | { PCI_DEVICE_ID_INTEL_82810_MC1, PCI_DEVICE_ID_INTEL_82810_IG1, "i810", |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 728 | NULL, &intel_810_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 729 | { PCI_DEVICE_ID_INTEL_82810_MC3, PCI_DEVICE_ID_INTEL_82810_IG3, "i810", |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 730 | NULL, &intel_810_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 731 | { PCI_DEVICE_ID_INTEL_82810E_MC, PCI_DEVICE_ID_INTEL_82810E_IG, "i810", |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 732 | NULL, &intel_810_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 733 | { PCI_DEVICE_ID_INTEL_82815_MC, PCI_DEVICE_ID_INTEL_82815_CGC, "i815", |
Wang Zhenyu | 8888985 | 2007-06-14 10:01:04 +0800 | [diff] [blame] | 734 | &intel_815_driver, &intel_810_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 735 | { PCI_DEVICE_ID_INTEL_82820_HB, 0, "i820", &intel_820_driver, NULL }, |
| 736 | { PCI_DEVICE_ID_INTEL_82820_UP_HB, 0, "i820", &intel_820_driver, NULL }, |
| 737 | { PCI_DEVICE_ID_INTEL_82830_HB, PCI_DEVICE_ID_INTEL_82830_CGC, "830M", |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 738 | &intel_830mp_driver, &intel_830_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 739 | { PCI_DEVICE_ID_INTEL_82840_HB, 0, "i840", &intel_840_driver, NULL }, |
| 740 | { PCI_DEVICE_ID_INTEL_82845_HB, 0, "845G", &intel_845_driver, NULL }, |
| 741 | { PCI_DEVICE_ID_INTEL_82845G_HB, PCI_DEVICE_ID_INTEL_82845G_IG, "830M", |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 742 | &intel_845_driver, &intel_830_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 743 | { PCI_DEVICE_ID_INTEL_82850_HB, 0, "i850", &intel_850_driver, NULL }, |
| 744 | { PCI_DEVICE_ID_INTEL_82854_HB, PCI_DEVICE_ID_INTEL_82854_IG, "854", |
Stefan Husemann | 347486b | 2009-04-13 14:40:10 -0700 | [diff] [blame] | 745 | &intel_845_driver, &intel_830_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 746 | { PCI_DEVICE_ID_INTEL_82855PM_HB, 0, "855PM", &intel_845_driver, NULL }, |
| 747 | { PCI_DEVICE_ID_INTEL_82855GM_HB, PCI_DEVICE_ID_INTEL_82855GM_IG, "855GM", |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 748 | &intel_845_driver, &intel_830_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 749 | { PCI_DEVICE_ID_INTEL_82860_HB, 0, "i860", &intel_860_driver, NULL }, |
| 750 | { PCI_DEVICE_ID_INTEL_82865_HB, PCI_DEVICE_ID_INTEL_82865_IG, "865", |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 751 | &intel_845_driver, &intel_830_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 752 | { PCI_DEVICE_ID_INTEL_82875_HB, 0, "i875", &intel_845_driver, NULL }, |
| 753 | { PCI_DEVICE_ID_INTEL_E7221_HB, PCI_DEVICE_ID_INTEL_E7221_IG, "E7221 (i915)", |
Carlos MartÃn | e914a36 | 2008-01-24 10:34:09 +1000 | [diff] [blame] | 754 | NULL, &intel_915_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 755 | { PCI_DEVICE_ID_INTEL_82915G_HB, PCI_DEVICE_ID_INTEL_82915G_IG, "915G", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 756 | NULL, &intel_915_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 757 | { PCI_DEVICE_ID_INTEL_82915GM_HB, PCI_DEVICE_ID_INTEL_82915GM_IG, "915GM", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 758 | NULL, &intel_915_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 759 | { PCI_DEVICE_ID_INTEL_82945G_HB, PCI_DEVICE_ID_INTEL_82945G_IG, "945G", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 760 | NULL, &intel_915_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 761 | { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GM_IG, "945GM", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 762 | NULL, &intel_915_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 763 | { PCI_DEVICE_ID_INTEL_82945GME_HB, PCI_DEVICE_ID_INTEL_82945GME_IG, "945GME", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 764 | NULL, &intel_915_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 765 | { PCI_DEVICE_ID_INTEL_82946GZ_HB, PCI_DEVICE_ID_INTEL_82946GZ_IG, "946GZ", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 766 | NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 767 | { PCI_DEVICE_ID_INTEL_82G35_HB, PCI_DEVICE_ID_INTEL_82G35_IG, "G35", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 768 | NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 769 | { PCI_DEVICE_ID_INTEL_82965Q_HB, PCI_DEVICE_ID_INTEL_82965Q_IG, "965Q", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 770 | NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 771 | { PCI_DEVICE_ID_INTEL_82965G_HB, PCI_DEVICE_ID_INTEL_82965G_IG, "965G", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 772 | NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 773 | { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GM_IG, "965GM", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 774 | NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 775 | { PCI_DEVICE_ID_INTEL_82965GME_HB, PCI_DEVICE_ID_INTEL_82965GME_IG, "965GME/GLE", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 776 | NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 777 | { PCI_DEVICE_ID_INTEL_7505_0, 0, "E7505", &intel_7505_driver, NULL }, |
| 778 | { PCI_DEVICE_ID_INTEL_7205_0, 0, "E7205", &intel_7505_driver, NULL }, |
| 779 | { PCI_DEVICE_ID_INTEL_G33_HB, PCI_DEVICE_ID_INTEL_G33_IG, "G33", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 780 | NULL, &intel_g33_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 781 | { PCI_DEVICE_ID_INTEL_Q35_HB, PCI_DEVICE_ID_INTEL_Q35_IG, "Q35", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 782 | NULL, &intel_g33_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 783 | { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, "Q33", |
Wang Zhenyu | 47d4637 | 2007-06-21 13:43:18 +0800 | [diff] [blame] | 784 | NULL, &intel_g33_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 785 | { PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB, PCI_DEVICE_ID_INTEL_PINEVIEW_M_IG, "GMA3150", |
Shaohua Li | 2177832 | 2009-02-23 15:19:16 +0800 | [diff] [blame] | 786 | NULL, &intel_g33_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 787 | { PCI_DEVICE_ID_INTEL_PINEVIEW_HB, PCI_DEVICE_ID_INTEL_PINEVIEW_IG, "GMA3150", |
Shaohua Li | 2177832 | 2009-02-23 15:19:16 +0800 | [diff] [blame] | 788 | NULL, &intel_g33_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 789 | { PCI_DEVICE_ID_INTEL_GM45_HB, PCI_DEVICE_ID_INTEL_GM45_IG, |
Adam Jackson | 107f517 | 2009-12-03 17:14:41 -0500 | [diff] [blame] | 790 | "GM45", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 791 | { PCI_DEVICE_ID_INTEL_EAGLELAKE_HB, PCI_DEVICE_ID_INTEL_EAGLELAKE_IG, |
Adam Jackson | 107f517 | 2009-12-03 17:14:41 -0500 | [diff] [blame] | 792 | "Eaglelake", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 793 | { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, |
Zhenyu Wang | 25ce77a | 2008-06-19 14:17:58 +1000 | [diff] [blame] | 794 | "Q45/Q43", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 795 | { PCI_DEVICE_ID_INTEL_G45_HB, PCI_DEVICE_ID_INTEL_G45_IG, |
Zhenyu Wang | 25ce77a | 2008-06-19 14:17:58 +1000 | [diff] [blame] | 796 | "G45/G43", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 797 | { PCI_DEVICE_ID_INTEL_B43_HB, PCI_DEVICE_ID_INTEL_B43_IG, |
Fabian Henze | 38d8a95 | 2009-09-08 00:59:58 +0800 | [diff] [blame] | 798 | "B43", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 799 | { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, |
Zhenyu Wang | a50ccc6 | 2008-11-17 14:39:00 +0800 | [diff] [blame] | 800 | "G41", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 801 | { PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG, |
Zhenyu Wang | af86d4b | 2010-02-10 10:39:33 +0800 | [diff] [blame] | 802 | "HD Graphics", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 803 | { PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, |
Zhenyu Wang | af86d4b | 2010-02-10 10:39:33 +0800 | [diff] [blame] | 804 | "HD Graphics", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 805 | { PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, |
Zhenyu Wang | af86d4b | 2010-02-10 10:39:33 +0800 | [diff] [blame] | 806 | "HD Graphics", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 807 | { PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, |
Zhenyu Wang | af86d4b | 2010-02-10 10:39:33 +0800 | [diff] [blame] | 808 | "HD Graphics", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 809 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_IG, |
Eric Anholt | 1089e30 | 2009-10-22 16:10:52 -0700 | [diff] [blame] | 810 | "Sandybridge", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 811 | { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_IG, |
Eric Anholt | 954bce5 | 2010-01-07 16:21:46 -0800 | [diff] [blame] | 812 | "Sandybridge", NULL, &intel_i965_driver }, |
Daniel Vetter | 059efc6 | 2010-04-14 00:29:54 +0200 | [diff] [blame] | 813 | { 0, 0, NULL, NULL, NULL } |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 814 | }; |
| 815 | |
Daniel Vetter | 22dd82a | 2010-04-14 00:29:55 +0200 | [diff] [blame] | 816 | static int __devinit intel_gmch_probe(struct pci_dev *pdev, |
| 817 | struct agp_bridge_data *bridge) |
| 818 | { |
| 819 | int i; |
| 820 | bridge->driver = NULL; |
| 821 | |
| 822 | for (i = 0; intel_agp_chipsets[i].name != NULL; i++) { |
| 823 | if ((intel_agp_chipsets[i].gmch_chip_id != 0) && |
| 824 | find_gmch(intel_agp_chipsets[i].gmch_chip_id)) { |
| 825 | bridge->driver = |
| 826 | intel_agp_chipsets[i].gmch_driver; |
| 827 | break; |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | if (!bridge->driver) |
| 832 | return 0; |
| 833 | |
| 834 | bridge->dev_private_data = &intel_private; |
| 835 | bridge->dev = pdev; |
| 836 | |
| 837 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); |
| 838 | |
| 839 | if (bridge->driver->mask_memory == intel_i965_mask_memory) { |
| 840 | if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36))) |
| 841 | dev_err(&intel_private.pcidev->dev, |
| 842 | "set gfx device dma mask 36bit failed!\n"); |
| 843 | else |
| 844 | pci_set_consistent_dma_mask(intel_private.pcidev, |
| 845 | DMA_BIT_MASK(36)); |
| 846 | } |
| 847 | |
| 848 | return 1; |
| 849 | } |
| 850 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 851 | static int __devinit agp_intel_probe(struct pci_dev *pdev, |
| 852 | const struct pci_device_id *ent) |
| 853 | { |
| 854 | struct agp_bridge_data *bridge; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 855 | u8 cap_ptr = 0; |
| 856 | struct resource *r; |
Zhenyu Wang | 1f7a6e3 | 2010-02-23 14:05:24 +0800 | [diff] [blame] | 857 | int i, err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 858 | |
| 859 | cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); |
| 860 | |
| 861 | bridge = agp_alloc_bridge(); |
| 862 | if (!bridge) |
| 863 | return -ENOMEM; |
| 864 | |
Daniel Vetter | 22dd82a | 2010-04-14 00:29:55 +0200 | [diff] [blame] | 865 | bridge->capndx = cap_ptr; |
| 866 | |
| 867 | if (intel_gmch_probe(pdev, bridge)) |
| 868 | goto found_gmch; |
| 869 | |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 870 | for (i = 0; intel_agp_chipsets[i].name != NULL; i++) { |
| 871 | /* In case that multiple models of gfx chip may |
| 872 | stand on same host bridge type, this can be |
| 873 | sure we detect the right IGD. */ |
Wang Zhenyu | 8888985 | 2007-06-14 10:01:04 +0800 | [diff] [blame] | 874 | if (pdev->device == intel_agp_chipsets[i].chip_id) { |
Daniel Vetter | 22dd82a | 2010-04-14 00:29:55 +0200 | [diff] [blame] | 875 | bridge->driver = intel_agp_chipsets[i].driver; |
| 876 | break; |
Wang Zhenyu | 8888985 | 2007-06-14 10:01:04 +0800 | [diff] [blame] | 877 | } |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 878 | } |
| 879 | |
| 880 | if (intel_agp_chipsets[i].name == NULL) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 881 | if (cap_ptr) |
Bjorn Helgaas | e3cf695 | 2008-07-30 12:26:51 -0700 | [diff] [blame] | 882 | dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n", |
| 883 | pdev->vendor, pdev->device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 884 | agp_put_bridge(bridge); |
| 885 | return -ENODEV; |
Wang Zhenyu | 9614ece | 2007-05-30 09:45:58 +0800 | [diff] [blame] | 886 | } |
| 887 | |
Dave Airlie | 10fd883 | 2010-04-20 16:34:20 +1000 | [diff] [blame^] | 888 | if (!bridge->driver) { |
| 889 | if (cap_ptr) |
| 890 | dev_warn(&pdev->dev, "can't find bridge device (chip_id: %04x)\n", |
| 891 | intel_agp_chipsets[i].gmch_chip_id); |
| 892 | agp_put_bridge(bridge); |
| 893 | return -ENODEV; |
| 894 | } |
| 895 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 896 | bridge->dev = pdev; |
Daniel Vetter | 22dd82a | 2010-04-14 00:29:55 +0200 | [diff] [blame] | 897 | bridge->dev_private_data = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 898 | |
Bjorn Helgaas | e3cf695 | 2008-07-30 12:26:51 -0700 | [diff] [blame] | 899 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 900 | |
| 901 | /* |
| 902 | * The following fixes the case where the BIOS has "forgotten" to |
| 903 | * provide an address range for the GART. |
| 904 | * 20030610 - hamish@zot.org |
| 905 | */ |
| 906 | r = &pdev->resource[0]; |
| 907 | if (!r->start && r->end) { |
Dave Jones | 6a92a4e | 2006-02-28 00:54:25 -0500 | [diff] [blame] | 908 | if (pci_assign_resource(pdev, 0)) { |
Bjorn Helgaas | e3cf695 | 2008-07-30 12:26:51 -0700 | [diff] [blame] | 909 | dev_err(&pdev->dev, "can't assign resource 0\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 910 | agp_put_bridge(bridge); |
| 911 | return -ENODEV; |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | /* |
| 916 | * If the device has not been properly setup, the following will catch |
| 917 | * the problem and should stop the system from crashing. |
| 918 | * 20030610 - hamish@zot.org |
| 919 | */ |
| 920 | if (pci_enable_device(pdev)) { |
Bjorn Helgaas | e3cf695 | 2008-07-30 12:26:51 -0700 | [diff] [blame] | 921 | dev_err(&pdev->dev, "can't enable PCI device\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 922 | agp_put_bridge(bridge); |
| 923 | return -ENODEV; |
| 924 | } |
| 925 | |
| 926 | /* Fill in the mode register */ |
| 927 | if (cap_ptr) { |
| 928 | pci_read_config_dword(pdev, |
| 929 | bridge->capndx+PCI_AGP_STATUS, |
| 930 | &bridge->mode); |
| 931 | } |
| 932 | |
Daniel Vetter | 22dd82a | 2010-04-14 00:29:55 +0200 | [diff] [blame] | 933 | found_gmch: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 934 | pci_set_drvdata(pdev, bridge); |
Zhenyu Wang | 1f7a6e3 | 2010-02-23 14:05:24 +0800 | [diff] [blame] | 935 | err = agp_add_bridge(bridge); |
| 936 | if (!err) |
| 937 | intel_agp_enabled = 1; |
| 938 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 939 | } |
| 940 | |
| 941 | static void __devexit agp_intel_remove(struct pci_dev *pdev) |
| 942 | { |
| 943 | struct agp_bridge_data *bridge = pci_get_drvdata(pdev); |
| 944 | |
| 945 | agp_remove_bridge(bridge); |
| 946 | |
Wang Zhenyu | c4ca881 | 2007-05-30 09:40:46 +0800 | [diff] [blame] | 947 | if (intel_private.pcidev) |
| 948 | pci_dev_put(intel_private.pcidev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 949 | |
| 950 | agp_put_bridge(bridge); |
| 951 | } |
| 952 | |
Alexey Dobriyan | 85be7d6 | 2006-08-12 02:02:02 +0400 | [diff] [blame] | 953 | #ifdef CONFIG_PM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 954 | static int agp_intel_resume(struct pci_dev *pdev) |
| 955 | { |
| 956 | struct agp_bridge_data *bridge = pci_get_drvdata(pdev); |
Keith Packard | a8c84df | 2008-07-31 15:48:07 +1000 | [diff] [blame] | 957 | int ret_val; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 958 | |
Daniel Vetter | e5a04d5 | 2010-04-14 00:29:53 +0200 | [diff] [blame] | 959 | bridge->driver->configure(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 960 | |
Keith Packard | a8c84df | 2008-07-31 15:48:07 +1000 | [diff] [blame] | 961 | ret_val = agp_rebind_memory(); |
| 962 | if (ret_val != 0) |
| 963 | return ret_val; |
| 964 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 965 | return 0; |
| 966 | } |
Alexey Dobriyan | 85be7d6 | 2006-08-12 02:02:02 +0400 | [diff] [blame] | 967 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 968 | |
| 969 | static struct pci_device_id agp_intel_pci_table[] = { |
| 970 | #define ID(x) \ |
| 971 | { \ |
| 972 | .class = (PCI_CLASS_BRIDGE_HOST << 8), \ |
| 973 | .class_mask = ~0, \ |
| 974 | .vendor = PCI_VENDOR_ID_INTEL, \ |
| 975 | .device = x, \ |
| 976 | .subvendor = PCI_ANY_ID, \ |
| 977 | .subdevice = PCI_ANY_ID, \ |
| 978 | } |
| 979 | ID(PCI_DEVICE_ID_INTEL_82443LX_0), |
| 980 | ID(PCI_DEVICE_ID_INTEL_82443BX_0), |
| 981 | ID(PCI_DEVICE_ID_INTEL_82443GX_0), |
| 982 | ID(PCI_DEVICE_ID_INTEL_82810_MC1), |
| 983 | ID(PCI_DEVICE_ID_INTEL_82810_MC3), |
| 984 | ID(PCI_DEVICE_ID_INTEL_82810E_MC), |
| 985 | ID(PCI_DEVICE_ID_INTEL_82815_MC), |
| 986 | ID(PCI_DEVICE_ID_INTEL_82820_HB), |
| 987 | ID(PCI_DEVICE_ID_INTEL_82820_UP_HB), |
| 988 | ID(PCI_DEVICE_ID_INTEL_82830_HB), |
| 989 | ID(PCI_DEVICE_ID_INTEL_82840_HB), |
| 990 | ID(PCI_DEVICE_ID_INTEL_82845_HB), |
| 991 | ID(PCI_DEVICE_ID_INTEL_82845G_HB), |
| 992 | ID(PCI_DEVICE_ID_INTEL_82850_HB), |
Stefan Husemann | 347486b | 2009-04-13 14:40:10 -0700 | [diff] [blame] | 993 | ID(PCI_DEVICE_ID_INTEL_82854_HB), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 994 | ID(PCI_DEVICE_ID_INTEL_82855PM_HB), |
| 995 | ID(PCI_DEVICE_ID_INTEL_82855GM_HB), |
| 996 | ID(PCI_DEVICE_ID_INTEL_82860_HB), |
| 997 | ID(PCI_DEVICE_ID_INTEL_82865_HB), |
| 998 | ID(PCI_DEVICE_ID_INTEL_82875_HB), |
| 999 | ID(PCI_DEVICE_ID_INTEL_7505_0), |
| 1000 | ID(PCI_DEVICE_ID_INTEL_7205_0), |
Carlos MartÃn | e914a36 | 2008-01-24 10:34:09 +1000 | [diff] [blame] | 1001 | ID(PCI_DEVICE_ID_INTEL_E7221_HB), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1002 | ID(PCI_DEVICE_ID_INTEL_82915G_HB), |
| 1003 | ID(PCI_DEVICE_ID_INTEL_82915GM_HB), |
Alan Hourihane | d0de98f | 2005-05-31 19:50:49 +0100 | [diff] [blame] | 1004 | ID(PCI_DEVICE_ID_INTEL_82945G_HB), |
Alan Hourihane | 3b0e8ea | 2006-01-19 14:08:40 +0000 | [diff] [blame] | 1005 | ID(PCI_DEVICE_ID_INTEL_82945GM_HB), |
Zhenyu Wang | dde4787 | 2007-07-26 09:18:09 +0800 | [diff] [blame] | 1006 | ID(PCI_DEVICE_ID_INTEL_82945GME_HB), |
Adam Jackson | 107f517 | 2009-12-03 17:14:41 -0500 | [diff] [blame] | 1007 | ID(PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB), |
| 1008 | ID(PCI_DEVICE_ID_INTEL_PINEVIEW_HB), |
Eric Anholt | 65c25aa | 2006-09-06 11:57:18 -0400 | [diff] [blame] | 1009 | ID(PCI_DEVICE_ID_INTEL_82946GZ_HB), |
Zhenyu Wang | 9119f85 | 2008-01-23 15:49:26 +1000 | [diff] [blame] | 1010 | ID(PCI_DEVICE_ID_INTEL_82G35_HB), |
Eric Anholt | 65c25aa | 2006-09-06 11:57:18 -0400 | [diff] [blame] | 1011 | ID(PCI_DEVICE_ID_INTEL_82965Q_HB), |
| 1012 | ID(PCI_DEVICE_ID_INTEL_82965G_HB), |
Wang Zhenyu | 4598af3 | 2007-04-09 08:51:36 +0800 | [diff] [blame] | 1013 | ID(PCI_DEVICE_ID_INTEL_82965GM_HB), |
Zhenyu Wang | dde4787 | 2007-07-26 09:18:09 +0800 | [diff] [blame] | 1014 | ID(PCI_DEVICE_ID_INTEL_82965GME_HB), |
Wang Zhenyu | 874808c6 | 2007-06-06 11:16:25 +0800 | [diff] [blame] | 1015 | ID(PCI_DEVICE_ID_INTEL_G33_HB), |
| 1016 | ID(PCI_DEVICE_ID_INTEL_Q35_HB), |
| 1017 | ID(PCI_DEVICE_ID_INTEL_Q33_HB), |
Zhenyu Wang | 99d32bd | 2008-07-30 12:26:50 -0700 | [diff] [blame] | 1018 | ID(PCI_DEVICE_ID_INTEL_GM45_HB), |
Adam Jackson | 107f517 | 2009-12-03 17:14:41 -0500 | [diff] [blame] | 1019 | ID(PCI_DEVICE_ID_INTEL_EAGLELAKE_HB), |
Zhenyu Wang | 25ce77a | 2008-06-19 14:17:58 +1000 | [diff] [blame] | 1020 | ID(PCI_DEVICE_ID_INTEL_Q45_HB), |
| 1021 | ID(PCI_DEVICE_ID_INTEL_G45_HB), |
Zhenyu Wang | a50ccc6 | 2008-11-17 14:39:00 +0800 | [diff] [blame] | 1022 | ID(PCI_DEVICE_ID_INTEL_G41_HB), |
Fabian Henze | 38d8a95 | 2009-09-08 00:59:58 +0800 | [diff] [blame] | 1023 | ID(PCI_DEVICE_ID_INTEL_B43_HB), |
Adam Jackson | 107f517 | 2009-12-03 17:14:41 -0500 | [diff] [blame] | 1024 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB), |
| 1025 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB), |
| 1026 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB), |
Dave Airlie | 3ff9916 | 2009-12-08 14:03:47 +1000 | [diff] [blame] | 1027 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB), |
Eric Anholt | 1089e30 | 2009-10-22 16:10:52 -0700 | [diff] [blame] | 1028 | ID(PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB), |
Eric Anholt | 954bce5 | 2010-01-07 16:21:46 -0800 | [diff] [blame] | 1029 | ID(PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1030 | { } |
| 1031 | }; |
| 1032 | |
| 1033 | MODULE_DEVICE_TABLE(pci, agp_intel_pci_table); |
| 1034 | |
| 1035 | static struct pci_driver agp_intel_pci_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1036 | .name = "agpgart-intel", |
| 1037 | .id_table = agp_intel_pci_table, |
| 1038 | .probe = agp_intel_probe, |
| 1039 | .remove = __devexit_p(agp_intel_remove), |
Alexey Dobriyan | 85be7d6 | 2006-08-12 02:02:02 +0400 | [diff] [blame] | 1040 | #ifdef CONFIG_PM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1041 | .resume = agp_intel_resume, |
Alexey Dobriyan | 85be7d6 | 2006-08-12 02:02:02 +0400 | [diff] [blame] | 1042 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1043 | }; |
| 1044 | |
| 1045 | static int __init agp_intel_init(void) |
| 1046 | { |
| 1047 | if (agp_off) |
| 1048 | return -EINVAL; |
| 1049 | return pci_register_driver(&agp_intel_pci_driver); |
| 1050 | } |
| 1051 | |
| 1052 | static void __exit agp_intel_cleanup(void) |
| 1053 | { |
| 1054 | pci_unregister_driver(&agp_intel_pci_driver); |
| 1055 | } |
| 1056 | |
| 1057 | module_init(agp_intel_init); |
| 1058 | module_exit(agp_intel_cleanup); |
| 1059 | |
Dave Jones | f4432c5 | 2008-10-20 13:31:45 -0400 | [diff] [blame] | 1060 | MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1061 | MODULE_LICENSE("GPL and additional rights"); |