aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/pci/pci.c8
-rw-r--r--arch/x86/include/asm/pci.h3
-rw-r--r--arch/x86/pci/acpi.c9
-rw-r--r--drivers/acpi/pci_root.c18
-rw-r--r--drivers/pci/pci-acpi.c19
-rw-r--r--drivers/pci/probe.c16
-rw-r--r--include/acpi/acpi_bus.h1
-rw-r--r--include/linux/pci.h2
8 files changed, 38 insertions, 38 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 5faa66c5c2a8..00e59c7ad3c0 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -396,6 +396,14 @@ out1:
396 return NULL; 396 return NULL;
397} 397}
398 398
399int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
400{
401 struct pci_controller *controller = bridge->bus->sysdata;
402
403 ACPI_HANDLE_SET(&bridge->dev, controller->acpi_handle);
404 return 0;
405}
406
399static int __devinit is_valid_resource(struct pci_dev *dev, int idx) 407static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
400{ 408{
401 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 409 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index dba7805176bf..9f437e97e9e8 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -14,6 +14,9 @@
14struct pci_sysdata { 14struct pci_sysdata {
15 int domain; /* PCI domain */ 15 int domain; /* PCI domain */
16 int node; /* NUMA node */ 16 int node; /* NUMA node */
17#ifdef CONFIG_ACPI
18 void *acpi; /* ACPI-specific data */
19#endif
17#ifdef CONFIG_X86_64 20#ifdef CONFIG_X86_64
18 void *iommu; /* IOMMU private data */ 21 void *iommu; /* IOMMU private data */
19#endif 22#endif
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 0c01261fe5a8..3d49094ed3e8 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -522,6 +522,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
522 sd = &info->sd; 522 sd = &info->sd;
523 sd->domain = domain; 523 sd->domain = domain;
524 sd->node = node; 524 sd->node = node;
525 sd->acpi = device->handle;
525 /* 526 /*
526 * Maybe the desired pci bus has been already scanned. In such case 527 * Maybe the desired pci bus has been already scanned. In such case
527 * it is unnecessary to scan the pci bus with the given domain,busnum. 528 * it is unnecessary to scan the pci bus with the given domain,busnum.
@@ -593,6 +594,14 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
593 return bus; 594 return bus;
594} 595}
595 596
597int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
598{
599 struct pci_sysdata *sd = bridge->bus->sysdata;
600
601 ACPI_HANDLE_SET(&bridge->dev, sd->acpi);
602 return 0;
603}
604
596int __init pci_acpi_init(void) 605int __init pci_acpi_init(void)
597{ 606{
598 struct pci_dev *dev = NULL; 607 struct pci_dev *dev = NULL;
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 471b2dcb1c67..bf5108ad4d63 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -107,24 +107,6 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
107} 107}
108EXPORT_SYMBOL(acpi_pci_unregister_driver); 108EXPORT_SYMBOL(acpi_pci_unregister_driver);
109 109
110acpi_handle acpi_get_pci_rootbridge_handle(unsigned int seg, unsigned int bus)
111{
112 struct acpi_pci_root *root;
113 acpi_handle handle = NULL;
114
115 mutex_lock(&acpi_pci_root_lock);
116 list_for_each_entry(root, &acpi_pci_roots, node)
117 if ((root->segment == (u16) seg) &&
118 (root->secondary.start == (u16) bus)) {
119 handle = root->device->handle;
120 break;
121 }
122 mutex_unlock(&acpi_pci_root_lock);
123 return handle;
124}
125
126EXPORT_SYMBOL_GPL(acpi_get_pci_rootbridge_handle);
127
128/** 110/**
129 * acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge 111 * acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge
130 * @handle - the ACPI CA node in question. 112 * @handle - the ACPI CA node in question.
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;
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index a9e1421cd007..796ccc3247df 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -402,7 +402,6 @@ struct acpi_pci_root {
402/* helper */ 402/* helper */
403acpi_handle acpi_get_child(acpi_handle, u64); 403acpi_handle acpi_get_child(acpi_handle, u64);
404int acpi_is_root_bridge(acpi_handle); 404int acpi_is_root_bridge(acpi_handle);
405acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
406struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); 405struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
407#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev)) 406#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev))
408 407
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 907b455ab603..6860f4dec997 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -378,6 +378,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
378 void (*release_fn)(struct pci_host_bridge *), 378 void (*release_fn)(struct pci_host_bridge *),
379 void *release_data); 379 void *release_data);
380 380
381int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
382
381/* 383/*
382 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 384 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
383 * to P2P or CardBus bridge windows) go in a table. Additional ones (for 385 * to P2P or CardBus bridge windows) go in a table. Additional ones (for