[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hvm: Add ACPI fixed sleep button



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1264019659 0
# Node ID 0edb75cd8126b9a463c829a763aafd1a5af1bb40
# Parent  fad80160c0012182006eb80ae55532ab09630db0
hvm: Add ACPI fixed sleep button

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 tools/firmware/hvmloader/acpi/static_tables.c |    2 +-
 xen/arch/x86/domctl.c                         |   13 +++++++++++++
 xen/arch/x86/hvm/pmtimer.c                    |   13 ++++++++++++-
 xen/include/public/domctl.h                   |    1 +
 4 files changed, 27 insertions(+), 2 deletions(-)

diff -r fad80160c001 -r 0edb75cd8126 
tools/firmware/hvmloader/acpi/static_tables.c
--- a/tools/firmware/hvmloader/acpi/static_tables.c     Wed Jan 20 20:33:35 
2010 +0000
+++ b/tools/firmware/hvmloader/acpi/static_tables.c     Wed Jan 20 20:34:19 
2010 +0000
@@ -68,7 +68,7 @@ struct acpi_20_fadt Fadt = {
     .p_lvl2_lat = 0x0fff, /* >100,  means we do not support C2 state */
     .p_lvl3_lat = 0x0fff, /* >1000, means we do not support C3 state */
     .iapc_boot_arch = ACPI_8042,
-    .flags = (ACPI_PROC_C1 | ACPI_SLP_BUTTON |
+    .flags = (ACPI_PROC_C1 |
               ACPI_WBINVD |
               ACPI_FIX_RTC | ACPI_TMR_VAL_EXT),
 
diff -r fad80160c001 -r 0edb75cd8126 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c     Wed Jan 20 20:33:35 2010 +0000
+++ b/xen/arch/x86/domctl.c     Wed Jan 20 20:34:19 2010 +0000
@@ -727,6 +727,19 @@ long arch_do_domctl(
         }
         break;
 
+        case XEN_DOMCTL_SENDTRIGGER_SLEEP:
+        {
+            extern void hvm_acpi_sleep_button(struct domain *d);
+
+            ret = -EINVAL;
+            if ( is_hvm_domain(d) ) 
+            {
+                ret = 0;
+                hvm_acpi_sleep_button(d);
+            }
+        }
+        break;
+
         default:
             ret = -ENOSYS;
         }
diff -r fad80160c001 -r 0edb75cd8126 xen/arch/x86/hvm/pmtimer.c
--- a/xen/arch/x86/hvm/pmtimer.c        Wed Jan 20 20:33:35 2010 +0000
+++ b/xen/arch/x86/hvm/pmtimer.c        Wed Jan 20 20:34:19 2010 +0000
@@ -32,14 +32,16 @@
 #define TMR_STS    (1 << 0)
 #define GBL_STS    (1 << 5)
 #define PWRBTN_STS (1 << 8)
+#define SLPBTN_STS (1 << 9)
 
 /* The same in PM1a_EN */
 #define TMR_EN     (1 << 0)
 #define GBL_EN     (1 << 5)
 #define PWRBTN_EN  (1 << 8)
+#define SLPBTN_EN  (1 << 9)
 
 /* Mask of bits in PM1a_STS that can generate an SCI. */
-#define SCI_MASK (TMR_STS|PWRBTN_STS|GBL_STS) 
+#define SCI_MASK (TMR_STS|PWRBTN_STS|SLPBTN_STS|GBL_STS) 
 
 /* SCI IRQ number (must match SCI_INT number in ACPI FADT in hvmloader) */
 #define SCI_IRQ 9
@@ -64,6 +66,15 @@ void hvm_acpi_power_button(struct domain
     PMTState *s = &d->arch.hvm_domain.pl_time.vpmt;
     spin_lock(&s->lock);
     s->pm.pm1a_sts |= PWRBTN_STS;
+    pmt_update_sci(s);
+    spin_unlock(&s->lock);
+}
+
+void hvm_acpi_sleep_button(struct domain *d)
+{
+    PMTState *s = &d->arch.hvm_domain.pl_time.vpmt;
+    spin_lock(&s->lock);
+    s->pm.pm1a_sts |= SLPBTN_STS;
     pmt_update_sci(s);
     spin_unlock(&s->lock);
 }
diff -r fad80160c001 -r 0edb75cd8126 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Wed Jan 20 20:33:35 2010 +0000
+++ b/xen/include/public/domctl.h       Wed Jan 20 20:34:19 2010 +0000
@@ -439,6 +439,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_
 #define XEN_DOMCTL_SENDTRIGGER_RESET  1
 #define XEN_DOMCTL_SENDTRIGGER_INIT   2
 #define XEN_DOMCTL_SENDTRIGGER_POWER  3
+#define XEN_DOMCTL_SENDTRIGGER_SLEEP  4
 struct xen_domctl_sendtrigger {
     uint32_t  trigger;  /* IN */
     uint32_t  vcpu;     /* IN */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.