public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Patterson <andrew.patterson@hp.com>
To: linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, lenb@kernel.org, gregkh@suse.de,
	matthew@wil.cx, tom.l.nguyen@intel.com,
	linux-acpi@vger.kernel.org,
	Andrew Patterson <andrew.patterson@hp.com>
Subject: [PATCH 4/4] PCI: Run ACPI _OSC method on root bridges only
Date: Tue, 22 Jan 2008 17:18:27 -0700	[thread overview]
Message-ID: <20080123001827.28190.7908.stgit@bluto.andrew> (raw)
In-Reply-To: <20080123001807.28190.32648.stgit@bluto.andrew>

From: Andrew Patterson <andrew.patterson@hp.com>

According to the PCI Firmware Specification Revision 3.0 section 4.5, _OSC
should only be called on a root brdige.  Here is the relevant passage: "The
_OSC interface defined in this section applies only to Host Bridge ACPI
devices that originate PCI, PCI-X, or PCI Express hierarchies". Changed the
code to find the parent root bridge of the device and call _OSC on that.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
---

 drivers/pci/pcie/aer/aerdrv_acpi.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c
index f685bf5..8c199ae 100644
--- a/drivers/pci/pcie/aer/aerdrv_acpi.c
+++ b/drivers/pci/pcie/aer/aerdrv_acpi.c
@@ -31,23 +31,13 @@ int aer_osc_setup(struct pcie_device *pciedev)
 {
 	acpi_status status = AE_NOT_FOUND;
 	struct pci_dev *pdev = pciedev->port;
-	acpi_handle handle = DEVICE_ACPI_HANDLE(&pdev->dev);
-	struct pci_bus *parent;
+	acpi_handle handle = 0;
 
-	while (!handle) {
-		if (!pdev || !pdev->bus->parent)
-			break;
-		parent = pdev->bus->parent;
-		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;
-	}
+	/* Find root host bridge */
+	while (pdev->bus && pdev->bus->self)
+		pdev = pdev->bus->self;
+	handle = acpi_get_pci_rootbridge_handle(
+		pci_domain_nr(pdev->bus), pdev->bus->number);
 
 	if (handle) {
 		pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);


      parent reply	other threads:[~2008-01-23  0:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-23  0:18 [PATCH 0/4] ACPI fixes for PCIe AER Andrew Patterson
2008-01-23  0:18 ` [PATCH 1/4] PCI ACPI: Added a function to register _OSC with only PCIe devices Andrew Patterson
2008-01-23  0:18 ` [PATCH 2/4] PCI ACPI: AER driver should only register PCIe devices with _OSC Andrew Patterson
2008-01-23  0:18 ` [PATCH 3/4] ACPI: Check for any matching CID when walking namespace Andrew Patterson
2008-01-23 17:42   ` Greg KH
2008-01-23 19:35     ` Andrew Patterson
2008-01-23 19:39   ` Len Brown
2008-01-23 19:48     ` Andrew Patterson
2008-02-12 23:38     ` Moore, Robert
2008-01-23  0:18 ` Andrew Patterson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080123001827.28190.7908.stgit@bluto.andrew \
    --to=andrew.patterson@hp.com \
    --cc=gregkh@suse.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=tom.l.nguyen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox