![]() |
|
|||
0001 /****************************************************************************** 0002 * acpi.c 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 #include <xen/acpi.h> 0034 #include <xen/interface/platform.h> 0035 #include <asm/xen/hypercall.h> 0036 #include <asm/xen/hypervisor.h> 0037 0038 static int xen_acpi_notify_hypervisor_state(u8 sleep_state, 0039 u32 val_a, u32 val_b, 0040 bool extended) 0041 { 0042 unsigned int bits = extended ? 8 : 16; 0043 0044 struct xen_platform_op op = { 0045 .cmd = XENPF_enter_acpi_sleep, 0046 .interface_version = XENPF_INTERFACE_VERSION, 0047 .u.enter_acpi_sleep = { 0048 .val_a = (u16)val_a, 0049 .val_b = (u16)val_b, 0050 .sleep_state = sleep_state, 0051 .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0, 0052 }, 0053 }; 0054 0055 if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)), 0056 "Using more than %u bits of sleep control values %#x/%#x!" 0057 "Email xen-devel@lists.xen.org - Thank you.\n", \ 0058 bits, val_a, val_b)) 0059 return -1; 0060 0061 HYPERVISOR_platform_op(&op); 0062 return 1; 0063 } 0064 0065 int xen_acpi_notify_hypervisor_sleep(u8 sleep_state, 0066 u32 pm1a_cnt, u32 pm1b_cnt) 0067 { 0068 return xen_acpi_notify_hypervisor_state(sleep_state, pm1a_cnt, 0069 pm1b_cnt, false); 0070 } 0071 0072 int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state, 0073 u32 val_a, u32 val_b) 0074 { 0075 return xen_acpi_notify_hypervisor_state(sleep_state, val_a, 0076 val_b, true); 0077 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |