diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2008-05-28 01:57:30 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-06-10 13:59:53 -0400 |
commit | 125c39f7d233de28f342d80858025ffed0c4b7f4 (patch) | |
tree | 9c6910276ef5b5b2fbfa3a8ec6249a217d1d848f /drivers/pci | |
parent | b143b3cc82fac459feb1abdffb1d77be9805adaa (diff) |
pciehp: evaluate _OSC/OSHP before controller init
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>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/pciehp.h | 1 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 10 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 17 |
3 files changed, 10 insertions, 18 deletions
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 79c9ddaad3fb..084b73efacb3 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -202,6 +202,7 @@ struct hpc_ops { | |||
202 | #include <acpi/actypes.h> | 202 | #include <acpi/actypes.h> |
203 | #include <linux/pci-acpi.h> | 203 | #include <linux/pci-acpi.h> |
204 | 204 | ||
205 | extern int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev); | ||
205 | #define pciehp_get_hp_hw_control_from_firmware(dev) \ | 206 | #define pciehp_get_hp_hw_control_from_firmware(dev) \ |
206 | pciehp_acpi_get_hp_hw_control_from_firmware(dev) | 207 | pciehp_acpi_get_hp_hw_control_from_firmware(dev) |
207 | static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev, | 208 | static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev, |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 54553b187b19..49414e9100de 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -444,7 +444,13 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
444 | struct controller *ctrl; | 444 | struct controller *ctrl; |
445 | struct slot *t_slot; | 445 | struct slot *t_slot; |
446 | u8 value; | 446 | u8 value; |
447 | struct pci_dev *pdev; | 447 | struct pci_dev *pdev = dev->port; |
448 | |||
449 | if (pciehp_force) | ||
450 | dbg("Bypassing BIOS check for pciehp use on %s\n", | ||
451 | pci_name(pdev)); | ||
452 | else if (pciehp_get_hp_hw_control_from_firmware(pdev)) | ||
453 | goto err_out_none; | ||
448 | 454 | ||
449 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); | 455 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); |
450 | if (!ctrl) { | 456 | if (!ctrl) { |
@@ -453,8 +459,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
453 | } | 459 | } |
454 | INIT_LIST_HEAD(&ctrl->slot_list); | 460 | INIT_LIST_HEAD(&ctrl->slot_list); |
455 | 461 | ||
456 | pdev = dev->port; | ||
457 | |||
458 | rc = pcie_init(ctrl, dev); | 462 | rc = pcie_init(ctrl, dev); |
459 | if (rc) { | 463 | if (rc) { |
460 | dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME); | 464 | dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME); |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 79f104963166..6339c638701e 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -1018,7 +1018,7 @@ static struct hpc_ops pciehp_hpc_ops = { | |||
1018 | }; | 1018 | }; |
1019 | 1019 | ||
1020 | #ifdef CONFIG_ACPI | 1020 | #ifdef CONFIG_ACPI |
1021 | static int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev) | 1021 | int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev) |
1022 | { | 1022 | { |
1023 | acpi_status status; | 1023 | acpi_status status; |
1024 | acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev)); | 1024 | 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) | |||
1122 | 1122 | ||
1123 | if (pcie_write_cmd(ctrl, cmd, mask)) { | 1123 | if (pcie_write_cmd(ctrl, cmd, mask)) { |
1124 | err("%s: Cannot enable software notification\n", __func__); | 1124 | err("%s: Cannot enable software notification\n", __func__); |
1125 | goto abort; | 1125 | return -1; |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | if (pciehp_force) | ||
1129 | dbg("Bypassing BIOS check for pciehp use on %s\n", | ||
1130 | pci_name(ctrl->pci_dev)); | ||
1131 | else if (pciehp_get_hp_hw_control_from_firmware(ctrl->pci_dev)) | ||
1132 | goto abort_disable_intr; | ||
1133 | |||
1134 | return 0; | 1128 | return 0; |
1135 | |||
1136 | /* We end up here for the many possible ways to fail this API. */ | ||
1137 | abort_disable_intr: | ||
1138 | if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE)) | ||
1139 | err("%s : disabling interrupts failed\n", __func__); | ||
1140 | abort: | ||
1141 | return -1; | ||
1142 | } | 1129 | } |
1143 | 1130 | ||
1144 | static inline void dbg_ctrl(struct controller *ctrl) | 1131 | static inline void dbg_ctrl(struct controller *ctrl) |