diff options
Diffstat (limited to 'arch/powerpc/kernel/pci-common.c')
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 893af2a9cd0..32656f10525 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -50,7 +50,7 @@ static int global_phb_number; /* Global phb counter */ | |||
50 | resource_size_t isa_mem_base; | 50 | resource_size_t isa_mem_base; |
51 | 51 | ||
52 | /* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */ | 52 | /* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */ |
53 | unsigned int ppc_pci_flags = 0; | 53 | unsigned int pci_flags = 0; |
54 | 54 | ||
55 | 55 | ||
56 | static struct dma_map_ops *pci_dma_ops = &dma_direct_ops; | 56 | static struct dma_map_ops *pci_dma_ops = &dma_direct_ops; |
@@ -107,7 +107,7 @@ static resource_size_t pcibios_io_size(const struct pci_controller *hose) | |||
107 | #ifdef CONFIG_PPC64 | 107 | #ifdef CONFIG_PPC64 |
108 | return hose->pci_io_size; | 108 | return hose->pci_io_size; |
109 | #else | 109 | #else |
110 | return hose->io_resource.end - hose->io_resource.start + 1; | 110 | return resource_size(&hose->io_resource); |
111 | #endif | 111 | #endif |
112 | } | 112 | } |
113 | 113 | ||
@@ -842,9 +842,9 @@ int pci_proc_domain(struct pci_bus *bus) | |||
842 | { | 842 | { |
843 | struct pci_controller *hose = pci_bus_to_host(bus); | 843 | struct pci_controller *hose = pci_bus_to_host(bus); |
844 | 844 | ||
845 | if (!(ppc_pci_flags & PPC_PCI_ENABLE_PROC_DOMAINS)) | 845 | if (!pci_has_flag(PCI_ENABLE_PROC_DOMAINS)) |
846 | return 0; | 846 | return 0; |
847 | if (ppc_pci_flags & PPC_PCI_COMPAT_DOMAIN_0) | 847 | if (pci_has_flag(PCI_COMPAT_DOMAIN_0)) |
848 | return hose->global_number != 0; | 848 | return hose->global_number != 0; |
849 | return 1; | 849 | return 1; |
850 | } | 850 | } |
@@ -920,13 +920,13 @@ static void __devinit pcibios_fixup_resources(struct pci_dev *dev) | |||
920 | struct resource *res = dev->resource + i; | 920 | struct resource *res = dev->resource + i; |
921 | if (!res->flags) | 921 | if (!res->flags) |
922 | continue; | 922 | continue; |
923 | /* On platforms that have PPC_PCI_PROBE_ONLY set, we don't | 923 | /* On platforms that have PCI_PROBE_ONLY set, we don't |
924 | * consider 0 as an unassigned BAR value. It's technically | 924 | * consider 0 as an unassigned BAR value. It's technically |
925 | * a valid value, but linux doesn't like it... so when we can | 925 | * a valid value, but linux doesn't like it... so when we can |
926 | * re-assign things, we do so, but if we can't, we keep it | 926 | * re-assign things, we do so, but if we can't, we keep it |
927 | * around and hope for the best... | 927 | * around and hope for the best... |
928 | */ | 928 | */ |
929 | if (res->start == 0 && !(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) { | 929 | if (res->start == 0 && !pci_has_flag(PCI_PROBE_ONLY)) { |
930 | pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] is unassigned\n", | 930 | pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] is unassigned\n", |
931 | pci_name(dev), i, | 931 | pci_name(dev), i, |
932 | (unsigned long long)res->start, | 932 | (unsigned long long)res->start, |
@@ -973,7 +973,7 @@ static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus, | |||
973 | int i; | 973 | int i; |
974 | 974 | ||
975 | /* We don't do anything if PCI_PROBE_ONLY is set */ | 975 | /* We don't do anything if PCI_PROBE_ONLY is set */ |
976 | if (ppc_pci_flags & PPC_PCI_PROBE_ONLY) | 976 | if (pci_has_flag(PCI_PROBE_ONLY)) |
977 | return 0; | 977 | return 0; |
978 | 978 | ||
979 | /* Job is a bit different between memory and IO */ | 979 | /* Job is a bit different between memory and IO */ |
@@ -1097,9 +1097,6 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus) | |||
1097 | if (dev->is_added) | 1097 | if (dev->is_added) |
1098 | continue; | 1098 | continue; |
1099 | 1099 | ||
1100 | /* Setup OF node pointer in the device */ | ||
1101 | dev->dev.of_node = pci_device_to_OF_node(dev); | ||
1102 | |||
1103 | /* Fixup NUMA node as it may not be setup yet by the generic | 1100 | /* Fixup NUMA node as it may not be setup yet by the generic |
1104 | * code and is needed by the DMA init | 1101 | * code and is needed by the DMA init |
1105 | */ | 1102 | */ |
@@ -1146,7 +1143,7 @@ void __devinit pci_fixup_cardbus(struct pci_bus *bus) | |||
1146 | 1143 | ||
1147 | static int skip_isa_ioresource_align(struct pci_dev *dev) | 1144 | static int skip_isa_ioresource_align(struct pci_dev *dev) |
1148 | { | 1145 | { |
1149 | if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && | 1146 | if (pci_has_flag(PCI_CAN_SKIP_ISA_ALIGN) && |
1150 | !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA)) | 1147 | !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA)) |
1151 | return 1; | 1148 | return 1; |
1152 | return 0; | 1149 | return 0; |
@@ -1274,7 +1271,7 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus) | |||
1274 | * and as such ensure proper re-allocation | 1271 | * and as such ensure proper re-allocation |
1275 | * later. | 1272 | * later. |
1276 | */ | 1273 | */ |
1277 | if (ppc_pci_flags & PPC_PCI_REASSIGN_ALL_RSRC) | 1274 | if (pci_has_flag(PCI_REASSIGN_ALL_RSRC)) |
1278 | goto clear_resource; | 1275 | goto clear_resource; |
1279 | pr = pci_find_parent_resource(bus->self, res); | 1276 | pr = pci_find_parent_resource(bus->self, res); |
1280 | if (pr == res) { | 1277 | if (pr == res) { |
@@ -1459,7 +1456,7 @@ void __init pcibios_resource_survey(void) | |||
1459 | list_for_each_entry(b, &pci_root_buses, node) | 1456 | list_for_each_entry(b, &pci_root_buses, node) |
1460 | pcibios_allocate_bus_resources(b); | 1457 | pcibios_allocate_bus_resources(b); |
1461 | 1458 | ||
1462 | if (!(ppc_pci_flags & PPC_PCI_REASSIGN_ALL_RSRC)) { | 1459 | if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) { |
1463 | pcibios_allocate_resources(0); | 1460 | pcibios_allocate_resources(0); |
1464 | pcibios_allocate_resources(1); | 1461 | pcibios_allocate_resources(1); |
1465 | } | 1462 | } |
@@ -1468,7 +1465,7 @@ void __init pcibios_resource_survey(void) | |||
1468 | * the low IO area and the VGA memory area if they intersect the | 1465 | * the low IO area and the VGA memory area if they intersect the |
1469 | * bus available resources to avoid allocating things on top of them | 1466 | * bus available resources to avoid allocating things on top of them |
1470 | */ | 1467 | */ |
1471 | if (!(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) { | 1468 | if (!pci_has_flag(PCI_PROBE_ONLY)) { |
1472 | list_for_each_entry(b, &pci_root_buses, node) | 1469 | list_for_each_entry(b, &pci_root_buses, node) |
1473 | pcibios_reserve_legacy_regions(b); | 1470 | pcibios_reserve_legacy_regions(b); |
1474 | } | 1471 | } |
@@ -1476,7 +1473,7 @@ void __init pcibios_resource_survey(void) | |||
1476 | /* Now, if the platform didn't decide to blindly trust the firmware, | 1473 | /* Now, if the platform didn't decide to blindly trust the firmware, |
1477 | * we proceed to assigning things that were left unassigned | 1474 | * we proceed to assigning things that were left unassigned |
1478 | */ | 1475 | */ |
1479 | if (!(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) { | 1476 | if (!pci_has_flag(PCI_PROBE_ONLY)) { |
1480 | pr_debug("PCI: Assigning unassigned resources...\n"); | 1477 | pr_debug("PCI: Assigning unassigned resources...\n"); |
1481 | pci_assign_unassigned_resources(); | 1478 | pci_assign_unassigned_resources(); |
1482 | } | 1479 | } |
@@ -1685,6 +1682,13 @@ int early_find_capability(struct pci_controller *hose, int bus, int devfn, | |||
1685 | return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap); | 1682 | return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap); |
1686 | } | 1683 | } |
1687 | 1684 | ||
1685 | struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus) | ||
1686 | { | ||
1687 | struct pci_controller *hose = bus->sysdata; | ||
1688 | |||
1689 | return of_node_get(hose->dn); | ||
1690 | } | ||
1691 | |||
1688 | /** | 1692 | /** |
1689 | * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus | 1693 | * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus |
1690 | * @hose: Pointer to the PCI host controller instance structure | 1694 | * @hose: Pointer to the PCI host controller instance structure |
@@ -1705,7 +1709,6 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose) | |||
1705 | hose->global_number); | 1709 | hose->global_number); |
1706 | return; | 1710 | return; |
1707 | } | 1711 | } |
1708 | bus->dev.of_node = of_node_get(node); | ||
1709 | bus->secondary = hose->first_busno; | 1712 | bus->secondary = hose->first_busno; |
1710 | hose->bus = bus; | 1713 | hose->bus = bus; |
1711 | 1714 | ||
@@ -1728,3 +1731,21 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose) | |||
1728 | if (mode == PCI_PROBE_NORMAL) | 1731 | if (mode == PCI_PROBE_NORMAL) |
1729 | hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); | 1732 | hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); |
1730 | } | 1733 | } |
1734 | |||
1735 | static void fixup_hide_host_resource_fsl(struct pci_dev *dev) | ||
1736 | { | ||
1737 | int i, class = dev->class >> 8; | ||
1738 | |||
1739 | if ((class == PCI_CLASS_PROCESSOR_POWERPC || | ||
1740 | class == PCI_CLASS_BRIDGE_OTHER) && | ||
1741 | (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) && | ||
1742 | (dev->bus->parent == NULL)) { | ||
1743 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
1744 | dev->resource[i].start = 0; | ||
1745 | dev->resource[i].end = 0; | ||
1746 | dev->resource[i].flags = 0; | ||
1747 | } | ||
1748 | } | ||
1749 | } | ||
1750 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, fixup_hide_host_resource_fsl); | ||
1751 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, fixup_hide_host_resource_fsl); | ||