diff options
| -rw-r--r-- | arch/mn10300/unit-asb2305/pci-asb2305.c | 2 | ||||
| -rw-r--r-- | arch/mn10300/unit-asb2305/pci.c | 47 |
2 files changed, 22 insertions, 27 deletions
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c index febb9cd83177..b5b036f64275 100644 --- a/arch/mn10300/unit-asb2305/pci-asb2305.c +++ b/arch/mn10300/unit-asb2305/pci-asb2305.c | |||
| @@ -106,7 +106,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
| 106 | if (!r->flags) | 106 | if (!r->flags) |
| 107 | continue; | 107 | continue; |
| 108 | if (!r->start || | 108 | if (!r->start || |
| 109 | pci_claim_resource(dev, idx) < 0) { | 109 | pci_claim_bridge_resource(dev, idx) < 0) { |
| 110 | printk(KERN_ERR "PCI:" | 110 | printk(KERN_ERR "PCI:" |
| 111 | " Cannot allocate resource" | 111 | " Cannot allocate resource" |
| 112 | " region %d of bridge %s\n", | 112 | " region %d of bridge %s\n", |
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c index 6b4339f8c9c2..471ff398090c 100644 --- a/arch/mn10300/unit-asb2305/pci.c +++ b/arch/mn10300/unit-asb2305/pci.c | |||
| @@ -281,42 +281,37 @@ static int __init pci_check_direct(void) | |||
| 281 | return -ENODEV; | 281 | return -ENODEV; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | static int is_valid_resource(struct pci_dev *dev, int idx) | 284 | static void pcibios_fixup_device_resources(struct pci_dev *dev) |
| 285 | { | 285 | { |
| 286 | unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; | 286 | int idx; |
| 287 | struct resource *devr = &dev->resource[idx], *busr; | ||
| 288 | |||
| 289 | if (dev->bus) { | ||
| 290 | pci_bus_for_each_resource(dev->bus, busr, i) { | ||
| 291 | if (!busr || (busr->flags ^ devr->flags) & type_mask) | ||
| 292 | continue; | ||
| 293 | |||
| 294 | if (devr->start && | ||
| 295 | devr->start >= busr->start && | ||
| 296 | devr->end <= busr->end) | ||
| 297 | return 1; | ||
| 298 | } | ||
| 299 | } | ||
| 300 | 287 | ||
| 301 | return 0; | 288 | if (!dev->bus) |
| 289 | return; | ||
| 290 | |||
| 291 | for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) { | ||
| 292 | struct resource *r = &dev->resource[idx]; | ||
| 293 | |||
| 294 | if (!r->flags || r->parent || !r->start) | ||
| 295 | continue; | ||
| 296 | |||
| 297 | pci_claim_resource(dev, idx); | ||
| 298 | } | ||
| 302 | } | 299 | } |
| 303 | 300 | ||
| 304 | static void pcibios_fixup_device_resources(struct pci_dev *dev) | 301 | static void pcibios_fixup_bridge_resources(struct pci_dev *dev) |
| 305 | { | 302 | { |
| 306 | int limit, i; | 303 | int idx; |
| 307 | 304 | ||
| 308 | if (dev->bus->number != 0) | 305 | if (!dev->bus) |
| 309 | return; | 306 | return; |
| 310 | 307 | ||
| 311 | limit = (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) ? | 308 | for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { |
| 312 | PCI_BRIDGE_RESOURCES : PCI_NUM_RESOURCES; | 309 | struct resource *r = &dev->resource[idx]; |
| 313 | 310 | ||
| 314 | for (i = 0; i < limit; i++) { | 311 | if (!r->flags || r->parent || !r->start) |
| 315 | if (!dev->resource[i].flags) | ||
| 316 | continue; | 312 | continue; |
| 317 | 313 | ||
| 318 | if (is_valid_resource(dev, i)) | 314 | pci_claim_bridge_resource(dev, idx); |
| 319 | pci_claim_resource(dev, i); | ||
| 320 | } | 315 | } |
| 321 | } | 316 | } |
| 322 | 317 | ||
| @@ -330,7 +325,7 @@ void pcibios_fixup_bus(struct pci_bus *bus) | |||
| 330 | 325 | ||
| 331 | if (bus->self) { | 326 | if (bus->self) { |
| 332 | pci_read_bridge_bases(bus); | 327 | pci_read_bridge_bases(bus); |
| 333 | pcibios_fixup_device_resources(bus->self); | 328 | pcibios_fixup_bridge_resources(bus->self); |
| 334 | } | 329 | } |
| 335 | 330 | ||
| 336 | list_for_each_entry(dev, &bus->devices, bus_list) | 331 | list_for_each_entry(dev, &bus->devices, bus_list) |
