aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-02-26 13:35:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-02-26 13:35:27 -0500
commit68c6b859846bd078b37c6ca5f3882032f129e72d (patch)
treee243605957f1cab3532d57d86ea87355c10b6385 /arch
parenta4a47bc03fe520e95e0c4212bf97c86545fb14f9 (diff)
parentbb8d41330ce27edb91adb6922d3f8e1a8923f727 (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: (48 commits) x86/PCI: Prevent mmconfig memory corruption ACPI: Use GPE reference counting to support shared GPEs x86/PCI: use host bridge _CRS info by default on 2008 and newer machines PCI: augment bus resource table with a list PCI: add pci_bus_for_each_resource(), remove direct bus->resource[] refs PCI: read bridge windows before filling in subtractive decode resources PCI: split up pci_read_bridge_bases() PCIe PME: use pci_pcie_cap() PCI PM: Run-time callbacks for PCI bus type PCIe PME: use pci_is_pcie() PCI / ACPI / PM: Platform support for PCI PME wake-up ACPI / ACPICA: Multiple system notify handlers per device ACPI / PM: Add more run-time wake-up fields ACPI: Use GPE reference counting to support shared GPEs PCI PM: Make it possible to force using INTx for PCIe PME signaling PCI PM: PCIe PME root port service driver PCI PM: Add function for checking PME status of devices PCI: mark is_pcie obsolete PCI: set PCI_PREF_RANGE_TYPE_64 in pci_bridge_check_ranges PCI: pciehp: second try to get big range for pcie devices ...
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci.c6
-rw-r--r--arch/arm/kernel/bios32.c8
-rw-r--r--arch/cris/arch-v32/drivers/pci/bios.c16
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.c16
-rw-r--r--arch/ia64/include/asm/acpi.h1
-rw-r--r--arch/ia64/pci/pci.c22
-rw-r--r--arch/mips/pci/pci.c6
-rw-r--r--arch/mips/pmc-sierra/yosemite/ht.c10
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.c16
-rw-r--r--arch/mn10300/unit-asb2305/pci.c6
-rw-r--r--arch/parisc/kernel/pci.c10
-rw-r--r--arch/powerpc/kernel/pci-common.c24
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c12
-rw-r--r--arch/sh/drivers/pci/pci.c6
-rw-r--r--arch/sparc/kernel/pci.c5
-rw-r--r--arch/sparc/kernel/pcic.c5
-rw-r--r--arch/x86/include/asm/pci_x86.h1
-rw-r--r--arch/x86/pci/acpi.c82
-rw-r--r--arch/x86/pci/bus_numa.c3
-rw-r--r--arch/x86/pci/bus_numa.h3
-rw-r--r--arch/x86/pci/common.c3
-rw-r--r--arch/x86/pci/i386.c14
-rw-r--r--arch/x86/pci/irq.c2
-rw-r--r--arch/x86/pci/mmconfig-shared.c17
-rw-r--r--arch/xtensa/kernel/pci.c15
25 files changed, 155 insertions, 154 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index a91ba28999b5..c9ab94ee1ca8 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -126,8 +126,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_final);
126#define MB (1024*KB) 126#define MB (1024*KB)
127#define GB (1024*MB) 127#define GB (1024*MB)
128 128
129void 129resource_size_t
130pcibios_align_resource(void *data, struct resource *res, 130pcibios_align_resource(void *data, const struct resource *res,
131 resource_size_t size, resource_size_t align) 131 resource_size_t size, resource_size_t align)
132{ 132{
133 struct pci_dev *dev = data; 133 struct pci_dev *dev = data;
@@ -184,7 +184,7 @@ pcibios_align_resource(void *data, struct resource *res,
184 } 184 }
185 } 185 }
186 186
187 res->start = start; 187 return start;
188} 188}
189#undef KB 189#undef KB
190#undef MB 190#undef MB
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 809681900ec8..bd397e0b663e 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -616,15 +616,17 @@ char * __init pcibios_setup(char *str)
616 * but we want to try to avoid allocating at 0x2900-0x2bff 616 * but we want to try to avoid allocating at 0x2900-0x2bff
617 * which might be mirrored at 0x0100-0x03ff.. 617 * which might be mirrored at 0x0100-0x03ff..
618 */ 618 */
619void pcibios_align_resource(void *data, struct resource *res, 619resource_size_t pcibios_align_resource(void *data, const struct resource *res,
620 resource_size_t size, resource_size_t align) 620 resource_size_t size, resource_size_t align)
621{ 621{
622 resource_size_t start = res->start; 622 resource_size_t start = res->start;
623 623
624 if (res->flags & IORESOURCE_IO && start & 0x300) 624 if (res->flags & IORESOURCE_IO && start & 0x300)
625 start = (start + 0x3ff) & ~0x3ff; 625 start = (start + 0x3ff) & ~0x3ff;
626 626
627 res->start = (start + align - 1) & ~(align - 1); 627 start = (start + align - 1) & ~(align - 1);
628
629 return start;
628} 630}
629 631
630/** 632/**
diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c
index 77ee319193c3..d4b9c36ddc0f 100644
--- a/arch/cris/arch-v32/drivers/pci/bios.c
+++ b/arch/cris/arch-v32/drivers/pci/bios.c
@@ -41,18 +41,16 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
41 return 0; 41 return 0;
42} 42}
43 43
44void 44resource_size_t
45pcibios_align_resource(void *data, struct resource *res, 45pcibios_align_resource(void *data, const struct resource *res,
46 resource_size_t size, resource_size_t align) 46 resource_size_t size, resource_size_t align)
47{ 47{
48 if (res->flags & IORESOURCE_IO) { 48 resource_size_t start = res->start;
49 resource_size_t start = res->start;
50 49
51 if (start & 0x300) { 50 if ((res->flags & IORESOURCE_IO) && (start & 0x300))
52 start = (start + 0x3ff) & ~0x3ff; 51 start = (start + 0x3ff) & ~0x3ff;
53 res->start = start; 52
54 } 53 return start
55 }
56} 54}
57 55
58int pcibios_enable_resources(struct pci_dev *dev, int mask) 56int pcibios_enable_resources(struct pci_dev *dev, int mask)
diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c
index 566bdeb499d1..1ed15d7fea20 100644
--- a/arch/frv/mb93090-mb00/pci-frv.c
+++ b/arch/frv/mb93090-mb00/pci-frv.c
@@ -32,18 +32,16 @@
32 * but we want to try to avoid allocating at 0x2900-0x2bff 32 * but we want to try to avoid allocating at 0x2900-0x2bff
33 * which might have be mirrored at 0x0100-0x03ff.. 33 * which might have be mirrored at 0x0100-0x03ff..
34 */ 34 */
35void 35resource_size_t
36pcibios_align_resource(void *data, struct resource *res, 36pcibios_align_resource(void *data, const struct resource *res,
37 resource_size_t size, resource_size_t align) 37 resource_size_t size, resource_size_t align)
38{ 38{
39 if (res->flags & IORESOURCE_IO) { 39 resource_size_t start = res->start;
40 resource_size_t start = res->start;
41 40
42 if (start & 0x300) { 41 if ((res->flags & IORESOURCE_IO) && (start & 0x300))
43 start = (start + 0x3ff) & ~0x3ff; 42 start = (start + 0x3ff) & ~0x3ff;
44 res->start = start; 43
45 } 44 return start
46 }
47} 45}
48 46
49 47
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index e97b255d97bc..93997bd5edc3 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -98,6 +98,7 @@ ia64_acpi_release_global_lock (unsigned int *lock)
98#endif 98#endif
99#define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */ 99#define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */
100static inline void disable_acpi(void) { } 100static inline void disable_acpi(void) { }
101static inline void pci_acpi_crs_quirks(void) { }
101 102
102const char *acpi_get_sysname (void); 103const char *acpi_get_sysname (void);
103int acpi_request_vector (u32 int_type); 104int acpi_request_vector (u32 int_type);
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index df639db779f9..64aff520b899 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -320,9 +320,9 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
320static void __devinit 320static void __devinit
321pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl) 321pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
322{ 322{
323 int i, j; 323 int i;
324 324
325 j = 0; 325 pci_bus_remove_resources(bus);
326 for (i = 0; i < ctrl->windows; i++) { 326 for (i = 0; i < ctrl->windows; i++) {
327 struct resource *res = &ctrl->window[i].resource; 327 struct resource *res = &ctrl->window[i].resource;
328 /* HP's firmware has a hack to work around a Windows bug. 328 /* HP's firmware has a hack to work around a Windows bug.
@@ -330,13 +330,7 @@ pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
330 if ((res->flags & IORESOURCE_MEM) && 330 if ((res->flags & IORESOURCE_MEM) &&
331 (res->end - res->start < 16)) 331 (res->end - res->start < 16))
332 continue; 332 continue;
333 if (j >= PCI_BUS_NUM_RESOURCES) { 333 pci_bus_add_resource(bus, res, 0);
334 dev_warn(&bus->dev,
335 "ignoring host bridge window %pR (no space)\n",
336 res);
337 continue;
338 }
339 bus->resource[j++] = res;
340 } 334 }
341} 335}
342 336
@@ -452,13 +446,12 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
452static int __devinit is_valid_resource(struct pci_dev *dev, int idx) 446static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
453{ 447{
454 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 448 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
455 struct resource *devr = &dev->resource[idx]; 449 struct resource *devr = &dev->resource[idx], *busr;
456 450
457 if (!dev->bus) 451 if (!dev->bus)
458 return 0; 452 return 0;
459 for (i=0; i<PCI_BUS_NUM_RESOURCES; i++) {
460 struct resource *busr = dev->bus->resource[i];
461 453
454 pci_bus_for_each_resource(dev->bus, busr, i) {
462 if (!busr || ((busr->flags ^ devr->flags) & type_mask)) 455 if (!busr || ((busr->flags ^ devr->flags) & type_mask))
463 continue; 456 continue;
464 if ((devr->start) && (devr->start >= busr->start) && 457 if ((devr->start) && (devr->start >= busr->start) &&
@@ -547,10 +540,11 @@ pcibios_disable_device (struct pci_dev *dev)
547 acpi_pci_irq_disable(dev); 540 acpi_pci_irq_disable(dev);
548} 541}
549 542
550void 543resource_size_t
551pcibios_align_resource (void *data, struct resource *res, 544pcibios_align_resource (void *data, const struct resource *res,
552 resource_size_t size, resource_size_t align) 545 resource_size_t size, resource_size_t align)
553{ 546{
547 return res->start;
554} 548}
555 549
556/* 550/*
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 9a11c2226891..f87f5e188fa6 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -49,8 +49,8 @@ static int pci_initialized;
49 * but we want to try to avoid allocating at 0x2900-0x2bff 49 * but we want to try to avoid allocating at 0x2900-0x2bff
50 * which might have be mirrored at 0x0100-0x03ff.. 50 * which might have be mirrored at 0x0100-0x03ff..
51 */ 51 */
52void 52resource_size_t
53pcibios_align_resource(void *data, struct resource *res, 53pcibios_align_resource(void *data, const struct resource *res,
54 resource_size_t size, resource_size_t align) 54 resource_size_t size, resource_size_t align)
55{ 55{
56 struct pci_dev *dev = data; 56 struct pci_dev *dev = data;
@@ -73,7 +73,7 @@ pcibios_align_resource(void *data, struct resource *res,
73 start = PCIBIOS_MIN_MEM + hose->mem_resource->start; 73 start = PCIBIOS_MIN_MEM + hose->mem_resource->start;
74 } 74 }
75 75
76 res->start = start; 76 return start;
77} 77}
78 78
79static void __devinit pcibios_scanbus(struct pci_controller *hose) 79static void __devinit pcibios_scanbus(struct pci_controller *hose)
diff --git a/arch/mips/pmc-sierra/yosemite/ht.c b/arch/mips/pmc-sierra/yosemite/ht.c
index 678388fd34b1..fd22597edb64 100644
--- a/arch/mips/pmc-sierra/yosemite/ht.c
+++ b/arch/mips/pmc-sierra/yosemite/ht.c
@@ -345,14 +345,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
345 return pcibios_enable_resources(dev); 345 return pcibios_enable_resources(dev);
346} 346}
347 347
348void pcibios_align_resource(void *data, struct resource *res, 348resource_size_t pcibios_align_resource(void *data, const struct resource *res,
349 resource_size_t size, resource_size_t align) 349 resource_size_t size, resource_size_t align)
350{ 350{
351 struct pci_dev *dev = data; 351 struct pci_dev *dev = data;
352 resource_size_t start = res->start;
352 353
353 if (res->flags & IORESOURCE_IO) { 354 if (res->flags & IORESOURCE_IO) {
354 resource_size_t start = res->start;
355
356 /* We need to avoid collisions with `mirrored' VGA ports 355 /* We need to avoid collisions with `mirrored' VGA ports
357 and other strange ISA hardware, so we always want the 356 and other strange ISA hardware, so we always want the
358 addresses kilobyte aligned. */ 357 addresses kilobyte aligned. */
@@ -363,8 +362,9 @@ void pcibios_align_resource(void *data, struct resource *res,
363 } 362 }
364 363
365 start = (start + 1024 - 1) & ~(1024 - 1); 364 start = (start + 1024 - 1) & ~(1024 - 1);
366 res->start = start;
367 } 365 }
366
367 return start;
368} 368}
369 369
370struct pci_ops titan_pci_ops = { 370struct pci_ops titan_pci_ops = {
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c
index 78cd134ddf7d..d6119b879a98 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.c
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.c
@@ -31,9 +31,11 @@
31 * but we want to try to avoid allocating at 0x2900-0x2bff 31 * but we want to try to avoid allocating at 0x2900-0x2bff
32 * which might have be mirrored at 0x0100-0x03ff.. 32 * which might have be mirrored at 0x0100-0x03ff..
33 */ 33 */
34void pcibios_align_resource(void *data, struct resource *res, 34resource_size_t pcibios_align_resource(void *data, const struct resource *res,
35 resource_size_t size, resource_size_t align) 35 resource_size_t size, resource_size_t align)
36{ 36{
37 resource_size_t start = res->start;
38
37#if 0 39#if 0
38 struct pci_dev *dev = data; 40 struct pci_dev *dev = data;
39 41
@@ -47,14 +49,10 @@ void pcibios_align_resource(void *data, struct resource *res,
47 ); 49 );
48#endif 50#endif
49 51
50 if (res->flags & IORESOURCE_IO) { 52 if ((res->flags & IORESOURCE_IO) && (start & 0x300))
51 unsigned long start = res->start; 53 start = (start + 0x3ff) & ~0x3ff;
52 54
53 if (start & 0x300) { 55 return start;
54 start = (start + 0x3ff) & ~0x3ff;
55 res->start = start;
56 }
57 }
58} 56}
59 57
60 58
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 2cb7e75ba1c0..6d8720a0a599 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -331,12 +331,10 @@ static int __init pci_check_direct(void)
331static int __devinit is_valid_resource(struct pci_dev *dev, int idx) 331static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
332{ 332{
333 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 333 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
334 struct resource *devr = &dev->resource[idx]; 334 struct resource *devr = &dev->resource[idx], *busr;
335 335
336 if (dev->bus) { 336 if (dev->bus) {
337 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { 337 pci_bus_for_each_resource(dev->bus, busr, i) {
338 struct resource *busr = dev->bus->resource[i];
339
340 if (!busr || (busr->flags ^ devr->flags) & type_mask) 338 if (!busr || (busr->flags ^ devr->flags) & type_mask)
341 continue; 339 continue;
342 340
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 9e74bfe071dc..38372e7cbb88 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -257,10 +257,10 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
257 * Since we are just checking candidates, don't use any fields other 257 * Since we are just checking candidates, don't use any fields other
258 * than res->start. 258 * than res->start.
259 */ 259 */
260void pcibios_align_resource(void *data, struct resource *res, 260resource_size_t pcibios_align_resource(void *data, const struct resource *res,
261 resource_size_t size, resource_size_t alignment) 261 resource_size_t size, resource_size_t alignment)
262{ 262{
263 resource_size_t mask, align; 263 resource_size_t mask, align, start = res->start;
264 264
265 DBG_RES("pcibios_align_resource(%s, (%p) [%lx,%lx]/%x, 0x%lx, 0x%lx)\n", 265 DBG_RES("pcibios_align_resource(%s, (%p) [%lx,%lx]/%x, 0x%lx, 0x%lx)\n",
266 pci_name(((struct pci_dev *) data)), 266 pci_name(((struct pci_dev *) data)),
@@ -272,10 +272,10 @@ void pcibios_align_resource(void *data, struct resource *res,
272 272
273 /* Align to largest of MIN or input size */ 273 /* Align to largest of MIN or input size */
274 mask = max(alignment, align) - 1; 274 mask = max(alignment, align) - 1;
275 res->start += mask; 275 start += mask;
276 res->start &= ~mask; 276 start &= ~mask;
277 277
278 /* The caller updates the end field, we don't. */ 278 return start;
279} 279}
280 280
281 281
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index cadbed679fbb..2597f9545d8a 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1047,10 +1047,8 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
1047 1047
1048 struct pci_dev *dev = bus->self; 1048 struct pci_dev *dev = bus->self;
1049 1049
1050 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { 1050 pci_bus_for_each_resource(bus, res, i) {
1051 if ((res = bus->resource[i]) == NULL) 1051 if (!res || !res->flags)
1052 continue;
1053 if (!res->flags)
1054 continue; 1052 continue;
1055 if (i >= 3 && bus->self->transparent) 1053 if (i >= 3 && bus->self->transparent)
1056 continue; 1054 continue;
@@ -1181,21 +1179,20 @@ static int skip_isa_ioresource_align(struct pci_dev *dev)
1181 * but we want to try to avoid allocating at 0x2900-0x2bff 1179 * but we want to try to avoid allocating at 0x2900-0x2bff
1182 * which might have be mirrored at 0x0100-0x03ff.. 1180 * which might have be mirrored at 0x0100-0x03ff..
1183 */ 1181 */
1184void pcibios_align_resource(void *data, struct resource *res, 1182resource_size_t pcibios_align_resource(void *data, const struct resource *res,
1185 resource_size_t size, resource_size_t align) 1183 resource_size_t size, resource_size_t align)
1186{ 1184{
1187 struct pci_dev *dev = data; 1185 struct pci_dev *dev = data;
1186 resource_size_t start = res->start;
1188 1187
1189 if (res->flags & IORESOURCE_IO) { 1188 if (res->flags & IORESOURCE_IO) {
1190 resource_size_t start = res->start;
1191
1192 if (skip_isa_ioresource_align(dev)) 1189 if (skip_isa_ioresource_align(dev))
1193 return; 1190 return start;
1194 if (start & 0x300) { 1191 if (start & 0x300)
1195 start = (start + 0x3ff) & ~0x3ff; 1192 start = (start + 0x3ff) & ~0x3ff;
1196 res->start = start;
1197 }
1198 } 1193 }
1194
1195 return start;
1199} 1196}
1200EXPORT_SYMBOL(pcibios_align_resource); 1197EXPORT_SYMBOL(pcibios_align_resource);
1201 1198
@@ -1278,9 +1275,8 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1278 pr_debug("PCI: Allocating bus resources for %04x:%02x...\n", 1275 pr_debug("PCI: Allocating bus resources for %04x:%02x...\n",
1279 pci_domain_nr(bus), bus->number); 1276 pci_domain_nr(bus), bus->number);
1280 1277
1281 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { 1278 pci_bus_for_each_resource(bus, res, i) {
1282 if ((res = bus->resource[i]) == NULL || !res->flags 1279 if (!res || !res->flags || res->start > res->end || res->parent)
1283 || res->start > res->end || res->parent)
1284 continue; 1280 continue;
1285 if (bus->parent == NULL) 1281 if (bus->parent == NULL)
1286 pr = (res->flags & IORESOURCE_IO) ? 1282 pr = (res->flags & IORESOURCE_IO) ?
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index fd23a1d4b39d..8b0c2082a783 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -222,6 +222,7 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
222 int i; 222 int i;
223 u8 *dummy; 223 u8 *dummy;
224 struct pci_bus *bus = dev->bus; 224 struct pci_bus *bus = dev->bus;
225 struct resource *res;
225 resource_size_t end = 0; 226 resource_size_t end = 0;
226 227
227 for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCES+3; i++) { 228 for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCES+3; i++) {
@@ -230,13 +231,12 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
230 end = pci_resource_end(dev, i); 231 end = pci_resource_end(dev, i);
231 } 232 }
232 233
233 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { 234 pci_bus_for_each_resource(bus, res, i) {
234 if ((bus->resource[i]) && 235 if (res && res->flags & IORESOURCE_MEM) {
235 (bus->resource[i]->flags & IORESOURCE_MEM)) { 236 if (res->end == end)
236 if (bus->resource[i]->end == end) 237 dummy = ioremap(res->start, 0x4);
237 dummy = ioremap(bus->resource[i]->start, 0x4);
238 else 238 else
239 dummy = ioremap(bus->resource[i]->end - 3, 0x4); 239 dummy = ioremap(res->end - 3, 0x4);
240 if (dummy) { 240 if (dummy) {
241 in_8(dummy); 241 in_8(dummy);
242 iounmap(dummy); 242 iounmap(dummy);
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index c481df639022..96213fd172ce 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -148,8 +148,8 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
148 * addresses to be allocated in the 0x000-0x0ff region 148 * addresses to be allocated in the 0x000-0x0ff region
149 * modulo 0x400. 149 * modulo 0x400.
150 */ 150 */
151void pcibios_align_resource(void *data, struct resource *res, 151resource_size_t pcibios_align_resource(void *data, const struct resource *res,
152 resource_size_t size, resource_size_t align) 152 resource_size_t size, resource_size_t align)
153{ 153{
154 struct pci_dev *dev = data; 154 struct pci_dev *dev = data;
155 struct pci_channel *chan = dev->sysdata; 155 struct pci_channel *chan = dev->sysdata;
@@ -171,7 +171,7 @@ void pcibios_align_resource(void *data, struct resource *res,
171 start = PCIBIOS_MIN_MEM + chan->mem_resource->start; 171 start = PCIBIOS_MIN_MEM + chan->mem_resource->start;
172 } 172 }
173 173
174 res->start = start; 174 return start;
175} 175}
176 176
177void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 177void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 592b03d85167..37b66c60abe3 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -722,9 +722,10 @@ void pcibios_update_irq(struct pci_dev *pdev, int irq)
722{ 722{
723} 723}
724 724
725void pcibios_align_resource(void *data, struct resource *res, 725resource_size_t pcibios_align_resource(void *data, const struct resource *res,
726 resource_size_t size, resource_size_t align) 726 resource_size_t size, resource_size_t align)
727{ 727{
728 return res->start;
728} 729}
729 730
730int pcibios_enable_device(struct pci_dev *dev, int mask) 731int pcibios_enable_device(struct pci_dev *dev, int mask)
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 4e2724ec2bb6..75e88c00bca3 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -768,9 +768,10 @@ char * __devinit pcibios_setup(char *str)
768 return str; 768 return str;
769} 769}
770 770
771void pcibios_align_resource(void *data, struct resource *res, 771resource_size_t pcibios_align_resource(void *data, const struct resource *res,
772 resource_size_t size, resource_size_t align) 772 resource_size_t size, resource_size_t align)
773{ 773{
774 return res->start;
774} 775}
775 776
776int pcibios_enable_device(struct pci_dev *pdev, int mask) 777int pcibios_enable_device(struct pci_dev *pdev, int mask)
diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index b4bf9a942ed0..05b58ccb2e82 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -29,6 +29,7 @@
29#define PCI_CHECK_ENABLE_AMD_MMCONF 0x20000 29#define PCI_CHECK_ENABLE_AMD_MMCONF 0x20000
30#define PCI_HAS_IO_ECS 0x40000 30#define PCI_HAS_IO_ECS 0x40000
31#define PCI_NOASSIGN_ROMS 0x80000 31#define PCI_NOASSIGN_ROMS 0x80000
32#define PCI_ROOT_NO_CRS 0x100000
32 33
33extern unsigned int pci_probe; 34extern unsigned int pci_probe;
34extern unsigned long pirq_table_addr; 35extern unsigned long pirq_table_addr;
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 959e548a7039..5f11ff6f5389 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -15,6 +15,51 @@ struct pci_root_info {
15 int busnum; 15 int busnum;
16}; 16};
17 17
18static bool pci_use_crs = true;
19
20static int __init set_use_crs(const struct dmi_system_id *id)
21{
22 pci_use_crs = true;
23 return 0;
24}
25
26static const struct dmi_system_id pci_use_crs_table[] __initconst = {
27 /* http://bugzilla.kernel.org/show_bug.cgi?id=14183 */
28 {
29 .callback = set_use_crs,
30 .ident = "IBM System x3800",
31 .matches = {
32 DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
33 DMI_MATCH(DMI_PRODUCT_NAME, "x3800"),
34 },
35 },
36 {}
37};
38
39void __init pci_acpi_crs_quirks(void)
40{
41 int year;
42
43 if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) && year < 2008)
44 pci_use_crs = false;
45
46 dmi_check_system(pci_use_crs_table);
47
48 /*
49 * If the user specifies "pci=use_crs" or "pci=nocrs" explicitly, that
50 * takes precedence over anything we figured out above.
51 */
52 if (pci_probe & PCI_ROOT_NO_CRS)
53 pci_use_crs = false;
54 else if (pci_probe & PCI_USE__CRS)
55 pci_use_crs = true;
56
57 printk(KERN_INFO "PCI: %s host bridge windows from ACPI; "
58 "if necessary, use \"pci=%s\" and report a bug\n",
59 pci_use_crs ? "Using" : "Ignoring",
60 pci_use_crs ? "nocrs" : "use_crs");
61}
62
18static acpi_status 63static acpi_status
19resource_to_addr(struct acpi_resource *resource, 64resource_to_addr(struct acpi_resource *resource,
20 struct acpi_resource_address64 *addr) 65 struct acpi_resource_address64 *addr)
@@ -45,20 +90,6 @@ count_resource(struct acpi_resource *acpi_res, void *data)
45 return AE_OK; 90 return AE_OK;
46} 91}
47 92
48static int
49bus_has_transparent_bridge(struct pci_bus *bus)
50{
51 struct pci_dev *dev;
52
53 list_for_each_entry(dev, &bus->devices, bus_list) {
54 u16 class = dev->class >> 8;
55
56 if (class == PCI_CLASS_BRIDGE_PCI && dev->transparent)
57 return true;
58 }
59 return false;
60}
61
62static void 93static void
63align_resource(struct acpi_device *bridge, struct resource *res) 94align_resource(struct acpi_device *bridge, struct resource *res)
64{ 95{
@@ -92,12 +123,8 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
92 acpi_status status; 123 acpi_status status;
93 unsigned long flags; 124 unsigned long flags;
94 struct resource *root; 125 struct resource *root;
95 int max_root_bus_resources = PCI_BUS_NUM_RESOURCES;
96 u64 start, end; 126 u64 start, end;
97 127
98 if (bus_has_transparent_bridge(info->bus))
99 max_root_bus_resources -= 3;
100
101 status = resource_to_addr(acpi_res, &addr); 128 status = resource_to_addr(acpi_res, &addr);
102 if (!ACPI_SUCCESS(status)) 129 if (!ACPI_SUCCESS(status))
103 return AE_OK; 130 return AE_OK;
@@ -115,15 +142,6 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
115 142
116 start = addr.minimum + addr.translation_offset; 143 start = addr.minimum + addr.translation_offset;
117 end = start + addr.address_length - 1; 144 end = start + addr.address_length - 1;
118 if (info->res_num >= max_root_bus_resources) {
119 if (pci_probe & PCI_USE__CRS)
120 printk(KERN_WARNING "PCI: Failed to allocate "
121 "0x%lx-0x%lx from %s for %s due to _CRS "
122 "returning more than %d resource descriptors\n",
123 (unsigned long) start, (unsigned long) end,
124 root->name, info->name, max_root_bus_resources);
125 return AE_OK;
126 }
127 145
128 res = &info->res[info->res_num]; 146 res = &info->res[info->res_num];
129 res->name = info->name; 147 res->name = info->name;
@@ -133,7 +151,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
133 res->child = NULL; 151 res->child = NULL;
134 align_resource(info->bridge, res); 152 align_resource(info->bridge, res);
135 153
136 if (!(pci_probe & PCI_USE__CRS)) { 154 if (!pci_use_crs) {
137 dev_printk(KERN_DEBUG, &info->bridge->dev, 155 dev_printk(KERN_DEBUG, &info->bridge->dev,
138 "host bridge window %pR (ignored)\n", res); 156 "host bridge window %pR (ignored)\n", res);
139 return AE_OK; 157 return AE_OK;
@@ -143,7 +161,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
143 dev_err(&info->bridge->dev, 161 dev_err(&info->bridge->dev,
144 "can't allocate host bridge window %pR\n", res); 162 "can't allocate host bridge window %pR\n", res);
145 } else { 163 } else {
146 info->bus->resource[info->res_num] = res; 164 pci_bus_add_resource(info->bus, res, 0);
147 info->res_num++; 165 info->res_num++;
148 if (addr.translation_offset) 166 if (addr.translation_offset)
149 dev_info(&info->bridge->dev, "host bridge window %pR " 167 dev_info(&info->bridge->dev, "host bridge window %pR "
@@ -164,10 +182,8 @@ get_current_resources(struct acpi_device *device, int busnum,
164 struct pci_root_info info; 182 struct pci_root_info info;
165 size_t size; 183 size_t size;
166 184
167 if (!(pci_probe & PCI_USE__CRS)) 185 if (pci_use_crs)
168 dev_info(&device->dev, 186 pci_bus_remove_resources(bus);
169 "ignoring host bridge windows from ACPI; "
170 "boot with \"pci=use_crs\" to use them\n");
171 187
172 info.bridge = device; 188 info.bridge = device;
173 info.bus = bus; 189 info.bus = bus;
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
index f939d603adfa..12d54ff3654d 100644
--- a/arch/x86/pci/bus_numa.c
+++ b/arch/x86/pci/bus_numa.c
@@ -36,13 +36,14 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
36 printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n", 36 printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n",
37 b->number); 37 b->number);
38 38
39 pci_bus_remove_resources(b);
39 info = &pci_root_info[i]; 40 info = &pci_root_info[i];
40 for (j = 0; j < info->res_num; j++) { 41 for (j = 0; j < info->res_num; j++) {
41 struct resource *res; 42 struct resource *res;
42 struct resource *root; 43 struct resource *root;
43 44
44 res = &info->res[j]; 45 res = &info->res[j];
45 b->resource[j] = res; 46 pci_bus_add_resource(b, res, 0);
46 if (res->flags & IORESOURCE_IO) 47 if (res->flags & IORESOURCE_IO)
47 root = &ioport_resource; 48 root = &ioport_resource;
48 else 49 else
diff --git a/arch/x86/pci/bus_numa.h b/arch/x86/pci/bus_numa.h
index adbc23fe82ac..731b64ee8d84 100644
--- a/arch/x86/pci/bus_numa.h
+++ b/arch/x86/pci/bus_numa.h
@@ -2,8 +2,7 @@
2 2
3/* 3/*
4 * sub bus (transparent) will use entres from 3 to store extra from 4 * sub bus (transparent) will use entres from 3 to store extra from
5 * root, so need to make sure we have enough slot there, Should we 5 * root, so need to make sure we have enough slot there.
6 * increase PCI_BUS_NUM_RESOURCES?
7 */ 6 */
8#define RES_NUM 16 7#define RES_NUM 16
9struct pci_root_info { 8struct pci_root_info {
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index d2552c68e94d..3736176acaab 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -520,6 +520,9 @@ char * __devinit pcibios_setup(char *str)
520 } else if (!strcmp(str, "use_crs")) { 520 } else if (!strcmp(str, "use_crs")) {
521 pci_probe |= PCI_USE__CRS; 521 pci_probe |= PCI_USE__CRS;
522 return NULL; 522 return NULL;
523 } else if (!strcmp(str, "nocrs")) {
524 pci_probe |= PCI_ROOT_NO_CRS;
525 return NULL;
523 } else if (!strcmp(str, "earlydump")) { 526 } else if (!strcmp(str, "earlydump")) {
524 pci_early_dump_regs = 1; 527 pci_early_dump_regs = 1;
525 return NULL; 528 return NULL;
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 5dc9e8c63fcd..5a8fbf8d4cac 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -60,22 +60,20 @@ skip_isa_ioresource_align(struct pci_dev *dev) {
60 * but we want to try to avoid allocating at 0x2900-0x2bff 60 * but we want to try to avoid allocating at 0x2900-0x2bff
61 * which might have be mirrored at 0x0100-0x03ff.. 61 * which might have be mirrored at 0x0100-0x03ff..
62 */ 62 */
63void 63resource_size_t
64pcibios_align_resource(void *data, struct resource *res, 64pcibios_align_resource(void *data, const struct resource *res,
65 resource_size_t size, resource_size_t align) 65 resource_size_t size, resource_size_t align)
66{ 66{
67 struct pci_dev *dev = data; 67 struct pci_dev *dev = data;
68 resource_size_t start = res->start;
68 69
69 if (res->flags & IORESOURCE_IO) { 70 if (res->flags & IORESOURCE_IO) {
70 resource_size_t start = res->start;
71
72 if (skip_isa_ioresource_align(dev)) 71 if (skip_isa_ioresource_align(dev))
73 return; 72 return start;
74 if (start & 0x300) { 73 if (start & 0x300)
75 start = (start + 0x3ff) & ~0x3ff; 74 start = (start + 0x3ff) & ~0x3ff;
76 res->start = start;
77 }
78 } 75 }
76 return start;
79} 77}
80EXPORT_SYMBOL(pcibios_align_resource); 78EXPORT_SYMBOL(pcibios_align_resource);
81 79
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 0696d506c4ad..b02f6d8ac922 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -590,6 +590,8 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
590 case PCI_DEVICE_ID_INTEL_ICH10_1: 590 case PCI_DEVICE_ID_INTEL_ICH10_1:
591 case PCI_DEVICE_ID_INTEL_ICH10_2: 591 case PCI_DEVICE_ID_INTEL_ICH10_2:
592 case PCI_DEVICE_ID_INTEL_ICH10_3: 592 case PCI_DEVICE_ID_INTEL_ICH10_3:
593 case PCI_DEVICE_ID_INTEL_CPT_LPC1:
594 case PCI_DEVICE_ID_INTEL_CPT_LPC2:
593 r->name = "PIIX/ICH"; 595 r->name = "PIIX/ICH";
594 r->get = pirq_piix_get; 596 r->get = pirq_piix_get;
595 r->set = pirq_piix_set; 597 r->set = pirq_piix_set;
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index b19d1e54201e..8f3f9a50b1e0 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -303,22 +303,17 @@ static void __init pci_mmcfg_check_end_bus_number(void)
303{ 303{
304 struct pci_mmcfg_region *cfg, *cfgx; 304 struct pci_mmcfg_region *cfg, *cfgx;
305 305
306 /* last one*/ 306 /* Fixup overlaps */
307 cfg = list_entry(pci_mmcfg_list.prev, typeof(*cfg), list);
308 if (cfg)
309 if (cfg->end_bus < cfg->start_bus)
310 cfg->end_bus = 255;
311
312 if (list_is_singular(&pci_mmcfg_list))
313 return;
314
315 /* don't overlap please */
316 list_for_each_entry(cfg, &pci_mmcfg_list, list) { 307 list_for_each_entry(cfg, &pci_mmcfg_list, list) {
317 if (cfg->end_bus < cfg->start_bus) 308 if (cfg->end_bus < cfg->start_bus)
318 cfg->end_bus = 255; 309 cfg->end_bus = 255;
319 310
311 /* Don't access the list head ! */
312 if (cfg->list.next == &pci_mmcfg_list)
313 break;
314
320 cfgx = list_entry(cfg->list.next, typeof(*cfg), list); 315 cfgx = list_entry(cfg->list.next, typeof(*cfg), list);
321 if (cfg != cfgx && cfg->end_bus >= cfgx->start_bus) 316 if (cfg->end_bus >= cfgx->start_bus)
322 cfg->end_bus = cfgx->start_bus - 1; 317 cfg->end_bus = cfgx->start_bus - 1;
323 } 318 }
324} 319}
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index b7c073484e01..cd1026931203 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -69,26 +69,25 @@ static int pci_bus_count;
69 * but we want to try to avoid allocating at 0x2900-0x2bff 69 * but we want to try to avoid allocating at 0x2900-0x2bff
70 * which might have be mirrored at 0x0100-0x03ff.. 70 * which might have be mirrored at 0x0100-0x03ff..
71 */ 71 */
72void 72resource_size_t
73pcibios_align_resource(void *data, struct resource *res, resource_size_t size, 73pcibios_align_resource(void *data, const struct resource *res,
74 resource_size_t align) 74 resource_size_t size, resource_size_t align)
75{ 75{
76 struct pci_dev *dev = data; 76 struct pci_dev *dev = data;
77 resource_size_t start = res->start;
77 78
78 if (res->flags & IORESOURCE_IO) { 79 if (res->flags & IORESOURCE_IO) {
79 resource_size_t start = res->start;
80
81 if (size > 0x100) { 80 if (size > 0x100) {
82 printk(KERN_ERR "PCI: I/O Region %s/%d too large" 81 printk(KERN_ERR "PCI: I/O Region %s/%d too large"
83 " (%ld bytes)\n", pci_name(dev), 82 " (%ld bytes)\n", pci_name(dev),
84 dev->resource - res, size); 83 dev->resource - res, size);
85 } 84 }
86 85
87 if (start & 0x300) { 86 if (start & 0x300)
88 start = (start + 0x3ff) & ~0x3ff; 87 start = (start + 0x3ff) & ~0x3ff;
89 res->start = start;
90 }
91 } 88 }
89
90 return start;
92} 91}
93 92
94int 93int