debuggers.hg

changeset 20874:0edb75cd8126

hvm: Add ACPI fixed sleep button

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jan 20 20:34:19 2010 +0000 (2010-01-20)
parents fad80160c001
children f300b53520d0
files tools/firmware/hvmloader/acpi/static_tables.c xen/arch/x86/domctl.c xen/arch/x86/hvm/pmtimer.c xen/include/public/domctl.h
line diff
     1.1 --- a/tools/firmware/hvmloader/acpi/static_tables.c	Wed Jan 20 20:33:35 2010 +0000
     1.2 +++ b/tools/firmware/hvmloader/acpi/static_tables.c	Wed Jan 20 20:34:19 2010 +0000
     1.3 @@ -68,7 +68,7 @@ struct acpi_20_fadt Fadt = {
     1.4      .p_lvl2_lat = 0x0fff, /* >100,  means we do not support C2 state */
     1.5      .p_lvl3_lat = 0x0fff, /* >1000, means we do not support C3 state */
     1.6      .iapc_boot_arch = ACPI_8042,
     1.7 -    .flags = (ACPI_PROC_C1 | ACPI_SLP_BUTTON |
     1.8 +    .flags = (ACPI_PROC_C1 |
     1.9                ACPI_WBINVD |
    1.10                ACPI_FIX_RTC | ACPI_TMR_VAL_EXT),
    1.11  
     2.1 --- a/xen/arch/x86/domctl.c	Wed Jan 20 20:33:35 2010 +0000
     2.2 +++ b/xen/arch/x86/domctl.c	Wed Jan 20 20:34:19 2010 +0000
     2.3 @@ -727,6 +727,19 @@ long arch_do_domctl(
     2.4          }
     2.5          break;
     2.6  
     2.7 +        case XEN_DOMCTL_SENDTRIGGER_SLEEP:
     2.8 +        {
     2.9 +            extern void hvm_acpi_sleep_button(struct domain *d);
    2.10 +
    2.11 +            ret = -EINVAL;
    2.12 +            if ( is_hvm_domain(d) ) 
    2.13 +            {
    2.14 +                ret = 0;
    2.15 +                hvm_acpi_sleep_button(d);
    2.16 +            }
    2.17 +        }
    2.18 +        break;
    2.19 +
    2.20          default:
    2.21              ret = -ENOSYS;
    2.22          }
     3.1 --- a/xen/arch/x86/hvm/pmtimer.c	Wed Jan 20 20:33:35 2010 +0000
     3.2 +++ b/xen/arch/x86/hvm/pmtimer.c	Wed Jan 20 20:34:19 2010 +0000
     3.3 @@ -32,14 +32,16 @@
     3.4  #define TMR_STS    (1 << 0)
     3.5  #define GBL_STS    (1 << 5)
     3.6  #define PWRBTN_STS (1 << 8)
     3.7 +#define SLPBTN_STS (1 << 9)
     3.8  
     3.9  /* The same in PM1a_EN */
    3.10  #define TMR_EN     (1 << 0)
    3.11  #define GBL_EN     (1 << 5)
    3.12  #define PWRBTN_EN  (1 << 8)
    3.13 +#define SLPBTN_EN  (1 << 9)
    3.14  
    3.15  /* Mask of bits in PM1a_STS that can generate an SCI. */
    3.16 -#define SCI_MASK (TMR_STS|PWRBTN_STS|GBL_STS) 
    3.17 +#define SCI_MASK (TMR_STS|PWRBTN_STS|SLPBTN_STS|GBL_STS) 
    3.18  
    3.19  /* SCI IRQ number (must match SCI_INT number in ACPI FADT in hvmloader) */
    3.20  #define SCI_IRQ 9
    3.21 @@ -68,6 +70,15 @@ void hvm_acpi_power_button(struct domain
    3.22      spin_unlock(&s->lock);
    3.23  }
    3.24  
    3.25 +void hvm_acpi_sleep_button(struct domain *d)
    3.26 +{
    3.27 +    PMTState *s = &d->arch.hvm_domain.pl_time.vpmt;
    3.28 +    spin_lock(&s->lock);
    3.29 +    s->pm.pm1a_sts |= SLPBTN_STS;
    3.30 +    pmt_update_sci(s);
    3.31 +    spin_unlock(&s->lock);
    3.32 +}
    3.33 +
    3.34  /* Set the correct value in the timer, accounting for time elapsed
    3.35   * since the last time we did that. */
    3.36  static void pmt_update_time(PMTState *s)
     4.1 --- a/xen/include/public/domctl.h	Wed Jan 20 20:33:35 2010 +0000
     4.2 +++ b/xen/include/public/domctl.h	Wed Jan 20 20:34:19 2010 +0000
     4.3 @@ -439,6 +439,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_
     4.4  #define XEN_DOMCTL_SENDTRIGGER_RESET  1
     4.5  #define XEN_DOMCTL_SENDTRIGGER_INIT   2
     4.6  #define XEN_DOMCTL_SENDTRIGGER_POWER  3
     4.7 +#define XEN_DOMCTL_SENDTRIGGER_SLEEP  4
     4.8  struct xen_domctl_sendtrigger {
     4.9      uint32_t  trigger;  /* IN */
    4.10      uint32_t  vcpu;     /* IN */