From patchwork Thu Jul 4 14:29:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 2823833 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 557EC9F7D6 for ; Thu, 4 Jul 2013 14:27:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CFD320188 for ; Thu, 4 Jul 2013 14:27:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D5042015B for ; Thu, 4 Jul 2013 14:27:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754351Ab3GDO07 (ORCPT ); Thu, 4 Jul 2013 10:26:59 -0400 Received: from mga14.intel.com ([143.182.124.37]:33808 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752708Ab3GDO06 (ORCPT ); Thu, 4 Jul 2013 10:26:58 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 04 Jul 2013 07:26:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,995,1363158000"; d="scan'208";a="326810016" Received: from blue.fi.intel.com ([10.237.72.156]) by azsmga001.ch.intel.com with ESMTP; 04 Jul 2013 07:26:54 -0700 Received: by blue.fi.intel.com (Postfix, from userid 1004) id 0C43BE0090; Thu, 4 Jul 2013 17:29:52 +0300 (EEST) From: Mika Westerberg To: "Rafael J. Wysocki" Cc: Greg Kroah-Hartman , Bjorn Helgaas , Jesse Barnes , Yinghai Lu , john.ronciak@intel.com, miles.j.penner@intel.com, bruce.w.allan@intel.com, Heikki Krogerus , "Kirill A. Shutemov" , Mika Westerberg , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, x86@kernel.org Subject: [PATCH v2.1 6/8] PCI: acpiphp: workaround for Thunderbolt on Acer Aspire S5 Date: Thu, 4 Jul 2013 17:29:51 +0300 Message-Id: <1372948192-17913-1-git-send-email-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1656567.0oqS7xVYJ8@vostro.rjw.lan> References: <1656567.0oqS7xVYJ8@vostro.rjw.lan> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Mika Westerberg Acked-by: Rafael J. Wysocki --- drivers/pci/hotplug/acpi_pcihp.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index 2a47e82..eae1511 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c @@ -33,6 +33,7 @@ #include #include #include +#include #define MY_NAME "acpi_pcihp" @@ -408,11 +409,31 @@ got_one: } EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); +static const struct dmi_system_id pcihp_platform_quirks[] = { + { + /* + * 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", + }, + { } +}; + static int pcihp_is_ejectable(acpi_handle handle) { acpi_status status; acpi_handle tmp; unsigned long long removable; + const struct dmi_system_id *id; + status = acpi_get_handle(handle, "_ADR", &tmp); if (ACPI_FAILURE(status)) return 0; @@ -422,6 +443,19 @@ static int pcihp_is_ejectable(acpi_handle handle) status = acpi_evaluate_integer(handle, "_RMV", NULL, &removable); if (ACPI_SUCCESS(status) && removable) return 1; + + /* + * Try to look if there is a platform specific method that we can + * use to determine if the device is removable or not. + */ + id = dmi_first_match(pcihp_platform_quirks); + if (id && id->driver_data) { + status = acpi_evaluate_integer(handle, id->driver_data, NULL, + &removable); + if (ACPI_SUCCESS(status) && removable) + return 1; + } + return 0; }