aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/pci
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/pci')
-rw-r--r--arch/ia64/pci/pci.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 2a1487758490..d929858cfb3e 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -373,6 +373,25 @@ void pcibios_bus_to_resource(struct pci_dev *dev,
373 res->end = region->end + offset; 373 res->end = region->end + offset;
374} 374}
375 375
376static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
377{
378 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
379 struct resource *devr = &dev->resource[idx];
380
381 if (!dev->bus)
382 return 0;
383 for (i=0; i<PCI_BUS_NUM_RESOURCES; i++) {
384 struct resource *busr = dev->bus->resource[i];
385
386 if (!busr || ((busr->flags ^ devr->flags) & type_mask))
387 continue;
388 if ((devr->start) && (devr->start >= busr->start) &&
389 (devr->end <= busr->end))
390 return 1;
391 }
392 return 0;
393}
394
376static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) 395static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
377{ 396{
378 struct pci_bus_region region; 397 struct pci_bus_region region;
@@ -386,7 +405,8 @@ static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
386 region.start = dev->resource[i].start; 405 region.start = dev->resource[i].start;
387 region.end = dev->resource[i].end; 406 region.end = dev->resource[i].end;
388 pcibios_bus_to_resource(dev, &dev->resource[i], &region); 407 pcibios_bus_to_resource(dev, &dev->resource[i], &region);
389 pci_claim_resource(dev, i); 408 if ((is_valid_resource(dev, i)))
409 pci_claim_resource(dev, i);
390 } 410 }
391} 411}
392 412