Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Do early PCI probing for bug detection when the main PCI subsystem is |
| 3 | * not up yet. |
| 4 | */ |
| 5 | #include <linux/init.h> |
| 6 | #include <linux/kernel.h> |
| 7 | #include <linux/pci.h> |
| 8 | #include <asm/pci-direct.h> |
| 9 | #include <asm/acpi.h> |
Linus Torvalds | a217e8c | 2005-09-12 12:32:31 -0700 | [diff] [blame] | 10 | #include <asm/apic.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 12 | static int __init check_bridge(int vendor, int device) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | { |
| 14 | /* According to Nvidia all timer overrides are bogus. Just ignore |
| 15 | them all. */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 16 | if (vendor == PCI_VENDOR_ID_NVIDIA) { |
| 17 | acpi_skip_timer_override = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | } |
Linus Torvalds | a217e8c | 2005-09-12 12:32:31 -0700 | [diff] [blame] | 19 | #ifdef CONFIG_X86_LOCAL_APIC |
Chuck Ebbert | 66759a0 | 2005-09-12 18:49:25 +0200 | [diff] [blame] | 20 | /* |
| 21 | * ATI IXP chipsets get double timer interrupts. |
| 22 | * For now just do this for all ATI chipsets. |
| 23 | * FIXME: this needs to be checked for the non ACPI case too. |
| 24 | */ |
| 25 | if (vendor == PCI_VENDOR_ID_ATI) |
| 26 | disable_timer_pin_1 = 1; |
Linus Torvalds | a217e8c | 2005-09-12 12:32:31 -0700 | [diff] [blame] | 27 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | return 0; |
| 29 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 30 | |
| 31 | void __init check_acpi_pci(void) |
| 32 | { |
| 33 | int num, slot, func; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
| 35 | /* Assume the machine supports type 1. If not it will |
| 36 | always read ffffffff and should not have any side effect. */ |
| 37 | |
| 38 | /* Poor man's PCI discovery */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 39 | for (num = 0; num < 32; num++) { |
| 40 | for (slot = 0; slot < 32; slot++) { |
| 41 | for (func = 0; func < 8; func++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | u32 class; |
| 43 | u32 vendor; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 44 | class = read_pci_config(num, slot, func, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | PCI_CLASS_REVISION); |
| 46 | if (class == 0xffffffff) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 47 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
| 49 | if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 50 | continue; |
| 51 | |
| 52 | vendor = read_pci_config(num, slot, func, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | PCI_VENDOR_ID); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 54 | |
| 55 | if (check_bridge(vendor & 0xffff, vendor >> 16)) |
| 56 | return; |
| 57 | } |
| 58 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | } |
| 60 | } |
| 61 | } |