[PATCH 13/28] PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
From: Yijing Wang
Date: Thu Jan 15 2015 - 22:56:36 EST
Signed-off-by: Yijing Wang <wangyijing@xxxxxxxxxx>
---
arch/x86/pci/acpi.c | 36 ++++++++++++++++++++----------------
1 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 8edea63..f9a55c2 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -467,6 +467,18 @@ static void probe_pci_root_info(struct pci_root_info *info,
info);
}
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+ struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+ ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+ return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+ .phb_prepare = pci_host_bridge_prepare,
+};
+
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
{
struct acpi_device *device = root->device;
@@ -475,6 +487,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
int busnum = root->secondary.start;
LIST_HEAD(resources);
struct pci_bus *bus;
+ struct pci_host_bridge *host = NULL;
struct pci_sysdata *sd;
int node;
@@ -537,14 +550,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
(u8)root->secondary.end, root->mcfg_addr))
- bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum),
- &pci_root_ops, sd, &resources);
-
- if (bus) {
- pci_scan_child_bus(bus);
- pci_set_host_bridge_release(
- to_pci_host_bridge(bus->bridge),
- release_pci_root_info, info);
+ host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, busnum),
+ &pci_root_ops, sd, &resources, &phb_ops);
+
+ if (host) {
+ bus = host->bus;
+ pci_set_host_bridge_release(host, release_pci_root_info,
+ info);
} else {
pci_free_resource_list(&resources);
__release_pci_root_info(info);
@@ -566,14 +578,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
return bus;
}
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
- struct pci_sysdata *sd = bridge->bus->sysdata;
-
- ACPI_COMPANION_SET(&bridge->dev, sd->companion);
- return 0;
-}
-
int __init pci_acpi_init(void)
{
struct pci_dev *dev = NULL;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html