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> |
1da177e4 | 13 | |
d44647b0 AC |
14 | #ifdef CONFIG_ACPI |
15 | ||
16 | static int nvidia_hpet_detected __initdata; | |
17 | ||
18 | static int __init nvidia_hpet_check(unsigned long phys, unsigned long size) | |
19 | { | |
20 | nvidia_hpet_detected = 1; | |
21 | return 0; | |
22 | } | |
23 | #endif | |
24 | ||
4be44fcd | 25 | static int __init check_bridge(int vendor, int device) |
1da177e4 | 26 | { |
f9262c12 | 27 | #ifdef CONFIG_ACPI |
d44647b0 AC |
28 | /* According to Nvidia all timer overrides are bogus unless HPET |
29 | is enabled. */ | |
4be44fcd | 30 | if (vendor == PCI_VENDOR_ID_NVIDIA) { |
d44647b0 AC |
31 | nvidia_hpet_detected = 0; |
32 | acpi_table_parse(ACPI_HPET, nvidia_hpet_check); | |
33 | if (nvidia_hpet_detected == 0) { | |
34 | acpi_skip_timer_override = 1; | |
35 | } | |
1da177e4 | 36 | } |
f9262c12 AK |
37 | #endif |
38 | if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) { | |
39 | timer_over_8254 = 0; | |
40 | printk(KERN_INFO "ATI board detected. Disabling timer routing " | |
41 | "over 8254.\n"); | |
42 | } | |
1da177e4 LT |
43 | return 0; |
44 | } | |
4be44fcd LB |
45 | |
46 | void __init check_acpi_pci(void) | |
47 | { | |
48 | int num, slot, func; | |
1da177e4 LT |
49 | |
50 | /* Assume the machine supports type 1. If not it will | |
51 | always read ffffffff and should not have any side effect. */ | |
52 | ||
53 | /* Poor man's PCI discovery */ | |
4be44fcd LB |
54 | for (num = 0; num < 32; num++) { |
55 | for (slot = 0; slot < 32; slot++) { | |
56 | for (func = 0; func < 8; func++) { | |
1da177e4 LT |
57 | u32 class; |
58 | u32 vendor; | |
4be44fcd | 59 | class = read_pci_config(num, slot, func, |
1da177e4 LT |
60 | PCI_CLASS_REVISION); |
61 | if (class == 0xffffffff) | |
4be44fcd | 62 | break; |
1da177e4 LT |
63 | |
64 | if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) | |
4be44fcd LB |
65 | continue; |
66 | ||
67 | vendor = read_pci_config(num, slot, func, | |
1da177e4 | 68 | PCI_VENDOR_ID); |
4be44fcd LB |
69 | |
70 | if (check_bridge(vendor & 0xffff, vendor >> 16)) | |
71 | return; | |
72 | } | |
73 | ||
1da177e4 LT |
74 | } |
75 | } | |
76 | } |