Back to home page

OSCL-LXR

 
 

    


0001 /******************************************************************************
0002  * acpi.h
0003  * acpi file for domain 0 kernel
0004  *
0005  * Copyright (c) 2011 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
0006  * Copyright (c) 2011 Yu Ke <ke.yu@intel.com>
0007  *
0008  * This program is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU General Public License version 2
0010  * as published by the Free Software Foundation; or, when distributed
0011  * separately from the Linux kernel or incorporated into other
0012  * software packages, subject to the following license:
0013  *
0014  * Permission is hereby granted, free of charge, to any person obtaining a copy
0015  * of this source file (the "Software"), to deal in the Software without
0016  * restriction, including without limitation the rights to use, copy, modify,
0017  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
0018  * and to permit persons to whom the Software is furnished to do so, subject to
0019  * the following conditions:
0020  *
0021  * The above copyright notice and this permission notice shall be included in
0022  * all copies or substantial portions of the Software.
0023  *
0024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0025  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0026  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0027  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0028  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0029  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
0030  * IN THE SOFTWARE.
0031  */
0032 
0033 #ifndef _XEN_ACPI_H
0034 #define _XEN_ACPI_H
0035 
0036 #include <linux/types.h>
0037 
0038 #ifdef CONFIG_XEN_DOM0
0039 #include <asm/xen/hypervisor.h>
0040 #include <xen/xen.h>
0041 #include <linux/acpi.h>
0042 
0043 int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
0044                      u32 pm1a_cnt, u32 pm1b_cnd);
0045 int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
0046                      u32 val_a, u32 val_b);
0047 
0048 static inline int xen_acpi_suspend_lowlevel(void)
0049 {
0050     /*
0051     * Xen will save and restore CPU context, so
0052     * we can skip that and just go straight to
0053     * the suspend.
0054     */
0055     acpi_enter_sleep_state(ACPI_STATE_S3);
0056     return 0;
0057 }
0058 
0059 static inline void xen_acpi_sleep_register(void)
0060 {
0061     if (xen_initial_domain()) {
0062         acpi_os_set_prepare_sleep(
0063             &xen_acpi_notify_hypervisor_sleep);
0064         acpi_os_set_prepare_extended_sleep(
0065             &xen_acpi_notify_hypervisor_extended_sleep);
0066 
0067         acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
0068     }
0069 }
0070 #else
0071 static inline void xen_acpi_sleep_register(void)
0072 {
0073 }
0074 #endif
0075 
0076 #endif  /* _XEN_ACPI_H */