Commit | Line | Data |
---|---|---|
1da177e4 LT |
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> | |
d44647b0 AC |
8 | #include <linux/acpi.h> |
9 | ||
1da177e4 LT |
10 | #include <asm/pci-direct.h> |
11 | #include <asm/acpi.h> | |
f9262c12 | 12 | #include <asm/apic.h> |
b0d0a4ba | 13 | #include <asm/irq.h> |
1da177e4 | 14 | |
d44647b0 AC |
15 | #ifdef CONFIG_ACPI |
16 | ||
ceb6c468 | 17 | static int __init nvidia_hpet_check(struct acpi_table_header *header) |
d44647b0 | 18 | { |
d44647b0 AC |
19 | return 0; |
20 | } | |
21 | #endif | |
22 | ||
4be44fcd | 23 | static int __init check_bridge(int vendor, int device) |
1da177e4 | 24 | { |
f9262c12 | 25 | #ifdef CONFIG_ACPI |
d44647b0 AC |
26 | /* According to Nvidia all timer overrides are bogus unless HPET |
27 | is enabled. */ | |
fa18f477 | 28 | if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) { |
fe699336 | 29 | if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check) { |
d44647b0 | 30 | acpi_skip_timer_override = 1; |
fa18f477 AK |
31 | printk(KERN_INFO "Nvidia board " |
32 | "detected. Ignoring ACPI " | |
33 | "timer override.\n"); | |
34 | printk(KERN_INFO "If you got timer trouble " | |
35 | "try acpi_use_timer_override\n"); | |
36 | ||
d44647b0 | 37 | } |
1da177e4 | 38 | } |
f9262c12 AK |
39 | #endif |
40 | if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) { | |
41 | timer_over_8254 = 0; | |
42 | printk(KERN_INFO "ATI board detected. Disabling timer routing " | |
43 | "over 8254.\n"); | |
44 | } | |
1da177e4 LT |
45 | return 0; |
46 | } | |
4be44fcd | 47 | |
b0d0a4ba SS |
48 | static void check_intel(void) |
49 | { | |
50 | u16 vendor, device; | |
51 | ||
52 | vendor = read_pci_config_16(0, 0, 0, PCI_VENDOR_ID); | |
53 | ||
54 | if (vendor != PCI_VENDOR_ID_INTEL) | |
55 | return; | |
56 | ||
57 | device = read_pci_config_16(0, 0, 0, PCI_DEVICE_ID); | |
58 | #ifdef CONFIG_SMP | |
59 | if (device == PCI_DEVICE_ID_INTEL_E7320_MCH || | |
60 | device == PCI_DEVICE_ID_INTEL_E7520_MCH || | |
61 | device == PCI_DEVICE_ID_INTEL_E7525_MCH) | |
62 | quirk_intel_irqbalance(); | |
63 | #endif | |
64 | } | |
65 | ||
4be44fcd LB |
66 | void __init check_acpi_pci(void) |
67 | { | |
68 | int num, slot, func; | |
1da177e4 LT |
69 | |
70 | /* Assume the machine supports type 1. If not it will | |
0637a70a AK |
71 | always read ffffffff and should not have any side effect. |
72 | Actually a few buggy systems can machine check. Allow the user | |
73 | to disable it by command line option at least -AK */ | |
74 | if (!early_pci_allowed()) | |
75 | return; | |
1da177e4 | 76 | |
b0d0a4ba SS |
77 | check_intel(); |
78 | ||
1da177e4 | 79 | /* Poor man's PCI discovery */ |
4be44fcd LB |
80 | for (num = 0; num < 32; num++) { |
81 | for (slot = 0; slot < 32; slot++) { | |
82 | for (func = 0; func < 8; func++) { | |
1da177e4 LT |
83 | u32 class; |
84 | u32 vendor; | |
4be44fcd | 85 | class = read_pci_config(num, slot, func, |
1da177e4 LT |
86 | PCI_CLASS_REVISION); |
87 | if (class == 0xffffffff) | |
4be44fcd | 88 | break; |
1da177e4 LT |
89 | |
90 | if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) | |
4be44fcd LB |
91 | continue; |
92 | ||
93 | vendor = read_pci_config(num, slot, func, | |
1da177e4 | 94 | PCI_VENDOR_ID); |
4be44fcd LB |
95 | |
96 | if (check_bridge(vendor & 0xffff, vendor >> 16)) | |
97 | return; | |
98 | } | |
99 | ||
1da177e4 LT |
100 | } |
101 | } | |
102 | } |