WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 1 of 2] Add ACPI fixed sleep button for HVM

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1 of 2] Add ACPI fixed sleep button for HVM
From: Paul Durrant <paul.durrant@xxxxxxxxxx>
Date: Wed, 13 Jan 2010 10:16:11 +0000
Cc: paul.durrant@xxxxxxxxxx
Delivery-date: Wed, 13 Jan 2010 02:21:05 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1263377770@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Paul Durrant <paul.durrant@xxxxxxxxxx>
# Date 1263377694 0
# Node ID cdf348c11aba31171bdc838ffe3a457acab0f7de
# Parent  13d4e78ede977ee92c4a4adf78a92b31ec52c00e
Add ACPI fixed sleep button for HVM.

signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

diff -r 13d4e78ede97 -r cdf348c11aba 
tools/firmware/hvmloader/acpi/static_tables.c
--- a/tools/firmware/hvmloader/acpi/static_tables.c     Wed Jan 13 08:33:34 
2010 +0000
+++ b/tools/firmware/hvmloader/acpi/static_tables.c     Wed Jan 13 10:14:54 
2010 +0000
@@ -68,7 +68,7 @@
     .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 13d4e78ede97 -r cdf348c11aba xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c     Wed Jan 13 08:33:34 2010 +0000
+++ b/xen/arch/x86/domctl.c     Wed Jan 13 10:14:54 2010 +0000
@@ -723,6 +723,19 @@
             {
                 ret = 0;
                 hvm_acpi_power_button(d);
+            }
+        }
+        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;
diff -r 13d4e78ede97 -r cdf348c11aba xen/arch/x86/hvm/pmtimer.c
--- a/xen/arch/x86/hvm/pmtimer.c        Wed Jan 13 08:33:34 2010 +0000
+++ b/xen/arch/x86/hvm/pmtimer.c        Wed Jan 13 10:14:54 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 @@
     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 13d4e78ede97 -r cdf348c11aba xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Wed Jan 13 08:33:34 2010 +0000
+++ b/xen/include/public/domctl.h       Wed Jan 13 10:14:54 2010 +0000
@@ -439,6 +439,7 @@
 #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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel