mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-24 18:38:38 +00:00
73c59afc65
This patch finishes the i386 and x86-64 ->sysdata conversion and hopefully also fixes Riku's and Andy's observed bugs. It is based on Yinghai Lu's and Andy Whitcroft's patches (thanks!) with some changes: - introduce pci_scan_bus_with_sysdata() and use it instead of pci_scan_bus() where appropriate. pci_scan_bus_with_sysdata() will allocate the sysdata structure and then call pci_scan_bus(). - always allocate pci_sysdata dynamically. The whole point of this sysdata work is to make it easy to do root-bus specific things (e.g., support PCI domains and IOMMU's). I dislike using a default struct pci_sysdata in some places and a dynamically allocated pci_sysdata elsewhere - the potential for someone indavertantly changing the default structure is too high. - this patch only makes the minimal changes necessary, i.e., the NUMA node is always initialized to -1. Patches to do the right thing with regards to the NUMA node can build on top of this (either add a 'node' parameter to pci_scan_bus_with_sysdata() or just update the node when it becomes known). The patch was compile tested with various configurations (e.g., NUMAQ, VISWS) and run-time tested on i386 and x86-64. Unfortunately none of my machines exhibited the bugs so caveat emptor. Andy, could you please see if this fixes the NUMA issues you've seen? Riku, does this fix "pci=noacpi" on your laptop? Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com> Cc: Yinghai Lu <yhlu.kernel@gmail.com> Cc: Andi Kleen <ak@suse.de> Cc: Chuck Ebbert <cebbert@redhat.com> Cc: <riku.seppala@kymp.net> Cc: Andy Whitcroft <apw@shadowen.org> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
57 lines
1.2 KiB
C
57 lines
1.2 KiB
C
/*
|
|
* legacy.c - traditional, old school PCI bus probing
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/pci.h>
|
|
#include "pci.h"
|
|
|
|
/*
|
|
* Discover remaining PCI buses in case there are peer host bridges.
|
|
* We use the number of last PCI bus provided by the PCI BIOS.
|
|
*/
|
|
static void __devinit pcibios_fixup_peer_bridges(void)
|
|
{
|
|
int n, devfn;
|
|
|
|
if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff)
|
|
return;
|
|
DBG("PCI: Peer bridge fixup\n");
|
|
|
|
for (n=0; n <= pcibios_last_bus; n++) {
|
|
u32 l;
|
|
if (pci_find_bus(0, n))
|
|
continue;
|
|
for (devfn = 0; devfn < 256; devfn += 8) {
|
|
if (!raw_pci_ops->read(0, n, devfn, PCI_VENDOR_ID, 2, &l) &&
|
|
l != 0x0000 && l != 0xffff) {
|
|
DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l);
|
|
printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n);
|
|
pci_scan_bus_with_sysdata(n);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static int __init pci_legacy_init(void)
|
|
{
|
|
if (!raw_pci_ops) {
|
|
printk("PCI: System does not support PCI\n");
|
|
return 0;
|
|
}
|
|
|
|
if (pcibios_scanned++)
|
|
return 0;
|
|
|
|
printk("PCI: Probing PCI hardware\n");
|
|
pci_root_bus = pcibios_scan_root(0);
|
|
if (pci_root_bus)
|
|
pci_bus_add_devices(pci_root_bus);
|
|
|
|
pcibios_fixup_peer_bridges();
|
|
|
|
return 0;
|
|
}
|
|
|
|
subsys_initcall(pci_legacy_init);
|