diff options
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r-- | drivers/pci/quirks.c | 101 |
1 files changed, 88 insertions, 13 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index a6a630a950d..7992bc8cc6a 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -241,7 +241,8 @@ static void __devinit quirk_s3_64M(struct pci_dev *dev) | |||
241 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_868, quirk_s3_64M ); | 241 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_868, quirk_s3_64M ); |
242 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_968, quirk_s3_64M ); | 242 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_968, quirk_s3_64M ); |
243 | 243 | ||
244 | static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region, unsigned size, int nr) | 244 | static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region, |
245 | unsigned size, int nr, const char *name) | ||
245 | { | 246 | { |
246 | region &= ~(size-1); | 247 | region &= ~(size-1); |
247 | if (region) { | 248 | if (region) { |
@@ -259,6 +260,7 @@ static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region, unsi | |||
259 | pcibios_bus_to_resource(dev, res, &bus_region); | 260 | pcibios_bus_to_resource(dev, res, &bus_region); |
260 | 261 | ||
261 | pci_claim_resource(dev, nr); | 262 | pci_claim_resource(dev, nr); |
263 | printk("PCI quirk: region %04x-%04x claimed by %s\n", region, region + size - 1, name); | ||
262 | } | 264 | } |
263 | } | 265 | } |
264 | 266 | ||
@@ -291,25 +293,98 @@ static void __devinit quirk_ali7101_acpi(struct pci_dev *dev) | |||
291 | u16 region; | 293 | u16 region; |
292 | 294 | ||
293 | pci_read_config_word(dev, 0xE0, ®ion); | 295 | pci_read_config_word(dev, 0xE0, ®ion); |
294 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES); | 296 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI"); |
295 | pci_read_config_word(dev, 0xE2, ®ion); | 297 | pci_read_config_word(dev, 0xE2, ®ion); |
296 | quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1); | 298 | quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB"); |
297 | } | 299 | } |
298 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101_acpi ); | 300 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101_acpi ); |
299 | 301 | ||
302 | static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable) | ||
303 | { | ||
304 | u32 devres; | ||
305 | u32 mask, size, base; | ||
306 | |||
307 | pci_read_config_dword(dev, port, &devres); | ||
308 | if ((devres & enable) != enable) | ||
309 | return; | ||
310 | mask = (devres >> 16) & 15; | ||
311 | base = devres & 0xffff; | ||
312 | size = 16; | ||
313 | for (;;) { | ||
314 | unsigned bit = size >> 1; | ||
315 | if ((bit & mask) == bit) | ||
316 | break; | ||
317 | size = bit; | ||
318 | } | ||
319 | /* | ||
320 | * For now we only print it out. Eventually we'll want to | ||
321 | * reserve it (at least if it's in the 0x1000+ range), but | ||
322 | * let's get enough confirmation reports first. | ||
323 | */ | ||
324 | base &= -size; | ||
325 | printk("%s PIO at %04x-%04x\n", name, base, base + size - 1); | ||
326 | } | ||
327 | |||
328 | static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable) | ||
329 | { | ||
330 | u32 devres; | ||
331 | u32 mask, size, base; | ||
332 | |||
333 | pci_read_config_dword(dev, port, &devres); | ||
334 | if ((devres & enable) != enable) | ||
335 | return; | ||
336 | base = devres & 0xffff0000; | ||
337 | mask = (devres & 0x3f) << 16; | ||
338 | size = 128 << 16; | ||
339 | for (;;) { | ||
340 | unsigned bit = size >> 1; | ||
341 | if ((bit & mask) == bit) | ||
342 | break; | ||
343 | size = bit; | ||
344 | } | ||
345 | /* | ||
346 | * For now we only print it out. Eventually we'll want to | ||
347 | * reserve it, but let's get enough confirmation reports first. | ||
348 | */ | ||
349 | base &= -size; | ||
350 | printk("%s MMIO at %04x-%04x\n", name, base, base + size - 1); | ||
351 | } | ||
352 | |||
300 | /* | 353 | /* |
301 | * PIIX4 ACPI: Two IO regions pointed to by longwords at | 354 | * PIIX4 ACPI: Two IO regions pointed to by longwords at |
302 | * 0x40 (64 bytes of ACPI registers) | 355 | * 0x40 (64 bytes of ACPI registers) |
303 | * 0x90 (32 bytes of SMB registers) | 356 | * 0x90 (32 bytes of SMB registers) |
357 | * and a few strange programmable PIIX4 device resources. | ||
304 | */ | 358 | */ |
305 | static void __devinit quirk_piix4_acpi(struct pci_dev *dev) | 359 | static void __devinit quirk_piix4_acpi(struct pci_dev *dev) |
306 | { | 360 | { |
307 | u32 region; | 361 | u32 region, res_a; |
308 | 362 | ||
309 | pci_read_config_dword(dev, 0x40, ®ion); | 363 | pci_read_config_dword(dev, 0x40, ®ion); |
310 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES); | 364 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "PIIX4 ACPI"); |
311 | pci_read_config_dword(dev, 0x90, ®ion); | 365 | pci_read_config_dword(dev, 0x90, ®ion); |
312 | quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1); | 366 | quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1, "PIIX4 SMB"); |
367 | |||
368 | /* Device resource A has enables for some of the other ones */ | ||
369 | pci_read_config_dword(dev, 0x5c, &res_a); | ||
370 | |||
371 | piix4_io_quirk(dev, "PIIX4 devres B", 0x60, 3 << 21); | ||
372 | piix4_io_quirk(dev, "PIIX4 devres C", 0x64, 3 << 21); | ||
373 | |||
374 | /* Device resource D is just bitfields for static resources */ | ||
375 | |||
376 | /* Device 12 enabled? */ | ||
377 | if (res_a & (1 << 29)) { | ||
378 | piix4_io_quirk(dev, "PIIX4 devres E", 0x68, 1 << 20); | ||
379 | piix4_mem_quirk(dev, "PIIX4 devres F", 0x6c, 1 << 7); | ||
380 | } | ||
381 | /* Device 13 enabled? */ | ||
382 | if (res_a & (1 << 30)) { | ||
383 | piix4_io_quirk(dev, "PIIX4 devres G", 0x70, 1 << 20); | ||
384 | piix4_mem_quirk(dev, "PIIX4 devres H", 0x74, 1 << 7); | ||
385 | } | ||
386 | piix4_io_quirk(dev, "PIIX4 devres I", 0x78, 1 << 20); | ||
387 | piix4_io_quirk(dev, "PIIX4 devres J", 0x7c, 1 << 20); | ||
313 | } | 388 | } |
314 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi ); | 389 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi ); |
315 | 390 | ||
@@ -323,10 +398,10 @@ static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev) | |||
323 | u32 region; | 398 | u32 region; |
324 | 399 | ||
325 | pci_read_config_dword(dev, 0x40, ®ion); | 400 | pci_read_config_dword(dev, 0x40, ®ion); |
326 | quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES); | 401 | quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH4 ACPI/GPIO/TCO"); |
327 | 402 | ||
328 | pci_read_config_dword(dev, 0x58, ®ion); | 403 | pci_read_config_dword(dev, 0x58, ®ion); |
329 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1); | 404 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH4 GPIO"); |
330 | } | 405 | } |
331 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi ); | 406 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi ); |
332 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi ); | 407 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi ); |
@@ -352,7 +427,7 @@ static void __devinit quirk_vt82c586_acpi(struct pci_dev *dev) | |||
352 | if (rev & 0x10) { | 427 | if (rev & 0x10) { |
353 | pci_read_config_dword(dev, 0x48, ®ion); | 428 | pci_read_config_dword(dev, 0x48, ®ion); |
354 | region &= PCI_BASE_ADDRESS_IO_MASK; | 429 | region &= PCI_BASE_ADDRESS_IO_MASK; |
355 | quirk_io_region(dev, region, 256, PCI_BRIDGE_RESOURCES); | 430 | quirk_io_region(dev, region, 256, PCI_BRIDGE_RESOURCES, "vt82c586 ACPI"); |
356 | } | 431 | } |
357 | } | 432 | } |
358 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_vt82c586_acpi ); | 433 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_vt82c586_acpi ); |
@@ -372,11 +447,11 @@ static void __devinit quirk_vt82c686_acpi(struct pci_dev *dev) | |||
372 | 447 | ||
373 | pci_read_config_word(dev, 0x70, &hm); | 448 | pci_read_config_word(dev, 0x70, &hm); |
374 | hm &= PCI_BASE_ADDRESS_IO_MASK; | 449 | hm &= PCI_BASE_ADDRESS_IO_MASK; |
375 | quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1); | 450 | quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1, "vt82c868 HW-mon"); |
376 | 451 | ||
377 | pci_read_config_dword(dev, 0x90, &smb); | 452 | pci_read_config_dword(dev, 0x90, &smb); |
378 | smb &= PCI_BASE_ADDRESS_IO_MASK; | 453 | smb &= PCI_BASE_ADDRESS_IO_MASK; |
379 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2); | 454 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2, "vt82c868 SMB"); |
380 | } | 455 | } |
381 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); | 456 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); |
382 | 457 | ||
@@ -391,11 +466,11 @@ static void __devinit quirk_vt8235_acpi(struct pci_dev *dev) | |||
391 | 466 | ||
392 | pci_read_config_word(dev, 0x88, &pm); | 467 | pci_read_config_word(dev, 0x88, &pm); |
393 | pm &= PCI_BASE_ADDRESS_IO_MASK; | 468 | pm &= PCI_BASE_ADDRESS_IO_MASK; |
394 | quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES); | 469 | quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES, "vt8235 PM"); |
395 | 470 | ||
396 | pci_read_config_word(dev, 0xd0, &smb); | 471 | pci_read_config_word(dev, 0xd0, &smb); |
397 | smb &= PCI_BASE_ADDRESS_IO_MASK; | 472 | smb &= PCI_BASE_ADDRESS_IO_MASK; |
398 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1); | 473 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1, "vt8235 SMB"); |
399 | } | 474 | } |
400 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); | 475 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); |
401 | 476 | ||