Upstream changes to the way PHB resources are registered broke the resource fixup for FSL boards. We can no longer rely on the resource pointer array for the PHB's pci_bus structure, so let's leave it alone and go straight for the PHB resources instead. This also makes the code generally more readable.
Unified · Split
| @@ -385,26 +385,36 @@ static void __init setup_pci_cmd(struct pci_controller *hose) · 384 unmodified lines | ||
| 385 | 385 | void fsl_pcibios_fixup_bus(struct pci_bus *bus) |
| 386 | 386 | { |
| 387 | 387 | struct pci_controller *hose = pci_bus_to_host(bus); |
| 388 | − int i; | |
| 389 | − | |
| 390 | − if ((bus->parent == hose->bus) && | |
| 391 | − ((fsl_pcie_bus_fixup && | |
| 392 | − early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) || | |
| 393 | − (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK))) | |
| 394 | − { | |
| 395 | − for (i = 0; i < 4; ++i) { | |
| 388 | + int i, is_pcie = 0, no_link; | |
| 389 | + | |
| 390 | + /* The root complex bridge comes up with bogus resources, | |
| 391 | + * we copy the PHB ones in. | |
| 392 | + * | |
| 393 | + * With the current generic PCI code, the PHB bus no longer | |
| 394 | + * has bus->resource[0..4] set, so things are a bit more | |
| 395 | + * tricky. | |
| 396 | + */ | |
| 397 | + | |
| 398 | + if (fsl_pcie_bus_fixup) | |
| 399 | + is_pcie = early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP); | |
| 400 | + no_link = !!(hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK); | |
| 401 | + | |
| 402 | + if (bus->parent == hose->bus && (is_pcie || no_link)) { | |
| 403 | + for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; ++i) { | |
| 396 | 404 | struct resource *res = bus->resource[i]; |
| 397 | − struct resource *par = bus->parent->resource[i]; | |
| 398 | − if (res) { | |
| 399 | − res->start = 0; | |
| 400 | − res->end = 0; | |
| 401 | − res->flags = 0; | |
| 402 | − } | |
| 403 | − if (res && par) { | |
| 404 | − res->start = par->start; | |
| 405 | − res->end = par->end; | |
| 406 | − res->flags = par->flags; | |
| 407 | − } | |
| 405 | + struct resource *par; | |
| 406 | + | |
| 407 | + if (!res) | |
| 408 | + continue; | |
| 409 | + if (i == 0) | |
| 410 | + par = &hose->io_resource; | |
| 411 | + else if (i < 4) | |
| 412 | + par = &hose->mem_resources[i-1]; | |
| 413 | + else par = NULL; | |
| 414 | + | |
| 415 | + res->start = par ? par->start : 0; | |
| 416 | + res->end = par ? par->end : 0; | |
| 417 | + res->flags = par ? par->flags : 0; | |
| 408 | 418 | } |
| 409 | 419 | } |
| 410 | 420 | } |