aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2019-06-18 15:50:24 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2019-06-29 10:41:50 +1000
commit9541b39201ed34f9d2c49495aef4c385dc83edb1 (patch)
treecb56acd82a4cca1e42283119b2cb8946b2b58a2d
parentd0c7ce60372867480393694eb6b2a9b3e7bc80dd (diff)
downloadpci-9541b39201ed34f9d2c49495aef4c385dc83edb1.tar.gz
parisc: dino_pci: Use pci_host_resource_survey()
Now that code is a bit obscure, so I hope I didn't break anything. It tries to allocate resources from pcibios_fixup_bus(). I ripped that out, in favor of a call to pci_host_resource_survey() with the policy set to reassign everything, which is I think what the old code was attempting to do, except the old code was preserving the existing p2p bridge sizes, while this will recalculate and reassign them completely. Testing needed... Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--drivers/parisc/dino.c38
1 files changed, 4 insertions, 34 deletions
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index 3c730103e6379e..ac920dbfb6dee1 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -555,40 +555,8 @@ dino_fixup_bus(struct pci_bus *bus)
/* Firmware doesn't set up card-mode dino, so we have to */
if (is_card_dino(&dino_dev->hba.dev->id)) {
dino_card_setup(bus, dino_dev->hba.base_addr);
- } else if (bus->parent) {
- int i;
-
- pci_read_bridge_bases(bus);
-
-
- for(i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) {
- if((bus->self->resource[i].flags &
- (IORESOURCE_IO | IORESOURCE_MEM)) == 0)
- continue;
-
- if(bus->self->resource[i].flags & IORESOURCE_MEM) {
- /* There's a quirk to alignment of
- * bridge memory resources: the start
- * is the alignment and start-end is
- * the size. However, firmware will
- * have assigned start and end, so we
- * need to take this into account */
- bus->self->resource[i].end = bus->self->resource[i].end - bus->self->resource[i].start + DINO_BRIDGE_ALIGN;
- bus->self->resource[i].start = DINO_BRIDGE_ALIGN;
-
- }
-
- DBG("DEBUG %s assigning %d [%pR]\n",
- dev_name(&bus->self->dev), i,
- &bus->self->resource[i]);
- WARN_ON(pci_assign_resource(bus->self, i));
- DBG("DEBUG %s after assign %d [%pR]\n",
- dev_name(&bus->self->dev), i,
- &bus->self->resource[i]);
- }
}
-
list_for_each_entry(dev, &bus->devices, bus_list) {
if (is_card_dino(&dino_dev->hba.dev->id))
dino_card_fixup(dev);
@@ -884,6 +852,7 @@ void ccio_cujo20_fixup(struct parisc_device *dev, u32 iovp);
*/
static int __init dino_probe(struct parisc_device *dev)
{
+ struct pci_host_bridge *host;
struct dino_device *dino_dev; // Dino specific control struct
const char *version = "unknown";
char *name;
@@ -995,7 +964,8 @@ static int __init dino_probe(struct parisc_device *dev)
dino_current_bus++;
return 0;
}
-
+ host = pci_find_host_bridge(bus);
+ host->rsrc_policy = pci_rsrc_assign_only;
max = pci_scan_child_bus(bus);
pci_bus_update_busn_res_end(bus, max);
@@ -1003,7 +973,7 @@ static int __init dino_probe(struct parisc_device *dev)
* if it isn't, this global bus number count will fail
*/
dino_current_bus = max + 1;
- pci_bus_assign_resources(bus);
+ pci_host_resource_survey(bus);
pci_bus_add_devices(bus);
return 0;
}