]> err.no Git - linux-2.6/commitdiff
pciehp: evaluate _OSC/OSHP before controller init
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Wed, 28 May 2008 05:57:30 +0000 (14:57 +0900)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Tue, 10 Jun 2008 17:59:53 +0000 (10:59 -0700)
Current pciehp evaluates _OSC/OSHP method after some controller
initialization is done. So if evaluating _OSC/OSHP is failed, we need
to cleanup already initialized data structures or hardware. This
clearly is not robust way. With this patch, _OSC/OSHP evaluation is
done first.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/hotplug/pciehp.h
drivers/pci/hotplug/pciehp_core.c
drivers/pci/hotplug/pciehp_hpc.c

index 79c9ddaad3fb4e9b7754f951b9845476e0d1c5f3..084b73efacb30e5d88280e6c4510e349aff26826 100644 (file)
@@ -202,6 +202,7 @@ struct hpc_ops {
 #include <acpi/actypes.h>
 #include <linux/pci-acpi.h>
 
+extern int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev);
 #define pciehp_get_hp_hw_control_from_firmware(dev)                    \
        pciehp_acpi_get_hp_hw_control_from_firmware(dev)
 static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev,
index 54553b187b19086ae992b25e3012fd91c4aecc49..49414e9100de1adde8b9ad11975b15ca49cf48c2 100644 (file)
@@ -444,7 +444,13 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
        struct controller *ctrl;
        struct slot *t_slot;
        u8 value;
-       struct pci_dev *pdev;
+       struct pci_dev *pdev = dev->port;
+
+       if (pciehp_force)
+               dbg("Bypassing BIOS check for pciehp use on %s\n",
+                   pci_name(pdev));
+       else if (pciehp_get_hp_hw_control_from_firmware(pdev))
+               goto err_out_none;
 
        ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
        if (!ctrl) {
@@ -453,8 +459,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
        }
        INIT_LIST_HEAD(&ctrl->slot_list);
 
-       pdev = dev->port;
-
        rc = pcie_init(ctrl, dev);
        if (rc) {
                dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME);
index 79f104963166bdce55420df4005966df49e0dcc6..6339c638701efeeb52426ba8643519a156f6dfc9 100644 (file)
@@ -1018,7 +1018,7 @@ static struct hpc_ops pciehp_hpc_ops = {
 };
 
 #ifdef CONFIG_ACPI
-static int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
+int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
 {
        acpi_status status;
        acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev));
@@ -1122,23 +1122,10 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev)
 
        if (pcie_write_cmd(ctrl, cmd, mask)) {
                err("%s: Cannot enable software notification\n", __func__);
-               goto abort;
+               return -1;
        }
 
-       if (pciehp_force)
-               dbg("Bypassing BIOS check for pciehp use on %s\n",
-                               pci_name(ctrl->pci_dev));
-       else if (pciehp_get_hp_hw_control_from_firmware(ctrl->pci_dev))
-               goto abort_disable_intr;
-
        return 0;
-
-       /* We end up here for the many possible ways to fail this API. */
-abort_disable_intr:
-       if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE))
-               err("%s : disabling interrupts failed\n", __func__);
-abort:
-       return -1;
 }
 
 static inline void dbg_ctrl(struct controller *ctrl)