aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/bios32.c7
-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/pci.c10
-rw-r--r--arch/powerpc/kernel/pci_64.c4
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c6
-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.c29
-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.c6
-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
19 files changed, 72 insertions, 246 deletions
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 588ec19a7e31..d0d46786892c 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -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 8e858b593e4f..007361d59aa6 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 __init 2034static int __init
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 07d209c9507f..5a585ebe9df3 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -803,14 +803,9 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
803 * ACPI based hotplug CPU support 803 * ACPI based hotplug CPU support
804 */ 804 */
805#ifdef CONFIG_ACPI_HOTPLUG_CPU 805#ifdef CONFIG_ACPI_HOTPLUG_CPU
806static 806static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
807int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
808{ 807{
809#ifdef CONFIG_ACPI_NUMA 808#ifdef CONFIG_ACPI_NUMA
810 int pxm_id;
811 int nid;
812
813 pxm_id = acpi_get_pxm(handle);
814 /* 809 /*
815 * We don't have cpu-only-node hotadd. But if the system equips 810 * We don't have cpu-only-node hotadd. But if the system equips
816 * SRAT table, pxm is already found and node is ready. 811 * SRAT table, pxm is already found and node is ready.
@@ -818,11 +813,10 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
818 * This code here is for the system which doesn't have full SRAT 813 * This code here is for the system which doesn't have full SRAT
819 * table for possible cpus. 814 * table for possible cpus.
820 */ 815 */
821 nid = acpi_map_pxm_to_node(pxm_id);
822 node_cpuid[cpu].phys_id = physid; 816 node_cpuid[cpu].phys_id = physid;
823 node_cpuid[cpu].nid = nid; 817 node_cpuid[cpu].nid = acpi_get_node(handle);
824#endif 818#endif
825 return (0); 819 return 0;
826} 820}
827 821
828int additional_cpus __initdata = -1; 822int additional_cpus __initdata = -1;
@@ -929,7 +923,7 @@ static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth,
929 union acpi_object *obj; 923 union acpi_object *obj;
930 struct acpi_madt_io_sapic *iosapic; 924 struct acpi_madt_io_sapic *iosapic;
931 unsigned int gsi_base; 925 unsigned int gsi_base;
932 int pxm, node; 926 int node;
933 927
934 /* Only care about objects w/ a method that returns the MADT */ 928 /* Only care about objects w/ a method that returns the MADT */
935 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) 929 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
@@ -956,17 +950,9 @@ static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth,
956 950
957 kfree(buffer.pointer); 951 kfree(buffer.pointer);
958 952
959 /* 953 /* OK, it's an IOSAPIC MADT entry; associate it with a node */
960 * OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell 954 node = acpi_get_node(handle);
961 * us which node to associate this with. 955 if (node == NUMA_NO_NODE || !node_online(node) ||
962 */
963 pxm = acpi_get_pxm(handle);
964 if (pxm < 0)
965 return AE_OK;
966
967 node = pxm_to_node(pxm);
968
969 if (node >= MAX_NUMNODES || !node_online(node) ||
970 cpumask_empty(cpumask_of_node(node))) 956 cpumask_empty(cpumask_of_node(node)))
971 return AE_OK; 957 return AE_OK;
972 958
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/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/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 d35f24e231cd..c840571afa4e 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -131,6 +131,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot)
131} 131}
132 132
133struct pci_bus; 133struct pci_bus;
134int x86_pci_root_bus_node(int bus);
134void x86_pci_root_bus_resources(int bus, struct list_head *resources); 135void x86_pci_root_bus_resources(int bus, struct list_head *resources);
135 136
136#ifdef CONFIG_SMP 137#ifdef CONFIG_SMP
@@ -139,17 +140,4 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources);
139#define smt_capable() (smp_num_siblings > 1) 140#define smt_capable() (smp_num_siblings > 1)
140#endif 141#endif
141 142
142#ifdef CONFIG_NUMA
143extern int get_mp_bus_to_node(int busnum);
144extern void set_mp_bus_to_node(int busnum, int node);
145#else
146static inline int get_mp_bus_to_node(int busnum)
147{
148 return 0;
149}
150static inline void set_mp_bus_to_node(int busnum, int node)
151{
152}
153#endif
154
155#endif /* _ASM_X86_TOPOLOGY_H */ 143#endif /* _ASM_X86_TOPOLOGY_H */
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index b0bc5920f5c6..01edac6c5e18 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -477,9 +477,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
477 struct pci_bus *bus; 477 struct pci_bus *bus;
478 struct pci_sysdata *sd; 478 struct pci_sysdata *sd;
479 int node; 479 int node;
480#ifdef CONFIG_ACPI_NUMA
481 int pxm;
482#endif
483 480
484 if (pci_ignore_seg) 481 if (pci_ignore_seg)
485 domain = 0; 482 domain = 0;
@@ -491,19 +488,12 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
491 return NULL; 488 return NULL;
492 } 489 }
493 490
494 node = -1; 491 node = acpi_get_node(device->handle);
495#ifdef CONFIG_ACPI_NUMA 492 if (node == NUMA_NO_NODE)
496 pxm = acpi_get_pxm(device->handle); 493 node = x86_pci_root_bus_node(busnum);
497 if (pxm >= 0)
498 node = pxm_to_node(pxm);
499 if (node != -1)
500 set_mp_bus_to_node(busnum, node);
501 else
502#endif
503 node = get_mp_bus_to_node(busnum);
504 494
505 if (node != -1 && !node_online(node)) 495 if (node != NUMA_NO_NODE && !node_online(node))
506 node = -1; 496 node = NUMA_NO_NODE;
507 497
508 info = kzalloc(sizeof(*info), GFP_KERNEL); 498 info = kzalloc(sizeof(*info), GFP_KERNEL);
509 if (!info) { 499 if (!info) {
@@ -566,15 +556,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
566 pcie_bus_configure_settings(child); 556 pcie_bus_configure_settings(child);
567 } 557 }
568 558
569 if (bus && node != -1) { 559 if (bus && node != NUMA_NO_NODE)
570#ifdef CONFIG_ACPI_NUMA
571 if (pxm >= 0)
572 dev_printk(KERN_DEBUG, &bus->dev,
573 "on NUMA node %d (pxm %d)\n", node, pxm);
574#else
575 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);
576#endif
577 }
578 561
579 return bus; 562 return bus;
580} 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 9fa3f2cb782a..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);
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 */