diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2019-06-17 16:17:30 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2019-06-24 14:03:57 +1000 |
commit | 7c7a2a1fd1ce2a6665e72aea2dcb34d1c7c19247 (patch) | |
tree | 2c97ac048963558e1b9d8516e6eb7992f0e5a2a4 | |
parent | 5a854951273bdefde6c3a50450f43d4a5d89031f (diff) | |
download | pci-7c7a2a1fd1ce2a6665e72aea2dcb34d1c7c19247.tar.gz |
mips: PCI: Use pci_host_resource_survey()
This replaces the open coded equivalent
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/mips/pci/pci-legacy.c | 30 | ||||
-rw-r--r-- | arch/mips/pci/pci-xtalk-bridge.c | 7 |
2 files changed, 14 insertions, 23 deletions
diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c index 39052de915f343..7ea6be26f8ec89 100644 --- a/arch/mips/pci/pci-legacy.c +++ b/arch/mips/pci/pci-legacy.c @@ -18,11 +18,6 @@ #include <asm/cpu-info.h> /* - * If PCI_PROBE_ONLY in pci_flags is set, we don't change any PCI resource - * assignments. - */ - -/* * The PCI controller list. */ static LIST_HEAD(controllers); @@ -116,21 +111,8 @@ static void pcibios_scanbus(struct pci_controller *hose) need_domain_info = 1; } - /* - * We insert PCI resources into the iomem_resource and - * ioport_resource trees in either pci_bus_claim_resources() - * or pci_bus_assign_resources(). - */ - if (pci_has_flag(PCI_PROBE_ONLY)) { - pci_bus_claim_resources(bus); - } else { - struct pci_bus *child; - - pci_bus_size_bridges(bus); - pci_bus_assign_resources(bus); - list_for_each_entry(child, &bus->children, node) - pcie_bus_configure_settings(child); - } + /* Setup PCI resources according to default policy */ + pci_host_resource_survey(bus); pci_bus_add_devices(bus); } @@ -233,6 +215,14 @@ static int __init pcibios_init(void) { struct pci_controller *hose; + /* + * Default resource policy: Reassign all + * + * Some platforms may have set PCI_PROBE_ONLY already, which will + * take precendence over this. + */ + pci_add_flags(PCI_REASSIGN_ALL_RSRC); + /* Scan all of the recorded PCI controllers. */ list_for_each_entry(hose, &controllers, list) pcibios_scanbus(hose); diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c index bcf7f559789a02..444faddafd030d 100644 --- a/arch/mips/pci/pci-xtalk-bridge.c +++ b/arch/mips/pci/pci-xtalk-bridge.c @@ -492,14 +492,15 @@ static int bridge_probe(struct platform_device *pdev) if (!domain) return -ENOMEM; - pci_set_flags(PCI_PROBE_ONLY); - host = devm_pci_alloc_host_bridge(dev, sizeof(*bc)); if (!host) { err = -ENOMEM; goto err_remove_domain; } + /* Use an explicit resource policy for xtalk bridges */ + host->rsrc_policy = pci_rsrc_claim_only; + bc = pci_host_bridge_priv(host); bc->busn.name = "Bridge PCI busn"; @@ -571,7 +572,7 @@ static int bridge_probe(struct platform_device *pdev) if (err < 0) goto err_free_resource; - pci_bus_claim_resources(host->bus); + pci_host_resource_survey(host->bus); pci_bus_add_devices(host->bus); platform_set_drvdata(pdev, host->bus); |