aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-07 18:41:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-07 18:41:01 -0500
commitb424e8d3b438e841cd1700f6433a100a5d611e4a (patch)
tree545638d0b925de4c7f740286760767cca86cb91e /arch
parent7c7758f99d39d529a64d4f60d22129bbf2f16d74 (diff)
parentf6dc1e5e3d4b523e1616b43beddb04e4fb1d376a (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: (98 commits) PCI PM: Put PM callbacks in the order of execution PCI PM: Run default PM callbacks for all devices using new framework PCI PM: Register power state of devices during initialization PCI PM: Call pci_fixup_device from legacy routines PCI PM: Rearrange code in pci-driver.c PCI PM: Avoid touching devices behind bridges in unknown state PCI PM: Move pci_has_legacy_pm_support PCI PM: Power-manage devices without drivers during suspend-resume PCI PM: Add suspend counterpart of pci_reenable_device PCI PM: Fix poweroff and restore callbacks PCI: Use msleep instead of cpu_relax during ASPM link retraining PCI: PCIe portdrv: Add kerneldoc comments to remining core funtions PCI: PCIe portdrv: Rearrange code so that related things are together PCI: PCIe portdrv: Fix suspend and resume of PCI Express port services PCI: PCIe portdrv: Add kerneldoc comments to some core functions x86/PCI: Do not use interrupt links for devices using MSI-X net: sfc: Use pci_clear_master() to disable bus mastering PCI: Add pci_clear_master() as opposite of pci_set_master() PCI hotplug: remove redundant test in cpq hotplug PCI: pciehp: cleanup register and field definitions ...
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci.c18
-rw-r--r--arch/alpha/kernel/pci_impl.h13
-rw-r--r--arch/alpha/kernel/sys_dp264.c2
-rw-r--r--arch/alpha/kernel/sys_eiger.c2
-rw-r--r--arch/alpha/kernel/sys_miata.c2
-rw-r--r--arch/alpha/kernel/sys_noritake.c2
-rw-r--r--arch/alpha/kernel/sys_ruffian.c2
-rw-r--r--arch/alpha/kernel/sys_sable.c2
-rw-r--r--arch/arm/include/asm/mach/pci.h2
-rw-r--r--arch/arm/kernel/bios32.c27
-rw-r--r--arch/arm/mach-integrator/pci.c11
-rw-r--r--arch/mips/pci/pci-ip27.c6
-rw-r--r--arch/mips/pci/pci.c24
-rw-r--r--arch/powerpc/kernel/prom_parse.c7
-rw-r--r--arch/sh/drivers/pci/ops-cayman.c9
-rw-r--r--arch/sh/drivers/pci/pci.c22
-rw-r--r--arch/x86/kernel/pci-dma.c2
-rw-r--r--arch/x86/mm/init_32.c2
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/pci/acpi.c7
-rw-r--r--arch/x86/pci/common.c12
-rw-r--r--arch/x86/pci/i386.c4
-rw-r--r--arch/x86/pci/init.c3
-rw-r--r--arch/x86/pci/irq.c54
-rw-r--r--arch/x86/pci/visws.c20
25 files changed, 66 insertions, 191 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index ff8cb638472e..a3b938811400 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -320,24 +320,6 @@ pcibios_update_irq(struct pci_dev *dev, int irq)
320 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); 320 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
321} 321}
322 322
323/* Most Alphas have straight-forward swizzling needs. */
324
325u8 __init
326common_swizzle(struct pci_dev *dev, u8 *pinp)
327{
328 u8 pin = *pinp;
329
330 while (dev->bus->parent) {
331 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
332 /* Move up the chain of bridges. */
333 dev = dev->bus->self;
334 }
335 *pinp = pin;
336
337 /* The slot is the slot of the last bridge. */
338 return PCI_SLOT(dev->devfn);
339}
340
341void 323void
342pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 324pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
343 struct resource *res) 325 struct resource *res)
diff --git a/arch/alpha/kernel/pci_impl.h b/arch/alpha/kernel/pci_impl.h
index f8b74995a002..00edd04b585e 100644
--- a/arch/alpha/kernel/pci_impl.h
+++ b/arch/alpha/kernel/pci_impl.h
@@ -106,16 +106,11 @@ struct pci_iommu_arena;
106 * Where A = pin 1, B = pin 2 and so on and pin=0 = default = A. 106 * Where A = pin 1, B = pin 2 and so on and pin=0 = default = A.
107 * Thus, each swizzle is ((pin-1) + (device#-4)) % 4 107 * Thus, each swizzle is ((pin-1) + (device#-4)) % 4
108 * 108 *
109 * The following code swizzles for exactly one bridge. The routine 109 * pci_swizzle_interrupt_pin() swizzles for exactly one bridge. The routine
110 * common_swizzle below handles multiple bridges. But there are a 110 * pci_common_swizzle() handles multiple bridges. But there are a
111 * couple boards that do strange things, so we define this here. 111 * couple boards that do strange things.
112 */ 112 */
113 113
114static inline u8 bridge_swizzle(u8 pin, u8 slot)
115{
116 return (((pin-1) + slot) % 4) + 1;
117}
118
119 114
120/* The following macro is used to implement the table-based irq mapping 115/* The following macro is used to implement the table-based irq mapping
121 function for all single-bus Alphas. */ 116 function for all single-bus Alphas. */
@@ -184,7 +179,7 @@ extern int pci_probe_only;
184extern unsigned long alpha_agpgart_size; 179extern unsigned long alpha_agpgart_size;
185 180
186extern void common_init_pci(void); 181extern void common_init_pci(void);
187extern u8 common_swizzle(struct pci_dev *, u8 *); 182#define common_swizzle pci_common_swizzle
188extern struct pci_controller *alloc_pci_controller(void); 183extern struct pci_controller *alloc_pci_controller(void);
189extern struct resource *alloc_resource(void); 184extern struct resource *alloc_resource(void);
190 185
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index ab44c164d9d4..9c9d1fd4155f 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -481,7 +481,7 @@ monet_swizzle(struct pci_dev *dev, u8 *pinp)
481 slot = PCI_SLOT(dev->devfn); 481 slot = PCI_SLOT(dev->devfn);
482 break; 482 break;
483 } 483 }
484 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)) ; 484 pin = pci_swizzle_interrupt_pin(dev, pin);
485 485
486 /* Move up the chain of bridges. */ 486 /* Move up the chain of bridges. */
487 dev = dev->bus->self; 487 dev = dev->bus->self;
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c
index 7ef3b6fb3700..baf60f36cbd7 100644
--- a/arch/alpha/kernel/sys_eiger.c
+++ b/arch/alpha/kernel/sys_eiger.c
@@ -204,7 +204,7 @@ eiger_swizzle(struct pci_dev *dev, u8 *pinp)
204 break; 204 break;
205 } 205 }
206 /* Must be a card-based bridge. */ 206 /* Must be a card-based bridge. */
207 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); 207 pin = pci_swizzle_interrupt_pin(dev, pin);
208 208
209 /* Move up the chain of bridges. */ 209 /* Move up the chain of bridges. */
210 dev = dev->bus->self; 210 dev = dev->bus->self;
diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c
index 910b43cd63e8..61ccd95579ec 100644
--- a/arch/alpha/kernel/sys_miata.c
+++ b/arch/alpha/kernel/sys_miata.c
@@ -219,7 +219,7 @@ miata_swizzle(struct pci_dev *dev, u8 *pinp)
219 slot = PCI_SLOT(dev->devfn) + 9; 219 slot = PCI_SLOT(dev->devfn) + 9;
220 break; 220 break;
221 } 221 }
222 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); 222 pin = pci_swizzle_interrupt_pin(dev, pin);
223 223
224 /* Move up the chain of bridges. */ 224 /* Move up the chain of bridges. */
225 dev = dev->bus->self; 225 dev = dev->bus->self;
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c
index eb2a1d63f484..538876b62449 100644
--- a/arch/alpha/kernel/sys_noritake.c
+++ b/arch/alpha/kernel/sys_noritake.c
@@ -257,7 +257,7 @@ noritake_swizzle(struct pci_dev *dev, u8 *pinp)
257 slot = PCI_SLOT(dev->devfn) + 15; 257 slot = PCI_SLOT(dev->devfn) + 15;
258 break; 258 break;
259 } 259 }
260 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)) ; 260 pin = pci_swizzle_interrupt_pin(dev, pin);
261 261
262 /* Move up the chain of bridges. */ 262 /* Move up the chain of bridges. */
263 dev = dev->bus->self; 263 dev = dev->bus->self;
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c
index 5b99cf3cd69c..f15a329b6011 100644
--- a/arch/alpha/kernel/sys_ruffian.c
+++ b/arch/alpha/kernel/sys_ruffian.c
@@ -160,7 +160,7 @@ ruffian_swizzle(struct pci_dev *dev, u8 *pinp)
160 slot = PCI_SLOT(dev->devfn) + 10; 160 slot = PCI_SLOT(dev->devfn) + 10;
161 break; 161 break;
162 } 162 }
163 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); 163 pin = pci_swizzle_interrupt_pin(dev, pin);
164 164
165 /* Move up the chain of bridges. */ 165 /* Move up the chain of bridges. */
166 dev = dev->bus->self; 166 dev = dev->bus->self;
diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c
index a4555f497639..d232e42be018 100644
--- a/arch/alpha/kernel/sys_sable.c
+++ b/arch/alpha/kernel/sys_sable.c
@@ -425,7 +425,7 @@ lynx_swizzle(struct pci_dev *dev, u8 *pinp)
425 slot = PCI_SLOT(dev->devfn) + 11; 425 slot = PCI_SLOT(dev->devfn) + 11;
426 break; 426 break;
427 } 427 }
428 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)) ; 428 pin = pci_swizzle_interrupt_pin(dev, pin);
429 429
430 /* Move up the chain of bridges. */ 430 /* Move up the chain of bridges. */
431 dev = dev->bus->self; 431 dev = dev->bus->self;
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 32da1ae17e06..a38bdc7afa34 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -42,7 +42,7 @@ struct pci_sys_data {
42/* 42/*
43 * This is the standard PCI-PCI bridge swizzling algorithm. 43 * This is the standard PCI-PCI bridge swizzling algorithm.
44 */ 44 */
45u8 pci_std_swizzle(struct pci_dev *dev, u8 *pinp); 45#define pci_std_swizzle pci_common_swizzle
46 46
47/* 47/*
48 * Call this with your hw_pci struct to initialise the PCI system. 48 * Call this with your hw_pci struct to initialise the PCI system.
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 17a59b6e521f..809681900ec8 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -480,33 +480,6 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
480#endif 480#endif
481 481
482/* 482/*
483 * This is the standard PCI-PCI bridge swizzling algorithm:
484 *
485 * Dev: 0 1 2 3
486 * A A B C D
487 * B B C D A
488 * C C D A B
489 * D D A B C
490 * ^^^^^^^^^^ irq pin on bridge
491 */
492u8 __devinit pci_std_swizzle(struct pci_dev *dev, u8 *pinp)
493{
494 int pin = *pinp - 1;
495
496 while (dev->bus->self) {
497 pin = (pin + PCI_SLOT(dev->devfn)) & 3;
498 /*
499 * move up the chain of bridges,
500 * swizzling as we go.
501 */
502 dev = dev->bus->self;
503 }
504 *pinp = pin + 1;
505
506 return PCI_SLOT(dev->devfn);
507}
508
509/*
510 * Swizzle the device pin each time we cross a bridge. 483 * Swizzle the device pin each time we cross a bridge.
511 * This might update pin and returns the slot number. 484 * This might update pin and returns the slot number.
512 */ 485 */
diff --git a/arch/arm/mach-integrator/pci.c b/arch/arm/mach-integrator/pci.c
index af7d3ff013ec..2fdb95433f0a 100644
--- a/arch/arm/mach-integrator/pci.c
+++ b/arch/arm/mach-integrator/pci.c
@@ -63,13 +63,7 @@
63 * 63 *
64 * Where A = pin 1, B = pin 2 and so on and pin=0 = default = A. 64 * Where A = pin 1, B = pin 2 and so on and pin=0 = default = A.
65 * Thus, each swizzle is ((pin-1) + (device#-4)) % 4 65 * Thus, each swizzle is ((pin-1) + (device#-4)) % 4
66 *
67 * The following code swizzles for exactly one bridge.
68 */ 66 */
69static inline int bridge_swizzle(int pin, unsigned int slot)
70{
71 return (pin + slot) & 3;
72}
73 67
74/* 68/*
75 * This routine handles multiple bridges. 69 * This routine handles multiple bridges.
@@ -81,15 +75,14 @@ static u8 __init integrator_swizzle(struct pci_dev *dev, u8 *pinp)
81 if (pin == 0) 75 if (pin == 0)
82 pin = 1; 76 pin = 1;
83 77
84 pin -= 1;
85 while (dev->bus->self) { 78 while (dev->bus->self) {
86 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); 79 pin = pci_swizzle_interrupt_pin(dev, pin);
87 /* 80 /*
88 * move up the chain of bridges, swizzling as we go. 81 * move up the chain of bridges, swizzling as we go.
89 */ 82 */
90 dev = dev->bus->self; 83 dev = dev->bus->self;
91 } 84 }
92 *pinp = pin + 1; 85 *pinp = pin;
93 86
94 return PCI_SLOT(dev->devfn); 87 return PCI_SLOT(dev->devfn);
95} 88}
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index f97ab1461012..dda6f2058665 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -146,12 +146,6 @@ int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
146 return 0; 146 return 0;
147} 147}
148 148
149/* Most MIPS systems have straight-forward swizzling needs. */
150static inline u8 bridge_swizzle(u8 pin, u8 slot)
151{
152 return (((pin - 1) + slot) % 4) + 1;
153}
154
155static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev) 149static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev)
156{ 150{
157 while (dev->bus->parent) { 151 while (dev->bus->parent) {
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 62cae740e250..b0eb9e75c682 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -149,28 +149,6 @@ out:
149 "Skipping PCI bus scan due to resource conflict\n"); 149 "Skipping PCI bus scan due to resource conflict\n");
150} 150}
151 151
152/* Most MIPS systems have straight-forward swizzling needs. */
153
154static inline u8 bridge_swizzle(u8 pin, u8 slot)
155{
156 return (((pin - 1) + slot) % 4) + 1;
157}
158
159static u8 __init common_swizzle(struct pci_dev *dev, u8 *pinp)
160{
161 u8 pin = *pinp;
162
163 while (dev->bus->parent) {
164 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
165 /* Move up the chain of bridges. */
166 dev = dev->bus->self;
167 }
168 *pinp = pin;
169
170 /* The slot is the slot of the last bridge. */
171 return PCI_SLOT(dev->devfn);
172}
173
174static int __init pcibios_init(void) 152static int __init pcibios_init(void)
175{ 153{
176 struct pci_controller *hose; 154 struct pci_controller *hose;
@@ -179,7 +157,7 @@ static int __init pcibios_init(void)
179 for (hose = hose_head; hose; hose = hose->next) 157 for (hose = hose_head; hose; hose = hose->next)
180 pcibios_scanbus(hose); 158 pcibios_scanbus(hose);
181 159
182 pci_fixup_irqs(common_swizzle, pcibios_map_irq); 160 pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
183 161
184 pci_initialized = 1; 162 pci_initialized = 1;
185 163
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 8c1335566089..8f0856f312da 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -232,11 +232,6 @@ int of_pci_address_to_resource(struct device_node *dev, int bar,
232} 232}
233EXPORT_SYMBOL_GPL(of_pci_address_to_resource); 233EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
234 234
235static u8 of_irq_pci_swizzle(u8 slot, u8 pin)
236{
237 return (((pin - 1) + slot) % 4) + 1;
238}
239
240int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq) 235int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
241{ 236{
242 struct device_node *dn, *ppnode; 237 struct device_node *dn, *ppnode;
@@ -306,7 +301,7 @@ int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
306 /* We can only get here if we hit a P2P bridge with no node, 301 /* We can only get here if we hit a P2P bridge with no node,
307 * let's do standard swizzling and try again 302 * let's do standard swizzling and try again
308 */ 303 */
309 lspec = of_irq_pci_swizzle(PCI_SLOT(pdev->devfn), lspec); 304 lspec = pci_swizzle_interrupt_pin(pdev, lspec);
310 pdev = ppdev; 305 pdev = ppdev;
311 } 306 }
312 307
diff --git a/arch/sh/drivers/pci/ops-cayman.c b/arch/sh/drivers/pci/ops-cayman.c
index 5ccf9ea3a9de..38ef76207af6 100644
--- a/arch/sh/drivers/pci/ops-cayman.c
+++ b/arch/sh/drivers/pci/ops-cayman.c
@@ -5,11 +5,6 @@
5#include <cpu/irq.h> 5#include <cpu/irq.h>
6#include "pci-sh5.h" 6#include "pci-sh5.h"
7 7
8static inline u8 bridge_swizzle(u8 pin, u8 slot)
9{
10 return (((pin - 1) + slot) % 4) + 1;
11}
12
13int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) 8int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
14{ 9{
15 int result = -1; 10 int result = -1;
@@ -42,7 +37,7 @@ int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
42 while (dev->bus->number > 0) { 37 while (dev->bus->number > 0) {
43 38
44 slot = path[i].slot = PCI_SLOT(dev->devfn); 39 slot = path[i].slot = PCI_SLOT(dev->devfn);
45 pin = path[i].pin = bridge_swizzle(pin, slot); 40 pin = path[i].pin = pci_swizzle_interrupt_pin(dev, pin);
46 dev = dev->bus->self; 41 dev = dev->bus->self;
47 i++; 42 i++;
48 if (i > 3) panic("PCI path to root bus too long!\n"); 43 if (i > 3) panic("PCI path to root bus too long!\n");
@@ -56,7 +51,7 @@ int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
56 if ((slot < 3) || (i == 0)) { 51 if ((slot < 3) || (i == 0)) {
57 /* Bus 0 (incl. PCI-PCI bridge itself) : perform the final 52 /* Bus 0 (incl. PCI-PCI bridge itself) : perform the final
58 swizzle now. */ 53 swizzle now. */
59 result = IRQ_INTA + bridge_swizzle(pin, slot) - 1; 54 result = IRQ_INTA + pci_swizzle_interrupt_pin(dev, pin) - 1;
60 } else { 55 } else {
61 i--; 56 i--;
62 slot = path[i].slot; 57 slot = path[i].slot;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index d3839e609aac..e36c7b870861 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -21,26 +21,6 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24static inline u8 bridge_swizzle(u8 pin, u8 slot)
25{
26 return (((pin - 1) + slot) % 4) + 1;
27}
28
29static u8 __init simple_swizzle(struct pci_dev *dev, u8 *pinp)
30{
31 u8 pin = *pinp;
32
33 while (dev->bus->parent) {
34 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
35 /* Move up the chain of bridges. */
36 dev = dev->bus->self;
37 }
38 *pinp = pin;
39
40 /* The slot is the slot of the last bridge. */
41 return PCI_SLOT(dev->devfn);
42}
43
44static int __init pcibios_init(void) 24static int __init pcibios_init(void)
45{ 25{
46 struct pci_channel *p; 26 struct pci_channel *p;
@@ -61,7 +41,7 @@ static int __init pcibios_init(void)
61 busno = bus->subordinate + 1; 41 busno = bus->subordinate + 1;
62 } 42 }
63 43
64 pci_fixup_irqs(simple_swizzle, pcibios_map_platform_irq); 44 pci_fixup_irqs(pci_common_swizzle, pcibios_map_platform_irq);
65 45
66 return 0; 46 return 0;
67} 47}
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 19a1044a0cd9..b25428533141 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -38,7 +38,7 @@ EXPORT_SYMBOL(bad_dma_address);
38 be probably a smaller DMA mask, but this is bug-to-bug compatible 38 be probably a smaller DMA mask, but this is bug-to-bug compatible
39 to older i386. */ 39 to older i386. */
40struct device x86_dma_fallback_dev = { 40struct device x86_dma_fallback_dev = {
41 .bus_id = "fallback device", 41 .init_name = "fallback device",
42 .coherent_dma_mask = DMA_32BIT_MASK, 42 .coherent_dma_mask = DMA_32BIT_MASK,
43 .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask, 43 .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask,
44}; 44};
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 544d724caeee..88f1b10de3be 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -328,6 +328,8 @@ int devmem_is_allowed(unsigned long pagenr)
328{ 328{
329 if (pagenr <= 256) 329 if (pagenr <= 256)
330 return 1; 330 return 1;
331 if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
332 return 0;
331 if (!page_is_ram(pagenr)) 333 if (!page_is_ram(pagenr))
332 return 1; 334 return 1;
333 return 0; 335 return 0;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 54c437e96541..23f68e77ad1f 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -888,6 +888,8 @@ int devmem_is_allowed(unsigned long pagenr)
888{ 888{
889 if (pagenr <= 256) 889 if (pagenr <= 256)
890 return 1; 890 return 1;
891 if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
892 return 0;
891 if (!page_is_ram(pagenr)) 893 if (!page_is_ram(pagenr))
892 return 1; 894 return 1;
893 return 0; 895 return 0;
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 9e5752fe4d15..c0ecf250fe51 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -210,11 +210,10 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
210 if (bus && node != -1) { 210 if (bus && node != -1) {
211#ifdef CONFIG_ACPI_NUMA 211#ifdef CONFIG_ACPI_NUMA
212 if (pxm >= 0) 212 if (pxm >= 0)
213 printk(KERN_DEBUG "bus %02x -> pxm %d -> node %d\n", 213 dev_printk(KERN_DEBUG, &bus->dev,
214 busnum, pxm, node); 214 "on NUMA node %d (pxm %d)\n", node, pxm);
215#else 215#else
216 printk(KERN_DEBUG "bus %02x -> node %d\n", 216 dev_printk(KERN_DEBUG, &bus->dev, "on NUMA node %d\n", node);
217 busnum, node);
218#endif 217#endif
219 } 218 }
220 219
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 62ddb73e09ed..82d22fc601ae 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -551,17 +551,25 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
551 if ((err = pci_enable_resources(dev, mask)) < 0) 551 if ((err = pci_enable_resources(dev, mask)) < 0)
552 return err; 552 return err;
553 553
554 if (!dev->msi_enabled) 554 if (!pci_dev_msi_enabled(dev))
555 return pcibios_enable_irq(dev); 555 return pcibios_enable_irq(dev);
556 return 0; 556 return 0;
557} 557}
558 558
559void pcibios_disable_device (struct pci_dev *dev) 559void pcibios_disable_device (struct pci_dev *dev)
560{ 560{
561 if (!dev->msi_enabled && pcibios_disable_irq) 561 if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq)
562 pcibios_disable_irq(dev); 562 pcibios_disable_irq(dev);
563} 563}
564 564
565int pci_ext_cfg_avail(struct pci_dev *dev)
566{
567 if (raw_pci_ext_ops)
568 return 1;
569 else
570 return 0;
571}
572
565struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node) 573struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node)
566{ 574{
567 struct pci_bus *bus = NULL; 575 struct pci_bus *bus = NULL;
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index e51bf2cda4b0..f884740da318 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -129,7 +129,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
129 pr = pci_find_parent_resource(dev, r); 129 pr = pci_find_parent_resource(dev, r);
130 if (!r->start || !pr || 130 if (!r->start || !pr ||
131 request_resource(pr, r) < 0) { 131 request_resource(pr, r) < 0) {
132 dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx); 132 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx);
133 /* 133 /*
134 * Something is wrong with the region. 134 * Something is wrong with the region.
135 * Invalidate the resource to prevent 135 * Invalidate the resource to prevent
@@ -170,7 +170,7 @@ static void __init pcibios_allocate_resources(int pass)
170 r->flags, disabled, pass); 170 r->flags, disabled, pass);
171 pr = pci_find_parent_resource(dev, r); 171 pr = pci_find_parent_resource(dev, r);
172 if (!pr || request_resource(pr, r) < 0) { 172 if (!pr || request_resource(pr, r) < 0) {
173 dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx); 173 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx);
174 /* We'll assign a new address later */ 174 /* We'll assign a new address later */
175 r->end -= r->start; 175 r->end -= r->start;
176 r->start = 0; 176 r->start = 0;
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c
index bec3b048e72b..25a1f8efed4a 100644
--- a/arch/x86/pci/init.c
+++ b/arch/x86/pci/init.c
@@ -12,7 +12,8 @@ static __init int pci_arch_init(void)
12 type = pci_direct_probe(); 12 type = pci_direct_probe();
13#endif 13#endif
14 14
15 pci_mmcfg_early_init(); 15 if (!(pci_probe & PCI_PROBE_NOEARLY))
16 pci_mmcfg_early_init();
16 17
17#ifdef CONFIG_PCI_OLPC 18#ifdef CONFIG_PCI_OLPC
18 if (!pci_olpc_init()) 19 if (!pci_olpc_init())
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 373b9afe6d44..4064345cf144 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -533,7 +533,7 @@ static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
533{ 533{
534 struct pci_dev *bridge; 534 struct pci_dev *bridge;
535 int pin = pci_get_interrupt_pin(dev, &bridge); 535 int pin = pci_get_interrupt_pin(dev, &bridge);
536 return pcibios_set_irq_routing(bridge, pin, irq); 536 return pcibios_set_irq_routing(bridge, pin - 1, irq);
537} 537}
538 538
539#endif 539#endif
@@ -887,7 +887,6 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
887 dev_dbg(&dev->dev, "no interrupt pin\n"); 887 dev_dbg(&dev->dev, "no interrupt pin\n");
888 return 0; 888 return 0;
889 } 889 }
890 pin = pin - 1;
891 890
892 /* Find IRQ routing entry */ 891 /* Find IRQ routing entry */
893 892
@@ -897,17 +896,17 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
897 info = pirq_get_info(dev); 896 info = pirq_get_info(dev);
898 if (!info) { 897 if (!info) {
899 dev_dbg(&dev->dev, "PCI INT %c not found in routing table\n", 898 dev_dbg(&dev->dev, "PCI INT %c not found in routing table\n",
900 'A' + pin); 899 'A' + pin - 1);
901 return 0; 900 return 0;
902 } 901 }
903 pirq = info->irq[pin].link; 902 pirq = info->irq[pin - 1].link;
904 mask = info->irq[pin].bitmap; 903 mask = info->irq[pin - 1].bitmap;
905 if (!pirq) { 904 if (!pirq) {
906 dev_dbg(&dev->dev, "PCI INT %c not routed\n", 'A' + pin); 905 dev_dbg(&dev->dev, "PCI INT %c not routed\n", 'A' + pin - 1);
907 return 0; 906 return 0;
908 } 907 }
909 dev_dbg(&dev->dev, "PCI INT %c -> PIRQ %02x, mask %04x, excl %04x", 908 dev_dbg(&dev->dev, "PCI INT %c -> PIRQ %02x, mask %04x, excl %04x",
910 'A' + pin, pirq, mask, pirq_table->exclusive_irqs); 909 'A' + pin - 1, pirq, mask, pirq_table->exclusive_irqs);
911 mask &= pcibios_irq_mask; 910 mask &= pcibios_irq_mask;
912 911
913 /* Work around broken HP Pavilion Notebooks which assign USB to 912 /* Work around broken HP Pavilion Notebooks which assign USB to
@@ -949,7 +948,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
949 newirq = i; 948 newirq = i;
950 } 949 }
951 } 950 }
952 dev_dbg(&dev->dev, "PCI INT %c -> newirq %d", 'A' + pin, newirq); 951 dev_dbg(&dev->dev, "PCI INT %c -> newirq %d", 'A' + pin - 1, newirq);
953 952
954 /* Check if it is hardcoded */ 953 /* Check if it is hardcoded */
955 if ((pirq & 0xf0) == 0xf0) { 954 if ((pirq & 0xf0) == 0xf0) {
@@ -977,18 +976,18 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
977 return 0; 976 return 0;
978 } 977 }
979 } 978 }
980 dev_info(&dev->dev, "%s PCI INT %c -> IRQ %d\n", msg, 'A' + pin, irq); 979 dev_info(&dev->dev, "%s PCI INT %c -> IRQ %d\n", msg, 'A' + pin - 1, irq);
981 980
982 /* Update IRQ for all devices with the same pirq value */ 981 /* Update IRQ for all devices with the same pirq value */
983 while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) { 982 while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) {
984 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin); 983 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin);
985 if (!pin) 984 if (!pin)
986 continue; 985 continue;
987 pin--; 986
988 info = pirq_get_info(dev2); 987 info = pirq_get_info(dev2);
989 if (!info) 988 if (!info)
990 continue; 989 continue;
991 if (info->irq[pin].link == pirq) { 990 if (info->irq[pin - 1].link == pirq) {
992 /* 991 /*
993 * We refuse to override the dev->irq 992 * We refuse to override the dev->irq
994 * information. Give a warning! 993 * information. Give a warning!
@@ -1042,6 +1041,9 @@ static void __init pcibios_fixup_irqs(void)
1042 dev = NULL; 1041 dev = NULL;
1043 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 1042 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
1044 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); 1043 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
1044 if (!pin)
1045 continue;
1046
1045#ifdef CONFIG_X86_IO_APIC 1047#ifdef CONFIG_X86_IO_APIC
1046 /* 1048 /*
1047 * Recalculate IRQ numbers if we use the I/O APIC. 1049 * Recalculate IRQ numbers if we use the I/O APIC.
@@ -1049,15 +1051,11 @@ static void __init pcibios_fixup_irqs(void)
1049 if (io_apic_assign_pci_irqs) { 1051 if (io_apic_assign_pci_irqs) {
1050 int irq; 1052 int irq;
1051 1053
1052 if (!pin)
1053 continue;
1054
1055 /* 1054 /*
1056 * interrupt pins are numbered starting from 1 1055 * interrupt pins are numbered starting from 1
1057 */ 1056 */
1058 pin--;
1059 irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, 1057 irq = IO_APIC_get_PCI_irq_vector(dev->bus->number,
1060 PCI_SLOT(dev->devfn), pin); 1058 PCI_SLOT(dev->devfn), pin - 1);
1061 /* 1059 /*
1062 * Busses behind bridges are typically not listed in the 1060 * Busses behind bridges are typically not listed in the
1063 * MP-table. In this case we have to look up the IRQ 1061 * MP-table. In this case we have to look up the IRQ
@@ -1070,22 +1068,22 @@ static void __init pcibios_fixup_irqs(void)
1070 struct pci_dev *bridge = dev->bus->self; 1068 struct pci_dev *bridge = dev->bus->self;
1071 int bus; 1069 int bus;
1072 1070
1073 pin = (pin + PCI_SLOT(dev->devfn)) % 4; 1071 pin = pci_swizzle_interrupt_pin(dev, pin);
1074 bus = bridge->bus->number; 1072 bus = bridge->bus->number;
1075 irq = IO_APIC_get_PCI_irq_vector(bus, 1073 irq = IO_APIC_get_PCI_irq_vector(bus,
1076 PCI_SLOT(bridge->devfn), pin); 1074 PCI_SLOT(bridge->devfn), pin - 1);
1077 if (irq >= 0) 1075 if (irq >= 0)
1078 dev_warn(&dev->dev, 1076 dev_warn(&dev->dev,
1079 "using bridge %s INT %c to " 1077 "using bridge %s INT %c to "
1080 "get IRQ %d\n", 1078 "get IRQ %d\n",
1081 pci_name(bridge), 1079 pci_name(bridge),
1082 'A' + pin, irq); 1080 'A' + pin - 1, irq);
1083 } 1081 }
1084 if (irq >= 0) { 1082 if (irq >= 0) {
1085 dev_info(&dev->dev, 1083 dev_info(&dev->dev,
1086 "PCI->APIC IRQ transform: INT %c " 1084 "PCI->APIC IRQ transform: INT %c "
1087 "-> IRQ %d\n", 1085 "-> IRQ %d\n",
1088 'A' + pin, irq); 1086 'A' + pin - 1, irq);
1089 dev->irq = irq; 1087 dev->irq = irq;
1090 } 1088 }
1091 } 1089 }
@@ -1093,7 +1091,7 @@ static void __init pcibios_fixup_irqs(void)
1093 /* 1091 /*
1094 * Still no IRQ? Try to lookup one... 1092 * Still no IRQ? Try to lookup one...
1095 */ 1093 */
1096 if (pin && !dev->irq) 1094 if (!dev->irq)
1097 pcibios_lookup_irq(dev, 0); 1095 pcibios_lookup_irq(dev, 0);
1098 } 1096 }
1099} 1097}
@@ -1220,12 +1218,10 @@ static int pirq_enable_irq(struct pci_dev *dev)
1220 if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) { 1218 if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
1221 char *msg = ""; 1219 char *msg = "";
1222 1220
1223 pin--; /* interrupt pins are numbered starting from 1 */
1224
1225 if (io_apic_assign_pci_irqs) { 1221 if (io_apic_assign_pci_irqs) {
1226 int irq; 1222 int irq;
1227 1223
1228 irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin); 1224 irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin - 1);
1229 /* 1225 /*
1230 * Busses behind bridges are typically not listed in the MP-table. 1226 * Busses behind bridges are typically not listed in the MP-table.
1231 * In this case we have to look up the IRQ based on the parent bus, 1227 * In this case we have to look up the IRQ based on the parent bus,
@@ -1236,20 +1232,20 @@ static int pirq_enable_irq(struct pci_dev *dev)
1236 while (irq < 0 && dev->bus->parent) { /* go back to the bridge */ 1232 while (irq < 0 && dev->bus->parent) { /* go back to the bridge */
1237 struct pci_dev *bridge = dev->bus->self; 1233 struct pci_dev *bridge = dev->bus->self;
1238 1234
1239 pin = (pin + PCI_SLOT(dev->devfn)) % 4; 1235 pin = pci_swizzle_interrupt_pin(dev, pin);
1240 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, 1236 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
1241 PCI_SLOT(bridge->devfn), pin); 1237 PCI_SLOT(bridge->devfn), pin - 1);
1242 if (irq >= 0) 1238 if (irq >= 0)
1243 dev_warn(&dev->dev, "using bridge %s " 1239 dev_warn(&dev->dev, "using bridge %s "
1244 "INT %c to get IRQ %d\n", 1240 "INT %c to get IRQ %d\n",
1245 pci_name(bridge), 'A' + pin, 1241 pci_name(bridge), 'A' + pin - 1,
1246 irq); 1242 irq);
1247 dev = bridge; 1243 dev = bridge;
1248 } 1244 }
1249 dev = temp_dev; 1245 dev = temp_dev;
1250 if (irq >= 0) { 1246 if (irq >= 0) {
1251 dev_info(&dev->dev, "PCI->APIC IRQ transform: " 1247 dev_info(&dev->dev, "PCI->APIC IRQ transform: "
1252 "INT %c -> IRQ %d\n", 'A' + pin, irq); 1248 "INT %c -> IRQ %d\n", 'A' + pin - 1, irq);
1253 dev->irq = irq; 1249 dev->irq = irq;
1254 return 0; 1250 return 0;
1255 } else 1251 } else
@@ -1268,7 +1264,7 @@ static int pirq_enable_irq(struct pci_dev *dev)
1268 return 0; 1264 return 0;
1269 1265
1270 dev_warn(&dev->dev, "can't find IRQ for PCI INT %c%s\n", 1266 dev_warn(&dev->dev, "can't find IRQ for PCI INT %c%s\n",
1271 'A' + pin, msg); 1267 'A' + pin - 1, msg);
1272 } 1268 }
1273 return 0; 1269 return 0;
1274} 1270}
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c
index 16d0c0eb0d19..bcead7a46871 100644
--- a/arch/x86/pci/visws.c
+++ b/arch/x86/pci/visws.c
@@ -24,24 +24,6 @@ static void pci_visws_disable_irq(struct pci_dev *dev) { }
24 24
25unsigned int pci_bus0, pci_bus1; 25unsigned int pci_bus0, pci_bus1;
26 26
27static inline u8 bridge_swizzle(u8 pin, u8 slot)
28{
29 return (((pin - 1) + slot) % 4) + 1;
30}
31
32static u8 __init visws_swizzle(struct pci_dev *dev, u8 *pinp)
33{
34 u8 pin = *pinp;
35
36 while (dev->bus->self) { /* Move up the chain of bridges. */
37 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
38 dev = dev->bus->self;
39 }
40 *pinp = pin;
41
42 return PCI_SLOT(dev->devfn);
43}
44
45static int __init visws_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 27static int __init visws_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
46{ 28{
47 int irq, bus = dev->bus->number; 29 int irq, bus = dev->bus->number;
@@ -106,7 +88,7 @@ int __init pci_visws_init(void)
106 raw_pci_ops = &pci_direct_conf1; 88 raw_pci_ops = &pci_direct_conf1;
107 pci_scan_bus_with_sysdata(pci_bus0); 89 pci_scan_bus_with_sysdata(pci_bus0);
108 pci_scan_bus_with_sysdata(pci_bus1); 90 pci_scan_bus_with_sysdata(pci_bus1);
109 pci_fixup_irqs(visws_swizzle, visws_map_irq); 91 pci_fixup_irqs(pci_common_swizzle, visws_map_irq);
110 pcibios_resource_survey(); 92 pcibios_resource_survey();
111 return 0; 93 return 0;
112} 94}