Skip to content

Commit

Permalink
sparc64: Properly claim resources as each PCI bus is probed.
Browse files Browse the repository at this point in the history
Perform a pci_claim_resource() on all valid resources discovered
during the OF device tree scan.

Based almost entirely upon the PCI OF bus probing code which does
the same thing there.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Aug 14, 2014
1 parent 4afba24 commit f1d25d3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions arch/sparc/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,36 @@ static void pci_bus_register_of_sysfs(struct pci_bus *bus)
pci_bus_register_of_sysfs(child_bus);
}

static void pci_claim_bus_resources(struct pci_bus *bus)
{
struct pci_bus *child_bus;
struct pci_dev *dev;

list_for_each_entry(dev, &bus->devices, bus_list) {
int i;

for (i = 0; i < PCI_NUM_RESOURCES; i++) {
struct resource *r = &dev->resource[i];

if (r->parent || !r->start || !r->flags)
continue;

if (ofpci_verbose)
printk("PCI: Claiming %s: "
"Resource %d: %016llx..%016llx [%x]\n",
pci_name(dev), i,
(unsigned long long)r->start,
(unsigned long long)r->end,
(unsigned int)r->flags);

pci_claim_resource(dev, i);
}
}

list_for_each_entry(child_bus, &bus->children, node)
pci_claim_bus_resources(child_bus);
}

struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
struct device *parent)
{
Expand Down Expand Up @@ -647,6 +677,8 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
pci_bus_add_devices(bus);
pci_bus_register_of_sysfs(bus);

pci_claim_bus_resources(bus);

return bus;
}

Expand Down

0 comments on commit f1d25d3

Please sign in to comment.