diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:16:36 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:16:36 -0400 |
commit | fb9aa6f1d4a1e11e66a680460b2c2b2b10b62f79 (patch) | |
tree | e0ad51f39b48a342244cef62099bd1a8a93927db /arch/x86/pci/legacy.c | |
parent | 4b60eb8380a0b588a03b6052d7ac93e1964c75b8 (diff) |
i386: move pci
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/pci/legacy.c')
-rw-r--r-- | arch/x86/pci/legacy.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c new file mode 100644 index 00000000000..5565d7016b7 --- /dev/null +++ b/arch/x86/pci/legacy.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * legacy.c - traditional, old school PCI bus probing | ||
3 | */ | ||
4 | #include <linux/init.h> | ||
5 | #include <linux/pci.h> | ||
6 | #include "pci.h" | ||
7 | |||
8 | /* | ||
9 | * Discover remaining PCI buses in case there are peer host bridges. | ||
10 | * We use the number of last PCI bus provided by the PCI BIOS. | ||
11 | */ | ||
12 | static void __devinit pcibios_fixup_peer_bridges(void) | ||
13 | { | ||
14 | int n, devfn; | ||
15 | |||
16 | if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff) | ||
17 | return; | ||
18 | DBG("PCI: Peer bridge fixup\n"); | ||
19 | |||
20 | for (n=0; n <= pcibios_last_bus; n++) { | ||
21 | u32 l; | ||
22 | if (pci_find_bus(0, n)) | ||
23 | continue; | ||
24 | for (devfn = 0; devfn < 256; devfn += 8) { | ||
25 | if (!raw_pci_ops->read(0, n, devfn, PCI_VENDOR_ID, 2, &l) && | ||
26 | l != 0x0000 && l != 0xffff) { | ||
27 | DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); | ||
28 | printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); | ||
29 | pci_scan_bus_with_sysdata(n); | ||
30 | break; | ||
31 | } | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | |||
36 | static int __init pci_legacy_init(void) | ||
37 | { | ||
38 | if (!raw_pci_ops) { | ||
39 | printk("PCI: System does not support PCI\n"); | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | if (pcibios_scanned++) | ||
44 | return 0; | ||
45 | |||
46 | printk("PCI: Probing PCI hardware\n"); | ||
47 | pci_root_bus = pcibios_scan_root(0); | ||
48 | if (pci_root_bus) | ||
49 | pci_bus_add_devices(pci_root_bus); | ||
50 | |||
51 | pcibios_fixup_peer_bridges(); | ||
52 | |||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | subsys_initcall(pci_legacy_init); | ||