diff options
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci-ioda.c')
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index b46e1dadc882..0e7eccc0f88d 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -1139,6 +1139,44 @@ static void __devinit pnv_pci_ioda_fixup_phb(struct pci_controller *hose) | |||
1139 | } | 1139 | } |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | /* | ||
1143 | * Returns the alignment for I/O or memory windows for P2P | ||
1144 | * bridges. That actually depends on how PEs are segmented. | ||
1145 | * For now, we return I/O or M32 segment size for PE sensitive | ||
1146 | * P2P bridges. Otherwise, the default values (4KiB for I/O, | ||
1147 | * 1MiB for memory) will be returned. | ||
1148 | * | ||
1149 | * The current PCI bus might be put into one PE, which was | ||
1150 | * create against the parent PCI bridge. For that case, we | ||
1151 | * needn't enlarge the alignment so that we can save some | ||
1152 | * resources. | ||
1153 | */ | ||
1154 | static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus, | ||
1155 | unsigned long type) | ||
1156 | { | ||
1157 | struct pci_dev *bridge; | ||
1158 | struct pci_controller *hose = pci_bus_to_host(bus); | ||
1159 | struct pnv_phb *phb = hose->private_data; | ||
1160 | int num_pci_bridges = 0; | ||
1161 | |||
1162 | bridge = bus->self; | ||
1163 | while (bridge) { | ||
1164 | if (pci_pcie_type(bridge) == PCI_EXP_TYPE_PCI_BRIDGE) { | ||
1165 | num_pci_bridges++; | ||
1166 | if (num_pci_bridges >= 2) | ||
1167 | return 1; | ||
1168 | } | ||
1169 | |||
1170 | bridge = bridge->bus->self; | ||
1171 | } | ||
1172 | |||
1173 | /* We need support prefetchable memory window later */ | ||
1174 | if (type & IORESOURCE_MEM) | ||
1175 | return phb->ioda.m32_segsize; | ||
1176 | |||
1177 | return phb->ioda.io_segsize; | ||
1178 | } | ||
1179 | |||
1142 | /* Prevent enabling devices for which we couldn't properly | 1180 | /* Prevent enabling devices for which we couldn't properly |
1143 | * assign a PE | 1181 | * assign a PE |
1144 | */ | 1182 | */ |
@@ -1306,6 +1344,7 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np) | |||
1306 | */ | 1344 | */ |
1307 | ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb; | 1345 | ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb; |
1308 | ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook; | 1346 | ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook; |
1347 | ppc_md.pcibios_window_alignment = pnv_pci_window_alignment; | ||
1309 | pci_add_flags(PCI_PROBE_ONLY | PCI_REASSIGN_ALL_RSRC); | 1348 | pci_add_flags(PCI_PROBE_ONLY | PCI_REASSIGN_ALL_RSRC); |
1310 | 1349 | ||
1311 | /* Reset IODA tables to a clean state */ | 1350 | /* Reset IODA tables to a clean state */ |