diff options
| -rw-r--r-- | arch/arm/kernel/bios32.c | 5 | ||||
| -rw-r--r-- | arch/m68k/platform/coldfire/pci.c | 1 | ||||
| -rw-r--r-- | arch/mips/pci/pci.c | 1 | ||||
| -rw-r--r-- | arch/sh/drivers/pci/pci.c | 1 | ||||
| -rw-r--r-- | drivers/acpi/pci_root.c | 5 | ||||
| -rw-r--r-- | drivers/parisc/lba_pci.c | 1 | ||||
| -rw-r--r-- | drivers/pci/bus.c | 19 | ||||
| -rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 1 | ||||
| -rw-r--r-- | drivers/pci/pci.c | 20 | ||||
| -rw-r--r-- | drivers/pci/probe.c | 1 | ||||
| -rw-r--r-- | drivers/pci/setup-bus.c | 151 | ||||
| -rw-r--r-- | drivers/pcmcia/cardbus.c | 1 | ||||
| -rw-r--r-- | include/linux/pci.h | 2 |
13 files changed, 99 insertions, 110 deletions
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 261fcc826169..88e14d74b6de 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
| @@ -525,11 +525,6 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw) | |||
| 525 | * Assign resources. | 525 | * Assign resources. |
| 526 | */ | 526 | */ |
| 527 | pci_bus_assign_resources(bus); | 527 | pci_bus_assign_resources(bus); |
| 528 | |||
| 529 | /* | ||
| 530 | * Enable bridges | ||
| 531 | */ | ||
| 532 | pci_enable_bridges(bus); | ||
| 533 | } | 528 | } |
| 534 | 529 | ||
| 535 | /* | 530 | /* |
diff --git a/arch/m68k/platform/coldfire/pci.c b/arch/m68k/platform/coldfire/pci.c index b33f97a13e6d..df9679238b6d 100644 --- a/arch/m68k/platform/coldfire/pci.c +++ b/arch/m68k/platform/coldfire/pci.c | |||
| @@ -319,7 +319,6 @@ static int __init mcf_pci_init(void) | |||
| 319 | pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq); | 319 | pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq); |
| 320 | pci_bus_size_bridges(rootbus); | 320 | pci_bus_size_bridges(rootbus); |
| 321 | pci_bus_assign_resources(rootbus); | 321 | pci_bus_assign_resources(rootbus); |
| 322 | pci_enable_bridges(rootbus); | ||
| 323 | return 0; | 322 | return 0; |
| 324 | } | 323 | } |
| 325 | 324 | ||
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c index 594e60d6a43b..33e7aa52d9c4 100644 --- a/arch/mips/pci/pci.c +++ b/arch/mips/pci/pci.c | |||
| @@ -113,7 +113,6 @@ static void pcibios_scanbus(struct pci_controller *hose) | |||
| 113 | if (!pci_has_flag(PCI_PROBE_ONLY)) { | 113 | if (!pci_has_flag(PCI_PROBE_ONLY)) { |
| 114 | pci_bus_size_bridges(bus); | 114 | pci_bus_size_bridges(bus); |
| 115 | pci_bus_assign_resources(bus); | 115 | pci_bus_assign_resources(bus); |
| 116 | pci_enable_bridges(bus); | ||
| 117 | } | 116 | } |
| 118 | } | 117 | } |
| 119 | } | 118 | } |
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index 102f5d58b037..60ed3e1c4b75 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
| @@ -69,7 +69,6 @@ static void pcibios_scanbus(struct pci_channel *hose) | |||
| 69 | 69 | ||
| 70 | pci_bus_size_bridges(bus); | 70 | pci_bus_size_bridges(bus); |
| 71 | pci_bus_assign_resources(bus); | 71 | pci_bus_assign_resources(bus); |
| 72 | pci_enable_bridges(bus); | ||
| 73 | } else { | 72 | } else { |
| 74 | pci_free_resource_list(&resources); | 73 | pci_free_resource_list(&resources); |
| 75 | } | 74 | } |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 5917839321b8..ce04eb28e029 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
| @@ -526,10 +526,7 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
| 526 | 526 | ||
| 527 | if (system_state != SYSTEM_BOOTING) { | 527 | if (system_state != SYSTEM_BOOTING) { |
| 528 | pcibios_resource_survey_bus(root->bus); | 528 | pcibios_resource_survey_bus(root->bus); |
| 529 | pci_assign_unassigned_bus_resources(root->bus); | 529 | pci_assign_unassigned_root_bus_resources(root->bus); |
| 530 | |||
| 531 | /* need to after hot-added ioapic is registered */ | ||
| 532 | pci_enable_bridges(root->bus); | ||
| 533 | } | 530 | } |
| 534 | 531 | ||
| 535 | pci_bus_add_devices(root->bus); | 532 | pci_bus_add_devices(root->bus); |
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 19f6f70c67d3..37e71ff6408d 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
| @@ -1590,7 +1590,6 @@ lba_driver_probe(struct parisc_device *dev) | |||
| 1590 | lba_dump_res(&lba_dev->hba.lmmio_space, 2); | 1590 | lba_dump_res(&lba_dev->hba.lmmio_space, 2); |
| 1591 | #endif | 1591 | #endif |
| 1592 | } | 1592 | } |
| 1593 | pci_enable_bridges(lba_bus); | ||
| 1594 | 1593 | ||
| 1595 | /* | 1594 | /* |
| 1596 | ** Once PCI register ops has walked the bus, access to config | 1595 | ** Once PCI register ops has walked the bus, access to config |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index b1ff02ab4f13..fc1b74013743 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
| @@ -216,24 +216,6 @@ void pci_bus_add_devices(const struct pci_bus *bus) | |||
| 216 | } | 216 | } |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | void pci_enable_bridges(struct pci_bus *bus) | ||
| 220 | { | ||
| 221 | struct pci_dev *dev; | ||
| 222 | int retval; | ||
| 223 | |||
| 224 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
| 225 | if (dev->subordinate) { | ||
| 226 | if (!pci_is_enabled(dev)) { | ||
| 227 | retval = pci_enable_device(dev); | ||
| 228 | if (retval) | ||
| 229 | dev_err(&dev->dev, "Error enabling bridge (%d), continuing\n", retval); | ||
| 230 | pci_set_master(dev); | ||
| 231 | } | ||
| 232 | pci_enable_bridges(dev->subordinate); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | /** pci_walk_bus - walk devices on/under bus, calling callback. | 219 | /** pci_walk_bus - walk devices on/under bus, calling callback. |
| 238 | * @top bus whose devices should be walked | 220 | * @top bus whose devices should be walked |
| 239 | * @cb callback to be called for each device found | 221 | * @cb callback to be called for each device found |
| @@ -301,4 +283,3 @@ EXPORT_SYMBOL(pci_bus_put); | |||
| 301 | EXPORT_SYMBOL(pci_bus_alloc_resource); | 283 | EXPORT_SYMBOL(pci_bus_alloc_resource); |
| 302 | EXPORT_SYMBOL_GPL(pci_bus_add_device); | 284 | EXPORT_SYMBOL_GPL(pci_bus_add_device); |
| 303 | EXPORT_SYMBOL(pci_bus_add_devices); | 285 | EXPORT_SYMBOL(pci_bus_add_devices); |
| 304 | EXPORT_SYMBOL(pci_enable_bridges); | ||
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 59df8575a48c..52dee9d31e1c 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
| @@ -723,7 +723,6 @@ static int __ref enable_device(struct acpiphp_slot *slot) | |||
| 723 | acpiphp_sanitize_bus(bus); | 723 | acpiphp_sanitize_bus(bus); |
| 724 | acpiphp_set_hpp_values(bus); | 724 | acpiphp_set_hpp_values(bus); |
| 725 | acpiphp_set_acpi_region(slot); | 725 | acpiphp_set_acpi_region(slot); |
| 726 | pci_enable_bridges(bus); | ||
| 727 | 726 | ||
| 728 | list_for_each_entry(dev, &bus->devices, bus_list) { | 727 | list_for_each_entry(dev, &bus->devices, bus_list) { |
| 729 | /* Assume that newly added devices are powered on already. */ | 728 | /* Assume that newly added devices are powered on already. */ |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 10e3c4e15178..d3fdce8f3d65 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -1146,6 +1146,24 @@ int pci_reenable_device(struct pci_dev *dev) | |||
| 1146 | return 0; | 1146 | return 0; |
| 1147 | } | 1147 | } |
| 1148 | 1148 | ||
| 1149 | static void pci_enable_bridge(struct pci_dev *dev) | ||
| 1150 | { | ||
| 1151 | int retval; | ||
| 1152 | |||
| 1153 | if (!dev) | ||
| 1154 | return; | ||
| 1155 | |||
| 1156 | pci_enable_bridge(dev->bus->self); | ||
| 1157 | |||
| 1158 | if (pci_is_enabled(dev)) | ||
| 1159 | return; | ||
| 1160 | retval = pci_enable_device(dev); | ||
| 1161 | if (retval) | ||
| 1162 | dev_err(&dev->dev, "Error enabling bridge (%d), continuing\n", | ||
| 1163 | retval); | ||
| 1164 | pci_set_master(dev); | ||
| 1165 | } | ||
| 1166 | |||
| 1149 | static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags) | 1167 | static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags) |
| 1150 | { | 1168 | { |
| 1151 | int err; | 1169 | int err; |
| @@ -1166,6 +1184,8 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags) | |||
| 1166 | if (atomic_inc_return(&dev->enable_cnt) > 1) | 1184 | if (atomic_inc_return(&dev->enable_cnt) > 1) |
| 1167 | return 0; /* already enabled */ | 1185 | return 0; /* already enabled */ |
| 1168 | 1186 | ||
| 1187 | pci_enable_bridge(dev->bus->self); | ||
| 1188 | |||
| 1169 | /* only skip sriov related */ | 1189 | /* only skip sriov related */ |
| 1170 | for (i = 0; i <= PCI_ROM_RESOURCE; i++) | 1190 | for (i = 0; i <= PCI_ROM_RESOURCE; i++) |
| 1171 | if (dev->resource[i].flags & flags) | 1191 | if (dev->resource[i].flags & flags) |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cf57fe79450a..4ab388a6cc26 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -1979,7 +1979,6 @@ unsigned int __ref pci_rescan_bus(struct pci_bus *bus) | |||
| 1979 | 1979 | ||
| 1980 | max = pci_scan_child_bus(bus); | 1980 | max = pci_scan_child_bus(bus); |
| 1981 | pci_assign_unassigned_bus_resources(bus); | 1981 | pci_assign_unassigned_bus_resources(bus); |
| 1982 | pci_enable_bridges(bus); | ||
| 1983 | pci_bus_add_devices(bus); | 1982 | pci_bus_add_devices(bus); |
| 1984 | 1983 | ||
| 1985 | return max; | 1984 | return max; |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 8333c92c2027..9be359594b05 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
| @@ -1297,7 +1297,7 @@ static void pci_bus_dump_resources(struct pci_bus *bus) | |||
| 1297 | } | 1297 | } |
| 1298 | } | 1298 | } |
| 1299 | 1299 | ||
| 1300 | static int __init pci_bus_get_depth(struct pci_bus *bus) | 1300 | static int pci_bus_get_depth(struct pci_bus *bus) |
| 1301 | { | 1301 | { |
| 1302 | int depth = 0; | 1302 | int depth = 0; |
| 1303 | struct pci_bus *child_bus; | 1303 | struct pci_bus *child_bus; |
| @@ -1312,21 +1312,6 @@ static int __init pci_bus_get_depth(struct pci_bus *bus) | |||
| 1312 | 1312 | ||
| 1313 | return depth; | 1313 | return depth; |
| 1314 | } | 1314 | } |
| 1315 | static int __init pci_get_max_depth(void) | ||
| 1316 | { | ||
| 1317 | int depth = 0; | ||
| 1318 | struct pci_bus *bus; | ||
| 1319 | |||
| 1320 | list_for_each_entry(bus, &pci_root_buses, node) { | ||
| 1321 | int ret; | ||
| 1322 | |||
| 1323 | ret = pci_bus_get_depth(bus); | ||
| 1324 | if (ret > depth) | ||
| 1325 | depth = ret; | ||
| 1326 | } | ||
| 1327 | |||
| 1328 | return depth; | ||
| 1329 | } | ||
| 1330 | 1315 | ||
| 1331 | /* | 1316 | /* |
| 1332 | * -1: undefined, will auto detect later | 1317 | * -1: undefined, will auto detect later |
| @@ -1343,7 +1328,7 @@ enum enable_type { | |||
| 1343 | auto_enabled, | 1328 | auto_enabled, |
| 1344 | }; | 1329 | }; |
| 1345 | 1330 | ||
| 1346 | static enum enable_type pci_realloc_enable __initdata = undefined; | 1331 | static enum enable_type pci_realloc_enable = undefined; |
| 1347 | void __init pci_realloc_get_opt(char *str) | 1332 | void __init pci_realloc_get_opt(char *str) |
| 1348 | { | 1333 | { |
| 1349 | if (!strncmp(str, "off", 3)) | 1334 | if (!strncmp(str, "off", 3)) |
| @@ -1351,45 +1336,64 @@ void __init pci_realloc_get_opt(char *str) | |||
| 1351 | else if (!strncmp(str, "on", 2)) | 1336 | else if (!strncmp(str, "on", 2)) |
| 1352 | pci_realloc_enable = user_enabled; | 1337 | pci_realloc_enable = user_enabled; |
| 1353 | } | 1338 | } |
| 1354 | static bool __init pci_realloc_enabled(void) | 1339 | static bool pci_realloc_enabled(enum enable_type enable) |
| 1355 | { | 1340 | { |
| 1356 | return pci_realloc_enable >= user_enabled; | 1341 | return enable >= user_enabled; |
| 1357 | } | 1342 | } |
| 1358 | 1343 | ||
| 1359 | static void __init pci_realloc_detect(void) | ||
| 1360 | { | ||
| 1361 | #if defined(CONFIG_PCI_IOV) && defined(CONFIG_PCI_REALLOC_ENABLE_AUTO) | 1344 | #if defined(CONFIG_PCI_IOV) && defined(CONFIG_PCI_REALLOC_ENABLE_AUTO) |
| 1362 | struct pci_dev *dev = NULL; | 1345 | static int iov_resources_unassigned(struct pci_dev *dev, void *data) |
| 1363 | 1346 | { | |
| 1364 | if (pci_realloc_enable != undefined) | 1347 | int i; |
| 1365 | return; | 1348 | bool *unassigned = data; |
| 1366 | |||
| 1367 | for_each_pci_dev(dev) { | ||
| 1368 | int i; | ||
| 1369 | 1349 | ||
| 1370 | for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++) { | 1350 | for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++) { |
| 1371 | struct resource *r = &dev->resource[i]; | 1351 | struct resource *r = &dev->resource[i]; |
| 1352 | struct pci_bus_region region; | ||
| 1372 | 1353 | ||
| 1373 | /* Not assigned, or rejected by kernel ? */ | 1354 | /* Not assigned or rejected by kernel? */ |
| 1374 | if (r->flags && !r->start) { | 1355 | if (!r->flags) |
| 1375 | pci_realloc_enable = auto_enabled; | 1356 | continue; |
| 1376 | 1357 | ||
| 1377 | return; | 1358 | pcibios_resource_to_bus(dev, ®ion, r); |
| 1378 | } | 1359 | if (!region.start) { |
| 1360 | *unassigned = true; | ||
| 1361 | return 1; /* return early from pci_walk_bus() */ | ||
| 1379 | } | 1362 | } |
| 1380 | } | 1363 | } |
| 1381 | #endif | 1364 | |
| 1365 | return 0; | ||
| 1366 | } | ||
| 1367 | |||
| 1368 | static enum enable_type pci_realloc_detect(struct pci_bus *bus, | ||
| 1369 | enum enable_type enable_local) | ||
| 1370 | { | ||
| 1371 | bool unassigned = false; | ||
| 1372 | |||
| 1373 | if (enable_local != undefined) | ||
| 1374 | return enable_local; | ||
| 1375 | |||
| 1376 | pci_walk_bus(bus, iov_resources_unassigned, &unassigned); | ||
| 1377 | if (unassigned) | ||
| 1378 | return auto_enabled; | ||
| 1379 | |||
| 1380 | return enable_local; | ||
| 1381 | } | ||
| 1382 | #else | ||
| 1383 | static enum enable_type pci_realloc_detect(struct pci_bus *bus, | ||
| 1384 | enum enable_type enable_local) | ||
| 1385 | { | ||
| 1386 | return enable_local; | ||
| 1382 | } | 1387 | } |
| 1388 | #endif | ||
| 1383 | 1389 | ||
| 1384 | /* | 1390 | /* |
| 1385 | * first try will not touch pci bridge res | 1391 | * first try will not touch pci bridge res |
| 1386 | * second and later try will clear small leaf bridge res | 1392 | * second and later try will clear small leaf bridge res |
| 1387 | * will stop till to the max deepth if can not find good one | 1393 | * will stop till to the max deepth if can not find good one |
| 1388 | */ | 1394 | */ |
| 1389 | void __init | 1395 | void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus) |
| 1390 | pci_assign_unassigned_resources(void) | ||
| 1391 | { | 1396 | { |
| 1392 | struct pci_bus *bus; | ||
| 1393 | LIST_HEAD(realloc_head); /* list of resources that | 1397 | LIST_HEAD(realloc_head); /* list of resources that |
| 1394 | want additional resources */ | 1398 | want additional resources */ |
| 1395 | struct list_head *add_list = NULL; | 1399 | struct list_head *add_list = NULL; |
| @@ -1400,15 +1404,17 @@ pci_assign_unassigned_resources(void) | |||
| 1400 | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | | 1404 | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | |
| 1401 | IORESOURCE_PREFETCH; | 1405 | IORESOURCE_PREFETCH; |
| 1402 | int pci_try_num = 1; | 1406 | int pci_try_num = 1; |
| 1407 | enum enable_type enable_local; | ||
| 1403 | 1408 | ||
| 1404 | /* don't realloc if asked to do so */ | 1409 | /* don't realloc if asked to do so */ |
| 1405 | pci_realloc_detect(); | 1410 | enable_local = pci_realloc_detect(bus, pci_realloc_enable); |
| 1406 | if (pci_realloc_enabled()) { | 1411 | if (pci_realloc_enabled(enable_local)) { |
| 1407 | int max_depth = pci_get_max_depth(); | 1412 | int max_depth = pci_bus_get_depth(bus); |
| 1408 | 1413 | ||
| 1409 | pci_try_num = max_depth + 1; | 1414 | pci_try_num = max_depth + 1; |
| 1410 | printk(KERN_DEBUG "PCI: max bus depth: %d pci_try_num: %d\n", | 1415 | dev_printk(KERN_DEBUG, &bus->dev, |
| 1411 | max_depth, pci_try_num); | 1416 | "max bus depth: %d pci_try_num: %d\n", |
| 1417 | max_depth, pci_try_num); | ||
| 1412 | } | 1418 | } |
| 1413 | 1419 | ||
| 1414 | again: | 1420 | again: |
| @@ -1420,32 +1426,30 @@ again: | |||
| 1420 | add_list = &realloc_head; | 1426 | add_list = &realloc_head; |
| 1421 | /* Depth first, calculate sizes and alignments of all | 1427 | /* Depth first, calculate sizes and alignments of all |
| 1422 | subordinate buses. */ | 1428 | subordinate buses. */ |
| 1423 | list_for_each_entry(bus, &pci_root_buses, node) | 1429 | __pci_bus_size_bridges(bus, add_list); |
| 1424 | __pci_bus_size_bridges(bus, add_list); | ||
| 1425 | 1430 | ||
| 1426 | /* Depth last, allocate resources and update the hardware. */ | 1431 | /* Depth last, allocate resources and update the hardware. */ |
| 1427 | list_for_each_entry(bus, &pci_root_buses, node) | 1432 | __pci_bus_assign_resources(bus, add_list, &fail_head); |
| 1428 | __pci_bus_assign_resources(bus, add_list, &fail_head); | ||
| 1429 | if (add_list) | 1433 | if (add_list) |
| 1430 | BUG_ON(!list_empty(add_list)); | 1434 | BUG_ON(!list_empty(add_list)); |
| 1431 | tried_times++; | 1435 | tried_times++; |
| 1432 | 1436 | ||
| 1433 | /* any device complain? */ | 1437 | /* any device complain? */ |
| 1434 | if (list_empty(&fail_head)) | 1438 | if (list_empty(&fail_head)) |
| 1435 | goto enable_and_dump; | 1439 | goto dump; |
| 1436 | 1440 | ||
| 1437 | if (tried_times >= pci_try_num) { | 1441 | if (tried_times >= pci_try_num) { |
| 1438 | if (pci_realloc_enable == undefined) | 1442 | if (enable_local == undefined) |
| 1439 | printk(KERN_INFO "Some PCI device resources are unassigned, try booting with pci=realloc\n"); | 1443 | dev_info(&bus->dev, "Some PCI device resources are unassigned, try booting with pci=realloc\n"); |
| 1440 | else if (pci_realloc_enable == auto_enabled) | 1444 | else if (enable_local == auto_enabled) |
| 1441 | printk(KERN_INFO "Automatically enabled pci realloc, if you have problem, try booting with pci=realloc=off\n"); | 1445 | dev_info(&bus->dev, "Automatically enabled pci realloc, if you have problem, try booting with pci=realloc=off\n"); |
| 1442 | 1446 | ||
| 1443 | free_list(&fail_head); | 1447 | free_list(&fail_head); |
| 1444 | goto enable_and_dump; | 1448 | goto dump; |
| 1445 | } | 1449 | } |
| 1446 | 1450 | ||
| 1447 | printk(KERN_DEBUG "PCI: No. %d try to assign unassigned res\n", | 1451 | dev_printk(KERN_DEBUG, &bus->dev, |
| 1448 | tried_times + 1); | 1452 | "No. %d try to assign unassigned res\n", tried_times + 1); |
| 1449 | 1453 | ||
| 1450 | /* third times and later will not check if it is leaf */ | 1454 | /* third times and later will not check if it is leaf */ |
| 1451 | if ((tried_times + 1) > 2) | 1455 | if ((tried_times + 1) > 2) |
| @@ -1455,12 +1459,11 @@ again: | |||
| 1455 | * Try to release leaf bridge's resources that doesn't fit resource of | 1459 | * Try to release leaf bridge's resources that doesn't fit resource of |
| 1456 | * child device under that bridge | 1460 | * child device under that bridge |
| 1457 | */ | 1461 | */ |
| 1458 | list_for_each_entry(fail_res, &fail_head, list) { | 1462 | list_for_each_entry(fail_res, &fail_head, list) |
| 1459 | bus = fail_res->dev->bus; | 1463 | pci_bus_release_bridge_resources(fail_res->dev->bus, |
| 1460 | pci_bus_release_bridge_resources(bus, | ||
| 1461 | fail_res->flags & type_mask, | 1464 | fail_res->flags & type_mask, |
| 1462 | rel_type); | 1465 | rel_type); |
| 1463 | } | 1466 | |
| 1464 | /* restore size and flags */ | 1467 | /* restore size and flags */ |
| 1465 | list_for_each_entry(fail_res, &fail_head, list) { | 1468 | list_for_each_entry(fail_res, &fail_head, list) { |
| 1466 | struct resource *res = fail_res->res; | 1469 | struct resource *res = fail_res->res; |
| @@ -1475,14 +1478,17 @@ again: | |||
| 1475 | 1478 | ||
| 1476 | goto again; | 1479 | goto again; |
| 1477 | 1480 | ||
| 1478 | enable_and_dump: | 1481 | dump: |
| 1479 | /* Depth last, update the hardware. */ | ||
| 1480 | list_for_each_entry(bus, &pci_root_buses, node) | ||
| 1481 | pci_enable_bridges(bus); | ||
| 1482 | |||
| 1483 | /* dump the resource on buses */ | 1482 | /* dump the resource on buses */ |
| 1484 | list_for_each_entry(bus, &pci_root_buses, node) | 1483 | pci_bus_dump_resources(bus); |
| 1485 | pci_bus_dump_resources(bus); | 1484 | } |
| 1485 | |||
| 1486 | void __init pci_assign_unassigned_resources(void) | ||
| 1487 | { | ||
| 1488 | struct pci_bus *root_bus; | ||
| 1489 | |||
| 1490 | list_for_each_entry(root_bus, &pci_root_buses, node) | ||
| 1491 | pci_assign_unassigned_root_bus_resources(root_bus); | ||
| 1486 | } | 1492 | } |
| 1487 | 1493 | ||
| 1488 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) | 1494 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) |
| @@ -1519,13 +1525,11 @@ again: | |||
| 1519 | * Try to release leaf bridge's resources that doesn't fit resource of | 1525 | * Try to release leaf bridge's resources that doesn't fit resource of |
| 1520 | * child device under that bridge | 1526 | * child device under that bridge |
| 1521 | */ | 1527 | */ |
| 1522 | list_for_each_entry(fail_res, &fail_head, list) { | 1528 | list_for_each_entry(fail_res, &fail_head, list) |
| 1523 | struct pci_bus *bus = fail_res->dev->bus; | 1529 | pci_bus_release_bridge_resources(fail_res->dev->bus, |
| 1524 | unsigned long flags = fail_res->flags; | 1530 | fail_res->flags & type_mask, |
| 1525 | |||
| 1526 | pci_bus_release_bridge_resources(bus, flags & type_mask, | ||
| 1527 | whole_subtree); | 1531 | whole_subtree); |
| 1528 | } | 1532 | |
| 1529 | /* restore size and flags */ | 1533 | /* restore size and flags */ |
| 1530 | list_for_each_entry(fail_res, &fail_head, list) { | 1534 | list_for_each_entry(fail_res, &fail_head, list) { |
| 1531 | struct resource *res = fail_res->res; | 1535 | struct resource *res = fail_res->res; |
| @@ -1545,7 +1549,6 @@ enable_all: | |||
| 1545 | if (retval) | 1549 | if (retval) |
| 1546 | dev_err(&bridge->dev, "Error reenabling bridge (%d)\n", retval); | 1550 | dev_err(&bridge->dev, "Error reenabling bridge (%d)\n", retval); |
| 1547 | pci_set_master(bridge); | 1551 | pci_set_master(bridge); |
| 1548 | pci_enable_bridges(parent); | ||
| 1549 | } | 1552 | } |
| 1550 | EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); | 1553 | EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); |
| 1551 | 1554 | ||
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index 9d3ac998fc1f..b2a98cdbd0d2 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c | |||
| @@ -91,7 +91,6 @@ int __ref cb_alloc(struct pcmcia_socket *s) | |||
| 91 | if (s->tune_bridge) | 91 | if (s->tune_bridge) |
| 92 | s->tune_bridge(s, bus); | 92 | s->tune_bridge(s, bus); |
| 93 | 93 | ||
| 94 | pci_enable_bridges(bus); | ||
| 95 | pci_bus_add_devices(bus); | 94 | pci_bus_add_devices(bus); |
| 96 | 95 | ||
| 97 | return 0; | 96 | return 0; |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 408f047ad929..82d1c78d3d91 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -1009,6 +1009,7 @@ int pci_claim_resource(struct pci_dev *, int); | |||
| 1009 | void pci_assign_unassigned_resources(void); | 1009 | void pci_assign_unassigned_resources(void); |
| 1010 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); | 1010 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); |
| 1011 | void pci_assign_unassigned_bus_resources(struct pci_bus *bus); | 1011 | void pci_assign_unassigned_bus_resources(struct pci_bus *bus); |
| 1012 | void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus); | ||
| 1012 | void pdev_enable_device(struct pci_dev *); | 1013 | void pdev_enable_device(struct pci_dev *); |
| 1013 | int pci_enable_resources(struct pci_dev *, int mask); | 1014 | int pci_enable_resources(struct pci_dev *, int mask); |
| 1014 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), | 1015 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), |
| @@ -1049,7 +1050,6 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus, | |||
| 1049 | resource_size_t, | 1050 | resource_size_t, |
| 1050 | resource_size_t), | 1051 | resource_size_t), |
| 1051 | void *alignf_data); | 1052 | void *alignf_data); |
| 1052 | void pci_enable_bridges(struct pci_bus *bus); | ||
| 1053 | 1053 | ||
| 1054 | /* Proper probing supporting hot-pluggable devices */ | 1054 | /* Proper probing supporting hot-pluggable devices */ |
| 1055 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, | 1055 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, |
