From patchwork Wed Aug 4 23:51:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 117179 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o74NrGIU025767 for ; Wed, 4 Aug 2010 23:53:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759518Ab0HDXxP (ORCPT ); Wed, 4 Aug 2010 19:53:15 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:39119 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753900Ab0HDXxP (ORCPT ); Wed, 4 Aug 2010 19:53:15 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 723FA18FABA; Thu, 5 Aug 2010 01:45:58 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22831-04; Thu, 5 Aug 2010 01:45:51 +0200 (CEST) Received: from ferrari.localnet (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 2940318F301; Thu, 5 Aug 2010 01:45:51 +0200 (CEST) From: "Rafael J. Wysocki" To: linux-pm@lists.linux-foundation.org Subject: Re: [linux-pm] [PATCH 7/8] ACPI / PCI: Do not preserve _OSC control bits returned by a query (v2) Date: Thu, 5 Aug 2010 01:51:27 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.35-rjw+; KDE/4.4.4; x86_64; ; ) Cc: Hidetoshi Seto , linux-pci@vger.kernel.org, ACPI Devel Maling List , Jesse Barnes , Kenji Kaneshige References: <201008022351.31406.rjw@sisk.pl> <4C5927CB.4070705@jp.fujitsu.com> <201008041229.19848.rjw@sisk.pl> In-Reply-To: <201008041229.19848.rjw@sisk.pl> MIME-Version: 1.0 Message-Id: <201008050151.27501.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 04 Aug 2010 23:53:17 +0000 (UTC) Index: linux-2.6/drivers/acpi/pci_root.c =================================================================== --- linux-2.6.orig/drivers/acpi/pci_root.c +++ linux-2.6/drivers/acpi/pci_root.c @@ -472,6 +472,30 @@ out: } EXPORT_SYMBOL(acpi_pci_osc_control_set); +/** + * acpi_pci_osc_control_set_safe - Query and set _OSC control bit mask. + * @handle: ACPI handle of a PCI root bridge (or PCIe Root Complex). + * @flags: Mask of _OSC bits to query and set. + * + * Check if the BIOS is willing to grant control of the features represented + * by @flags and request control of these features from it. + **/ +acpi_status acpi_pci_osc_control_set_safe(acpi_handle handle, u32 flags) +{ + acpi_status status; + u32 ctrl = flags; + + status = acpi_pci_osc_control_query(handle, &flags); + if (ACPI_FAILURE(status)) + return status; + if ((ctrl & flags) != ctrl) + return AE_SUPPORT; + + status = acpi_pci_osc_control_set(handle, flags); + return status; +} +EXPORT_SYMBOL(acpi_pci_osc_control_set_safe); + static int __devinit acpi_pci_root_add(struct acpi_device *device) { unsigned long long segment, bus; Index: linux-2.6/drivers/pci/hotplug/acpi_pcihp.c =================================================================== --- linux-2.6.orig/drivers/pci/hotplug/acpi_pcihp.c +++ linux-2.6/drivers/pci/hotplug/acpi_pcihp.c @@ -358,7 +358,7 @@ int acpi_get_hp_hw_control_from_firmware acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); dbg("Trying to get hotplug control for %s\n", (char *)string.pointer); - status = acpi_pci_osc_control_set(handle, flags); + status = acpi_pci_osc_control_set_safe(handle, flags); if (ACPI_SUCCESS(status)) goto got_one; if (status == AE_SUPPORT) Index: linux-2.6/include/linux/acpi.h =================================================================== --- linux-2.6.orig/include/linux/acpi.h +++ linux-2.6/include/linux/acpi.h @@ -307,6 +307,7 @@ acpi_status acpi_run_osc(acpi_handle han extern acpi_status acpi_pci_osc_control_query(acpi_handle handle, u32 *mask); extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags); +extern acpi_status acpi_pci_osc_control_set_safe(acpi_handle handle, u32 flags); extern void acpi_early_init(void); #else /* !CONFIG_ACPI */