blob: 087ecc67e9b358e265e79ee450995e1ed73b6c46 [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>
10
Len Brown4be44fc2005-08-05 00:44:28 -040011static int __init check_bridge(int vendor, int device)
Linus Torvalds1da177e2005-04-16 15:20:36 -070012{
13 /* According to Nvidia all timer overrides are bogus. Just ignore
14 them all. */
Len Brown4be44fc2005-08-05 00:44:28 -040015 if (vendor == PCI_VENDOR_ID_NVIDIA) {
16 acpi_skip_timer_override = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 }
Chuck Ebbert66759a02005-09-12 18:49:25 +020018 /*
19 * ATI IXP chipsets get double timer interrupts.
20 * For now just do this for all ATI chipsets.
21 * FIXME: this needs to be checked for the non ACPI case too.
22 */
23 if (vendor == PCI_VENDOR_ID_ATI)
24 disable_timer_pin_1 = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 return 0;
26}
Len Brown4be44fc2005-08-05 00:44:28 -040027
28void __init check_acpi_pci(void)
29{
30 int num, slot, func;
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
32 /* Assume the machine supports type 1. If not it will
33 always read ffffffff and should not have any side effect. */
34
35 /* Poor man's PCI discovery */
Len Brown4be44fc2005-08-05 00:44:28 -040036 for (num = 0; num < 32; num++) {
37 for (slot = 0; slot < 32; slot++) {
38 for (func = 0; func < 8; func++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 u32 class;
40 u32 vendor;
Len Brown4be44fc2005-08-05 00:44:28 -040041 class = read_pci_config(num, slot, func,
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 PCI_CLASS_REVISION);
43 if (class == 0xffffffff)
Len Brown4be44fc2005-08-05 00:44:28 -040044 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
46 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
Len Brown4be44fc2005-08-05 00:44:28 -040047 continue;
48
49 vendor = read_pci_config(num, slot, func,
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 PCI_VENDOR_ID);
Len Brown4be44fc2005-08-05 00:44:28 -040051
52 if (check_bridge(vendor & 0xffff, vendor >> 16))
53 return;
54 }
55
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 }
57 }
58}