aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-01 18:14:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-01 18:14:04 -0400
commit4b1779c2cf030c68aefe939d946475e4136c1895 (patch)
tree27e4bda2f6c8d269d02dec52a62dd1443880c6dc /arch
parent62ff577fa2fec87edbf26f53e87210ba726d4d44 (diff)
parent30723cbf6f7aec2ab4810bdc4bf12c5749a09e33 (diff)
Merge tag 'pci-v3.15-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI changes from Bjorn Helgaas: "Enumeration - Increment max correctly in pci_scan_bridge() (Andreas Noever) - Clarify the "scan anyway" comment in pci_scan_bridge() (Andreas Noever) - Assign CardBus bus number only during the second pass (Andreas Noever) - Use request_resource_conflict() instead of insert_ for bus numbers (Andreas Noever) - Make sure bus number resources stay within their parents bounds (Andreas Noever) - Remove pci_fixup_parent_subordinate_busnr() (Andreas Noever) - Check for child busses which use more bus numbers than allocated (Andreas Noever) - Don't scan random busses in pci_scan_bridge() (Andreas Noever) - x86: Drop pcibios_scan_root() check for bus already scanned (Bjorn Helgaas) - x86: Use pcibios_scan_root() instead of pci_scan_bus_with_sysdata() (Bjorn Helgaas) - x86: Use pcibios_scan_root() instead of pci_scan_bus_on_node() (Bjorn Helgaas) - x86: Merge pci_scan_bus_on_node() into pcibios_scan_root() (Bjorn Helgaas) - x86: Drop return value of pcibios_scan_root() (Bjorn Helgaas) NUMA - x86: Add x86_pci_root_bus_node() to look up NUMA node from PCI bus (Bjorn Helgaas) - x86: Use x86_pci_root_bus_node() instead of get_mp_bus_to_node() (Bjorn Helgaas) - x86: Remove mp_bus_to_node[], set_mp_bus_to_node(), get_mp_bus_to_node() (Bjorn Helgaas) - x86: Use NUMA_NO_NODE, not -1, for unknown node (Bjorn Helgaas) - x86: Remove acpi_get_pxm() usage (Bjorn Helgaas) - ia64: Use NUMA_NO_NODE, not MAX_NUMNODES, for unknown node (Bjorn Helgaas) - ia64: Remove acpi_get_pxm() usage (Bjorn Helgaas) - ACPI: Fix acpi_get_node() prototype (Bjorn Helgaas) Resource management - i2o: Fix and refactor PCI space allocation (Bjorn Helgaas) - Add resource_contains() (Bjorn Helgaas) - Add %pR support for IORESOURCE_UNSET (Bjorn Helgaas) - Mark resources as IORESOURCE_UNSET if we can't assign them (Bjorn Helgaas) - Don't clear IORESOURCE_UNSET when updating BAR (Bjorn Helgaas) - Check IORESOURCE_UNSET before updating BAR (Bjorn Helgaas) - Don't try to claim IORESOURCE_UNSET resources (Bjorn Helgaas) - Mark 64-bit resource as IORESOURCE_UNSET if we only support 32-bit (Bjorn Helgaas) - Don't enable decoding if BAR hasn't been assigned an address (Bjorn Helgaas) - Add "weak" generic pcibios_enable_device() implementation (Bjorn Helgaas) - alpha, microblaze, sh, sparc, tile: Use default pcibios_enable_device() (Bjorn Helgaas) - s390: Use generic pci_enable_resources() (Bjorn Helgaas) - Don't check resource_size() in pci_bus_alloc_resource() (Bjorn Helgaas) - Set type in __request_region() (Bjorn Helgaas) - Check all IORESOURCE_TYPE_BITS in pci_bus_alloc_from_region() (Bjorn Helgaas) - Change pci_bus_alloc_resource() type_mask to unsigned long (Bjorn Helgaas) - Log IDE resource quirk in dmesg (Bjorn Helgaas) - Revert "[PATCH] Insert GART region into resource map" (Bjorn Helgaas) PCI device hotplug - Make check_link_active() non-static (Rajat Jain) - Use link change notifications for hot-plug and removal (Rajat Jain) - Enable link state change notifications (Rajat Jain) - Don't disable the link permanently during removal (Rajat Jain) - Don't check adapter or latch status while disabling (Rajat Jain) - Disable link notification across slot reset (Rajat Jain) - Ensure very fast hotplug events are also processed (Rajat Jain) - Add hotplug_lock to serialize hotplug events (Rajat Jain) - Remove a non-existent card, regardless of "surprise" capability (Rajat Jain) - Don't turn slot off when hot-added device already exists (Yijing Wang) MSI - Keep pci_enable_msi() documentation (Alexander Gordeev) - ahci: Fix broken single MSI fallback (Alexander Gordeev) - ahci, vfio: Use pci_enable_msi_range() (Alexander Gordeev) - Check kmalloc() return value, fix leak of name (Greg Kroah-Hartman) - Fix leak of msi_attrs (Greg Kroah-Hartman) - Fix pci_msix_vec_count() htmldocs failure (Masanari Iida) Virtualization - Device-specific ACS support (Alex Williamson) Freescale i.MX6 - Wait for retraining (Marek Vasut) Marvell MVEBU - Use Device ID and revision from underlying endpoint (Andrew Lunn) - Fix incorrect size for PCI aperture resources (Jason Gunthorpe) - Call request_resource() on the apertures (Jason Gunthorpe) - Fix potential issue in range parsing (Jean-Jacques Hiblot) Renesas R-Car - Check platform_get_irq() return code (Ben Dooks) - Add error interrupt handling (Ben Dooks) - Fix bridge logic configuration accesses (Ben Dooks) - Register each instance independently (Magnus Damm) - Break out window size handling (Magnus Damm) - Make the Kconfig dependencies more generic (Magnus Damm) Synopsys DesignWare - Fix RC BAR to be single 64-bit non-prefetchable memory (Mohit Kumar) Miscellaneous - Remove unused SR-IOV VF Migration support (Bjorn Helgaas) - Enable INTx if BIOS left them disabled (Bjorn Helgaas) - Fix hex vs decimal typo in cpqhpc_probe() (Dan Carpenter) - Clean up par-arch object file list (Liviu Dudau) - Set IORESOURCE_ROM_SHADOW only for the default VGA device (Sander Eikelenboom) - ACPI, ARM, drm, powerpc, pcmcia, PCI: Use list_for_each_entry() for bus traversal (Yijing Wang) - Fix pci_bus_b() build failure (Paul Gortmaker)" * tag 'pci-v3.15-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (108 commits) Revert "[PATCH] Insert GART region into resource map" PCI: Log IDE resource quirk in dmesg PCI: Change pci_bus_alloc_resource() type_mask to unsigned long PCI: Check all IORESOURCE_TYPE_BITS in pci_bus_alloc_from_region() resources: Set type in __request_region() PCI: Don't check resource_size() in pci_bus_alloc_resource() s390/PCI: Use generic pci_enable_resources() tile PCI RC: Use default pcibios_enable_device() sparc/PCI: Use default pcibios_enable_device() (Leon only) sh/PCI: Use default pcibios_enable_device() microblaze/PCI: Use default pcibios_enable_device() alpha/PCI: Use default pcibios_enable_device() PCI: Add "weak" generic pcibios_enable_device() implementation PCI: Don't enable decoding if BAR hasn't been assigned an address PCI: Enable INTx in pci_reenable_device() only when MSI/MSI-X not enabled PCI: Mark 64-bit resource as IORESOURCE_UNSET if we only support 32-bit PCI: Don't try to claim IORESOURCE_UNSET resources PCI: Check IORESOURCE_UNSET before updating BAR PCI: Don't clear IORESOURCE_UNSET when updating BAR PCI: Mark resources as IORESOURCE_UNSET if we can't assign them ... Conflicts: arch/x86/include/asm/topology.h drivers/ata/ahci.c
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci.c6
-rw-r--r--arch/arm/kernel/bios32.c9
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.c2
-rw-r--r--arch/ia64/hp/common/sba_iommu.c32
-rw-r--r--arch/ia64/include/asm/pci.h2
-rw-r--r--arch/ia64/kernel/acpi.c28
-rw-r--r--arch/ia64/pci/fixup.c25
-rw-r--r--arch/ia64/pci/pci.c10
-rw-r--r--arch/microblaze/pci/pci-common.c5
-rw-r--r--arch/powerpc/kernel/pci_64.c4
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c6
-rw-r--r--arch/s390/pci/pci.c16
-rw-r--r--arch/sh/drivers/pci/pci.c5
-rw-r--r--arch/sparc/kernel/leon_pci.c5
-rw-r--r--arch/tile/kernel/pci_gx.c12
-rw-r--r--arch/x86/include/asm/pci.h7
-rw-r--r--arch/x86/include/asm/topology.h14
-rw-r--r--arch/x86/pci/acpi.c59
-rw-r--r--arch/x86/pci/amd_bus.c10
-rw-r--r--arch/x86/pci/bus_numa.c13
-rw-r--r--arch/x86/pci/common.c128
-rw-r--r--arch/x86/pci/fixup.c24
-rw-r--r--arch/x86/pci/irq.c6
-rw-r--r--arch/x86/pci/legacy.c4
-rw-r--r--arch/x86/pci/numaq_32.c6
-rw-r--r--arch/x86/pci/visws.c4
26 files changed, 110 insertions, 332 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index edb4e0097b75..076c35cd6cde 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -254,12 +254,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
254 } 254 }
255} 255}
256 256
257int
258pcibios_enable_device(struct pci_dev *dev, int mask)
259{
260 return pci_enable_resources(dev, mask);
261}
262
263/* 257/*
264 * If we set up a device for bus mastering, we need to check the latency 258 * If we set up a device for bus mastering, we need to check the latency
265 * timer as certain firmware forgets to set it properly, as seen 259 * timer as certain firmware forgets to set it properly, as seen
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 317da88ae65b..d0d46786892c 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -19,7 +19,7 @@
19static int debug_pci; 19static int debug_pci;
20 20
21/* 21/*
22 * We can't use pci_find_device() here since we are 22 * We can't use pci_get_device() here since we are
23 * called from interrupt context. 23 * called from interrupt context.
24 */ 24 */
25static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, int warn) 25static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, int warn)
@@ -57,13 +57,10 @@ static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, in
57 57
58void pcibios_report_status(u_int status_mask, int warn) 58void pcibios_report_status(u_int status_mask, int warn)
59{ 59{
60 struct list_head *l; 60 struct pci_bus *bus;
61
62 list_for_each(l, &pci_root_buses) {
63 struct pci_bus *bus = pci_bus_b(l);
64 61
62 list_for_each_entry(bus, &pci_root_buses, node)
65 pcibios_bus_report_status(bus, status_mask, warn); 63 pcibios_bus_report_status(bus, status_mask, warn);
66 }
67} 64}
68 65
69/* 66/*
diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c
index c28121765448..67b1d1685759 100644
--- a/arch/frv/mb93090-mb00/pci-frv.c
+++ b/arch/frv/mb93090-mb00/pci-frv.c
@@ -88,7 +88,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
88 88
89 /* Depth-First Search on bus tree */ 89 /* Depth-First Search on bus tree */
90 for (ln=bus_list->next; ln != bus_list; ln=ln->next) { 90 for (ln=bus_list->next; ln != bus_list; ln=ln->next) {
91 bus = pci_bus_b(ln); 91 bus = list_entry(ln, struct pci_bus, node);
92 if ((dev = bus->self)) { 92 if ((dev = bus->self)) {
93 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { 93 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
94 r = &dev->resource[idx]; 94 r = &dev->resource[idx];
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 30c43d39dede..1a871b78e570 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1140,11 +1140,13 @@ sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
1140 1140
1141#ifdef CONFIG_NUMA 1141#ifdef CONFIG_NUMA
1142 { 1142 {
1143 int node = ioc->node;
1143 struct page *page; 1144 struct page *page;
1144 page = alloc_pages_exact_node(ioc->node == MAX_NUMNODES ?
1145 numa_node_id() : ioc->node, flags,
1146 get_order(size));
1147 1145
1146 if (node == NUMA_NO_NODE)
1147 node = numa_node_id();
1148
1149 page = alloc_pages_exact_node(node, flags, get_order(size));
1148 if (unlikely(!page)) 1150 if (unlikely(!page))
1149 return NULL; 1151 return NULL;
1150 1152
@@ -1914,7 +1916,7 @@ ioc_show(struct seq_file *s, void *v)
1914 seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n", 1916 seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n",
1915 ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF)); 1917 ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF));
1916#ifdef CONFIG_NUMA 1918#ifdef CONFIG_NUMA
1917 if (ioc->node != MAX_NUMNODES) 1919 if (ioc->node != NUMA_NO_NODE)
1918 seq_printf(s, "NUMA node : %d\n", ioc->node); 1920 seq_printf(s, "NUMA node : %d\n", ioc->node);
1919#endif 1921#endif
1920 seq_printf(s, "IOVA size : %ld MB\n", ((ioc->pdir_size >> 3) * iovp_size)/(1024*1024)); 1922 seq_printf(s, "IOVA size : %ld MB\n", ((ioc->pdir_size >> 3) * iovp_size)/(1024*1024));
@@ -2015,31 +2017,19 @@ sba_connect_bus(struct pci_bus *bus)
2015 printk(KERN_WARNING "No IOC for PCI Bus %04x:%02x in ACPI\n", pci_domain_nr(bus), bus->number); 2017 printk(KERN_WARNING "No IOC for PCI Bus %04x:%02x in ACPI\n", pci_domain_nr(bus), bus->number);
2016} 2018}
2017 2019
2018#ifdef CONFIG_NUMA
2019static void __init 2020static void __init
2020sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) 2021sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
2021{ 2022{
2023#ifdef CONFIG_NUMA
2022 unsigned int node; 2024 unsigned int node;
2023 int pxm;
2024
2025 ioc->node = MAX_NUMNODES;
2026
2027 pxm = acpi_get_pxm(handle);
2028
2029 if (pxm < 0)
2030 return;
2031
2032 node = pxm_to_node(pxm);
2033 2025
2034 if (node >= MAX_NUMNODES || !node_online(node)) 2026 node = acpi_get_node(handle);
2035 return; 2027 if (node != NUMA_NO_NODE && !node_online(node))
2028 node = NUMA_NO_NODE;
2036 2029
2037 ioc->node = node; 2030 ioc->node = node;
2038 return;
2039}
2040#else
2041#define sba_map_ioc_to_node(ioc, handle)
2042#endif 2031#endif
2032}
2043 2033
2044static int 2034static int
2045acpi_sba_ioc_add(struct acpi_device *device, 2035acpi_sba_ioc_add(struct acpi_device *device,
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 71fbaaa495cc..7d41cc089822 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -98,7 +98,7 @@ struct pci_controller {
98 struct acpi_device *companion; 98 struct acpi_device *companion;
99 void *iommu; 99 void *iommu;
100 int segment; 100 int segment;
101 int node; /* nearest node with memory or -1 for global allocation */ 101 int node; /* nearest node with memory or NUMA_NO_NODE for global allocation */
102 102
103 void *platform_data; 103 void *platform_data;
104}; 104};
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 467497ade45f..0d407b300762 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -799,14 +799,9 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
799 * ACPI based hotplug CPU support 799 * ACPI based hotplug CPU support
800 */ 800 */
801#ifdef CONFIG_ACPI_HOTPLUG_CPU 801#ifdef CONFIG_ACPI_HOTPLUG_CPU
802static 802static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
803int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
804{ 803{
805#ifdef CONFIG_ACPI_NUMA 804#ifdef CONFIG_ACPI_NUMA
806 int pxm_id;
807 int nid;
808
809 pxm_id = acpi_get_pxm(handle);
810 /* 805 /*
811 * We don't have cpu-only-node hotadd. But if the system equips 806 * We don't have cpu-only-node hotadd. But if the system equips
812 * SRAT table, pxm is already found and node is ready. 807 * SRAT table, pxm is already found and node is ready.
@@ -814,11 +809,10 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
814 * This code here is for the system which doesn't have full SRAT 809 * This code here is for the system which doesn't have full SRAT
815 * table for possible cpus. 810 * table for possible cpus.
816 */ 811 */
817 nid = acpi_map_pxm_to_node(pxm_id);
818 node_cpuid[cpu].phys_id = physid; 812 node_cpuid[cpu].phys_id = physid;
819 node_cpuid[cpu].nid = nid; 813 node_cpuid[cpu].nid = acpi_get_node(handle);
820#endif 814#endif
821 return (0); 815 return 0;
822} 816}
823 817
824int additional_cpus __initdata = -1; 818int additional_cpus __initdata = -1;
@@ -925,7 +919,7 @@ static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth,
925 union acpi_object *obj; 919 union acpi_object *obj;
926 struct acpi_madt_io_sapic *iosapic; 920 struct acpi_madt_io_sapic *iosapic;
927 unsigned int gsi_base; 921 unsigned int gsi_base;
928 int pxm, node; 922 int node;
929 923
930 /* Only care about objects w/ a method that returns the MADT */ 924 /* Only care about objects w/ a method that returns the MADT */
931 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) 925 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
@@ -952,17 +946,9 @@ static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth,
952 946
953 kfree(buffer.pointer); 947 kfree(buffer.pointer);
954 948
955 /* 949 /* OK, it's an IOSAPIC MADT entry; associate it with a node */
956 * OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell 950 node = acpi_get_node(handle);
957 * us which node to associate this with. 951 if (node == NUMA_NO_NODE || !node_online(node) ||
958 */
959 pxm = acpi_get_pxm(handle);
960 if (pxm < 0)
961 return AE_OK;
962
963 node = pxm_to_node(pxm);
964
965 if (node >= MAX_NUMNODES || !node_online(node) ||
966 cpumask_empty(cpumask_of_node(node))) 952 cpumask_empty(cpumask_of_node(node)))
967 return AE_OK; 953 return AE_OK;
968 954
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index 5dc969dd4ac0..eee069a0b539 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/vgaarb.h>
8 9
9#include <asm/machvec.h> 10#include <asm/machvec.h>
10 11
@@ -19,9 +20,10 @@
19 * IORESOURCE_ROM_SHADOW is used to associate the boot video 20 * IORESOURCE_ROM_SHADOW is used to associate the boot video
20 * card with this copy. On laptops this copy has to be used since 21 * card with this copy. On laptops this copy has to be used since
21 * the main ROM may be compressed or combined with another image. 22 * the main ROM may be compressed or combined with another image.
22 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW 23 * See pci_map_rom() for use of this flag. Before marking the device
23 * is marked here since the boot video device will be the only enabled 24 * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set
24 * video device at this point. 25 * by either arch cde or vga-arbitration, if so only apply the fixup to this
26 * already determined primary video card.
25 */ 27 */
26 28
27static void pci_fixup_video(struct pci_dev *pdev) 29static void pci_fixup_video(struct pci_dev *pdev)
@@ -35,9 +37,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
35 return; 37 return;
36 /* Maybe, this machine supports legacy memory map. */ 38 /* Maybe, this machine supports legacy memory map. */
37 39
38 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
39 return;
40
41 /* Is VGA routed to us? */ 40 /* Is VGA routed to us? */
42 bus = pdev->bus; 41 bus = pdev->bus;
43 while (bus) { 42 while (bus) {
@@ -60,10 +59,14 @@ static void pci_fixup_video(struct pci_dev *pdev)
60 } 59 }
61 bus = bus->parent; 60 bus = bus->parent;
62 } 61 }
63 pci_read_config_word(pdev, PCI_COMMAND, &config); 62 if (!vga_default_device() || pdev == vga_default_device()) {
64 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 63 pci_read_config_word(pdev, PCI_COMMAND, &config);
65 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 64 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
66 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 65 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
66 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
67 vga_set_default_device(pdev);
68 }
67 } 69 }
68} 70}
69DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video); 71DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
72 PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 9e4938d8ca4d..291a582777cf 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -126,7 +126,6 @@ static struct pci_controller *alloc_pci_controller(int seg)
126 return NULL; 126 return NULL;
127 127
128 controller->segment = seg; 128 controller->segment = seg;
129 controller->node = -1;
130 return controller; 129 return controller;
131} 130}
132 131
@@ -430,19 +429,14 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
430 struct pci_root_info *info = NULL; 429 struct pci_root_info *info = NULL;
431 int busnum = root->secondary.start; 430 int busnum = root->secondary.start;
432 struct pci_bus *pbus; 431 struct pci_bus *pbus;
433 int pxm, ret; 432 int ret;
434 433
435 controller = alloc_pci_controller(domain); 434 controller = alloc_pci_controller(domain);
436 if (!controller) 435 if (!controller)
437 return NULL; 436 return NULL;
438 437
439 controller->companion = device; 438 controller->companion = device;
440 439 controller->node = acpi_get_node(device->handle);
441 pxm = acpi_get_pxm(device->handle);
442#ifdef CONFIG_NUMA
443 if (pxm >= 0)
444 controller->node = pxm_to_node(pxm);
445#endif
446 440
447 info = kzalloc(sizeof(*info), GFP_KERNEL); 441 info = kzalloc(sizeof(*info), GFP_KERNEL);
448 if (!info) { 442 if (!info) {
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 66804adcacf0..70996cc66aa2 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1294,11 +1294,6 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1294} 1294}
1295EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); 1295EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
1296 1296
1297int pcibios_enable_device(struct pci_dev *dev, int mask)
1298{
1299 return pci_enable_resources(dev, mask);
1300}
1301
1302static void pcibios_setup_phb_resources(struct pci_controller *hose, 1297static void pcibios_setup_phb_resources(struct pci_controller *hose,
1303 struct list_head *resources) 1298 struct list_head *resources)
1304{ 1299{
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index a9e311f7a9dd..2a4779091a58 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -208,7 +208,6 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
208 unsigned long in_devfn) 208 unsigned long in_devfn)
209{ 209{
210 struct pci_controller* hose; 210 struct pci_controller* hose;
211 struct list_head *ln;
212 struct pci_bus *bus = NULL; 211 struct pci_bus *bus = NULL;
213 struct device_node *hose_node; 212 struct device_node *hose_node;
214 213
@@ -230,8 +229,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
230 * used on pre-domains setup. We return the first match 229 * used on pre-domains setup. We return the first match
231 */ 230 */
232 231
233 for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) { 232 list_for_each_entry(bus, &pci_root_buses, node) {
234 bus = pci_bus_b(ln);
235 if (in_bus >= bus->number && in_bus <= bus->busn_res.end) 233 if (in_bus >= bus->number && in_bus <= bus->busn_res.end)
236 break; 234 break;
237 bus = NULL; 235 bus = NULL;
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index efe61374f6ea..203cbf0dc101 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -37,15 +37,15 @@ find_bus_among_children(struct pci_bus *bus,
37 struct device_node *dn) 37 struct device_node *dn)
38{ 38{
39 struct pci_bus *child = NULL; 39 struct pci_bus *child = NULL;
40 struct list_head *tmp; 40 struct pci_bus *tmp;
41 struct device_node *busdn; 41 struct device_node *busdn;
42 42
43 busdn = pci_bus_to_OF_node(bus); 43 busdn = pci_bus_to_OF_node(bus);
44 if (busdn == dn) 44 if (busdn == dn)
45 return bus; 45 return bus;
46 46
47 list_for_each(tmp, &bus->children) { 47 list_for_each_entry(tmp, &bus->children, node) {
48 child = find_bus_among_children(pci_bus_b(tmp), dn); 48 child = find_bus_among_children(tmp, dn);
49 if (child) 49 if (child)
50 break; 50 break;
51 }; 51 };
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 66670ff262a0..1df1d29ac81d 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -686,27 +686,13 @@ int pcibios_add_device(struct pci_dev *pdev)
686int pcibios_enable_device(struct pci_dev *pdev, int mask) 686int pcibios_enable_device(struct pci_dev *pdev, int mask)
687{ 687{
688 struct zpci_dev *zdev = get_zdev(pdev); 688 struct zpci_dev *zdev = get_zdev(pdev);
689 struct resource *res;
690 u16 cmd;
691 int i;
692 689
693 zdev->pdev = pdev; 690 zdev->pdev = pdev;
694 zpci_debug_init_device(zdev); 691 zpci_debug_init_device(zdev);
695 zpci_fmb_enable_device(zdev); 692 zpci_fmb_enable_device(zdev);
696 zpci_map_resources(zdev); 693 zpci_map_resources(zdev);
697 694
698 pci_read_config_word(pdev, PCI_COMMAND, &cmd); 695 return pci_enable_resources(pdev, mask);
699 for (i = 0; i < PCI_BAR_COUNT; i++) {
700 res = &pdev->resource[i];
701
702 if (res->flags & IORESOURCE_IO)
703 return -EINVAL;
704
705 if (res->flags & IORESOURCE_MEM)
706 cmd |= PCI_COMMAND_MEMORY;
707 }
708 pci_write_config_word(pdev, PCI_COMMAND, cmd);
709 return 0;
710} 696}
711 697
712void pcibios_disable_device(struct pci_dev *pdev) 698void pcibios_disable_device(struct pci_dev *pdev)
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 60ed3e1c4b75..1bc09ee7948f 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -186,11 +186,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
186 return start; 186 return start;
187} 187}
188 188
189int pcibios_enable_device(struct pci_dev *dev, int mask)
190{
191 return pci_enable_resources(dev, mask);
192}
193
194static void __init 189static void __init
195pcibios_bus_report_status_early(struct pci_channel *hose, 190pcibios_bus_report_status_early(struct pci_channel *hose,
196 int top_bus, int current_bus, 191 int top_bus, int current_bus,
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 88aaaa57bb64..e16c4157e1ae 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -99,11 +99,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
99 return res->start; 99 return res->start;
100} 100}
101 101
102int pcibios_enable_device(struct pci_dev *dev, int mask)
103{
104 return pci_enable_resources(dev, mask);
105}
106
107/* in/out routines taken from pcic.c 102/* in/out routines taken from pcic.c
108 * 103 *
109 * This probably belongs here rather than ioport.c because 104 * This probably belongs here rather than ioport.c because
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index a97a6452b812..077b7bc437e5 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -1065,18 +1065,6 @@ char *__init pcibios_setup(char *str)
1065} 1065}
1066 1066
1067/* 1067/*
1068 * Enable memory address decoding, as appropriate, for the
1069 * device described by the 'dev' struct.
1070 *
1071 * This is called from the generic PCI layer, and can be called
1072 * for bridges or endpoints.
1073 */
1074int pcibios_enable_device(struct pci_dev *dev, int mask)
1075{
1076 return pci_enable_resources(dev, mask);
1077}
1078
1079/*
1080 * Called for each device after PCI setup is done. 1068 * Called for each device after PCI setup is done.
1081 * We initialize the PCI device capabilities conservatively, assuming that 1069 * We initialize the PCI device capabilities conservatively, assuming that
1082 * all devices can only address the 32-bit DMA space. The exception here is 1070 * all devices can only address the 32-bit DMA space. The exception here is
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 1ac6114c9ea5..96ae4f4040bb 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -26,11 +26,6 @@ extern int pci_routeirq;
26extern int noioapicquirk; 26extern int noioapicquirk;
27extern int noioapicreroute; 27extern int noioapicreroute;
28 28
29/* scan a bus after allocating a pci_sysdata for it */
30extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops,
31 int node);
32extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
33
34#ifdef CONFIG_PCI 29#ifdef CONFIG_PCI
35 30
36#ifdef CONFIG_PCI_DOMAINS 31#ifdef CONFIG_PCI_DOMAINS
@@ -70,7 +65,7 @@ extern unsigned long pci_mem_start;
70 65
71extern int pcibios_enabled; 66extern int pcibios_enabled;
72void pcibios_config_init(void); 67void pcibios_config_init(void);
73struct pci_bus *pcibios_scan_root(int bus); 68void pcibios_scan_root(int bus);
74 69
75void pcibios_set_master(struct pci_dev *dev); 70void pcibios_set_master(struct pci_dev *dev);
76void pcibios_penalize_isa_irq(int irq, int active); 71void pcibios_penalize_isa_irq(int irq, int active);
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index b28097e4c8c3..0e8f04f2c26f 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -132,19 +132,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot)
132} 132}
133 133
134struct pci_bus; 134struct pci_bus;
135int x86_pci_root_bus_node(int bus);
135void x86_pci_root_bus_resources(int bus, struct list_head *resources); 136void x86_pci_root_bus_resources(int bus, struct list_head *resources);
136 137
137#ifdef CONFIG_NUMA
138extern int get_mp_bus_to_node(int busnum);
139extern void set_mp_bus_to_node(int busnum, int node);
140#else
141static inline int get_mp_bus_to_node(int busnum)
142{
143 return 0;
144}
145static inline void set_mp_bus_to_node(int busnum, int node)
146{
147}
148#endif
149
150#endif /* _ASM_X86_TOPOLOGY_H */ 138#endif /* _ASM_X86_TOPOLOGY_H */
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 4f25ec077552..01edac6c5e18 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -218,9 +218,8 @@ static void teardown_mcfg_map(struct pci_root_info *info)
218} 218}
219#endif 219#endif
220 220
221static acpi_status 221static acpi_status resource_to_addr(struct acpi_resource *resource,
222resource_to_addr(struct acpi_resource *resource, 222 struct acpi_resource_address64 *addr)
223 struct acpi_resource_address64 *addr)
224{ 223{
225 acpi_status status; 224 acpi_status status;
226 struct acpi_resource_memory24 *memory24; 225 struct acpi_resource_memory24 *memory24;
@@ -265,8 +264,7 @@ resource_to_addr(struct acpi_resource *resource,
265 return AE_ERROR; 264 return AE_ERROR;
266} 265}
267 266
268static acpi_status 267static acpi_status count_resource(struct acpi_resource *acpi_res, void *data)
269count_resource(struct acpi_resource *acpi_res, void *data)
270{ 268{
271 struct pci_root_info *info = data; 269 struct pci_root_info *info = data;
272 struct acpi_resource_address64 addr; 270 struct acpi_resource_address64 addr;
@@ -278,8 +276,7 @@ count_resource(struct acpi_resource *acpi_res, void *data)
278 return AE_OK; 276 return AE_OK;
279} 277}
280 278
281static acpi_status 279static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data)
282setup_resource(struct acpi_resource *acpi_res, void *data)
283{ 280{
284 struct pci_root_info *info = data; 281 struct pci_root_info *info = data;
285 struct resource *res; 282 struct resource *res;
@@ -435,9 +432,9 @@ static void release_pci_root_info(struct pci_host_bridge *bridge)
435 __release_pci_root_info(info); 432 __release_pci_root_info(info);
436} 433}
437 434
438static void 435static void probe_pci_root_info(struct pci_root_info *info,
439probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, 436 struct acpi_device *device,
440 int busnum, int domain) 437 int busnum, int domain)
441{ 438{
442 size_t size; 439 size_t size;
443 440
@@ -473,16 +470,13 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
473struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) 470struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
474{ 471{
475 struct acpi_device *device = root->device; 472 struct acpi_device *device = root->device;
476 struct pci_root_info *info = NULL; 473 struct pci_root_info *info;
477 int domain = root->segment; 474 int domain = root->segment;
478 int busnum = root->secondary.start; 475 int busnum = root->secondary.start;
479 LIST_HEAD(resources); 476 LIST_HEAD(resources);
480 struct pci_bus *bus = NULL; 477 struct pci_bus *bus;
481 struct pci_sysdata *sd; 478 struct pci_sysdata *sd;
482 int node; 479 int node;
483#ifdef CONFIG_ACPI_NUMA
484 int pxm;
485#endif
486 480
487 if (pci_ignore_seg) 481 if (pci_ignore_seg)
488 domain = 0; 482 domain = 0;
@@ -494,19 +488,12 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
494 return NULL; 488 return NULL;
495 } 489 }
496 490
497 node = -1; 491 node = acpi_get_node(device->handle);
498#ifdef CONFIG_ACPI_NUMA 492 if (node == NUMA_NO_NODE)
499 pxm = acpi_get_pxm(device->handle); 493 node = x86_pci_root_bus_node(busnum);
500 if (pxm >= 0)
501 node = pxm_to_node(pxm);
502 if (node != -1)
503 set_mp_bus_to_node(busnum, node);
504 else
505#endif
506 node = get_mp_bus_to_node(busnum);
507 494
508 if (node != -1 && !node_online(node)) 495 if (node != NUMA_NO_NODE && !node_online(node))
509 node = -1; 496 node = NUMA_NO_NODE;
510 497
511 info = kzalloc(sizeof(*info), GFP_KERNEL); 498 info = kzalloc(sizeof(*info), GFP_KERNEL);
512 if (!info) { 499 if (!info) {
@@ -519,15 +506,12 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
519 sd->domain = domain; 506 sd->domain = domain;
520 sd->node = node; 507 sd->node = node;
521 sd->companion = device; 508 sd->companion = device;
522 /* 509
523 * Maybe the desired pci bus has been already scanned. In such case
524 * it is unnecessary to scan the pci bus with the given domain,busnum.
525 */
526 bus = pci_find_bus(domain, busnum); 510 bus = pci_find_bus(domain, busnum);
527 if (bus) { 511 if (bus) {
528 /* 512 /*
529 * If the desired bus exits, the content of bus->sysdata will 513 * If the desired bus has been scanned already, replace
530 * be replaced by sd. 514 * its bus->sysdata.
531 */ 515 */
532 memcpy(bus->sysdata, sd, sizeof(*sd)); 516 memcpy(bus->sysdata, sd, sizeof(*sd));
533 kfree(info); 517 kfree(info);
@@ -572,15 +556,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
572 pcie_bus_configure_settings(child); 556 pcie_bus_configure_settings(child);
573 } 557 }
574 558
575 if (bus && node != -1) { 559 if (bus && node != NUMA_NO_NODE)
576#ifdef CONFIG_ACPI_NUMA
577 if (pxm >= 0)
578 dev_printk(KERN_DEBUG, &bus->dev,
579 "on NUMA node %d (pxm %d)\n", node, pxm);
580#else
581 dev_printk(KERN_DEBUG, &bus->dev, "on NUMA node %d\n", node); 560 dev_printk(KERN_DEBUG, &bus->dev, "on NUMA node %d\n", node);
582#endif
583 }
584 561
585 return bus; 562 return bus;
586} 563}
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index a48be98e9ded..a313a7fb6b86 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -44,15 +44,6 @@ static struct pci_root_info __init *find_pci_root_info(int node, int link)
44 return NULL; 44 return NULL;
45} 45}
46 46
47static void __init set_mp_bus_range_to_node(int min_bus, int max_bus, int node)
48{
49#ifdef CONFIG_NUMA
50 int j;
51
52 for (j = min_bus; j <= max_bus; j++)
53 set_mp_bus_to_node(j, node);
54#endif
55}
56/** 47/**
57 * early_fill_mp_bus_to_node() 48 * early_fill_mp_bus_to_node()
58 * called before pcibios_scan_root and pci_scan_bus 49 * called before pcibios_scan_root and pci_scan_bus
@@ -117,7 +108,6 @@ static int __init early_fill_mp_bus_info(void)
117 min_bus = (reg >> 16) & 0xff; 108 min_bus = (reg >> 16) & 0xff;
118 max_bus = (reg >> 24) & 0xff; 109 max_bus = (reg >> 24) & 0xff;
119 node = (reg >> 4) & 0x07; 110 node = (reg >> 4) & 0x07;
120 set_mp_bus_range_to_node(min_bus, max_bus, node);
121 link = (reg >> 8) & 0x03; 111 link = (reg >> 8) & 0x03;
122 112
123 info = alloc_pci_root_info(min_bus, max_bus, node, link); 113 info = alloc_pci_root_info(min_bus, max_bus, node, link);
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
index c2735feb2508..f3a2cfc14125 100644
--- a/arch/x86/pci/bus_numa.c
+++ b/arch/x86/pci/bus_numa.c
@@ -10,9 +10,6 @@ static struct pci_root_info *x86_find_pci_root_info(int bus)
10{ 10{
11 struct pci_root_info *info; 11 struct pci_root_info *info;
12 12
13 if (list_empty(&pci_root_infos))
14 return NULL;
15
16 list_for_each_entry(info, &pci_root_infos, list) 13 list_for_each_entry(info, &pci_root_infos, list)
17 if (info->busn.start == bus) 14 if (info->busn.start == bus)
18 return info; 15 return info;
@@ -20,6 +17,16 @@ static struct pci_root_info *x86_find_pci_root_info(int bus)
20 return NULL; 17 return NULL;
21} 18}
22 19
20int x86_pci_root_bus_node(int bus)
21{
22 struct pci_root_info *info = x86_find_pci_root_info(bus);
23
24 if (!info)
25 return NUMA_NO_NODE;
26
27 return info->node;
28}
29
23void x86_pci_root_bus_resources(int bus, struct list_head *resources) 30void x86_pci_root_bus_resources(int bus, struct list_head *resources)
24{ 31{
25 struct pci_root_info *info = x86_find_pci_root_info(bus); 32 struct pci_root_info *info = x86_find_pci_root_info(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 981c2dbd72cc..d491deddebae 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -456,19 +456,25 @@ void __init dmi_check_pciprobe(void)
456 dmi_check_system(pciprobe_dmi_table); 456 dmi_check_system(pciprobe_dmi_table);
457} 457}
458 458
459struct pci_bus *pcibios_scan_root(int busnum) 459void pcibios_scan_root(int busnum)
460{ 460{
461 struct pci_bus *bus = NULL; 461 struct pci_bus *bus;
462 struct pci_sysdata *sd;
463 LIST_HEAD(resources);
462 464
463 while ((bus = pci_find_next_bus(bus)) != NULL) { 465 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
464 if (bus->number == busnum) { 466 if (!sd) {
465 /* Already scanned */ 467 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busnum);
466 return bus; 468 return;
467 } 469 }
470 sd->node = x86_pci_root_bus_node(busnum);
471 x86_pci_root_bus_resources(busnum, &resources);
472 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
473 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
474 if (!bus) {
475 pci_free_resource_list(&resources);
476 kfree(sd);
468 } 477 }
469
470 return pci_scan_bus_on_node(busnum, &pci_root_ops,
471 get_mp_bus_to_node(busnum));
472} 478}
473 479
474void __init pcibios_set_cache_line_size(void) 480void __init pcibios_set_cache_line_size(void)
@@ -677,105 +683,3 @@ int pci_ext_cfg_avail(void)
677 else 683 else
678 return 0; 684 return 0;
679} 685}
680
681struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node)
682{
683 LIST_HEAD(resources);
684 struct pci_bus *bus = NULL;
685 struct pci_sysdata *sd;
686
687 /*
688 * Allocate per-root-bus (not per bus) arch-specific data.
689 * TODO: leak; this memory is never freed.
690 * It's arguable whether it's worth the trouble to care.
691 */
692 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
693 if (!sd) {
694 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno);
695 return NULL;
696 }
697 sd->node = node;
698 x86_pci_root_bus_resources(busno, &resources);
699 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busno);
700 bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources);
701 if (!bus) {
702 pci_free_resource_list(&resources);
703 kfree(sd);
704 }
705
706 return bus;
707}
708
709struct pci_bus *pci_scan_bus_with_sysdata(int busno)
710{
711 return pci_scan_bus_on_node(busno, &pci_root_ops, -1);
712}
713
714/*
715 * NUMA info for PCI busses
716 *
717 * Early arch code is responsible for filling in reasonable values here.
718 * A node id of "-1" means "use current node". In other words, if a bus
719 * has a -1 node id, it's not tightly coupled to any particular chunk
720 * of memory (as is the case on some Nehalem systems).
721 */
722#ifdef CONFIG_NUMA
723
724#define BUS_NR 256
725
726#ifdef CONFIG_X86_64
727
728static int mp_bus_to_node[BUS_NR] = {
729 [0 ... BUS_NR - 1] = -1
730};
731
732void set_mp_bus_to_node(int busnum, int node)
733{
734 if (busnum >= 0 && busnum < BUS_NR)
735 mp_bus_to_node[busnum] = node;
736}
737
738int get_mp_bus_to_node(int busnum)
739{
740 int node = -1;
741
742 if (busnum < 0 || busnum > (BUS_NR - 1))
743 return node;
744
745 node = mp_bus_to_node[busnum];
746
747 /*
748 * let numa_node_id to decide it later in dma_alloc_pages
749 * if there is no ram on that node
750 */
751 if (node != -1 && !node_online(node))
752 node = -1;
753
754 return node;
755}
756
757#else /* CONFIG_X86_32 */
758
759static int mp_bus_to_node[BUS_NR] = {
760 [0 ... BUS_NR - 1] = -1
761};
762
763void set_mp_bus_to_node(int busnum, int node)
764{
765 if (busnum >= 0 && busnum < BUS_NR)
766 mp_bus_to_node[busnum] = (unsigned char) node;
767}
768
769int get_mp_bus_to_node(int busnum)
770{
771 int node;
772
773 if (busnum < 0 || busnum > (BUS_NR - 1))
774 return 0;
775 node = mp_bus_to_node[busnum];
776 return node;
777}
778
779#endif /* CONFIG_X86_32 */
780
781#endif /* CONFIG_NUMA */
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index bca9e85daaa5..94ae9ae9574f 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -25,9 +25,9 @@ static void pci_fixup_i450nx(struct pci_dev *d)
25 dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, 25 dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno,
26 suba, subb); 26 suba, subb);
27 if (busno) 27 if (busno)
28 pci_scan_bus_with_sysdata(busno); /* Bus A */ 28 pcibios_scan_root(busno); /* Bus A */
29 if (suba < subb) 29 if (suba < subb)
30 pci_scan_bus_with_sysdata(suba+1); /* Bus B */ 30 pcibios_scan_root(suba+1); /* Bus B */
31 } 31 }
32 pcibios_last_bus = -1; 32 pcibios_last_bus = -1;
33} 33}
@@ -42,7 +42,7 @@ static void pci_fixup_i450gx(struct pci_dev *d)
42 u8 busno; 42 u8 busno;
43 pci_read_config_byte(d, 0x4a, &busno); 43 pci_read_config_byte(d, 0x4a, &busno);
44 dev_info(&d->dev, "i440KX/GX host bridge; secondary bus %02x\n", busno); 44 dev_info(&d->dev, "i440KX/GX host bridge; secondary bus %02x\n", busno);
45 pci_scan_bus_with_sysdata(busno); 45 pcibios_scan_root(busno);
46 pcibios_last_bus = -1; 46 pcibios_last_bus = -1;
47} 47}
48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx); 48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx);
@@ -313,9 +313,10 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_r
313 * IORESOURCE_ROM_SHADOW is used to associate the boot video 313 * IORESOURCE_ROM_SHADOW is used to associate the boot video
314 * card with this copy. On laptops this copy has to be used since 314 * card with this copy. On laptops this copy has to be used since
315 * the main ROM may be compressed or combined with another image. 315 * the main ROM may be compressed or combined with another image.
316 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW 316 * See pci_map_rom() for use of this flag. Before marking the device
317 * is marked here since the boot video device will be the only enabled 317 * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set
318 * video device at this point. 318 * by either arch cde or vga-arbitration, if so only apply the fixup to this
319 * already determined primary video card.
319 */ 320 */
320 321
321static void pci_fixup_video(struct pci_dev *pdev) 322static void pci_fixup_video(struct pci_dev *pdev)
@@ -346,12 +347,13 @@ static void pci_fixup_video(struct pci_dev *pdev)
346 } 347 }
347 bus = bus->parent; 348 bus = bus->parent;
348 } 349 }
349 pci_read_config_word(pdev, PCI_COMMAND, &config); 350 if (!vga_default_device() || pdev == vga_default_device()) {
350 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 351 pci_read_config_word(pdev, PCI_COMMAND, &config);
351 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 352 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
352 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 353 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
353 if (!vga_default_device()) 354 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
354 vga_set_default_device(pdev); 355 vga_set_default_device(pdev);
356 }
355 } 357 }
356} 358}
357DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, 359DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 372e9b8989b3..84112f55dd7a 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -136,13 +136,9 @@ static void __init pirq_peer_trick(void)
136 busmap[e->bus] = 1; 136 busmap[e->bus] = 1;
137 } 137 }
138 for (i = 1; i < 256; i++) { 138 for (i = 1; i < 256; i++) {
139 int node;
140 if (!busmap[i] || pci_find_bus(0, i)) 139 if (!busmap[i] || pci_find_bus(0, i))
141 continue; 140 continue;
142 node = get_mp_bus_to_node(i); 141 pcibios_scan_root(i);
143 if (pci_scan_bus_on_node(i, &pci_root_ops, node))
144 printk(KERN_INFO "PCI: Discovered primary peer "
145 "bus %02x [IRQ]\n", i);
146 } 142 }
147 pcibios_last_bus = -1; 143 pcibios_last_bus = -1;
148} 144}
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index 4db96fb1c232..5b662c0faf8c 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -37,19 +37,17 @@ int __init pci_legacy_init(void)
37void pcibios_scan_specific_bus(int busn) 37void pcibios_scan_specific_bus(int busn)
38{ 38{
39 int devfn; 39 int devfn;
40 long node;
41 u32 l; 40 u32 l;
42 41
43 if (pci_find_bus(0, busn)) 42 if (pci_find_bus(0, busn))
44 return; 43 return;
45 44
46 node = get_mp_bus_to_node(busn);
47 for (devfn = 0; devfn < 256; devfn += 8) { 45 for (devfn = 0; devfn < 256; devfn += 8) {
48 if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) && 46 if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) &&
49 l != 0x0000 && l != 0xffff) { 47 l != 0x0000 && l != 0xffff) {
50 DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l); 48 DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l);
51 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", busn); 49 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", busn);
52 pci_scan_bus_on_node(busn, &pci_root_ops, node); 50 pcibios_scan_root(busn);
53 return; 51 return;
54 } 52 }
55 } 53 }
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c
index 72c229f9ebcf..080eb0374fff 100644
--- a/arch/x86/pci/numaq_32.c
+++ b/arch/x86/pci/numaq_32.c
@@ -135,11 +135,11 @@ static void pci_fixup_i450nx(struct pci_dev *d)
135 pxb, busno, suba, subb); 135 pxb, busno, suba, subb);
136 if (busno) { 136 if (busno) {
137 /* Bus A */ 137 /* Bus A */
138 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno)); 138 pcibios_scan_root(QUADLOCAL2BUS(quad, busno));
139 } 139 }
140 if (suba < subb) { 140 if (suba < subb) {
141 /* Bus B */ 141 /* Bus B */
142 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, suba+1)); 142 pcibios_scan_root(QUADLOCAL2BUS(quad, suba+1));
143 } 143 }
144 } 144 }
145 pcibios_last_bus = -1; 145 pcibios_last_bus = -1;
@@ -159,7 +159,7 @@ int __init pci_numaq_init(void)
159 continue; 159 continue;
160 printk("Scanning PCI bus %d for quad %d\n", 160 printk("Scanning PCI bus %d for quad %d\n",
161 QUADLOCAL2BUS(quad,0), quad); 161 QUADLOCAL2BUS(quad,0), quad);
162 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, 0)); 162 pcibios_scan_root(QUADLOCAL2BUS(quad, 0));
163 } 163 }
164 return 0; 164 return 0;
165} 165}
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c
index 3e6d2a6db866..cd9d4d1681d2 100644
--- a/arch/x86/pci/visws.c
+++ b/arch/x86/pci/visws.c
@@ -78,8 +78,8 @@ int __init pci_visws_init(void)
78 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0); 78 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0);
79 79
80 raw_pci_ops = &pci_direct_conf1; 80 raw_pci_ops = &pci_direct_conf1;
81 pci_scan_bus_with_sysdata(pci_bus0); 81 pcibios_scan_root(pci_bus0);
82 pci_scan_bus_with_sysdata(pci_bus1); 82 pcibios_scan_root(pci_bus1);
83 pci_fixup_irqs(pci_common_swizzle, visws_map_irq); 83 pci_fixup_irqs(pci_common_swizzle, visws_map_irq);
84 pcibios_resource_survey(); 84 pcibios_resource_survey();
85 /* Request bus scan */ 85 /* Request bus scan */