aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_hpc.c
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2008-05-28 02:01:03 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-06-10 13:59:53 -0400
commitac9c052d10d8d6f46a30cb46c0d6d753997c299f (patch)
tree15c252f9a0addcc944aa7e453bf68b174dfc38fe /drivers/pci/hotplug/pciehp_hpc.c
parentd737bdc141f0f040171fffbb7f9e08a825b27aab (diff)
shpchp: check firmware before taking control
Fix the following problems of shpchp driver about getting hotplug control from firmware. - The shpchp driver must not control the hotplug controller if it fails to get control from the firmware. But current shpchp controls the hotplug controller regardless the result, because it doesn't check the return value of get_hp_hw_control_from_firmware(). - Current shpchp driver doesn't support _OSC. The pciehp driver already have the code for evaluating _OSC and OSHP and shpchp and pciehp can share it. So this patch move that code from pciehp to acpi_pcihp.c. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug/pciehp_hpc.c')
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 7e3a3d17c334..a48021d85f22 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -1009,75 +1009,6 @@ static struct hpc_ops pciehp_hpc_ops = {
1009 .check_lnk_status = hpc_check_lnk_status, 1009 .check_lnk_status = hpc_check_lnk_status,
1010}; 1010};
1011 1011
1012#ifdef CONFIG_ACPI
1013int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
1014{
1015 acpi_status status;
1016 acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev));
1017 struct pci_dev *pdev = dev;
1018 struct pci_bus *parent;
1019 struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL };
1020
1021 /*
1022 * Per PCI firmware specification, we should run the ACPI _OSC
1023 * method to get control of hotplug hardware before using it.
1024 * If an _OSC is missing, we look for an OSHP to do the same thing.
1025 * To handle different BIOS behavior, we look for _OSC and OSHP
1026 * within the scope of the hotplug controller and its parents, upto
1027 * the host bridge under which this controller exists.
1028 */
1029 while (!handle) {
1030 /*
1031 * This hotplug controller was not listed in the ACPI name
1032 * space at all. Try to get acpi handle of parent pci bus.
1033 */
1034 if (!pdev || !pdev->bus->parent)
1035 break;
1036 parent = pdev->bus->parent;
1037 dbg("Could not find %s in acpi namespace, trying parent\n",
1038 pci_name(pdev));
1039 if (!parent->self)
1040 /* Parent must be a host bridge */
1041 handle = acpi_get_pci_rootbridge_handle(
1042 pci_domain_nr(parent),
1043 parent->number);
1044 else
1045 handle = DEVICE_ACPI_HANDLE(
1046 &(parent->self->dev));
1047 pdev = parent->self;
1048 }
1049
1050 while (handle) {
1051 acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
1052 dbg("Trying to get hotplug control for %s \n",
1053 (char *)string.pointer);
1054 status = pci_osc_control_set(handle,
1055 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL |
1056 OSC_PCI_EXPRESS_NATIVE_HP_CONTROL);
1057 if (status == AE_NOT_FOUND)
1058 status = acpi_run_oshp(handle);
1059 if (ACPI_SUCCESS(status)) {
1060 dbg("Gained control for hotplug HW for pci %s (%s)\n",
1061 pci_name(dev), (char *)string.pointer);
1062 kfree(string.pointer);
1063 return 0;
1064 }
1065 if (acpi_root_bridge(handle))
1066 break;
1067 chandle = handle;
1068 status = acpi_get_parent(chandle, &handle);
1069 if (ACPI_FAILURE(status))
1070 break;
1071 }
1072
1073 dbg("Cannot get control of hotplug hardware for pci %s\n",
1074 pci_name(dev));
1075
1076 kfree(string.pointer);
1077 return -1;
1078}
1079#endif
1080
1081static int pcie_init_hardware_part1(struct controller *ctrl, 1012static int pcie_init_hardware_part1(struct controller *ctrl,
1082 struct pcie_device *dev) 1013 struct pcie_device *dev)
1083{ 1014{