blob: 2e3b643a4dc4df57552562015349c7657ca5b5d6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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>
Andi Kleenf9262c12006-03-08 17:57:25 -080010#include <asm/apic.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Len Brown4be44fc2005-08-05 00:44:28 -040012static int __init check_bridge(int vendor, int device)
Linus Torvalds1da177e2005-04-16 15:20:36 -070013{
Andi Kleenf9262c12006-03-08 17:57:25 -080014#ifdef CONFIG_ACPI
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 /* According to Nvidia all timer overrides are bogus. Just ignore
16 them all. */
Len Brown4be44fc2005-08-05 00:44:28 -040017 if (vendor == PCI_VENDOR_ID_NVIDIA) {
18 acpi_skip_timer_override = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 }
Andi Kleenf9262c12006-03-08 17:57:25 -080020#endif
21 if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) {
22 timer_over_8254 = 0;
23 printk(KERN_INFO "ATI board detected. Disabling timer routing "
24 "over 8254.\n");
25 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 return 0;
27}
Len Brown4be44fc2005-08-05 00:44:28 -040028
29void __init check_acpi_pci(void)
30{
31 int num, slot, func;
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
33 /* Assume the machine supports type 1. If not it will
34 always read ffffffff and should not have any side effect. */
35
36 /* Poor man's PCI discovery */
Len Brown4be44fc2005-08-05 00:44:28 -040037 for (num = 0; num < 32; num++) {
38 for (slot = 0; slot < 32; slot++) {
39 for (func = 0; func < 8; func++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 u32 class;
41 u32 vendor;
Len Brown4be44fc2005-08-05 00:44:28 -040042 class = read_pci_config(num, slot, func,
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 PCI_CLASS_REVISION);
44 if (class == 0xffffffff)
Len Brown4be44fc2005-08-05 00:44:28 -040045 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
Len Brown4be44fc2005-08-05 00:44:28 -040048 continue;
49
50 vendor = read_pci_config(num, slot, func,
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 PCI_VENDOR_ID);
Len Brown4be44fc2005-08-05 00:44:28 -040052
53 if (check_bridge(vendor & 0xffff, vendor >> 16))
54 return;
55 }
56
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 }
58 }
59}