X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=arch%2Fia64%2Fpci%2Fpci.c;h=d929858cfb3ec97f35cda37369a3a782269e21cd;hb=71c3511c22e8e0648094672abec898b3bf84c18b;hp=2a1487758490b9017606ecccb0d3fdfe71c60b7e;hpb=fab3fb0ac8c83072465b28ca859c420da6c6511c;p=mv-sheeva.git diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 2a148775849..d929858cfb3 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, res->end = region->end + offset; } +static int __devinit is_valid_resource(struct pci_dev *dev, int idx) +{ + unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; + struct resource *devr = &dev->resource[idx]; + + if (!dev->bus) + return 0; + for (i=0; ibus->resource[i]; + + if (!busr || ((busr->flags ^ devr->flags) & type_mask)) + continue; + if ((devr->start) && (devr->start >= busr->start) && + (devr->end <= busr->end)) + return 1; + } + return 0; +} + static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) { struct pci_bus_region region; @@ -386,7 +405,8 @@ static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) region.start = dev->resource[i].start; region.end = dev->resource[i].end; pcibios_bus_to_resource(dev, &dev->resource[i], ®ion); - pci_claim_resource(dev, i); + if ((is_valid_resource(dev, i))) + pci_claim_resource(dev, i); } }