aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/pci/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/pci/pci.c')
-rw-r--r--arch/ia64/pci/pci.c55
1 files changed, 2 insertions, 53 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 94627926552..524df4295c9 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -319,7 +319,8 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
319 * Ignore these tiny memory ranges */ 319 * Ignore these tiny memory ranges */
320 if (!((window->resource.flags & IORESOURCE_MEM) && 320 if (!((window->resource.flags & IORESOURCE_MEM) &&
321 (window->resource.end - window->resource.start < 16))) 321 (window->resource.end - window->resource.start < 16)))
322 pci_add_resource(&info->resources, &window->resource); 322 pci_add_resource_offset(&info->resources, &window->resource,
323 window->offset);
323 324
324 return AE_OK; 325 return AE_OK;
325} 326}
@@ -394,54 +395,6 @@ out1:
394 return NULL; 395 return NULL;
395} 396}
396 397
397void pcibios_resource_to_bus(struct pci_dev *dev,
398 struct pci_bus_region *region, struct resource *res)
399{
400 struct pci_controller *controller = PCI_CONTROLLER(dev);
401 unsigned long offset = 0;
402 int i;
403
404 for (i = 0; i < controller->windows; i++) {
405 struct pci_window *window = &controller->window[i];
406 if (!(window->resource.flags & res->flags))
407 continue;
408 if (window->resource.start > res->start)
409 continue;
410 if (window->resource.end < res->end)
411 continue;
412 offset = window->offset;
413 break;
414 }
415
416 region->start = res->start - offset;
417 region->end = res->end - offset;
418}
419EXPORT_SYMBOL(pcibios_resource_to_bus);
420
421void pcibios_bus_to_resource(struct pci_dev *dev,
422 struct resource *res, struct pci_bus_region *region)
423{
424 struct pci_controller *controller = PCI_CONTROLLER(dev);
425 unsigned long offset = 0;
426 int i;
427
428 for (i = 0; i < controller->windows; i++) {
429 struct pci_window *window = &controller->window[i];
430 if (!(window->resource.flags & res->flags))
431 continue;
432 if (window->resource.start - window->offset > region->start)
433 continue;
434 if (window->resource.end - window->offset < region->end)
435 continue;
436 offset = window->offset;
437 break;
438 }
439
440 res->start = region->start + offset;
441 res->end = region->end + offset;
442}
443EXPORT_SYMBOL(pcibios_bus_to_resource);
444
445static int __devinit is_valid_resource(struct pci_dev *dev, int idx) 398static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
446{ 399{
447 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 400 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
@@ -463,15 +416,11 @@ static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
463static void __devinit 416static void __devinit
464pcibios_fixup_resources(struct pci_dev *dev, int start, int limit) 417pcibios_fixup_resources(struct pci_dev *dev, int start, int limit)
465{ 418{
466 struct pci_bus_region region;
467 int i; 419 int i;
468 420
469 for (i = start; i < limit; i++) { 421 for (i = start; i < limit; i++) {
470 if (!dev->resource[i].flags) 422 if (!dev->resource[i].flags)
471 continue; 423 continue;
472 region.start = dev->resource[i].start;
473 region.end = dev->resource[i].end;
474 pcibios_bus_to_resource(dev, &dev->resource[i], &region);
475 if ((is_valid_resource(dev, i))) 424 if ((is_valid_resource(dev, i)))
476 pci_claim_resource(dev, i); 425 pci_claim_resource(dev, i);
477 } 426 }