diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2012-09-24 16:36:48 -0600 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-09-24 16:36:48 -0600 |
commit | d3ce52f50cc1697504130897f1d7c489b62dae1c (patch) | |
tree | b91971ad26f7b59c71e775d7e71b9dc89da8e568 /drivers/pci/hotplug/acpiphp_glue.c | |
parent | 18d63c35a265465b7137c4ea9c6b135aada13c3c (diff) | |
parent | 5ba113f7c4fb06cfdd6cba92353ac55ad5b81b75 (diff) | |
download | op-kernel-dev-d3ce52f50cc1697504130897f1d7c489b62dae1c.zip op-kernel-dev-d3ce52f50cc1697504130897f1d7c489b62dae1c.tar.gz |
Merge branch 'pci/jiang-acpiphp' into next
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_glue.c')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 466233b..3d6d4fd 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -115,6 +115,35 @@ static const struct acpi_dock_ops acpiphp_dock_ops = { .handler = handle_hotplug_event_func, }; +/* Check whether the PCI device is managed by native PCIe hotplug driver */ +static bool device_is_managed_by_native_pciehp(struct pci_dev *pdev) +{ + u32 reg32; + acpi_handle tmp; + struct acpi_pci_root *root; + + /* Check whether the PCIe port supports native PCIe hotplug */ + if (pcie_capability_read_dword(pdev, PCI_EXP_SLTCAP, ®32)) + return false; + if (!(reg32 & PCI_EXP_SLTCAP_HPC)) + return false; + + /* + * Check whether native PCIe hotplug has been enabled for + * this PCIe hierarchy. + */ + tmp = acpi_find_root_bridge_handle(pdev); + if (!tmp) + return false; + root = acpi_pci_find_root(tmp); + if (!root) + return false; + if (!(root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)) + return false; + + return true; +} + /* callback routine to register each ACPI PCI slot object */ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) @@ -142,16 +171,8 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) function = adr & 0xffff; pdev = pbus->self; - if (pdev && pci_is_pcie(pdev)) { - tmp = acpi_find_root_bridge_handle(pdev); - if (tmp) { - struct acpi_pci_root *root = acpi_pci_find_root(tmp); - - if (root && (root->osc_control_set & - OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)) - return AE_OK; - } - } + if (pdev && device_is_managed_by_native_pciehp(pdev)) + return AE_OK; newfunc = kzalloc(sizeof(struct acpiphp_func), GFP_KERNEL); if (!newfunc) |