linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: pci merge conflict
@ 2008-05-28  2:27 Stephen Rothwell
  2008-05-28  2:50 ` Kenji Kaneshige
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Rothwell @ 2008-05-28  2:27 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: linux-next, Kenji Kaneshige

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

Hi Jesse,

Today's linux-next mege of the pci tree got conflicts in
drivers/pci/hotplug/pciehp_hpc.c between commits
5808639bfa98d69f77a481d759570d85f164fea0 ("pciehp: fix slow probing") and 6592e02ae4bd7b277230aa0c5821588a13b9d8e3 ("pciehp: poll cmd completion if
hotplug interrupt is disabled") from the pci-current tree and commit
2b26196717939221ccc06073780b73d0f4ee3203 ("pciehp: fix waiting
command").  I fixed it up as best I can, but please have a look.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: linux-next: pci merge conflict
  2008-05-28  2:27 linux-next: pci merge conflict Stephen Rothwell
@ 2008-05-28  2:50 ` Kenji Kaneshige
  2008-05-28  3:19   ` Stephen Rothwell
                     ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2008-05-28  2:50 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Jesse Barnes, linux-next

Hi Stephen-san, Jesse-san,

I have already have updated patches. I'll send them if necessary.

Thanks,
Kenji Kaneshige


Stephen Rothwell wrote:
> Hi Jesse,
> 
> Today's linux-next mege of the pci tree got conflicts in
> drivers/pci/hotplug/pciehp_hpc.c between commits
> 5808639bfa98d69f77a481d759570d85f164fea0 ("pciehp: fix slow probing") and 6592e02ae4bd7b277230aa0c5821588a13b9d8e3 ("pciehp: poll cmd completion if
> hotplug interrupt is disabled") from the pci-current tree and commit
> 2b26196717939221ccc06073780b73d0f4ee3203 ("pciehp: fix waiting
> command").  I fixed it up as best I can, but please have a look.
> 



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: linux-next: pci merge conflict
  2008-05-28  2:50 ` Kenji Kaneshige
@ 2008-05-28  3:19   ` Stephen Rothwell
  2008-05-28  4:04   ` Jesse Barnes
  2008-05-28  4:08   ` Jesse Barnes
  2 siblings, 0 replies; 13+ messages in thread
From: Stephen Rothwell @ 2008-05-28  3:19 UTC (permalink / raw)
  To: Kenji Kaneshige; +Cc: Jesse Barnes, linux-next

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

Hi Kenji,

On Wed, 28 May 2008 11:50:27 +0900 Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> wrote:
>
> I have already have updated patches. I'll send them if necessary.

That would be good for tomorrow as the pci-current tree has now gone into
Linus' tree.

Thanks
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: linux-next: pci merge conflict
  2008-05-28  2:50 ` Kenji Kaneshige
  2008-05-28  3:19   ` Stephen Rothwell
@ 2008-05-28  4:04   ` Jesse Barnes
  2008-05-28  4:08   ` Jesse Barnes
  2 siblings, 0 replies; 13+ messages in thread
From: Jesse Barnes @ 2008-05-28  4:04 UTC (permalink / raw)
  To: Kenji Kaneshige; +Cc: Stephen Rothwell, linux-next

On Tuesday, May 27, 2008 7:50 pm Kenji Kaneshige wrote:
> Hi Stephen-san, Jesse-san,
>
> I have already have updated patches. I'll send them if necessary.
>
> Thanks,
> Kenji Kaneshige
>
> Stephen Rothwell wrote:
> > Hi Jesse,
> >
> > Today's linux-next mege of the pci tree got conflicts in
> > drivers/pci/hotplug/pciehp_hpc.c between commits
> > 5808639bfa98d69f77a481d759570d85f164fea0 ("pciehp: fix slow probing") and
> > 6592e02ae4bd7b277230aa0c5821588a13b9d8e3 ("pciehp: poll cmd completion if
> > hotplug interrupt is disabled") from the pci-current tree and commit
> > 2b26196717939221ccc06073780b73d0f4ee3203 ("pciehp: fix waiting
> > command").  I fixed it up as best I can, but please have a look.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: linux-next: pci merge conflict
  2008-05-28  2:50 ` Kenji Kaneshige
  2008-05-28  3:19   ` Stephen Rothwell
  2008-05-28  4:04   ` Jesse Barnes
@ 2008-05-28  4:08   ` Jesse Barnes
  2008-05-28  5:53     ` Kenji Kaneshige
  2 siblings, 1 reply; 13+ messages in thread
From: Jesse Barnes @ 2008-05-28  4:08 UTC (permalink / raw)
  To: Kenji Kaneshige; +Cc: Stephen Rothwell, linux-next

On Tuesday, May 27, 2008 7:50 pm Kenji Kaneshige wrote:
> Hi Stephen-san, Jesse-san,
>
> I have already have updated patches. I'll send them if necessary.

Oops, meant to actually write a message. :)

I'll merge the Linus tree into linux-next tomorrow.  Kenji-san, I'll probably 
ask for updated patches then for anything that's in linux-next but not in 
Linus' tree yet.

Thanks,
Jesse

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: linux-next: pci merge conflict
  2008-05-28  4:08   ` Jesse Barnes
@ 2008-05-28  5:53     ` Kenji Kaneshige
  2008-05-28  5:56       ` [PATCH 1/4] Updated version of 72c4928058175e889b2f83d1a62ac6f2eb0498a0 Kenji Kaneshige
                         ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2008-05-28  5:53 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: Stephen Rothwell, linux-next

Jesse Barnes wrote:
> On Tuesday, May 27, 2008 7:50 pm Kenji Kaneshige wrote:
>> Hi Stephen-san, Jesse-san,
>>
>> I have already have updated patches. I'll send them if necessary.
> 
> Oops, meant to actually write a message. :)
> 
> I'll merge the Linus tree into linux-next tomorrow.  Kenji-san, I'll probably 
> ask for updated patches then for anything that's in linux-next but not in 
> Linus' tree yet.
> 

Ok, just in case, I send patches related to pciehp now. I'll send the flowing
patches followed by this e-mail.

- [PATCH 1/4] Updated version of 72c4928058175e889b2f83d1a62ac6f2eb0498a0
- [PATCH 2/4] Updated version of 4c8cc2d54b1d35cf24ede6057e05f103cfa28852
- [PATCH 3/4] Updated version of 2b26196717939221ccc06073780b73d0f4ee3203
- [PATCH 4/4] Updated version of 9d06d9963852e7818157994c645c640239cb5137

I made these patches against 2.6.24-rc4 with recent pciehp regression fixes
applied.

Thanks,
Kenji Kaneshige



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/4] Updated version of 72c4928058175e889b2f83d1a62ac6f2eb0498a0
  2008-05-28  5:53     ` Kenji Kaneshige
@ 2008-05-28  5:56       ` Kenji Kaneshige
  2008-05-28  5:57       ` [PATCH 2/4] Updated version of 4c8cc2d54b1d35cf24ede6057e05f103cfa28852 Kenji Kaneshige
                         ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2008-05-28  5:56 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: Stephen Rothwell, linux-next

Remove the redundant initialization of pci_dev member of struct
controller in pciehp_probe(). It is initialized in pcie_init().

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

---
 drivers/pci/hotplug/pciehp_core.c |    1 -
 1 file changed, 1 deletion(-)

Index: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_core.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp_core.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_core.c
@@ -454,7 +454,6 @@ static int pciehp_probe(struct pcie_devi
 	INIT_LIST_HEAD(&ctrl->slot_list);
 
 	pdev = dev->port;
-	ctrl->pci_dev = pdev;
 
 	rc = pcie_init(ctrl, dev);
 	if (rc) {



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 2/4] Updated version of 4c8cc2d54b1d35cf24ede6057e05f103cfa28852
  2008-05-28  5:53     ` Kenji Kaneshige
  2008-05-28  5:56       ` [PATCH 1/4] Updated version of 72c4928058175e889b2f83d1a62ac6f2eb0498a0 Kenji Kaneshige
@ 2008-05-28  5:57       ` Kenji Kaneshige
  2008-05-28  5:59       ` [PATCH 3/4] Updated version of 2b26196717939221ccc06073780b73d0f4ee3203 Kenji Kaneshige
                         ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2008-05-28  5:57 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: Stephen Rothwell, linux-next

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>

---
 drivers/pci/hotplug/pciehp.h      |    1 +
 drivers/pci/hotplug/pciehp_core.c |   10 +++++++---
 drivers/pci/hotplug/pciehp_hpc.c  |   17 ++---------------
 3 files changed, 10 insertions(+), 18 deletions(-)

Index: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_core.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp_core.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_core.c
@@ -444,7 +444,13 @@ static int pciehp_probe(struct pcie_devi
 	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_devi
 	}
 	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: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_hpc.c
@@ -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 cont
 
 	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)
Index: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp.h
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp.h
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp.h
@@ -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,



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 3/4] Updated version of 2b26196717939221ccc06073780b73d0f4ee3203
  2008-05-28  5:53     ` Kenji Kaneshige
  2008-05-28  5:56       ` [PATCH 1/4] Updated version of 72c4928058175e889b2f83d1a62ac6f2eb0498a0 Kenji Kaneshige
  2008-05-28  5:57       ` [PATCH 2/4] Updated version of 4c8cc2d54b1d35cf24ede6057e05f103cfa28852 Kenji Kaneshige
@ 2008-05-28  5:59       ` Kenji Kaneshige
  2008-05-28  6:01       ` [PATCH 4/4] Updated version of 9d06d9963852e7818157994c645c640239cb5137 Kenji Kaneshige
  2008-05-28 17:57       ` linux-next: pci merge conflict Jesse Barnes
  4 siblings, 0 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2008-05-28  5:59 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: Stephen Rothwell, linux-next

Since we need to wait for command completion for muximum 1sec, waiting
command should not be interrupted by a signal.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

---
 drivers/pci/hotplug/pciehp_hpc.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Index: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_hpc.c
@@ -268,9 +268,8 @@ completed:
 	return timeout;
 }
 
-static inline int pcie_wait_cmd(struct controller *ctrl, int poll)
+static inline void pcie_wait_cmd(struct controller *ctrl, int poll)
 {
-	int retval = 0;
 	unsigned int msecs = pciehp_poll_mode ? 2500 : 1000;
 	unsigned long timeout = msecs_to_jiffies(msecs);
 	int rc;
@@ -278,16 +277,9 @@ static inline int pcie_wait_cmd(struct c
 	if (poll)
 		rc = pcie_poll_cmd(ctrl);
 	else
-		rc = wait_event_interruptible_timeout(ctrl->queue,
-					      !ctrl->cmd_busy, timeout);
+		rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout);
 	if (!rc)
 		dbg("Command not completed in 1000 msec\n");
-	else if (rc < 0) {
-		retval = -EINTR;
-		info("Command was interrupted by a signal\n");
-	}
-
-	return retval;
 }
 
 /**
@@ -365,7 +357,7 @@ static int pcie_write_cmd(struct control
 		if (!(slot_ctrl & HP_INTR_ENABLE) ||
 		    !(slot_ctrl & CMD_CMPL_INTR_ENABLE))
 			poll = 1;
-                retval = pcie_wait_cmd(ctrl, poll);
+                pcie_wait_cmd(ctrl, poll);
 	}
  out:
 	mutex_unlock(&ctrl->ctrl_lock);
@@ -797,7 +789,7 @@ static irqreturn_t pcie_isr(int irq, voi
 	if (intr_loc & CMD_COMPLETED) {
 		ctrl->cmd_busy = 0;
 		smp_mb();
-		wake_up_interruptible(&ctrl->queue);
+		wake_up(&ctrl->queue);
 	}
 
 	if (!(intr_loc & ~CMD_COMPLETED))



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 4/4] Updated version of 9d06d9963852e7818157994c645c640239cb5137
  2008-05-28  5:53     ` Kenji Kaneshige
                         ` (2 preceding siblings ...)
  2008-05-28  5:59       ` [PATCH 3/4] Updated version of 2b26196717939221ccc06073780b73d0f4ee3203 Kenji Kaneshige
@ 2008-05-28  6:01       ` Kenji Kaneshige
  2008-05-28 17:57       ` linux-next: pci merge conflict Jesse Barnes
  4 siblings, 0 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2008-05-28  6:01 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: Stephen Rothwell, linux-next

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>

---
 drivers/pci/hotplug/acpi_pcihp.c  |   85 ++++++++++++++++++++++++++++++++++++--
 drivers/pci/hotplug/pciehp.h      |   10 +++-
 drivers/pci/hotplug/pciehp_hpc.c  |   69 ------------------------------
 drivers/pci/hotplug/shpchp.h      |   14 +++---
 drivers/pci/hotplug/shpchp_core.c |   15 +++---
 drivers/pci/hotplug/shpchp_hpc.c  |    1 
 include/linux/pci_hotplug.h       |    2 
 7 files changed, 105 insertions(+), 91 deletions(-)

Index: linux-2.6.26-rc4/drivers/pci/hotplug/acpi_pcihp.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/acpi_pcihp.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/acpi_pcihp.c
@@ -30,6 +30,7 @@
 #include <linux/types.h>
 #include <linux/pci.h>
 #include <linux/pci_hotplug.h>
+#include <linux/pci-acpi.h>
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/actypes.h>
@@ -299,7 +300,7 @@ free_and_return:
  *
  * @handle - the handle of the hotplug controller.
  */
-acpi_status acpi_run_oshp(acpi_handle handle)
+static acpi_status acpi_run_oshp(acpi_handle handle)
 {
 	acpi_status		status;
 	struct acpi_buffer	string = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -322,9 +323,6 @@ acpi_status acpi_run_oshp(acpi_handle ha
 	kfree(string.pointer);
 	return status;
 }
-EXPORT_SYMBOL_GPL(acpi_run_oshp);
-
-
 
 /* acpi_get_hp_params_from_firmware
  *
@@ -374,6 +372,85 @@ acpi_status acpi_get_hp_params_from_firm
 }
 EXPORT_SYMBOL_GPL(acpi_get_hp_params_from_firmware);
 
+/**
+ * acpi_get_hp_hw_control_from_firmware
+ * @dev: the pci_dev of the bridge that has a hotplug controller
+ * @flags: requested control bits for _OSC
+ *
+ * Attempt to take hotplug control from firmware.
+ */
+int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags)
+{
+	acpi_status status;
+	acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev));
+	struct pci_dev *pdev = dev;
+	struct pci_bus *parent;
+	struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL };
+
+	flags &= (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL |
+		  OSC_SHPC_NATIVE_HP_CONTROL |
+		  OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
+	if (!flags) {
+		err("Invalid flags %u specified!\n", flags);
+		return -EINVAL;
+	}
+
+	/*
+	 * Per PCI firmware specification, we should run the ACPI _OSC
+	 * method to get control of hotplug hardware before using it. If
+	 * an _OSC is missing, we look for an OSHP to do the same thing.
+	 * To handle different BIOS behavior, we look for _OSC and OSHP
+	 * within the scope of the hotplug controller and its parents,
+	 * upto the host bridge under which this controller exists.
+	 */
+	while (!handle) {
+		/*
+		 * This hotplug controller was not listed in the ACPI name
+		 * space at all. Try to get acpi handle of parent pci bus.
+		 */
+		if (!pdev || !pdev->bus->parent)
+			break;
+		parent = pdev->bus->parent;
+		dbg("Could not find %s in acpi namespace, trying parent\n",
+		    pci_name(pdev));
+		if (!parent->self)
+			/* Parent must be a host bridge */
+			handle = acpi_get_pci_rootbridge_handle(
+					pci_domain_nr(parent),
+					parent->number);
+		else
+			handle = DEVICE_ACPI_HANDLE(&(parent->self->dev));
+		pdev = parent->self;
+	}
+
+	while (handle) {
+		acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
+		dbg("Trying to get hotplug control for %s \n",
+		    (char *)string.pointer);
+		status = pci_osc_control_set(handle, flags);
+		if (status == AE_NOT_FOUND)
+			status = acpi_run_oshp(handle);
+		if (ACPI_SUCCESS(status)) {
+			dbg("Gained control for hotplug HW for pci %s (%s)\n",
+			    pci_name(dev), (char *)string.pointer);
+			kfree(string.pointer);
+			return 0;
+		}
+		if (acpi_root_bridge(handle))
+			break;
+		chandle = handle;
+		status = acpi_get_parent(chandle, &handle);
+		if (ACPI_FAILURE(status))
+			break;
+	}
+
+	dbg("Cannot get control of hotplug hardware for pci %s\n",
+	    pci_name(dev));
+
+	kfree(string.pointer);
+	return -ENODEV;
+}
+EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware);
 
 /* acpi_root_bridge - check to see if this acpi object is a root bridge
  *
Index: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp.h
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp.h
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp.h
@@ -202,9 +202,13 @@ 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_hw_control_from_firmware(struct pci_dev *dev)
+{
+	u32 flags = (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL |
+		     OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
+	return acpi_get_hp_hw_control_from_firmware(dev, flags);
+}
+
 static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev,
 			struct hotplug_params *hpp)
 {
Index: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_hpc.c
@@ -1009,75 +1009,6 @@ static struct hpc_ops pciehp_hpc_ops = {
 	.check_lnk_status		= hpc_check_lnk_status,
 };
 
-#ifdef CONFIG_ACPI
-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));
-	struct pci_dev *pdev = dev;
-	struct pci_bus *parent;
-	struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL };
-
-	/*
-	 * Per PCI firmware specification, we should run the ACPI _OSC
-	 * method to get control of hotplug hardware before using it.
-	 * If an _OSC is missing, we look for an OSHP to do the same thing.
-	 * To handle different BIOS behavior, we look for _OSC and OSHP
-	 * within the scope of the hotplug controller and its parents, upto
-	 * the host bridge under which this controller exists.
-	 */
-	while (!handle) {
-		/*
-		 * This hotplug controller was not listed in the ACPI name
-		 * space at all. Try to get acpi handle of parent pci bus.
-		 */
-		if (!pdev || !pdev->bus->parent)
-			break;
-		parent = pdev->bus->parent;
-		dbg("Could not find %s in acpi namespace, trying parent\n",
-				pci_name(pdev));
-		if (!parent->self)
-			/* Parent must be a host bridge */
-			handle = acpi_get_pci_rootbridge_handle(
-					pci_domain_nr(parent),
-					parent->number);
-		else
-			handle = DEVICE_ACPI_HANDLE(
-					&(parent->self->dev));
-		pdev = parent->self;
-	}
-
-	while (handle) {
-		acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
-		dbg("Trying to get hotplug control for %s \n",
-			(char *)string.pointer);
-		status = pci_osc_control_set(handle,
-				OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL |
-				OSC_PCI_EXPRESS_NATIVE_HP_CONTROL);
-		if (status == AE_NOT_FOUND)
-			status = acpi_run_oshp(handle);
-		if (ACPI_SUCCESS(status)) {
-			dbg("Gained control for hotplug HW for pci %s (%s)\n",
-				pci_name(dev), (char *)string.pointer);
-			kfree(string.pointer);
-			return 0;
-		}
-		if (acpi_root_bridge(handle))
-			break;
-		chandle = handle;
-		status = acpi_get_parent(chandle, &handle);
-		if (ACPI_FAILURE(status))
-			break;
-	}
-
-	dbg("Cannot get control of hotplug hardware for pci %s\n",
-			pci_name(dev));
-
-	kfree(string.pointer);
-	return -1;
-}
-#endif
-
 static int pcie_init_hardware_part1(struct controller *ctrl,
 				    struct pcie_device *dev)
 {
Index: linux-2.6.26-rc4/include/linux/pci_hotplug.h
===================================================================
--- linux-2.6.26-rc4.orig/include/linux/pci_hotplug.h
+++ linux-2.6.26-rc4/include/linux/pci_hotplug.h
@@ -227,9 +227,9 @@ struct hotplug_params {
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/actypes.h>
-extern acpi_status acpi_run_oshp(acpi_handle handle);
 extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
 				struct hotplug_params *hpp);
+int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
 int acpi_root_bridge(acpi_handle handle);
 #endif
 #endif
Index: linux-2.6.26-rc4/drivers/pci/hotplug/shpchp.h
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/shpchp.h
+++ linux-2.6.26-rc4/drivers/pci/hotplug/shpchp.h
@@ -170,6 +170,7 @@ extern void shpchp_queue_pushbutton_work
 extern int shpc_init( struct controller *ctrl, struct pci_dev *pdev);
 
 #ifdef CONFIG_ACPI
+#include <linux/pci-acpi.h>
 static inline int get_hp_params_from_firmware(struct pci_dev *dev,
 					      struct hotplug_params *hpp)
 {
@@ -177,14 +178,15 @@ static inline int get_hp_params_from_fir
 			return -ENODEV;
 	return 0;
 }
-#define get_hp_hw_control_from_firmware(pdev)				\
-	do {								\
-		if (DEVICE_ACPI_HANDLE(&(pdev->dev)))			\
-			acpi_run_oshp(DEVICE_ACPI_HANDLE(&(pdev->dev)));\
-	} while (0)
+
+static inline int get_hp_hw_control_from_firmware(struct pci_dev *dev)
+{
+	u32 flags = OSC_SHPC_NATIVE_HP_CONTROL;
+	return acpi_get_hp_hw_control_from_firmware(dev, flags);
+}
 #else
 #define get_hp_params_from_firmware(dev, hpp) (-ENODEV)
-#define get_hp_hw_control_from_firmware(dev) do { } while (0)
+#define get_hp_hw_control_from_firmware(dev) (0)
 #endif
 
 struct ctrl_reg {
Index: linux-2.6.26-rc4/drivers/pci/hotplug/shpchp_core.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/shpchp_core.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/shpchp_core.c
@@ -330,13 +330,14 @@ static int get_cur_bus_speed (struct hot
 
 static int is_shpc_capable(struct pci_dev *dev)
 {
-       if ((dev->vendor == PCI_VENDOR_ID_AMD) || (dev->device ==
-                               PCI_DEVICE_ID_AMD_GOLAM_7450))
-               return 1;
-       if (pci_find_capability(dev, PCI_CAP_ID_SHPC))
-               return 1;
-
-       return 0;
+	if ((dev->vendor == PCI_VENDOR_ID_AMD) || (dev->device ==
+						PCI_DEVICE_ID_AMD_GOLAM_7450))
+		return 1;
+	if (!pci_find_capability(dev, PCI_CAP_ID_SHPC))
+		return 0;
+	if (get_hp_hw_control_from_firmware(dev))
+		return 0;
+	return 1;
 }
 
 static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
Index: linux-2.6.26-rc4/drivers/pci/hotplug/shpchp_hpc.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/shpchp_hpc.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/shpchp_hpc.c
@@ -1084,7 +1084,6 @@ int shpc_init(struct controller *ctrl, s
 	dbg("%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", __func__,
 			pdev->bus->number, PCI_SLOT(pdev->devfn),
 			PCI_FUNC(pdev->devfn), pdev->irq);
-	get_hp_hw_control_from_firmware(pdev);
 
 	/*
 	 * If this is the first controller to be initialized,



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: linux-next: pci merge conflict
  2008-05-28  5:53     ` Kenji Kaneshige
                         ` (3 preceding siblings ...)
  2008-05-28  6:01       ` [PATCH 4/4] Updated version of 9d06d9963852e7818157994c645c640239cb5137 Kenji Kaneshige
@ 2008-05-28 17:57       ` Jesse Barnes
  4 siblings, 0 replies; 13+ messages in thread
From: Jesse Barnes @ 2008-05-28 17:57 UTC (permalink / raw)
  To: Kenji Kaneshige; +Cc: Stephen Rothwell, linux-next

On Tuesday, May 27, 2008 10:53 pm Kenji Kaneshige wrote:
> Jesse Barnes wrote:
> > On Tuesday, May 27, 2008 7:50 pm Kenji Kaneshige wrote:
> >> Hi Stephen-san, Jesse-san,
> >>
> >> I have already have updated patches. I'll send them if necessary.
> >
> > Oops, meant to actually write a message. :)
> >
> > I'll merge the Linus tree into linux-next tomorrow.  Kenji-san, I'll
> > probably ask for updated patches then for anything that's in linux-next
> > but not in Linus' tree yet.
>
> Ok, just in case, I send patches related to pciehp now. I'll send the
> flowing patches followed by this e-mail.
>
> - [PATCH 1/4] Updated version of 72c4928058175e889b2f83d1a62ac6f2eb0498a0
> - [PATCH 2/4] Updated version of 4c8cc2d54b1d35cf24ede6057e05f103cfa28852
> - [PATCH 3/4] Updated version of 2b26196717939221ccc06073780b73d0f4ee3203
> - [PATCH 4/4] Updated version of 9d06d9963852e7818157994c645c640239cb5137
>
> I made these patches against 2.6.24-rc4 with recent pciehp regression fixes
> applied.

Great, thanks a lot.  I just pushed these into linux-next, please verify 
things when you get a chance.

Thanks,
Jesse

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: linux-next: pci merge conflict
  2008-06-11  3:23 Stephen Rothwell
@ 2008-06-11  3:38 ` Alex Chiang
  0 siblings, 0 replies; 13+ messages in thread
From: Alex Chiang @ 2008-06-11  3:38 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Jesse Barnes, linux-next, Greg KH, Kay Sievers

* Stephen Rothwell <sfr@canb.auug.org.au>:
> Hi Jesse,
> 
> Today's linux-next merge of the pci tree got a conflict in
> drivers/pci/hotplug/fakephp.c between commit
> b9a4a152420e0158822ffb0cf0e57d36019604c7 ("driver-core: prepare for
> removal of 20 char limit from struct device") from the driver-core tree
> and commit fe99740cac117f208707488c03f3789cf4904957 ("PCI: construct one
> fakephp slot per PCI slot") from the pci tree.
> 
> I did what seemed to be the right thing - it seems that the driver-core
> patch to this file is no longer needed.  It is worth a check.

Yes, I mentioned the possibility of this conflict here:

	http://lkml.org/lkml/2008/6/10/382

And yes, dropping the driver-core hunk is the correct thing to
do.

Thanks Stephen!

/ac


^ permalink raw reply	[flat|nested] 13+ messages in thread

* linux-next: pci merge conflict
@ 2008-06-11  3:23 Stephen Rothwell
  2008-06-11  3:38 ` Alex Chiang
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Rothwell @ 2008-06-11  3:23 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: linux-next, Greg KH, Kay Sievers, Alex Chiang

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

Hi Jesse,

Today's linux-next merge of the pci tree got a conflict in
drivers/pci/hotplug/fakephp.c between commit
b9a4a152420e0158822ffb0cf0e57d36019604c7 ("driver-core: prepare for
removal of 20 char limit from struct device") from the driver-core tree
and commit fe99740cac117f208707488c03f3789cf4904957 ("PCI: construct one
fakephp slot per PCI slot") from the pci tree.

I did what seemed to be the right thing - it seems that the driver-core
patch to this file is no longer needed.  It is worth a check.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-06-11  3:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-28  2:27 linux-next: pci merge conflict Stephen Rothwell
2008-05-28  2:50 ` Kenji Kaneshige
2008-05-28  3:19   ` Stephen Rothwell
2008-05-28  4:04   ` Jesse Barnes
2008-05-28  4:08   ` Jesse Barnes
2008-05-28  5:53     ` Kenji Kaneshige
2008-05-28  5:56       ` [PATCH 1/4] Updated version of 72c4928058175e889b2f83d1a62ac6f2eb0498a0 Kenji Kaneshige
2008-05-28  5:57       ` [PATCH 2/4] Updated version of 4c8cc2d54b1d35cf24ede6057e05f103cfa28852 Kenji Kaneshige
2008-05-28  5:59       ` [PATCH 3/4] Updated version of 2b26196717939221ccc06073780b73d0f4ee3203 Kenji Kaneshige
2008-05-28  6:01       ` [PATCH 4/4] Updated version of 9d06d9963852e7818157994c645c640239cb5137 Kenji Kaneshige
2008-05-28 17:57       ` linux-next: pci merge conflict Jesse Barnes
2008-06-11  3:23 Stephen Rothwell
2008-06-11  3:38 ` Alex Chiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).