aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci-common.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-27 15:48:52 -0400
committerPaul Mackerras <paulus@samba.org>2008-11-05 17:31:52 -0500
commitfd6852c8fa060bd45c82a2593e18f933f6c6204f (patch)
treea0534b189bc6a791e93bce5894f892634aa4ab0c /arch/powerpc/kernel/pci-common.c
parentb5ae5f911d221ad85090d6805ab9ab020f6e4703 (diff)
powerpc/pci: Fix various pseries PCI hotplug issues
The pseries PCI hotplug code has a number of issues, ranging from incorrect resource setup to crashes, depending on what is added, when, whether it contains a bridge, etc etc.... This fixes a whole bunch of these, while actually simplifying the code a bit, using more generic code in the process and factoring out common code between adding of a PHB, a slot or a device. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/pci-common.c')
-rw-r--r--arch/powerpc/kernel/pci-common.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index f965397a6105..f3fd7eb90a7b 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -203,7 +203,7 @@ char __devinit *pcibios_setup(char *str)
203 return str; 203 return str;
204} 204}
205 205
206void __devinit pcibios_setup_new_device(struct pci_dev *dev) 206static void __devinit pcibios_setup_new_device(struct pci_dev *dev)
207{ 207{
208 struct dev_archdata *sd = &dev->dev.archdata; 208 struct dev_archdata *sd = &dev->dev.archdata;
209 209
@@ -221,7 +221,6 @@ void __devinit pcibios_setup_new_device(struct pci_dev *dev)
221 if (ppc_md.pci_dma_dev_setup) 221 if (ppc_md.pci_dma_dev_setup)
222 ppc_md.pci_dma_dev_setup(dev); 222 ppc_md.pci_dma_dev_setup(dev);
223} 223}
224EXPORT_SYMBOL(pcibios_setup_new_device);
225 224
226/* 225/*
227 * Reads the interrupt pin to determine if interrupt is use by card. 226 * Reads the interrupt pin to determine if interrupt is use by card.
@@ -1397,9 +1396,10 @@ void __init pcibios_resource_survey(void)
1397 1396
1398#ifdef CONFIG_HOTPLUG 1397#ifdef CONFIG_HOTPLUG
1399 1398
1400/* This is used by the pSeries hotplug driver to allocate resource 1399/* This is used by the PCI hotplug driver to allocate resource
1401 * of newly plugged busses. We can try to consolidate with the 1400 * of newly plugged busses. We can try to consolidate with the
1402 * rest of the code later, for now, keep it as-is 1401 * rest of the code later, for now, keep it as-is as our main
1402 * resource allocation function doesn't deal with sub-trees yet.
1403 */ 1403 */
1404void __devinit pcibios_claim_one_bus(struct pci_bus *bus) 1404void __devinit pcibios_claim_one_bus(struct pci_bus *bus)
1405{ 1405{
@@ -1414,6 +1414,14 @@ void __devinit pcibios_claim_one_bus(struct pci_bus *bus)
1414 1414
1415 if (r->parent || !r->start || !r->flags) 1415 if (r->parent || !r->start || !r->flags)
1416 continue; 1416 continue;
1417
1418 pr_debug("PCI: Claiming %s: "
1419 "Resource %d: %016llx..%016llx [%x]\n",
1420 pci_name(dev), i,
1421 (unsigned long long)r->start,
1422 (unsigned long long)r->end,
1423 (unsigned int)r->flags);
1424
1417 pci_claim_resource(dev, i); 1425 pci_claim_resource(dev, i);
1418 } 1426 }
1419 } 1427 }
@@ -1422,6 +1430,31 @@ void __devinit pcibios_claim_one_bus(struct pci_bus *bus)
1422 pcibios_claim_one_bus(child_bus); 1430 pcibios_claim_one_bus(child_bus);
1423} 1431}
1424EXPORT_SYMBOL_GPL(pcibios_claim_one_bus); 1432EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
1433
1434
1435/* pcibios_finish_adding_to_bus
1436 *
1437 * This is to be called by the hotplug code after devices have been
1438 * added to a bus, this include calling it for a PHB that is just
1439 * being added
1440 */
1441void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1442{
1443 pr_debug("PCI: Finishing adding to hotplug bus %04x:%02x\n",
1444 pci_domain_nr(bus), bus->number);
1445
1446 /* Allocate bus and devices resources */
1447 pcibios_allocate_bus_resources(bus);
1448 pcibios_claim_one_bus(bus);
1449
1450 /* Add new devices to global lists. Register in proc, sysfs. */
1451 pci_bus_add_devices(bus);
1452
1453 /* Fixup EEH */
1454 eeh_add_device_tree_late(bus);
1455}
1456EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
1457
1425#endif /* CONFIG_HOTPLUG */ 1458#endif /* CONFIG_HOTPLUG */
1426 1459
1427int pcibios_enable_device(struct pci_dev *dev, int mask) 1460int pcibios_enable_device(struct pci_dev *dev, int mask)