diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2012-03-16 19:48:14 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2012-03-20 13:41:51 -0400 |
commit | 39aa146aad3711317baa661e6c421e979c432f2d (patch) | |
tree | 9900cb0d8de115dec5e4f9d0214c423ac848f0e8 /arch/powerpc/kernel/pci_of_scan.c | |
parent | 38973ba7903fa0660a31b2bdc50ff711ec8d08c9 (diff) |
powerpc/PCI: convert devtree bus addresses to resource
Normal PCI enumeration via PCI config space uses __pci_read_base(), where
the PCI core applies any bus-to-resource offset. But powerpc doesn't use
that path when enumerating via the device tree.
In 6c5705fec63d, I converted powerpc to use the PCI core bus-to-resource
conversion, but I missed these powerpc-specific paths. Some powerpc
platforms fail to boot ("Cannot allocate resource region," "device not
available," etc.) between that commit and this one.
This adds the corresponding bus-to-resource conversion in the paths that
read BAR values from the OF device tree.
CC: Anton Blanchard <anton@samba.org>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch/powerpc/kernel/pci_of_scan.c')
-rw-r--r-- | arch/powerpc/kernel/pci_of_scan.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c index b37d0b5a796e..89dde171a6fa 100644 --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c | |||
@@ -75,6 +75,7 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev) | |||
75 | { | 75 | { |
76 | u64 base, size; | 76 | u64 base, size; |
77 | unsigned int flags; | 77 | unsigned int flags; |
78 | struct pci_bus_region region; | ||
78 | struct resource *res; | 79 | struct resource *res; |
79 | const u32 *addrs; | 80 | const u32 *addrs; |
80 | u32 i; | 81 | u32 i; |
@@ -106,10 +107,11 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev) | |||
106 | printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i); | 107 | printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i); |
107 | continue; | 108 | continue; |
108 | } | 109 | } |
109 | res->start = base; | ||
110 | res->end = base + size - 1; | ||
111 | res->flags = flags; | 110 | res->flags = flags; |
112 | res->name = pci_name(dev); | 111 | res->name = pci_name(dev); |
112 | region.start = base; | ||
113 | region.end = base + size - 1; | ||
114 | pcibios_bus_to_resource(dev, res, ®ion); | ||
113 | } | 115 | } |
114 | } | 116 | } |
115 | 117 | ||
@@ -209,6 +211,7 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev) | |||
209 | struct pci_bus *bus; | 211 | struct pci_bus *bus; |
210 | const u32 *busrange, *ranges; | 212 | const u32 *busrange, *ranges; |
211 | int len, i, mode; | 213 | int len, i, mode; |
214 | struct pci_bus_region region; | ||
212 | struct resource *res; | 215 | struct resource *res; |
213 | unsigned int flags; | 216 | unsigned int flags; |
214 | u64 size; | 217 | u64 size; |
@@ -270,9 +273,10 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev) | |||
270 | res = bus->resource[i]; | 273 | res = bus->resource[i]; |
271 | ++i; | 274 | ++i; |
272 | } | 275 | } |
273 | res->start = of_read_number(&ranges[1], 2); | ||
274 | res->end = res->start + size - 1; | ||
275 | res->flags = flags; | 276 | res->flags = flags; |
277 | region.start = of_read_number(&ranges[1], 2); | ||
278 | region.end = region.start + size - 1; | ||
279 | pcibios_bus_to_resource(dev, res, ®ion); | ||
276 | } | 280 | } |
277 | sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), | 281 | sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), |
278 | bus->number); | 282 | bus->number); |