aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-01-17 18:00:36 -0500
committerBjorn Helgaas <bhelgaas@google.com>2013-01-17 18:00:36 -0500
commit708b59bfe1d1727451ca41f5dc4c17cf99dfaf51 (patch)
treeda5fb7826f92f90b58bb5f33ec552b52d3667152 /drivers/pci
parentb7040469de97d361120836b4140941a08d06f56f (diff)
parent6c0cc950ae670403a362bdcbf3cde0df33744928 (diff)
Merge branch 'pci/rafael-set-root-bridge-handle' into next
* pci/rafael-set-root-bridge-handle: ACPI / PCI: Set root bridge ACPI handle in advance
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-acpi.c19
-rw-r--r--drivers/pci/probe.c16
2 files changed, 16 insertions, 19 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 42736e213f25..1c2587c40299 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -302,24 +302,6 @@ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
302 return 0; 302 return 0;
303} 303}
304 304
305static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle)
306{
307 int num;
308 unsigned int seg, bus;
309
310 /*
311 * The string should be the same as root bridge's name
312 * Please look at 'pci_scan_bus_parented'
313 */
314 num = sscanf(dev_name(dev), "pci%04x:%02x", &seg, &bus);
315 if (num != 2)
316 return -ENODEV;
317 *handle = acpi_get_pci_rootbridge_handle(seg, bus);
318 if (!*handle)
319 return -ENODEV;
320 return 0;
321}
322
323static void pci_acpi_setup(struct device *dev) 305static void pci_acpi_setup(struct device *dev)
324{ 306{
325 struct pci_dev *pci_dev = to_pci_dev(dev); 307 struct pci_dev *pci_dev = to_pci_dev(dev);
@@ -378,7 +360,6 @@ static void pci_acpi_cleanup(struct device *dev)
378static struct acpi_bus_type acpi_pci_bus = { 360static struct acpi_bus_type acpi_pci_bus = {
379 .bus = &pci_bus_type, 361 .bus = &pci_bus_type,
380 .find_device = acpi_pci_find_device, 362 .find_device = acpi_pci_find_device,
381 .find_bridge = acpi_pci_find_root_bridge,
382 .setup = pci_acpi_setup, 363 .setup = pci_acpi_setup,
383 .cleanup = pci_acpi_cleanup, 364 .cleanup = pci_acpi_cleanup,
384}; 365};
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2dcd22d9c816..bbe4be7fc685 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1632,6 +1632,18 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
1632 return max; 1632 return max;
1633} 1633}
1634 1634
1635/**
1636 * pcibios_root_bridge_prepare - Platform-specific host bridge setup.
1637 * @bridge: Host bridge to set up.
1638 *
1639 * Default empty implementation. Replace with an architecture-specific setup
1640 * routine, if necessary.
1641 */
1642int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
1643{
1644 return 0;
1645}
1646
1635struct pci_bus *pci_create_root_bus(struct device *parent, int bus, 1647struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
1636 struct pci_ops *ops, void *sysdata, struct list_head *resources) 1648 struct pci_ops *ops, void *sysdata, struct list_head *resources)
1637{ 1649{
@@ -1665,6 +1677,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
1665 bridge->dev.parent = parent; 1677 bridge->dev.parent = parent;
1666 bridge->dev.release = pci_release_bus_bridge_dev; 1678 bridge->dev.release = pci_release_bus_bridge_dev;
1667 dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus); 1679 dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
1680 error = pcibios_root_bridge_prepare(bridge);
1681 if (error)
1682 goto bridge_dev_reg_err;
1683
1668 error = device_register(&bridge->dev); 1684 error = device_register(&bridge->dev);
1669 if (error) 1685 if (error)
1670 goto bridge_dev_reg_err; 1686 goto bridge_dev_reg_err;