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>
10 
11 #ifdef CONFIG_ACPI_BOOT
check_bridge(int vendor,int device)12 static int __init check_bridge(int vendor, int device)
13 {
14 	/* According to Nvidia all timer overrides are bogus. Just ignore
15 	   them all. */
16 	if (vendor == PCI_VENDOR_ID_NVIDIA) {
17 		acpi_skip_timer_override = 1;
18 	}
19 	return 0;
20 }
21 
check_acpi_pci(void)22 void __init check_acpi_pci(void)
23 {
24 	int num,slot,func;
25 
26 	/* Assume the machine supports type 1. If not it will
27 	   always read ffffffff and should not have any side effect. */
28 
29 	/* Poor man's PCI discovery */
30 	for (num = 0; num < 32; num++) {
31 		for (slot = 0; slot < 32; slot++) {
32 			for (func = 0; func < 8; func++) {
33 				u32 class;
34 				u32 vendor;
35 				class = read_pci_config(num,slot,func,
36 							PCI_CLASS_REVISION);
37 				if (class == 0xffffffff)
38 					break;
39 
40 				if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
41 					continue;
42 
43 				vendor = read_pci_config(num, slot, func,
44 							 PCI_VENDOR_ID);
45 
46 				if (check_bridge(vendor&0xffff, vendor >> 16))
47 					return;
48 			}
49 
50 		}
51 	}
52 }
53 #endif /* CONFIG_ACPI */
54