This source file includes following definitions.
- xen_acpi_notify_hypervisor_state
- xen_acpi_notify_hypervisor_sleep
- xen_acpi_notify_hypervisor_extended_sleep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 #include <xen/acpi.h>
34 #include <xen/interface/platform.h>
35 #include <asm/xen/hypercall.h>
36 #include <asm/xen/hypervisor.h>
37
38 static int xen_acpi_notify_hypervisor_state(u8 sleep_state,
39 u32 val_a, u32 val_b,
40 bool extended)
41 {
42 unsigned int bits = extended ? 8 : 16;
43
44 struct xen_platform_op op = {
45 .cmd = XENPF_enter_acpi_sleep,
46 .interface_version = XENPF_INTERFACE_VERSION,
47 .u.enter_acpi_sleep = {
48 .val_a = (u16)val_a,
49 .val_b = (u16)val_b,
50 .sleep_state = sleep_state,
51 .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
52 },
53 };
54
55 if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
56 "Using more than %u bits of sleep control values %#x/%#x!"
57 "Email xen-devel@lists.xen.org - Thank you.\n", \
58 bits, val_a, val_b))
59 return -1;
60
61 HYPERVISOR_platform_op(&op);
62 return 1;
63 }
64
65 int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
66 u32 pm1a_cnt, u32 pm1b_cnt)
67 {
68 return xen_acpi_notify_hypervisor_state(sleep_state, pm1a_cnt,
69 pm1b_cnt, false);
70 }
71
72 int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
73 u32 val_a, u32 val_b)
74 {
75 return xen_acpi_notify_hypervisor_state(sleep_state, val_a,
76 val_b, true);
77 }