diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2011-10-28 18:26:31 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2012-01-06 15:10:58 -0500 |
commit | e30f99222fd7b701ba7bc564722bb284ab2b2317 (patch) | |
tree | 8b7efbe8f96d4126be03a2fea054580b02d76687 /arch/ia64/pci/pci.c | |
parent | 79e77f27f52264768a393f8bafb548d3776f993e (diff) |
ia64/PCI: convert to pci_create_root_bus() for correct root bus resources
Convert from pci_create_bus() to pci_create_root_bus(). This way the root
bus resources are correct immediately. This fixes the problem of "early"
and "header" quirks seeing incorrect root bus resources.
We can't use pci_scan_root_bus() because, like x86, ACPI hotplug currently
requires pci_bus_add_devices() in a separate host bridge .start() method.
v2: fix compile error by using window resource pointer instead
CC: Tony Luck <tony.luck@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch/ia64/pci/pci.c')
-rw-r--r-- | arch/ia64/pci/pci.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 3f9c86ad00fa..f82f5d4b65fd 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -134,6 +134,7 @@ alloc_pci_controller (int seg) | |||
134 | struct pci_root_info { | 134 | struct pci_root_info { |
135 | struct acpi_device *bridge; | 135 | struct acpi_device *bridge; |
136 | struct pci_controller *controller; | 136 | struct pci_controller *controller; |
137 | struct list_head resources; | ||
137 | char *name; | 138 | char *name; |
138 | }; | 139 | }; |
139 | 140 | ||
@@ -315,24 +316,13 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data) | |||
315 | &window->resource); | 316 | &window->resource); |
316 | } | 317 | } |
317 | 318 | ||
318 | return AE_OK; | 319 | /* HP's firmware has a hack to work around a Windows bug. |
319 | } | 320 | * Ignore these tiny memory ranges */ |
321 | if (!((window->resource.flags & IORESOURCE_MEM) && | ||
322 | (window->resource.end - window->resource.start < 16))) | ||
323 | pci_add_resource(&info->resources, &window->resource); | ||
320 | 324 | ||
321 | static void __devinit | 325 | return AE_OK; |
322 | pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl) | ||
323 | { | ||
324 | int i; | ||
325 | |||
326 | pci_bus_remove_resources(bus); | ||
327 | for (i = 0; i < ctrl->windows; i++) { | ||
328 | struct resource *res = &ctrl->window[i].resource; | ||
329 | /* HP's firmware has a hack to work around a Windows bug. | ||
330 | * Ignore these tiny memory ranges */ | ||
331 | if ((res->flags & IORESOURCE_MEM) && | ||
332 | (res->end - res->start < 16)) | ||
333 | continue; | ||
334 | pci_bus_add_resource(bus, res, 0); | ||
335 | } | ||
336 | } | 326 | } |
337 | 327 | ||
338 | struct pci_bus * __devinit | 328 | struct pci_bus * __devinit |
@@ -343,6 +333,7 @@ pci_acpi_scan_root(struct acpi_pci_root *root) | |||
343 | int bus = root->secondary.start; | 333 | int bus = root->secondary.start; |
344 | struct pci_controller *controller; | 334 | struct pci_controller *controller; |
345 | unsigned int windows = 0; | 335 | unsigned int windows = 0; |
336 | struct pci_root_info info; | ||
346 | struct pci_bus *pbus; | 337 | struct pci_bus *pbus; |
347 | char *name; | 338 | char *name; |
348 | int pxm; | 339 | int pxm; |
@@ -359,11 +350,10 @@ pci_acpi_scan_root(struct acpi_pci_root *root) | |||
359 | controller->node = pxm_to_node(pxm); | 350 | controller->node = pxm_to_node(pxm); |
360 | #endif | 351 | #endif |
361 | 352 | ||
353 | INIT_LIST_HEAD(&info.resources); | ||
362 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, | 354 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, |
363 | &windows); | 355 | &windows); |
364 | if (windows) { | 356 | if (windows) { |
365 | struct pci_root_info info; | ||
366 | |||
367 | controller->window = | 357 | controller->window = |
368 | kmalloc_node(sizeof(*controller->window) * windows, | 358 | kmalloc_node(sizeof(*controller->window) * windows, |
369 | GFP_KERNEL, controller->node); | 359 | GFP_KERNEL, controller->node); |
@@ -387,9 +377,12 @@ pci_acpi_scan_root(struct acpi_pci_root *root) | |||
387 | * should handle the case here, but it appears that IA64 hasn't | 377 | * should handle the case here, but it appears that IA64 hasn't |
388 | * such quirk. So we just ignore the case now. | 378 | * such quirk. So we just ignore the case now. |
389 | */ | 379 | */ |
390 | pbus = pci_create_bus(NULL, bus, &pci_root_ops, controller); | 380 | pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller, |
391 | if (!pbus) | 381 | &info.resources); |
382 | if (!pbus) { | ||
383 | pci_free_resource_list(&info.resources); | ||
392 | return NULL; | 384 | return NULL; |
385 | } | ||
393 | 386 | ||
394 | pbus->subordinate = pci_scan_child_bus(pbus); | 387 | pbus->subordinate = pci_scan_child_bus(pbus); |
395 | return pbus; | 388 | return pbus; |
@@ -507,14 +500,10 @@ pcibios_fixup_bus (struct pci_bus *b) | |||
507 | if (b->self) { | 500 | if (b->self) { |
508 | pci_read_bridge_bases(b); | 501 | pci_read_bridge_bases(b); |
509 | pcibios_fixup_bridge_resources(b->self); | 502 | pcibios_fixup_bridge_resources(b->self); |
510 | } else { | ||
511 | pcibios_setup_root_windows(b, b->sysdata); | ||
512 | } | 503 | } |
513 | list_for_each_entry(dev, &b->devices, bus_list) | 504 | list_for_each_entry(dev, &b->devices, bus_list) |
514 | pcibios_fixup_device_resources(dev); | 505 | pcibios_fixup_device_resources(dev); |
515 | platform_pci_fixup_bus(b); | 506 | platform_pci_fixup_bus(b); |
516 | |||
517 | return; | ||
518 | } | 507 | } |
519 | 508 | ||
520 | void pcibios_set_master (struct pci_dev *dev) | 509 | void pcibios_set_master (struct pci_dev *dev) |