Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI: add acpi_find_root_bridge_handle
PCI: acpi_pcihp: run _OSC on a root bridge
x86/PCI: irq and pci_ids patch for Intel Ibex Peak PCHs
x86/PCI: allow scanning of 255 PCI busses
x86, pci: detect end_bus_number according to acpi/e820 reserved, v2
pci: debug extra pci bus resources
pci: debug extra pci resources range

+130 -36
+2
arch/x86/pci/irq.c
··· 590 case PCI_DEVICE_ID_INTEL_ICH10_1: 591 case PCI_DEVICE_ID_INTEL_ICH10_2: 592 case PCI_DEVICE_ID_INTEL_ICH10_3: 593 r->name = "PIIX/ICH"; 594 r->get = pirq_piix_get; 595 r->set = pirq_piix_set;
··· 590 case PCI_DEVICE_ID_INTEL_ICH10_1: 591 case PCI_DEVICE_ID_INTEL_ICH10_2: 592 case PCI_DEVICE_ID_INTEL_ICH10_3: 593 + case PCI_DEVICE_ID_INTEL_PCH_0: 594 + case PCI_DEVICE_ID_INTEL_PCH_1: 595 r->name = "PIIX/ICH"; 596 r->get = pirq_piix_get; 597 r->set = pirq_piix_set;
+1 -1
arch/x86/pci/legacy.c
··· 14 int n, devfn; 15 long node; 16 17 - if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff) 18 return; 19 DBG("PCI: Peer bridge fixup\n"); 20
··· 14 int n, devfn; 15 long node; 16 17 + if (pcibios_last_bus <= 0 || pcibios_last_bus > 0xff) 18 return; 19 DBG("PCI: Peer bridge fixup\n"); 20
+48 -17
arch/x86/pci/mmconfig-shared.c
··· 293 return AE_OK; 294 } 295 296 - static int __init is_acpi_reserved(unsigned long start, unsigned long end) 297 { 298 struct resource mcfg_res; 299 ··· 310 return mcfg_res.flags; 311 } 312 313 static void __init pci_mmcfg_reject_broken(int early) 314 { 315 typeof(pci_mmcfg_config[0]) *cfg; ··· 359 360 for (i = 0; i < pci_mmcfg_config_num; i++) { 361 int valid = 0; 362 - u32 size = (cfg->end_bus_number + 1) << 20; 363 cfg = &pci_mmcfg_config[i]; 364 printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " 365 "segment %hu buses %u - %u\n", 366 i, (unsigned long)cfg->address, cfg->pci_segment, 367 (unsigned int)cfg->start_bus_number, 368 (unsigned int)cfg->end_bus_number); 369 370 - if (!early && 371 - is_acpi_reserved(cfg->address, cfg->address + size - 1)) { 372 - printk(KERN_NOTICE "PCI: MCFG area at %Lx reserved " 373 - "in ACPI motherboard resources\n", 374 - cfg->address); 375 - valid = 1; 376 - } 377 378 if (valid) 379 continue; ··· 383 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not" 384 " reserved in ACPI motherboard resources\n", 385 cfg->address); 386 /* Don't try to do this check unless configuration 387 type 1 is available. how about type 2 ?*/ 388 - if (raw_pci_ops && e820_all_mapped(cfg->address, 389 - cfg->address + size - 1, 390 - E820_RESERVED)) { 391 - printk(KERN_NOTICE 392 - "PCI: MCFG area at %Lx reserved in E820\n", 393 - cfg->address); 394 - valid = 1; 395 - } 396 397 if (!valid) 398 goto reject;
··· 293 return AE_OK; 294 } 295 296 + static int __init is_acpi_reserved(u64 start, u64 end, unsigned not_used) 297 { 298 struct resource mcfg_res; 299 ··· 310 return mcfg_res.flags; 311 } 312 313 + typedef int (*check_reserved_t)(u64 start, u64 end, unsigned type); 314 + 315 + static int __init is_mmconf_reserved(check_reserved_t is_reserved, 316 + u64 addr, u64 size, int i, 317 + typeof(pci_mmcfg_config[0]) *cfg, int with_e820) 318 + { 319 + u64 old_size = size; 320 + int valid = 0; 321 + 322 + while (!is_reserved(addr, addr + size - 1, E820_RESERVED)) { 323 + size >>= 1; 324 + if (size < (16UL<<20)) 325 + break; 326 + } 327 + 328 + if (size >= (16UL<<20) || size == old_size) { 329 + printk(KERN_NOTICE 330 + "PCI: MCFG area at %Lx reserved in %s\n", 331 + addr, with_e820?"E820":"ACPI motherboard resources"); 332 + valid = 1; 333 + 334 + if (old_size != size) { 335 + /* update end_bus_number */ 336 + cfg->end_bus_number = cfg->start_bus_number + ((size>>20) - 1); 337 + printk(KERN_NOTICE "PCI: updated MCFG configuration %d: base %lx " 338 + "segment %hu buses %u - %u\n", 339 + i, (unsigned long)cfg->address, cfg->pci_segment, 340 + (unsigned int)cfg->start_bus_number, 341 + (unsigned int)cfg->end_bus_number); 342 + } 343 + } 344 + 345 + return valid; 346 + } 347 + 348 static void __init pci_mmcfg_reject_broken(int early) 349 { 350 typeof(pci_mmcfg_config[0]) *cfg; ··· 324 325 for (i = 0; i < pci_mmcfg_config_num; i++) { 326 int valid = 0; 327 + u64 addr, size; 328 + 329 cfg = &pci_mmcfg_config[i]; 330 + addr = cfg->start_bus_number; 331 + addr <<= 20; 332 + addr += cfg->address; 333 + size = cfg->end_bus_number + 1 - cfg->start_bus_number; 334 + size <<= 20; 335 printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " 336 "segment %hu buses %u - %u\n", 337 i, (unsigned long)cfg->address, cfg->pci_segment, 338 (unsigned int)cfg->start_bus_number, 339 (unsigned int)cfg->end_bus_number); 340 341 + if (!early) 342 + valid = is_mmconf_reserved(is_acpi_reserved, addr, size, i, cfg, 0); 343 344 if (valid) 345 continue; ··· 347 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not" 348 " reserved in ACPI motherboard resources\n", 349 cfg->address); 350 + 351 /* Don't try to do this check unless configuration 352 type 1 is available. how about type 2 ?*/ 353 + if (raw_pci_ops) 354 + valid = is_mmconf_reserved(e820_all_mapped, addr, size, i, cfg, 1); 355 356 if (!valid) 357 goto reject;
+26 -12
drivers/pci/hotplug/acpi_pcihp.c
··· 382 int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags) 383 { 384 acpi_status status; 385 - acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev)); 386 struct pci_dev *pdev = dev; 387 struct pci_bus *parent; 388 struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; ··· 399 * Per PCI firmware specification, we should run the ACPI _OSC 400 * method to get control of hotplug hardware before using it. If 401 * an _OSC is missing, we look for an OSHP to do the same thing. 402 - * To handle different BIOS behavior, we look for _OSC and OSHP 403 - * within the scope of the hotplug controller and its parents, 404 * upto the host bridge under which this controller exists. 405 */ 406 while (!handle) { 407 /* 408 * This hotplug controller was not listed in the ACPI name ··· 442 acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); 443 dbg("Trying to get hotplug control for %s \n", 444 (char *)string.pointer); 445 - status = pci_osc_control_set(handle, flags); 446 - if (status == AE_NOT_FOUND) 447 - status = acpi_run_oshp(handle); 448 - if (ACPI_SUCCESS(status)) { 449 - dbg("Gained control for hotplug HW for pci %s (%s)\n", 450 - pci_name(dev), (char *)string.pointer); 451 - kfree(string.pointer); 452 - return 0; 453 - } 454 if (acpi_root_bridge(handle)) 455 break; 456 chandle = handle; ··· 458 459 kfree(string.pointer); 460 return -ENODEV; 461 } 462 EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); 463
··· 382 int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags) 383 { 384 acpi_status status; 385 + acpi_handle chandle, handle; 386 struct pci_dev *pdev = dev; 387 struct pci_bus *parent; 388 struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; ··· 399 * Per PCI firmware specification, we should run the ACPI _OSC 400 * method to get control of hotplug hardware before using it. If 401 * an _OSC is missing, we look for an OSHP to do the same thing. 402 + * To handle different BIOS behavior, we look for _OSC on a root 403 + * bridge preferentially (according to PCI fw spec). Later for 404 + * OSHP within the scope of the hotplug controller and its parents, 405 * upto the host bridge under which this controller exists. 406 */ 407 + handle = acpi_find_root_bridge_handle(pdev); 408 + if (handle) { 409 + acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); 410 + dbg("Trying to get hotplug control for %s\n", 411 + (char *)string.pointer); 412 + status = pci_osc_control_set(handle, flags); 413 + if (ACPI_SUCCESS(status)) 414 + goto got_one; 415 + kfree(string.pointer); 416 + string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL }; 417 + } 418 + 419 + pdev = dev; 420 + handle = DEVICE_ACPI_HANDLE(&dev->dev); 421 while (!handle) { 422 /* 423 * This hotplug controller was not listed in the ACPI name ··· 427 acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); 428 dbg("Trying to get hotplug control for %s \n", 429 (char *)string.pointer); 430 + status = acpi_run_oshp(handle); 431 + if (ACPI_SUCCESS(status)) 432 + goto got_one; 433 if (acpi_root_bridge(handle)) 434 break; 435 chandle = handle; ··· 449 450 kfree(string.pointer); 451 return -ENODEV; 452 + got_one: 453 + dbg("Gained control for hotplug HW for pci %s (%s)\n", pci_name(dev), 454 + (char *)string.pointer); 455 + kfree(string.pointer); 456 + return 0; 457 } 458 EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); 459
+1 -6
drivers/pci/pcie/aer/aerdrv_acpi.c
··· 36 if (acpi_pci_disabled) 37 return -1; 38 39 - /* Find root host bridge */ 40 - while (pdev->bus->self) 41 - pdev = pdev->bus->self; 42 - handle = acpi_get_pci_rootbridge_handle( 43 - pci_domain_nr(pdev->bus), pdev->bus->number); 44 - 45 if (handle) { 46 pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT); 47 status = pci_osc_control_set(handle,
··· 36 if (acpi_pci_disabled) 37 return -1; 38 39 + handle = acpi_find_root_bridge_handle(pdev); 40 if (handle) { 41 pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT); 42 status = pci_osc_control_set(handle,
+3
drivers/pci/probe.c
··· 383 res->start = base; 384 if (!res->end) 385 res->end = limit + 0xfff; 386 } 387 388 res = child->resource[1]; ··· 395 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; 396 res->start = base; 397 res->end = limit + 0xfffff; 398 } 399 400 res = child->resource[2]; ··· 431 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; 432 res->start = base; 433 res->end = limit + 0xfffff; 434 } 435 } 436
··· 383 res->start = base; 384 if (!res->end) 385 res->end = limit + 0xfff; 386 + printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end); 387 } 388 389 res = child->resource[1]; ··· 394 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; 395 res->start = base; 396 res->end = limit + 0xfffff; 397 + printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end); 398 } 399 400 res = child->resource[2]; ··· 429 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; 430 res->start = base; 431 res->end = limit + 0xfffff; 432 + printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end); 433 } 434 } 435
+35
drivers/pci/setup-bus.c
··· 530 } 531 EXPORT_SYMBOL(pci_bus_assign_resources); 532 533 void __init 534 pci_assign_unassigned_resources(void) 535 { ··· 574 list_for_each_entry(bus, &pci_root_buses, node) { 575 pci_bus_assign_resources(bus); 576 pci_enable_bridges(bus); 577 } 578 }
··· 530 } 531 EXPORT_SYMBOL(pci_bus_assign_resources); 532 533 + static void pci_bus_dump_res(struct pci_bus *bus) 534 + { 535 + int i; 536 + 537 + for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { 538 + struct resource *res = bus->resource[i]; 539 + if (!res) 540 + continue; 541 + 542 + printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number, i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end); 543 + } 544 + } 545 + 546 + static void pci_bus_dump_resources(struct pci_bus *bus) 547 + { 548 + struct pci_bus *b; 549 + struct pci_dev *dev; 550 + 551 + 552 + pci_bus_dump_res(bus); 553 + 554 + list_for_each_entry(dev, &bus->devices, bus_list) { 555 + b = dev->subordinate; 556 + if (!b) 557 + continue; 558 + 559 + pci_bus_dump_resources(b); 560 + } 561 + } 562 + 563 void __init 564 pci_assign_unassigned_resources(void) 565 { ··· 544 list_for_each_entry(bus, &pci_root_buses, node) { 545 pci_bus_assign_resources(bus); 546 pci_enable_bridges(bus); 547 + } 548 + 549 + /* dump the resource on buses */ 550 + list_for_each_entry(bus, &pci_root_buses, node) { 551 + pci_bus_dump_resources(bus); 552 } 553 }
+11
include/linux/pci-acpi.h
··· 57 { 58 return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING); 59 } 60 #else 61 #if !defined(AE_ERROR) 62 typedef u32 acpi_status; ··· 75 {return AE_ERROR;} 76 static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} 77 static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;} 78 #endif 79 80 #endif /* _PCI_ACPI_H_ */
··· 57 { 58 return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING); 59 } 60 + static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 61 + { 62 + /* Find root host bridge */ 63 + while (pdev->bus->self) 64 + pdev = pdev->bus->self; 65 + 66 + return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus), 67 + pdev->bus->number); 68 + } 69 #else 70 #if !defined(AE_ERROR) 71 typedef u32 acpi_status; ··· 66 {return AE_ERROR;} 67 static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} 68 static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;} 69 + static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 70 + { return NULL; } 71 #endif 72 73 #endif /* _PCI_ACPI_H_ */
+3
include/linux/pci_ids.h
··· 2428 #define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a 2429 #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2430 #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2431 #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2432 #define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2433 #define PCI_DEVICE_ID_INTEL_5100_21 0x65f5
··· 2428 #define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a 2429 #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2430 #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2431 + #define PCI_DEVICE_ID_INTEL_PCH_0 0x3b10 2432 + #define PCI_DEVICE_ID_INTEL_PCH_1 0x3b11 2433 + #define PCI_DEVICE_ID_INTEL_PCH_2 0x3b30 2434 #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2435 #define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2436 #define PCI_DEVICE_ID_INTEL_5100_21 0x65f5