Jesse Keating 2f82dda
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
Jesse Keating 2f82dda
index b2801a7..c9f18f9 100644
Jesse Keating 2f82dda
--- a/drivers/pci/hotplug/pciehp.h
Jesse Keating 2f82dda
+++ b/drivers/pci/hotplug/pciehp.h
Jesse Keating 2f82dda
@@ -224,6 +224,10 @@ static inline int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev)
Jesse Keating 2f82dda
 {
Jesse Keating 2f82dda
 	u32 flags = (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL |
Jesse Keating 2f82dda
 		     OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
Jesse Keating 2f82dda
+	if (pciehp_force) {
Jesse Keating 2f82dda
+		dev_info(&dev->dev, "Bypassing BIOS check for pciehp\n");
Jesse Keating 2f82dda
+		return 0;
Jesse Keating 2f82dda
+	}
Jesse Keating 2f82dda
 	return acpi_get_hp_hw_control_from_firmware(dev, flags);
Jesse Keating 2f82dda
 }
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
Jesse Keating 2f82dda
index 39cf248..ab6b016 100644
Jesse Keating 2f82dda
--- a/drivers/pci/hotplug/pciehp_core.c
Jesse Keating 2f82dda
+++ b/drivers/pci/hotplug/pciehp_core.c
Jesse Keating 2f82dda
@@ -41,6 +41,7 @@ int pciehp_debug;
Jesse Keating 2f82dda
 int pciehp_poll_mode;
Jesse Keating 2f82dda
 int pciehp_poll_time;
Jesse Keating 2f82dda
 int pciehp_force;
Jesse Keating 2f82dda
+int pciehp_passive;
Jesse Keating 2f82dda
 struct workqueue_struct *pciehp_wq;
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
 #define DRIVER_VERSION	"0.4"
Jesse Keating 2f82dda
@@ -50,15 +51,18 @@ struct workqueue_struct *pciehp_wq;
Jesse Keating 2f82dda
 MODULE_AUTHOR(DRIVER_AUTHOR);
Jesse Keating 2f82dda
 MODULE_DESCRIPTION(DRIVER_DESC);
Jesse Keating 2f82dda
 MODULE_LICENSE("GPL");
Jesse Keating 2f82dda
+MODULE_ALIAS("acpi*:PNP0A08:*");
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
 module_param(pciehp_debug, bool, 0644);
Jesse Keating 2f82dda
 module_param(pciehp_poll_mode, bool, 0644);
Jesse Keating 2f82dda
 module_param(pciehp_poll_time, int, 0644);
Jesse Keating 2f82dda
 module_param(pciehp_force, bool, 0644);
Jesse Keating 2f82dda
+module_param(pciehp_passive, bool, 0644);
Jesse Keating 2f82dda
 MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not");
Jesse Keating 2f82dda
 MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not");
Jesse Keating 2f82dda
 MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds");
Jesse Keating 2f82dda
 MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if _OSC and OSHP are missing");
Jesse Keating 2f82dda
+MODULE_PARM_DESC(pciehp_passive, "Listen for pciehp events, even if _OSC and OSHP are missing");
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
 #define PCIE_MODULE_NAME "pciehp"
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
@@ -85,6 +89,13 @@ static struct hotplug_slot_ops pciehp_hotplug_slot_ops = {
Jesse Keating 2f82dda
   	.get_cur_bus_speed =	get_cur_bus_speed,
Jesse Keating 2f82dda
 };
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
+static struct hotplug_slot_ops pciehp_passive_hotplug_slot_ops = {
Jesse Keating 2f82dda
+	.owner =		THIS_MODULE,
Jesse Keating 2f82dda
+	.get_adapter_status =	get_adapter_status,
Jesse Keating 2f82dda
+	.get_max_bus_speed =	get_max_bus_speed,
Jesse Keating 2f82dda
+	.get_cur_bus_speed =	get_cur_bus_speed,
Jesse Keating 2f82dda
+};
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
 /*
Jesse Keating 2f82dda
  * Check the status of the Electro Mechanical Interlock (EMI)
Jesse Keating 2f82dda
  */
Jesse Keating 2f82dda
@@ -212,7 +223,11 @@ static int init_slots(struct controller *ctrl)
Jesse Keating 2f82dda
 		hotplug_slot->info = info;
Jesse Keating 2f82dda
 		hotplug_slot->private = slot;
Jesse Keating 2f82dda
 		hotplug_slot->release = &release_slot;
Jesse Keating 2f82dda
-		hotplug_slot->ops = &pciehp_hotplug_slot_ops;
Jesse Keating 2f82dda
+		if (pciehp_passive &&
Jesse Keating 2f82dda
+		    pciehp_get_hp_hw_control_from_firmware(ctrl->pci_dev))
Jesse Keating 2f82dda
+			hotplug_slot->ops = &pciehp_passive_hotplug_slot_ops;
Jesse Keating 2f82dda
+		else
Jesse Keating 2f82dda
+			hotplug_slot->ops = &pciehp_hotplug_slot_ops;
Jesse Keating 2f82dda
 		slot->hotplug_slot = hotplug_slot;
Jesse Keating 2f82dda
 		snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
@@ -407,11 +422,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
Jesse Keating 2f82dda
 	u8 value;
Jesse Keating 2f82dda
 	struct pci_dev *pdev = dev->port;
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
-	if (pciehp_force)
Jesse Keating 2f82dda
-		dev_info(&dev->device,
Jesse Keating 2f82dda
-			 "Bypassing BIOS check for pciehp use on %s\n",
Jesse Keating 2f82dda
-			 pci_name(pdev));
Jesse Keating 2f82dda
-	else if (pciehp_get_hp_hw_control_from_firmware(pdev))
Jesse Keating 2f82dda
+	if (!pciehp_passive && pciehp_get_hp_hw_control_from_firmware(pdev))
Jesse Keating 2f82dda
 		goto err_out_none;
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
 	ctrl = pcie_init(dev);
Jesse Keating 2f82dda
@@ -436,7 +447,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
Jesse Keating 2f82dda
 	t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset);
Jesse Keating 2f82dda
 	t_slot->hpc_ops->get_adapter_status(t_slot, &value);
Jesse Keating 2f82dda
 	if (value) {
Jesse Keating 2f82dda
-		if (pciehp_force)
Jesse Keating 2f82dda
+		if (pciehp_force || pciehp_passive)
Jesse Keating 2f82dda
 			pciehp_enable_slot(t_slot);
Jesse Keating 2f82dda
 	} else {
Jesse Keating 2f82dda
 		/* Power off slot if not occupied */
Jesse Keating 2f82dda
@@ -474,8 +485,11 @@ static int pciehp_suspend (struct pcie_device *dev, pm_message_t state)
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
 static int pciehp_resume (struct pcie_device *dev)
Jesse Keating 2f82dda
 {
Jesse Keating 2f82dda
+	struct pci_dev *pdev = dev->port;
Jesse Keating 2f82dda
 	dev_info(&dev->device, "%s ENTRY\n", __func__);
Jesse Keating 2f82dda
-	if (pciehp_force) {
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+	if (pciehp_force || (pciehp_passive &&
Jesse Keating 2f82dda
+			     pciehp_get_hp_hw_control_from_firmware(pdev))) {
Jesse Keating 2f82dda
 		struct controller *ctrl = get_service_data(dev);
Jesse Keating 2f82dda
 		struct slot *t_slot;
Jesse Keating 2f82dda
 		u8 status;
Jesse Keating 2f82dda
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
Jesse Keating 2f82dda
index fead63c..12640bd 100644
Jesse Keating 2f82dda
--- a/drivers/pci/hotplug/pciehp_ctrl.c
Jesse Keating 2f82dda
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
Jesse Keating 2f82dda
@@ -185,7 +185,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
Jesse Keating 2f82dda
 	 * before taking any action that relies on power having been
Jesse Keating 2f82dda
 	 * removed from the slot/adapter.
Jesse Keating 2f82dda
 	 */
Jesse Keating 2f82dda
-	msleep(1000);
Jesse Keating 2f82dda
+	if (PWR_LED(ctrl) || ATTN_LED(ctrl))
Jesse Keating 2f82dda
+		msleep(1000);
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
 	if (PWR_LED(ctrl))
Jesse Keating 2f82dda
 		pslot->hpc_ops->green_led_off(pslot);
Jesse Keating 2f82dda
@@ -288,16 +289,16 @@ static int remove_board(struct slot *p_slot)
Jesse Keating 2f82dda
 		}
Jesse Keating 2f82dda
 	}
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
-	/*
Jesse Keating 2f82dda
-	 * After turning power off, we must wait for at least 1 second
Jesse Keating 2f82dda
-	 * before taking any action that relies on power having been
Jesse Keating 2f82dda
-	 * removed from the slot/adapter.
Jesse Keating 2f82dda
-	 */
Jesse Keating 2f82dda
-	msleep(1000);
Jesse Keating 2f82dda
-
Jesse Keating 2f82dda
-	if (PWR_LED(ctrl))
Jesse Keating 2f82dda
+	if (PWR_LED(ctrl)) {
Jesse Keating 2f82dda
+		/*
Jesse Keating 2f82dda
+		 * After turning power off, we must wait for at least 1 second
Jesse Keating 2f82dda
+		 * before taking any action that relies on power having been
Jesse Keating 2f82dda
+		 * removed from the slot/adapter.
Jesse Keating 2f82dda
+		 */
Jesse Keating 2f82dda
+		msleep(1000);
Jesse Keating 2f82dda
 		/* turn off Green LED */
Jesse Keating 2f82dda
 		p_slot->hpc_ops->green_led_off(p_slot);
Jesse Keating 2f82dda
+	}
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
 	return 0;
Jesse Keating 2f82dda
 }