diff options
-rw-r--r-- | arch/x86/pci/mmconfig-shared.c | 65 | ||||
-rw-r--r-- | drivers/pci/probe.c | 3 | ||||
-rw-r--r-- | drivers/pci/setup-bus.c | 35 |
3 files changed, 86 insertions, 17 deletions
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 23faaa890ffc..429c7014febc 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c | |||
@@ -293,7 +293,7 @@ static acpi_status __init find_mboard_resource(acpi_handle handle, u32 lvl, | |||
293 | return AE_OK; | 293 | return AE_OK; |
294 | } | 294 | } |
295 | 295 | ||
296 | static int __init is_acpi_reserved(unsigned long start, unsigned long end) | 296 | static int __init is_acpi_reserved(u64 start, u64 end, unsigned not_used) |
297 | { | 297 | { |
298 | struct resource mcfg_res; | 298 | struct resource mcfg_res; |
299 | 299 | ||
@@ -310,6 +310,41 @@ static int __init is_acpi_reserved(unsigned long start, unsigned long end) | |||
310 | return mcfg_res.flags; | 310 | return mcfg_res.flags; |
311 | } | 311 | } |
312 | 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 | |||
313 | static void __init pci_mmcfg_reject_broken(int early) | 348 | static void __init pci_mmcfg_reject_broken(int early) |
314 | { | 349 | { |
315 | typeof(pci_mmcfg_config[0]) *cfg; | 350 | typeof(pci_mmcfg_config[0]) *cfg; |
@@ -324,21 +359,22 @@ static void __init pci_mmcfg_reject_broken(int early) | |||
324 | 359 | ||
325 | for (i = 0; i < pci_mmcfg_config_num; i++) { | 360 | for (i = 0; i < pci_mmcfg_config_num; i++) { |
326 | int valid = 0; | 361 | int valid = 0; |
327 | u32 size = (cfg->end_bus_number + 1) << 20; | 362 | u64 addr, size; |
363 | |||
328 | cfg = &pci_mmcfg_config[i]; | 364 | cfg = &pci_mmcfg_config[i]; |
365 | addr = cfg->start_bus_number; | ||
366 | addr <<= 20; | ||
367 | addr += cfg->address; | ||
368 | size = cfg->end_bus_number + 1 - cfg->start_bus_number; | ||
369 | size <<= 20; | ||
329 | printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " | 370 | printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " |
330 | "segment %hu buses %u - %u\n", | 371 | "segment %hu buses %u - %u\n", |
331 | i, (unsigned long)cfg->address, cfg->pci_segment, | 372 | i, (unsigned long)cfg->address, cfg->pci_segment, |
332 | (unsigned int)cfg->start_bus_number, | 373 | (unsigned int)cfg->start_bus_number, |
333 | (unsigned int)cfg->end_bus_number); | 374 | (unsigned int)cfg->end_bus_number); |
334 | 375 | ||
335 | if (!early && | 376 | if (!early) |
336 | is_acpi_reserved(cfg->address, cfg->address + size - 1)) { | 377 | valid = is_mmconf_reserved(is_acpi_reserved, addr, size, i, cfg, 0); |
337 | printk(KERN_NOTICE "PCI: MCFG area at %Lx reserved " | ||
338 | "in ACPI motherboard resources\n", | ||
339 | cfg->address); | ||
340 | valid = 1; | ||
341 | } | ||
342 | 378 | ||
343 | if (valid) | 379 | if (valid) |
344 | continue; | 380 | continue; |
@@ -347,16 +383,11 @@ static void __init pci_mmcfg_reject_broken(int early) | |||
347 | printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not" | 383 | printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not" |
348 | " reserved in ACPI motherboard resources\n", | 384 | " reserved in ACPI motherboard resources\n", |
349 | cfg->address); | 385 | cfg->address); |
386 | |||
350 | /* Don't try to do this check unless configuration | 387 | /* Don't try to do this check unless configuration |
351 | type 1 is available. how about type 2 ?*/ | 388 | type 1 is available. how about type 2 ?*/ |
352 | if (raw_pci_ops && e820_all_mapped(cfg->address, | 389 | if (raw_pci_ops) |
353 | cfg->address + size - 1, | 390 | valid = is_mmconf_reserved(e820_all_mapped, addr, size, i, cfg, 1); |
354 | E820_RESERVED)) { | ||
355 | printk(KERN_NOTICE | ||
356 | "PCI: MCFG area at %Lx reserved in E820\n", | ||
357 | cfg->address); | ||
358 | valid = 1; | ||
359 | } | ||
360 | 391 | ||
361 | if (!valid) | 392 | if (!valid) |
362 | goto reject; | 393 | goto reject; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a04498d390c8..cce2f4cb1fbf 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -383,6 +383,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
383 | res->start = base; | 383 | res->start = base; |
384 | if (!res->end) | 384 | if (!res->end) |
385 | res->end = limit + 0xfff; | 385 | res->end = limit + 0xfff; |
386 | printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end); | ||
386 | } | 387 | } |
387 | 388 | ||
388 | res = child->resource[1]; | 389 | res = child->resource[1]; |
@@ -394,6 +395,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
394 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; | 395 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; |
395 | res->start = base; | 396 | res->start = base; |
396 | res->end = limit + 0xfffff; | 397 | res->end = limit + 0xfffff; |
398 | printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end); | ||
397 | } | 399 | } |
398 | 400 | ||
399 | res = child->resource[2]; | 401 | res = child->resource[2]; |
@@ -429,6 +431,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
429 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; | 431 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; |
430 | res->start = base; | 432 | res->start = base; |
431 | res->end = limit + 0xfffff; | 433 | res->end = limit + 0xfffff; |
434 | 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); | ||
432 | } | 435 | } |
433 | } | 436 | } |
434 | 437 | ||
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 827c0a520e2b..82634a2f1b1d 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -530,6 +530,36 @@ void __ref pci_bus_assign_resources(struct pci_bus *bus) | |||
530 | } | 530 | } |
531 | EXPORT_SYMBOL(pci_bus_assign_resources); | 531 | EXPORT_SYMBOL(pci_bus_assign_resources); |
532 | 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 | |||
533 | void __init | 563 | void __init |
534 | pci_assign_unassigned_resources(void) | 564 | pci_assign_unassigned_resources(void) |
535 | { | 565 | { |
@@ -545,4 +575,9 @@ pci_assign_unassigned_resources(void) | |||
545 | pci_bus_assign_resources(bus); | 575 | pci_bus_assign_resources(bus); |
546 | pci_enable_bridges(bus); | 576 | pci_enable_bridges(bus); |
547 | } | 577 | } |
578 | |||
579 | /* dump the resource on buses */ | ||
580 | list_for_each_entry(bus, &pci_root_buses, node) { | ||
581 | pci_bus_dump_resources(bus); | ||
582 | } | ||
548 | } | 583 | } |