aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-16 10:49:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-16 10:49:54 -0400
commit4406c56d0a4da7a37b9180abeaece6cd00bcc874 (patch)
tree65a85fa73a25d24cbed6d163fdcf8df1b934a0be /arch
parent6b7b352f2102e21f9d8f38e932f01d9c5705c073 (diff)
parent5e3573db2bd5db6925159279d99576a4635bdb66 (diff)
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (75 commits) PCI hotplug: clean up acpi_run_hpp() PCI hotplug: acpiphp: use generic pci_configure_slot() PCI hotplug: shpchp: use generic pci_configure_slot() PCI hotplug: pciehp: use generic pci_configure_slot() PCI hotplug: add pci_configure_slot() PCI hotplug: clean up acpi_get_hp_params_from_firmware() interface PCI hotplug: acpiphp: don't cache hotplug_params in acpiphp_bridge PCI hotplug: acpiphp: remove superfluous _HPP/_HPX evaluation PCI: Clear saved_state after the state has been restored PCI PM: Return error codes from pci_pm_resume() PCI: use dev_printk in quirk messages PCI / PCIe portdrv: Fix pcie_portdrv_slot_reset() PCI Hotplug: convert acpi_pci_detect_ejectable() to take an acpi_handle PCI Hotplug: acpiphp: find bridges the easy way PCI: pcie portdrv: remove unused variable PCI / ACPI PM: Propagate wake-up enable for devices w/o ACPI support ACPI PM: Replace wakeup.prepared with reference counter PCI PM: Introduce device flag wakeup_prepared PCI / ACPI PM: Rework some debug messages PCI PM: Simplify PCI wake-up code ... Fixed up conflict in arch/powerpc/kernel/pci_64.c due to OF device tree scanning having been moved and merged for the 32- and 64-bit cases. The 'needs_freset' initialization added in 6e19314cc ("PCI/powerpc: support PCIe fundamental reset") is now in arch/powerpc/kernel/pci_of_scan.c.
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/pci.h1
-rw-r--r--arch/arm/include/asm/pci.h2
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.c10
-rw-r--r--arch/h8300/include/asm/pci.h1
-rw-r--r--arch/ia64/include/asm/pci.h14
-rw-r--r--arch/mips/include/asm/pci.h2
-rw-r--r--arch/mn10300/include/asm/pci.h13
-rw-r--r--arch/parisc/include/asm/pci.h1
-rw-r--r--arch/powerpc/include/asm/pci.h1
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c1
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c10
-rw-r--r--arch/sh/include/asm/pci.h1
-rw-r--r--arch/sparc/include/asm/pci_32.h1
-rw-r--r--arch/sparc/include/asm/pci_64.h1
-rw-r--r--arch/um/include/asm/pci.h1
-rw-r--r--arch/x86/include/asm/pci.h1
-rw-r--r--arch/x86/kernel/pci-dma.c4
-rw-r--r--arch/x86/kernel/quirks.c2
-rw-r--r--arch/x86/pci/amd_bus.c64
-rw-r--r--arch/x86/pci/common.c69
20 files changed, 110 insertions, 90 deletions
diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index d22ace99d13d..dd8dcabf160f 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -52,7 +52,6 @@ struct pci_controller {
52 bus numbers. */ 52 bus numbers. */
53 53
54#define pcibios_assign_all_busses() 1 54#define pcibios_assign_all_busses() 1
55#define pcibios_scan_all_fns(a, b) 0
56 55
57#define PCIBIOS_MIN_IO alpha_mv.min_io_address 56#define PCIBIOS_MIN_IO alpha_mv.min_io_address
58#define PCIBIOS_MIN_MEM alpha_mv.min_mem_address 57#define PCIBIOS_MIN_MEM alpha_mv.min_mem_address
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index 0abf386ba3d3..226cddd2fb65 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -6,8 +6,6 @@
6 6
7#include <mach/hardware.h> /* for PCIBIOS_MIN_* */ 7#include <mach/hardware.h> /* for PCIBIOS_MIN_* */
8 8
9#define pcibios_scan_all_fns(a, b) 0
10
11#ifdef CONFIG_PCI_HOST_ITE8152 9#ifdef CONFIG_PCI_HOST_ITE8152
12/* ITE bridge requires setting latency timer to avoid early bus access 10/* ITE bridge requires setting latency timer to avoid early bus access
13 termination by PIC bus mater devices 11 termination by PIC bus mater devices
diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c
index 43d67534c712..566bdeb499d1 100644
--- a/arch/frv/mb93090-mb00/pci-frv.c
+++ b/arch/frv/mb93090-mb00/pci-frv.c
@@ -86,7 +86,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
86 struct pci_bus *bus; 86 struct pci_bus *bus;
87 struct pci_dev *dev; 87 struct pci_dev *dev;
88 int idx; 88 int idx;
89 struct resource *r, *pr; 89 struct resource *r;
90 90
91 /* Depth-First Search on bus tree */ 91 /* Depth-First Search on bus tree */
92 for (ln=bus_list->next; ln != bus_list; ln=ln->next) { 92 for (ln=bus_list->next; ln != bus_list; ln=ln->next) {
@@ -96,8 +96,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
96 r = &dev->resource[idx]; 96 r = &dev->resource[idx];
97 if (!r->start) 97 if (!r->start)
98 continue; 98 continue;
99 pr = pci_find_parent_resource(dev, r); 99 if (pci_claim_resource(dev, idx) < 0)
100 if (!pr || request_resource(pr, r) < 0)
101 printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev)); 100 printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev));
102 } 101 }
103 } 102 }
@@ -110,7 +109,7 @@ static void __init pcibios_allocate_resources(int pass)
110 struct pci_dev *dev = NULL; 109 struct pci_dev *dev = NULL;
111 int idx, disabled; 110 int idx, disabled;
112 u16 command; 111 u16 command;
113 struct resource *r, *pr; 112 struct resource *r;
114 113
115 for_each_pci_dev(dev) { 114 for_each_pci_dev(dev) {
116 pci_read_config_word(dev, PCI_COMMAND, &command); 115 pci_read_config_word(dev, PCI_COMMAND, &command);
@@ -127,8 +126,7 @@ static void __init pcibios_allocate_resources(int pass)
127 if (pass == disabled) { 126 if (pass == disabled) {
128 DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n", 127 DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n",
129 r->start, r->end, r->flags, disabled, pass); 128 r->start, r->end, r->flags, disabled, pass);
130 pr = pci_find_parent_resource(dev, r); 129 if (pci_claim_resource(dev, idx) < 0) {
131 if (!pr || request_resource(pr, r) < 0) {
132 printk(KERN_ERR "PCI: Cannot allocate resource region %d of device %s\n", idx, pci_name(dev)); 130 printk(KERN_ERR "PCI: Cannot allocate resource region %d of device %s\n", idx, pci_name(dev));
133 /* We'll assign a new address later */ 131 /* We'll assign a new address later */
134 r->end -= r->start; 132 r->end -= r->start;
diff --git a/arch/h8300/include/asm/pci.h b/arch/h8300/include/asm/pci.h
index 97389b35aa35..cc9762091c0a 100644
--- a/arch/h8300/include/asm/pci.h
+++ b/arch/h8300/include/asm/pci.h
@@ -8,7 +8,6 @@
8 */ 8 */
9 9
10#define pcibios_assign_all_busses() 0 10#define pcibios_assign_all_busses() 0
11#define pcibios_scan_all_fns(a, b) 0
12 11
13static inline void pcibios_set_master(struct pci_dev *dev) 12static inline void pcibios_set_master(struct pci_dev *dev)
14{ 13{
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index fcfca56bb850..55281aabe5f2 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -17,7 +17,6 @@
17 * loader. 17 * loader.
18 */ 18 */
19#define pcibios_assign_all_busses() 0 19#define pcibios_assign_all_busses() 0
20#define pcibios_scan_all_fns(a, b) 0
21 20
22#define PCIBIOS_MIN_IO 0x1000 21#define PCIBIOS_MIN_IO 0x1000
23#define PCIBIOS_MIN_MEM 0x10000000 22#define PCIBIOS_MIN_MEM 0x10000000
@@ -135,7 +134,18 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev,
135extern void pcibios_bus_to_resource(struct pci_dev *dev, 134extern void pcibios_bus_to_resource(struct pci_dev *dev,
136 struct resource *res, struct pci_bus_region *region); 135 struct resource *res, struct pci_bus_region *region);
137 136
138#define pcibios_scan_all_fns(a, b) 0 137static inline struct resource *
138pcibios_select_root(struct pci_dev *pdev, struct resource *res)
139{
140 struct resource *root = NULL;
141
142 if (res->flags & IORESOURCE_IO)
143 root = &ioport_resource;
144 if (res->flags & IORESOURCE_MEM)
145 root = &iomem_resource;
146
147 return root;
148}
139 149
140#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 150#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
141static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 151static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index a68d111e55e9..5ebf82572ec0 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -65,8 +65,6 @@ extern int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
65 65
66extern unsigned int pcibios_assign_all_busses(void); 66extern unsigned int pcibios_assign_all_busses(void);
67 67
68#define pcibios_scan_all_fns(a, b) 0
69
70extern unsigned long PCIBIOS_MIN_IO; 68extern unsigned long PCIBIOS_MIN_IO;
71extern unsigned long PCIBIOS_MIN_MEM; 69extern unsigned long PCIBIOS_MIN_MEM;
72 70
diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h
index 19aecc90f7a4..6095a28561dd 100644
--- a/arch/mn10300/include/asm/pci.h
+++ b/arch/mn10300/include/asm/pci.h
@@ -101,7 +101,18 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev,
101 struct resource *res, 101 struct resource *res,
102 struct pci_bus_region *region); 102 struct pci_bus_region *region);
103 103
104#define pcibios_scan_all_fns(a, b) 0 104static inline struct resource *
105pcibios_select_root(struct pci_dev *pdev, struct resource *res)
106{
107 struct resource *root = NULL;
108
109 if (res->flags & IORESOURCE_IO)
110 root = &ioport_resource;
111 if (res->flags & IORESOURCE_MEM)
112 root = &iomem_resource;
113
114 return root;
115}
105 116
106static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 117static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
107{ 118{
diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h
index 7d842d699df2..64c7aa590ae5 100644
--- a/arch/parisc/include/asm/pci.h
+++ b/arch/parisc/include/asm/pci.h
@@ -233,7 +233,6 @@ static inline void pcibios_register_hba(struct pci_hba_data *x)
233 * rp7420/8420 boxes and then revisit this issue. 233 * rp7420/8420 boxes and then revisit this issue.
234 */ 234 */
235#define pcibios_assign_all_busses() (1) 235#define pcibios_assign_all_busses() (1)
236#define pcibios_scan_all_fns(a, b) (0)
237 236
238#define PCIBIOS_MIN_IO 0x10 237#define PCIBIOS_MIN_IO 0x10
239#define PCIBIOS_MIN_MEM 0x1000 /* NBPG - but pci/setup-res.c dies */ 238#define PCIBIOS_MIN_MEM 0x1000 /* NBPG - but pci/setup-res.c dies */
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 7aca4839387b..b5ea626eea2d 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -45,7 +45,6 @@ struct pci_dev;
45 */ 45 */
46#define pcibios_assign_all_busses() \ 46#define pcibios_assign_all_busses() \
47 (ppc_pci_has_flag(PPC_PCI_REASSIGN_ALL_BUS)) 47 (ppc_pci_has_flag(PPC_PCI_REASSIGN_ALL_BUS))
48#define pcibios_scan_all_fns(a, b) 0
49 48
50static inline void pcibios_set_master(struct pci_dev *dev) 49static inline void pcibios_set_master(struct pci_dev *dev)
51{ 50{
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 72c31bcb7aa4..7311fdfb9bf8 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -139,6 +139,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
139 dev->dev.bus = &pci_bus_type; 139 dev->dev.bus = &pci_bus_type;
140 dev->devfn = devfn; 140 dev->devfn = devfn;
141 dev->multifunction = 0; /* maybe a lie? */ 141 dev->multifunction = 0; /* maybe a lie? */
142 dev->needs_freset = 0; /* pcie fundamental reset required */
142 143
143 dev->vendor = get_int_prop(node, "vendor-id", 0xffff); 144 dev->vendor = get_int_prop(node, "vendor-id", 0xffff);
144 dev->device = get_int_prop(node, "device-id", 0xffff); 145 dev->device = get_int_prop(node, "device-id", 0xffff);
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 989d6462c154..ccd8dd03b8c9 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -744,7 +744,15 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
744 744
745static void __rtas_set_slot_reset(struct pci_dn *pdn) 745static void __rtas_set_slot_reset(struct pci_dn *pdn)
746{ 746{
747 rtas_pci_slot_reset (pdn, 1); 747 struct pci_dev *dev = pdn->pcidev;
748
749 /* Determine type of EEH reset required by device,
750 * default hot reset or fundamental reset
751 */
752 if (dev->needs_freset)
753 rtas_pci_slot_reset(pdn, 3);
754 else
755 rtas_pci_slot_reset(pdn, 1);
748 756
749 /* The PCI bus requires that the reset be held high for at least 757 /* The PCI bus requires that the reset be held high for at least
750 * a 100 milliseconds. We wait a bit longer 'just in case'. */ 758 * a 100 milliseconds. We wait a bit longer 'just in case'. */
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index d3633f513ebc..4163950cd1c6 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -10,7 +10,6 @@
10 or architectures with incomplete PCI setup by the loader */ 10 or architectures with incomplete PCI setup by the loader */
11 11
12#define pcibios_assign_all_busses() 1 12#define pcibios_assign_all_busses() 1
13#define pcibios_scan_all_fns(a, b) 0
14 13
15/* 14/*
16 * A board can define one or more PCI channels that represent built-in (or 15 * A board can define one or more PCI channels that represent built-in (or
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h
index ac0e8369fd97..e769f668a4b5 100644
--- a/arch/sparc/include/asm/pci_32.h
+++ b/arch/sparc/include/asm/pci_32.h
@@ -10,7 +10,6 @@
10 * or architectures with incomplete PCI setup by the loader. 10 * or architectures with incomplete PCI setup by the loader.
11 */ 11 */
12#define pcibios_assign_all_busses() 0 12#define pcibios_assign_all_busses() 0
13#define pcibios_scan_all_fns(a, b) 0
14 13
15#define PCIBIOS_MIN_IO 0UL 14#define PCIBIOS_MIN_IO 0UL
16#define PCIBIOS_MIN_MEM 0UL 15#define PCIBIOS_MIN_MEM 0UL
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index 5cc9f6aa5494..b63e51c3c3ee 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -10,7 +10,6 @@
10 * or architectures with incomplete PCI setup by the loader. 10 * or architectures with incomplete PCI setup by the loader.
11 */ 11 */
12#define pcibios_assign_all_busses() 0 12#define pcibios_assign_all_busses() 0
13#define pcibios_scan_all_fns(a, b) 0
14 13
15#define PCIBIOS_MIN_IO 0UL 14#define PCIBIOS_MIN_IO 0UL
16#define PCIBIOS_MIN_MEM 0UL 15#define PCIBIOS_MIN_MEM 0UL
diff --git a/arch/um/include/asm/pci.h b/arch/um/include/asm/pci.h
index 59923199cdc3..b44cf59ede1e 100644
--- a/arch/um/include/asm/pci.h
+++ b/arch/um/include/asm/pci.h
@@ -2,6 +2,5 @@
2#define __UM_PCI_H 2#define __UM_PCI_H
3 3
4#define PCI_DMA_BUS_IS_PHYS (1) 4#define PCI_DMA_BUS_IS_PHYS (1)
5#define pcibios_scan_all_fns(a, b) 0
6 5
7#endif 6#endif
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 1ff685ca221c..f76a162c082c 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -48,7 +48,6 @@ extern unsigned int pcibios_assign_all_busses(void);
48#else 48#else
49#define pcibios_assign_all_busses() 0 49#define pcibios_assign_all_busses() 0
50#endif 50#endif
51#define pcibios_scan_all_fns(a, b) 0
52 51
53extern unsigned long pci_mem_start; 52extern unsigned long pci_mem_start;
54#define PCIBIOS_MIN_IO 0x1000 53#define PCIBIOS_MIN_IO 0x1000
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index d71c8655905b..64b838eac18c 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -225,10 +225,8 @@ static __init int iommu_setup(char *p)
225 if (!strncmp(p, "soft", 4)) 225 if (!strncmp(p, "soft", 4))
226 swiotlb = 1; 226 swiotlb = 1;
227#endif 227#endif
228 if (!strncmp(p, "pt", 2)) { 228 if (!strncmp(p, "pt", 2))
229 iommu_pass_through = 1; 229 iommu_pass_through = 1;
230 return 1;
231 }
232 230
233 gart_parse_options(p); 231 gart_parse_options(p);
234 232
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index af71d06624bf..6c3b2c6fd772 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -508,7 +508,7 @@ static void __init quirk_amd_nb_node(struct pci_dev *dev)
508 508
509 pci_read_config_dword(nb_ht, 0x60, &val); 509 pci_read_config_dword(nb_ht, 0x60, &val);
510 set_dev_node(&dev->dev, val & 7); 510 set_dev_node(&dev->dev, val & 7);
511 pci_dev_put(dev); 511 pci_dev_put(nb_ht);
512} 512}
513 513
514DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB, 514DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB,
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index 3ffa10df20b9..572ee9782f2a 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -15,63 +15,6 @@
15 * also get peer root bus resource for io,mmio 15 * also get peer root bus resource for io,mmio
16 */ 16 */
17 17
18#ifdef CONFIG_NUMA
19
20#define BUS_NR 256
21
22#ifdef CONFIG_X86_64
23
24static int mp_bus_to_node[BUS_NR];
25
26void set_mp_bus_to_node(int busnum, int node)
27{
28 if (busnum >= 0 && busnum < BUS_NR)
29 mp_bus_to_node[busnum] = node;
30}
31
32int get_mp_bus_to_node(int busnum)
33{
34 int node = -1;
35
36 if (busnum < 0 || busnum > (BUS_NR - 1))
37 return node;
38
39 node = mp_bus_to_node[busnum];
40
41 /*
42 * let numa_node_id to decide it later in dma_alloc_pages
43 * if there is no ram on that node
44 */
45 if (node != -1 && !node_online(node))
46 node = -1;
47
48 return node;
49}
50
51#else /* CONFIG_X86_32 */
52
53static unsigned char mp_bus_to_node[BUS_NR];
54
55void set_mp_bus_to_node(int busnum, int node)
56{
57 if (busnum >= 0 && busnum < BUS_NR)
58 mp_bus_to_node[busnum] = (unsigned char) node;
59}
60
61int get_mp_bus_to_node(int busnum)
62{
63 int node;
64
65 if (busnum < 0 || busnum > (BUS_NR - 1))
66 return 0;
67 node = mp_bus_to_node[busnum];
68 return node;
69}
70
71#endif /* CONFIG_X86_32 */
72
73#endif /* CONFIG_NUMA */
74
75#ifdef CONFIG_X86_64 18#ifdef CONFIG_X86_64
76 19
77/* 20/*
@@ -301,11 +244,6 @@ static int __init early_fill_mp_bus_info(void)
301 u64 val; 244 u64 val;
302 u32 address; 245 u32 address;
303 246
304#ifdef CONFIG_NUMA
305 for (i = 0; i < BUS_NR; i++)
306 mp_bus_to_node[i] = -1;
307#endif
308
309 if (!early_pci_allowed()) 247 if (!early_pci_allowed())
310 return -1; 248 return -1;
311 249
@@ -346,7 +284,7 @@ static int __init early_fill_mp_bus_info(void)
346 node = (reg >> 4) & 0x07; 284 node = (reg >> 4) & 0x07;
347#ifdef CONFIG_NUMA 285#ifdef CONFIG_NUMA
348 for (j = min_bus; j <= max_bus; j++) 286 for (j = min_bus; j <= max_bus; j++)
349 mp_bus_to_node[j] = (unsigned char) node; 287 set_mp_bus_to_node(j, node);
350#endif 288#endif
351 link = (reg >> 8) & 0x03; 289 link = (reg >> 8) & 0x03;
352 290
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 2202b6257b82..5db96d4304de 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -600,3 +600,72 @@ struct pci_bus * __devinit pci_scan_bus_with_sysdata(int busno)
600{ 600{
601 return pci_scan_bus_on_node(busno, &pci_root_ops, -1); 601 return pci_scan_bus_on_node(busno, &pci_root_ops, -1);
602} 602}
603
604/*
605 * NUMA info for PCI busses
606 *
607 * Early arch code is responsible for filling in reasonable values here.
608 * A node id of "-1" means "use current node". In other words, if a bus
609 * has a -1 node id, it's not tightly coupled to any particular chunk
610 * of memory (as is the case on some Nehalem systems).
611 */
612#ifdef CONFIG_NUMA
613
614#define BUS_NR 256
615
616#ifdef CONFIG_X86_64
617
618static int mp_bus_to_node[BUS_NR] = {
619 [0 ... BUS_NR - 1] = -1
620};
621
622void set_mp_bus_to_node(int busnum, int node)
623{
624 if (busnum >= 0 && busnum < BUS_NR)
625 mp_bus_to_node[busnum] = node;
626}
627
628int get_mp_bus_to_node(int busnum)
629{
630 int node = -1;
631
632 if (busnum < 0 || busnum > (BUS_NR - 1))
633 return node;
634
635 node = mp_bus_to_node[busnum];
636
637 /*
638 * let numa_node_id to decide it later in dma_alloc_pages
639 * if there is no ram on that node
640 */
641 if (node != -1 && !node_online(node))
642 node = -1;
643
644 return node;
645}
646
647#else /* CONFIG_X86_32 */
648
649static unsigned char mp_bus_to_node[BUS_NR] = {
650 [0 ... BUS_NR - 1] = -1
651};
652
653void set_mp_bus_to_node(int busnum, int node)
654{
655 if (busnum >= 0 && busnum < BUS_NR)
656 mp_bus_to_node[busnum] = (unsigned char) node;
657}
658
659int get_mp_bus_to_node(int busnum)
660{
661 int node;
662
663 if (busnum < 0 || busnum > (BUS_NR - 1))
664 return 0;
665 node = mp_bus_to_node[busnum];
666 return node;
667}
668
669#endif /* CONFIG_X86_32 */
670
671#endif /* CONFIG_NUMA */