ia64/xen-unstable

changeset 15632:ae672309bb95

Xen PM: Enter all ACPI S states on boot CPU.
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Jul 20 10:38:51 2007 +0100 (2007-07-20)
parents bb5c23bbc7b7
children 8e2d43396306
files xen/arch/x86/acpi/power.c
line diff
     1.1 --- a/xen/arch/x86/acpi/power.c	Fri Jul 20 09:38:27 2007 +0100
     1.2 +++ b/xen/arch/x86/acpi/power.c	Fri Jul 20 10:38:51 2007 +0100
     1.3 @@ -124,7 +124,7 @@ static int enter_state(u32 state)
     1.4  
     1.5      if ( !spin_trylock(&pm_lock) )
     1.6          return -EBUSY;
     1.7 -    
     1.8 +
     1.9      pmprintk(XENLOG_INFO, "PM: Preparing system for %s sleep\n",
    1.10          acpi_states[state]);
    1.11  
    1.12 @@ -153,12 +153,15 @@ static int enter_state(u32 state)
    1.13  
    1.14      switch ( state )
    1.15      {
    1.16 -        case ACPI_STATE_S3:
    1.17 -            do_suspend_lowlevel();
    1.18 -            break;
    1.19 -        default:
    1.20 -            error = -EINVAL;
    1.21 -            break;
    1.22 +    case ACPI_STATE_S3:
    1.23 +        do_suspend_lowlevel();
    1.24 +        break;
    1.25 +    case ACPI_STATE_S5:
    1.26 +        acpi_enter_sleep_state(ACPI_STATE_S5);
    1.27 +        break;
    1.28 +    default:
    1.29 +        error = -EINVAL;
    1.30 +        break;
    1.31      }
    1.32  
    1.33      pmprintk(XENLOG_INFO, "Back to C!\n");
    1.34 @@ -183,14 +186,6 @@ static int enter_state(u32 state)
    1.35      return error;
    1.36  }
    1.37  
    1.38 -static void acpi_power_off(void)
    1.39 -{
    1.40 -    pmprintk(XENLOG_INFO, "%s called\n", __FUNCTION__);
    1.41 -    local_irq_disable();
    1.42 -    /* Some SMP machines only can poweroff in boot CPU */
    1.43 -    acpi_enter_sleep_state(ACPI_STATE_S5);
    1.44 -}
    1.45 -
    1.46  static long enter_state_helper(void *data)
    1.47  {
    1.48      struct acpi_sleep_info *sinfo = (struct acpi_sleep_info *)data;
    1.49 @@ -227,7 +222,7 @@ int acpi_enter_sleep(struct xenpf_enter_
    1.50      if ( !(sleep->pm1a_cnt_val & ACPI_BITMASK_SLEEP_ENABLE) )
    1.51      {
    1.52          outw((u16)sleep->pm1a_cnt_val, acpi_sinfo.pm1a_cnt);
    1.53 -        if (acpi_sinfo.pm1b_cnt)
    1.54 +        if ( acpi_sinfo.pm1b_cnt )
    1.55              outw((u16)sleep->pm1b_cnt_val, acpi_sinfo.pm1b_cnt);
    1.56          return 0;
    1.57      }
    1.58 @@ -237,13 +232,6 @@ int acpi_enter_sleep(struct xenpf_enter_
    1.59      acpi_sinfo.pm1b_cnt_val = sleep->pm1b_cnt_val;
    1.60      acpi_sinfo.sleep_state = sleep->sleep_state;
    1.61  
    1.62 -    /* ACPI power-off method. */
    1.63 -    if ( acpi_sinfo.sleep_state == ACPI_STATE_S5 )
    1.64 -    {
    1.65 -        for ( ; ; )
    1.66 -            acpi_power_off();
    1.67 -    }
    1.68 -
    1.69      return continue_hypercall_on_cpu(0, enter_state_helper, &acpi_sinfo);
    1.70  }
    1.71