diff options
Diffstat (limited to 'drivers/pci/setup-bus.c')
-rw-r--r-- | drivers/pci/setup-bus.c | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 827c0a520e2b..d5e2106760f8 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -352,11 +352,12 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long | |||
352 | continue; | 352 | continue; |
353 | r_size = r->end - r->start + 1; | 353 | r_size = r->end - r->start + 1; |
354 | /* For bridges size != alignment */ | 354 | /* For bridges size != alignment */ |
355 | align = (i < PCI_BRIDGE_RESOURCES) ? r_size : r->start; | 355 | align = resource_alignment(r); |
356 | order = __ffs(align) - 20; | 356 | order = __ffs(align) - 20; |
357 | if (order > 11) { | 357 | if (order > 11) { |
358 | dev_warn(&dev->dev, "BAR %d too large: " | 358 | dev_warn(&dev->dev, "BAR %d bad alignment %llx: " |
359 | "%#016llx-%#016llx\n", i, | 359 | "%#016llx-%#016llx\n", i, |
360 | (unsigned long long)align, | ||
360 | (unsigned long long)r->start, | 361 | (unsigned long long)r->start, |
361 | (unsigned long long)r->end); | 362 | (unsigned long long)r->end); |
362 | r->flags = 0; | 363 | r->flags = 0; |
@@ -377,11 +378,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long | |||
377 | align = 0; | 378 | align = 0; |
378 | min_align = 0; | 379 | min_align = 0; |
379 | for (order = 0; order <= max_order; order++) { | 380 | for (order = 0; order <= max_order; order++) { |
380 | #ifdef CONFIG_RESOURCES_64BIT | 381 | resource_size_t align1 = 1; |
381 | resource_size_t align1 = 1ULL << (order + 20); | 382 | |
382 | #else | 383 | align1 <<= (order + 20); |
383 | resource_size_t align1 = 1U << (order + 20); | 384 | |
384 | #endif | ||
385 | if (!align) | 385 | if (!align) |
386 | min_align = align1; | 386 | min_align = align1; |
387 | else if (ALIGN(align + min_align, min_align) < align1) | 387 | else if (ALIGN(align + min_align, min_align) < align1) |
@@ -530,6 +530,40 @@ 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", | ||
543 | bus->number, i, | ||
544 | (res->flags & IORESOURCE_IO) ? "io port" : "mmio", | ||
545 | (unsigned long long) res->start, | ||
546 | (unsigned long long) res->end); | ||
547 | } | ||
548 | } | ||
549 | |||
550 | static void pci_bus_dump_resources(struct pci_bus *bus) | ||
551 | { | ||
552 | struct pci_bus *b; | ||
553 | struct pci_dev *dev; | ||
554 | |||
555 | |||
556 | pci_bus_dump_res(bus); | ||
557 | |||
558 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
559 | b = dev->subordinate; | ||
560 | if (!b) | ||
561 | continue; | ||
562 | |||
563 | pci_bus_dump_resources(b); | ||
564 | } | ||
565 | } | ||
566 | |||
533 | void __init | 567 | void __init |
534 | pci_assign_unassigned_resources(void) | 568 | pci_assign_unassigned_resources(void) |
535 | { | 569 | { |
@@ -545,4 +579,9 @@ pci_assign_unassigned_resources(void) | |||
545 | pci_bus_assign_resources(bus); | 579 | pci_bus_assign_resources(bus); |
546 | pci_enable_bridges(bus); | 580 | pci_enable_bridges(bus); |
547 | } | 581 | } |
582 | |||
583 | /* dump the resource on buses */ | ||
584 | list_for_each_entry(bus, &pci_root_buses, node) { | ||
585 | pci_bus_dump_resources(bus); | ||
586 | } | ||
548 | } | 587 | } |