From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Bjorn Helgaas <bhelgaas@google.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Yinghai Lu <yinghai@kernel.org>,
john.ronciak@intel.com, miles.j.penner@intel.com,
bruce.w.allan@intel.com,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-pci@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH v2 6/8] PCI: acpiphp: workaround for Thunderbolt on Acer Aspire S5
Date: Thu, 4 Jul 2013 11:58:44 +0300 [thread overview]
Message-ID: <20130704085844.GF4898@intel.com> (raw)
In-Reply-To: <1444243.g9GbxN3NM0@vostro.rjw.lan>
On Wed, Jul 03, 2013 at 11:40:42PM +0200, Rafael J. Wysocki wrote:
> On Wednesday, July 03, 2013 05:04:53 PM Mika Westerberg wrote:
> > From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> >
> > Correct ACPI PCI hotplug imeplementation should have _RMV method in a
> > PCI slot (device under pci bridge). In Acer Aspire S5 case we have it
> > deeper in hierarchy:
> >
> > Device (RP05)
> > {
> > // ...
> > Device (HRUP)
> > {
> > // ...
> > Device (HRDN)
> > {
> > // ...
> > Device (EPUP)
> > {
> > // ...
> > Method (_RMV, 0, NotSerialized) // _RMV: Removal Status
> > {
> > Return (One)
> > }
> > }
> > }
> > }
> > }
> >
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > ---
> > drivers/pci/hotplug/acpi_pcihp.c | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> > diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
> > index 2a47e82..d92ebfb 100644
> > --- a/drivers/pci/hotplug/acpi_pcihp.c
> > +++ b/drivers/pci/hotplug/acpi_pcihp.c
> > @@ -422,6 +422,19 @@ static int pcihp_is_ejectable(acpi_handle handle)
> > status = acpi_evaluate_integer(handle, "_RMV", NULL, &removable);
> > if (ACPI_SUCCESS(status) && removable)
> > return 1;
> > +
> > + /*
> > + * Workaround for Thunderbolt implementation on Acer Aspire S5.
> > + *
> > + * Correct ACPI PCI hotplug imeplementation has _RMV method in a PCI
> > + * slot (device under pci bridge). In Acer Aspire S5 case we have it
> > + * deeper in hierarchy.
> > + */
> > + status = acpi_evaluate_integer(handle, "HRDN.EPUP._RMV", NULL,
> > + &removable);
>
> Well, calling stuff like this directly from a general function is kind of ugly.
>
> Can we use something like a quirk instead? A DMI check or something?
Sure we can. How about something like the patch below?
From: Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH] PCI: acpiphp: workaround for Thunderbolt on Acer Aspire S5
The acpiphp driver finds out whether the device is removable by checking
whether it has _RMV method directly behind it (and if it returns 1).
However, at least on Acer Aspire S5 with Thunderbolt host router has this
method placed behind a device called EPUP (endpoint upstream port?) and not
in the usual place expected by the acpiphp driver. The ASL code below shows
how this is done on that machine:
Device (RP05)
{
...
Device (HRUP)
{
Name (_ADR, Zero)
Name (_PRW, Package (0x02)
{
0x09,
0x04
})
Device (HRDN)
{
Name (_ADR, 0x00040000)
Name (_PRW, Package (0x02)
{
0x09,
0x04
})
Device (EPUP)
{
Name (_ADR, Zero)
Method (_RMV, 0, NotSerialized)
{
Return (One)
}
}
}
}
...
Fix this by adding a DMI quirk for the Acer Aspire S5 machine that gives an
alternative path to the _RMV method.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/pci/hotplug/acpi_pcihp.c | 57 ++++++++++++++++++++++++++++++++++++----
1 file changed, 52 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index 2a47e82..99fccf3 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -33,6 +33,7 @@
#include <linux/acpi.h>
#include <linux/pci-acpi.h>
#include <linux/slab.h>
+#include <linux/dmi.h>
#define MY_NAME "acpi_pcihp"
@@ -408,21 +409,67 @@ got_one:
}
EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware);
+/**
+ * pcihp_is_removable - is the given ACPI device removable
+ * @handle: ACPI handle of the device
+ *
+ * Try to find out whether the given ACPI device is removable by evaluating
+ * its _RMV and returning the result. If we can't find the _RMV directly
+ * under the device use system specific quirks to locate it.
+ */
+static bool pcihp_is_removable(acpi_handle handle)
+{
+ static const struct dmi_system_id rmv_paths[] = {
+ {
+ /*
+ * On Acer Aspire S5 the _RMV method for the
+ * Thunderbolt host router upstream port is not
+ * located directly under the device but it is
+ * instead placed a bit deeper in the hierarchy.
+ */
+ .ident = "Acer Aspire S5",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire S5-391"),
+ },
+ .driver_data = "HRDN.EPUP._RMV",
+ },
+ { }
+ };
+ const struct dmi_system_id *id;
+ unsigned long long removable;
+ acpi_status status;
+
+ status = acpi_evaluate_integer(handle, "_RMV", NULL, &removable);
+ if (ACPI_SUCCESS(status))
+ return !!removable;
+
+ /* Try system specific quirks */
+ id = dmi_first_match(rmv_paths);
+ if (id && id->driver_data) {
+ char path[64];
+
+ strlcpy(path, id->driver_data, sizeof(path));
+ status = acpi_evaluate_integer(handle, path, NULL, &removable);
+ if (ACPI_SUCCESS(status))
+ return !!removable;
+ }
+
+ return false;
+}
+
static int pcihp_is_ejectable(acpi_handle handle)
{
acpi_status status;
acpi_handle tmp;
- unsigned long long removable;
+
status = acpi_get_handle(handle, "_ADR", &tmp);
if (ACPI_FAILURE(status))
return 0;
status = acpi_get_handle(handle, "_EJ0", &tmp);
if (ACPI_SUCCESS(status))
return 1;
- status = acpi_evaluate_integer(handle, "_RMV", NULL, &removable);
- if (ACPI_SUCCESS(status) && removable)
- return 1;
- return 0;
+ return pcihp_is_removable(handle);
}
/**
--
1.8.3.2
next prev parent reply other threads:[~2013-07-04 8:58 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 14:04 [PATCH v2 0/8] Thunderbolt workarounds Mika Westerberg
2013-07-03 14:04 ` [PATCH v2 1/8] x86/PCI: prevent re-allocation of already existing bridge and ROM resources Mika Westerberg
2013-07-23 0:08 ` Bjorn Helgaas
2013-07-23 1:18 ` Bjorn Helgaas
2013-07-23 1:33 ` Bjorn Helgaas
2013-07-23 2:01 ` Rafael J. Wysocki
2013-07-23 1:50 ` Rafael J. Wysocki
2013-07-03 14:04 ` [PATCH v2 2/8] PCI: acpiphp: do not check for SLOT_ENABLED in enable_device() Mika Westerberg
2013-07-03 14:04 ` [PATCH v2 3/8] PCI: acpiphp: enable_device(): rescan even if no new devices on slot Mika Westerberg
2013-07-11 0:25 ` Rafael J. Wysocki
2013-07-11 5:11 ` Mika Westerberg
2013-07-11 22:48 ` Rafael J. Wysocki
2013-07-03 14:04 ` [PATCH v2 4/8] PCI: acpiphp: check for new devices on enabled host Mika Westerberg
2013-07-03 14:04 ` [PATCH v2 5/8] PCI: acpiphp: kill SLOT_ENABLED in favor of always re-enumerating the devices Mika Westerberg
2013-07-03 14:04 ` [PATCH v2 6/8] PCI: acpiphp: workaround for Thunderbolt on Acer Aspire S5 Mika Westerberg
2013-07-03 21:40 ` Rafael J. Wysocki
2013-07-04 8:58 ` Mika Westerberg [this message]
2013-07-04 12:36 ` Rafael J. Wysocki
2013-07-04 12:53 ` Mika Westerberg
2013-07-04 13:14 ` Rafael J. Wysocki
2013-07-04 13:33 ` Mika Westerberg
2013-07-04 13:53 ` Rafael J. Wysocki
2013-07-04 14:29 ` [PATCH v2.1 " Mika Westerberg
2013-07-04 23:48 ` Rafael J. Wysocki
2013-07-05 5:47 ` Mika Westerberg
2013-07-19 3:57 ` [PATCH v2 " Robert Hancock
2013-07-19 12:18 ` Rafael J. Wysocki
2013-07-03 21:45 ` Bjorn Helgaas
2013-07-03 21:58 ` Rafael J. Wysocki
2013-07-03 14:04 ` [PATCH v2 7/8] PCI: acpiphp: get rid of unused constants in acpiphp.h Mika Westerberg
2013-07-03 14:04 ` [PATCH v2 8/8] PCI: acpiphp: sanitize acpiphp_get_[latch|adapter]_status() Mika Westerberg
2013-07-03 18:29 ` [PATCH v2 0/8] Thunderbolt workarounds Matthew Garrett
2013-07-03 18:33 ` Greg Kroah-Hartman
2013-07-03 18:44 ` Matthew Garrett
2013-07-03 19:57 ` Ronciak, John
2013-07-03 20:35 ` Matthew Garrett
2013-07-03 20:46 ` Ronciak, John
2013-07-03 21:21 ` Matthew Garrett
2013-07-03 18:41 ` Mika Westerberg
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=20130704085844.GF4898@intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=bruce.w.allan@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=jbarnes@virtuousgeek.org \
--cc=john.ronciak@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=miles.j.penner@intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@sisk.pl \
--cc=x86@kernel.org \
--cc=yinghai@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.