From patchwork Wed Aug 31 18:31:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 1117512 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7VIXU6D000602 for ; Wed, 31 Aug 2011 18:33:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751538Ab1HaSdb (ORCPT ); Wed, 31 Aug 2011 14:33:31 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]:42950 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750889Ab1HaSda (ORCPT ); Wed, 31 Aug 2011 14:33:30 -0400 Received: from rtcsinet21.oracle.com (rtcsinet21.oracle.com [66.248.204.29]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p7VIVfQd023465 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 31 Aug 2011 18:31:43 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by rtcsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p7VIVcF0007987 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 31 Aug 2011 18:31:38 GMT Received: from abhmt103.oracle.com (abhmt103.oracle.com [141.146.116.55]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p7VIVVKQ017210; Wed, 31 Aug 2011 13:31:31 -0500 Received: from phenom (/209.6.55.207) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 31 Aug 2011 11:31:31 -0700 Received: by phenom (Postfix, from userid 1000) id 7D1AEEBD; Wed, 31 Aug 2011 14:31:29 -0400 (EDT) From: Konrad Rzeszutek Wilk To: x86@kernel.org, tglx@linutronix.de, tboot-devel@lists.sourceforge.net, shane.wang@intel.com, linux-pm@lists.linux-foundation.org, linux-acpi@vger.kernel.org, len.brown@intel.com, joseph.cihula@intel.com, hpa@zytor.com, ke.yu@intel.com, liang.tang@oracle.com, kevin.tian@intel.com, keir@xen.org Cc: xen-devel@lists.xensource.com, Konrad Rzeszutek Wilk Subject: [PATCH 3/7] x86/acpi/sleep: Provide registration for acpi_suspend_lowlevel. Date: Wed, 31 Aug 2011 14:31:20 -0400 Message-Id: <1314815484-4668-4-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1314815484-4668-1-git-send-email-konrad.wilk@oracle.com> References: <1314815484-4668-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: rtcsinet21.oracle.com [66.248.204.29] X-CT-RefId: str=0001.0A090205.4E5E7E13.0063,ss=1,re=0.000,fgs=0 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.6 (demeter1.kernel.org [140.211.167.41]); Wed, 31 Aug 2011 18:33:32 +0000 (UTC) From: Liang Tang Which by default will be x86_acpi_suspend_lowlevel. This registration allows us to register another callback if there is a need to use another platform specific callback. CC: Thomas Gleixner CC: "H. Peter Anvin" CC: x86@kernel.org CC: Len Brown CC: Joseph Cihula CC: Shane Wang CC: linux-pm@lists.linux-foundation.org CC: linux-acpi@vger.kernel.org CC: Len Brown Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Liang Tang --- arch/x86/include/asm/acpi.h | 2 +- arch/x86/kernel/acpi/boot.c | 2 ++ arch/x86/kernel/acpi/sleep.c | 4 ++-- arch/x86/kernel/acpi/sleep.h | 2 ++ drivers/acpi/sleep.c | 2 ++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index 49864a1..a5f0b73 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h @@ -118,7 +118,7 @@ static inline void acpi_disable_pci(void) } /* Low-level suspend routine. */ -extern int acpi_suspend_lowlevel(void); +extern int (*acpi_suspend_lowlevel)(void); extern const unsigned char acpi_wakeup_code[]; #define acpi_wakeup_address (__pa(TRAMPOLINE_SYM(acpi_wakeup_code))) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index d191b4c..92f4f38 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -44,6 +44,7 @@ #include #include +#include "sleep.h" /* To include x86_acpi_suspend_lowlevel */ static int __initdata acpi_force = 0; u32 acpi_rsdt_forced; int acpi_disabled; @@ -555,6 +556,7 @@ int (*__acpi_register_gsi)(struct device *dev, u32 gsi, int (*__acpi_override_sleep)(u8 sleep_state, u32 pm1a_ctrl, u32 pm1b_ctrl, bool *skip_rest) = NULL; +int (*acpi_suspend_lowlevel)(void) = x86_acpi_suspend_lowlevel; /* * success: return IRQ number (>=0) * failure: return < 0 diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index 103b6ab..4d2d0b1 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c @@ -25,12 +25,12 @@ static char temp_stack[4096]; #endif /** - * acpi_suspend_lowlevel - save kernel state + * x86_acpi_suspend_lowlevel - save kernel state * * Create an identity mapped page table and copy the wakeup routine to * low memory. */ -int acpi_suspend_lowlevel(void) +int x86_acpi_suspend_lowlevel(void) { struct wakeup_header *header; /* address in low memory of the wakeup routine. */ diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h index 416d4be..4d3feb5 100644 --- a/arch/x86/kernel/acpi/sleep.h +++ b/arch/x86/kernel/acpi/sleep.h @@ -13,3 +13,5 @@ extern unsigned long acpi_copy_wakeup_routine(unsigned long); extern void wakeup_long64(void); extern void do_suspend_lowlevel(void); + +extern int x86_acpi_suspend_lowlevel(void); diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 6c94960..a6da454 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -254,6 +254,8 @@ static int acpi_suspend_enter(suspend_state_t pm_state) break; case ACPI_STATE_S3: + if (!acpi_suspend_lowlevel) + return -ENODEV; error = acpi_suspend_lowlevel(); if (error) return error;