diff options
Diffstat (limited to 'arch/powerpc/kernel/pci-common.c')
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 6053f037ef0a..f46914a0f33e 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -657,15 +657,6 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar, | |||
657 | * ranges. However, some machines (thanks Apple !) tend to split their | 657 | * ranges. However, some machines (thanks Apple !) tend to split their |
658 | * space into lots of small contiguous ranges. So we have to coalesce. | 658 | * space into lots of small contiguous ranges. So we have to coalesce. |
659 | * | 659 | * |
660 | * - We can only cope with all memory ranges having the same offset | ||
661 | * between CPU addresses and PCI addresses. Unfortunately, some bridges | ||
662 | * are setup for a large 1:1 mapping along with a small "window" which | ||
663 | * maps PCI address 0 to some arbitrary high address of the CPU space in | ||
664 | * order to give access to the ISA memory hole. | ||
665 | * The way out of here that I've chosen for now is to always set the | ||
666 | * offset based on the first resource found, then override it if we | ||
667 | * have a different offset and the previous was set by an ISA hole. | ||
668 | * | ||
669 | * - Some busses have IO space not starting at 0, which causes trouble with | 660 | * - Some busses have IO space not starting at 0, which causes trouble with |
670 | * the way we do our IO resource renumbering. The code somewhat deals with | 661 | * the way we do our IO resource renumbering. The code somewhat deals with |
671 | * it for 64 bits but I would expect problems on 32 bits. | 662 | * it for 64 bits but I would expect problems on 32 bits. |
@@ -680,10 +671,9 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
680 | int rlen; | 671 | int rlen; |
681 | int pna = of_n_addr_cells(dev); | 672 | int pna = of_n_addr_cells(dev); |
682 | int np = pna + 5; | 673 | int np = pna + 5; |
683 | int memno = 0, isa_hole = -1; | 674 | int memno = 0; |
684 | u32 pci_space; | 675 | u32 pci_space; |
685 | unsigned long long pci_addr, cpu_addr, pci_next, cpu_next, size; | 676 | unsigned long long pci_addr, cpu_addr, pci_next, cpu_next, size; |
686 | unsigned long long isa_mb = 0; | ||
687 | struct resource *res; | 677 | struct resource *res; |
688 | 678 | ||
689 | printk(KERN_INFO "PCI host bridge %s %s ranges:\n", | 679 | printk(KERN_INFO "PCI host bridge %s %s ranges:\n", |
@@ -777,8 +767,6 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
777 | } | 767 | } |
778 | /* Handles ISA memory hole space here */ | 768 | /* Handles ISA memory hole space here */ |
779 | if (pci_addr == 0) { | 769 | if (pci_addr == 0) { |
780 | isa_mb = cpu_addr; | ||
781 | isa_hole = memno; | ||
782 | if (primary || isa_mem_base == 0) | 770 | if (primary || isa_mem_base == 0) |
783 | isa_mem_base = cpu_addr; | 771 | isa_mem_base = cpu_addr; |
784 | hose->isa_mem_phys = cpu_addr; | 772 | hose->isa_mem_phys = cpu_addr; |
@@ -839,6 +827,7 @@ static void pcibios_fixup_resources(struct pci_dev *dev) | |||
839 | } | 827 | } |
840 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | 828 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
841 | struct resource *res = dev->resource + i; | 829 | struct resource *res = dev->resource + i; |
830 | struct pci_bus_region reg; | ||
842 | if (!res->flags) | 831 | if (!res->flags) |
843 | continue; | 832 | continue; |
844 | 833 | ||
@@ -847,8 +836,9 @@ static void pcibios_fixup_resources(struct pci_dev *dev) | |||
847 | * at 0 as unset as well, except if PCI_PROBE_ONLY is also set | 836 | * at 0 as unset as well, except if PCI_PROBE_ONLY is also set |
848 | * since in that case, we don't want to re-assign anything | 837 | * since in that case, we don't want to re-assign anything |
849 | */ | 838 | */ |
839 | pcibios_resource_to_bus(dev, ®, res); | ||
850 | if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) || | 840 | if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) || |
851 | (res->start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { | 841 | (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { |
852 | /* Only print message if not re-assigning */ | 842 | /* Only print message if not re-assigning */ |
853 | if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) | 843 | if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) |
854 | pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] " | 844 | pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] " |
@@ -1004,7 +994,7 @@ void pcibios_setup_bus_self(struct pci_bus *bus) | |||
1004 | ppc_md.pci_dma_bus_setup(bus); | 994 | ppc_md.pci_dma_bus_setup(bus); |
1005 | } | 995 | } |
1006 | 996 | ||
1007 | void pcibios_setup_device(struct pci_dev *dev) | 997 | static void pcibios_setup_device(struct pci_dev *dev) |
1008 | { | 998 | { |
1009 | /* Fixup NUMA node as it may not be setup yet by the generic | 999 | /* Fixup NUMA node as it may not be setup yet by the generic |
1010 | * code and is needed by the DMA init | 1000 | * code and is needed by the DMA init |
@@ -1025,6 +1015,17 @@ void pcibios_setup_device(struct pci_dev *dev) | |||
1025 | ppc_md.pci_irq_fixup(dev); | 1015 | ppc_md.pci_irq_fixup(dev); |
1026 | } | 1016 | } |
1027 | 1017 | ||
1018 | int pcibios_add_device(struct pci_dev *dev) | ||
1019 | { | ||
1020 | /* | ||
1021 | * We can only call pcibios_setup_device() after bus setup is complete, | ||
1022 | * since some of the platform specific DMA setup code depends on it. | ||
1023 | */ | ||
1024 | if (dev->bus->is_added) | ||
1025 | pcibios_setup_device(dev); | ||
1026 | return 0; | ||
1027 | } | ||
1028 | |||
1028 | void pcibios_setup_bus_devices(struct pci_bus *bus) | 1029 | void pcibios_setup_bus_devices(struct pci_bus *bus) |
1029 | { | 1030 | { |
1030 | struct pci_dev *dev; | 1031 | struct pci_dev *dev; |
@@ -1479,10 +1480,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
1479 | if (ppc_md.pcibios_enable_device_hook(dev)) | 1480 | if (ppc_md.pcibios_enable_device_hook(dev)) |
1480 | return -EINVAL; | 1481 | return -EINVAL; |
1481 | 1482 | ||
1482 | /* avoid pcie irq fix up impact on cardbus */ | ||
1483 | if (dev->hdr_type != PCI_HEADER_TYPE_CARDBUS) | ||
1484 | pcibios_setup_device(dev); | ||
1485 | |||
1486 | return pci_enable_resources(dev, mask); | 1483 | return pci_enable_resources(dev, mask); |
1487 | } | 1484 | } |
1488 | 1485 | ||
@@ -1520,9 +1517,10 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose, | |||
1520 | for (i = 0; i < 3; ++i) { | 1517 | for (i = 0; i < 3; ++i) { |
1521 | res = &hose->mem_resources[i]; | 1518 | res = &hose->mem_resources[i]; |
1522 | if (!res->flags) { | 1519 | if (!res->flags) { |
1523 | printk(KERN_ERR "PCI: Memory resource 0 not set for " | 1520 | if (i == 0) |
1524 | "host bridge %s (domain %d)\n", | 1521 | printk(KERN_ERR "PCI: Memory resource 0 not set for " |
1525 | hose->dn->full_name, hose->global_number); | 1522 | "host bridge %s (domain %d)\n", |
1523 | hose->dn->full_name, hose->global_number); | ||
1526 | continue; | 1524 | continue; |
1527 | } | 1525 | } |
1528 | offset = hose->mem_offset[i]; | 1526 | offset = hose->mem_offset[i]; |