diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-01-24 21:31:56 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-01-24 21:32:00 -0500 |
commit | f7ea82beb24f65e2058fa4029edefa0949e872b1 (patch) | |
tree | 85c07317c040fa2dc7962d00dd02eb55003d0768 | |
parent | 897e01a08c08d86bc76bebb0ca14588b406500e5 (diff) |
powerpc/powernv: Fix PCI resource handling
Recent changes to the handling of PCI resources for host bridges
are breaking the PowerNV code for assigning resources on IODA.
The root of the problem is that the pci_bus attached to a host
bridge no longer has its "legacy" resource pointers populated
but only uses the newer list instead.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index f31162cfdaa9..5e155dfc4320 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -204,11 +204,10 @@ static void __devinit pnv_ioda_offset_bus(struct pci_bus *bus, | |||
204 | pr_devel(" -> OBR %s [%x] +%016llx\n", | 204 | pr_devel(" -> OBR %s [%x] +%016llx\n", |
205 | bus->self ? pci_name(bus->self) : "root", flags, offset); | 205 | bus->self ? pci_name(bus->self) : "root", flags, offset); |
206 | 206 | ||
207 | for (i = 0; i < 2; i++) { | 207 | pci_bus_for_each_resource(bus, r, i) { |
208 | r = bus->resource[i]; | ||
209 | if (r && (r->flags & flags)) { | 208 | if (r && (r->flags & flags)) { |
210 | bus->resource[i]->start += offset; | 209 | r->start += offset; |
211 | bus->resource[i]->end += offset; | 210 | r->end += offset; |
212 | } | 211 | } |
213 | } | 212 | } |
214 | list_for_each_entry(dev, &bus->devices, bus_list) | 213 | list_for_each_entry(dev, &bus->devices, bus_list) |
@@ -288,12 +287,17 @@ static void __devinit pnv_ioda_calc_bus(struct pci_bus *bus, unsigned int flags, | |||
288 | * assignment algorithm is going to be uber-trivial for now, we | 287 | * assignment algorithm is going to be uber-trivial for now, we |
289 | * can try to be smarter later at filling out holes. | 288 | * can try to be smarter later at filling out holes. |
290 | */ | 289 | */ |
291 | start = bus->self ? 0 : bus->resource[bres]->start; | 290 | if (bus->self) { |
292 | 291 | /* No offset for downstream bridges */ | |
293 | /* Don't hand out IO 0 */ | 292 | start = 0; |
294 | if ((flags & IORESOURCE_IO) && !bus->self) | 293 | } else { |
295 | start += 0x1000; | 294 | /* Offset from the root */ |
296 | 295 | if (flags & IORESOURCE_IO) | |
296 | /* Don't hand out IO 0 */ | ||
297 | start = hose->io_resource.start + 0x1000; | ||
298 | else | ||
299 | start = hose->mem_resources[0].start; | ||
300 | } | ||
297 | while(!list_empty(&head)) { | 301 | while(!list_empty(&head)) { |
298 | w = list_first_entry(&head, struct resource_wrap, link); | 302 | w = list_first_entry(&head, struct resource_wrap, link); |
299 | list_del(&w->link); | 303 | list_del(&w->link); |
@@ -321,13 +325,20 @@ static void __devinit pnv_ioda_calc_bus(struct pci_bus *bus, unsigned int flags, | |||
321 | empty: | 325 | empty: |
322 | /* Only setup P2P's, not the PHB itself */ | 326 | /* Only setup P2P's, not the PHB itself */ |
323 | if (bus->self) { | 327 | if (bus->self) { |
324 | WARN_ON(bus->resource[bres] == NULL); | 328 | struct resource *res = bus->resource[bres]; |
325 | bus->resource[bres]->start = 0; | 329 | |
326 | bus->resource[bres]->flags = (*size) ? flags : 0; | 330 | if (WARN_ON(res == NULL)) |
327 | bus->resource[bres]->end = (*size) ? (*size - 1) : 0; | 331 | return; |
328 | 332 | ||
329 | /* Clear prefetch bus resources for now */ | 333 | /* |
330 | bus->resource[2]->flags = 0; | 334 | * FIXME: We should probably export and call |
335 | * pci_bridge_check_ranges() to properly re-initialize | ||
336 | * the PCI portion of the flags here, and to detect | ||
337 | * what the bridge actually supports. | ||
338 | */ | ||
339 | res->start = 0; | ||
340 | res->flags = (*size) ? flags : 0; | ||
341 | res->end = (*size) ? (*size - 1) : 0; | ||
331 | } | 342 | } |
332 | 343 | ||
333 | pr_devel("<- CBR %s [%x] *size=%016llx *align=%016llx\n", | 344 | pr_devel("<- CBR %s [%x] *size=%016llx *align=%016llx\n", |