ia64/xen-unstable

changeset 18809:876bffced2b8

x86, hpet: Avoud double initialisation on boot or after S3.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Nov 19 12:48:31 2008 +0000 (2008-11-19)
parents 9958ef441af0
children 2f8b0e14143c
files xen/arch/x86/acpi/power.c xen/arch/x86/hpet.c xen/include/asm-x86/acpi.h
line diff
     1.1 --- a/xen/arch/x86/acpi/power.c	Wed Nov 19 12:40:23 2008 +0000
     1.2 +++ b/xen/arch/x86/acpi/power.c	Wed Nov 19 12:48:31 2008 +0000
     1.3 @@ -30,6 +30,8 @@
     1.4  
     1.5  #include <acpi/cpufreq/cpufreq.h>
     1.6  
     1.7 +uint32_t system_reset_counter = 1;
     1.8 +
     1.9  static char opt_acpi_sleep[20];
    1.10  string_param("acpi_sleep", opt_acpi_sleep);
    1.11  
    1.12 @@ -163,6 +165,7 @@ static int enter_state(u32 state)
    1.13      {
    1.14      case ACPI_STATE_S3:
    1.15          do_suspend_lowlevel();
    1.16 +        system_reset_counter++;
    1.17          break;
    1.18      case ACPI_STATE_S5:
    1.19          acpi_enter_sleep_state(ACPI_STATE_S5);
     2.1 --- a/xen/arch/x86/hpet.c	Wed Nov 19 12:40:23 2008 +0000
     2.2 +++ b/xen/arch/x86/hpet.c	Wed Nov 19 12:48:31 2008 +0000
     2.3 @@ -264,12 +264,14 @@ int hpet_legacy_irq_tick(void)
     2.4  
     2.5  u64 hpet_setup(void)
     2.6  {
     2.7 -    u64 hpet_rate;
     2.8 +    static u64 hpet_rate;
     2.9 +    static u32 system_reset_latch;
    2.10      u32 hpet_id, hpet_period, cfg;
    2.11      int i;
    2.12  
    2.13 -    if ( hpet_address == 0 )
    2.14 -        return 0;
    2.15 +    if ( system_reset_latch == system_reset_counter )
    2.16 +        return hpet_rate;
    2.17 +    system_reset_latch = system_reset_counter;
    2.18  
    2.19      set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
    2.20  
     3.1 --- a/xen/include/asm-x86/acpi.h	Wed Nov 19 12:40:23 2008 +0000
     3.2 +++ b/xen/include/asm-x86/acpi.h	Wed Nov 19 12:48:31 2008 +0000
     3.3 @@ -166,4 +166,7 @@ extern u8 x86_acpiid_to_apicid[];
     3.4  
     3.5  extern int acpi_dmar_init(void);
     3.6  
     3.7 +/* Incremented whenever we transition through S3. Value is 1 during boot. */
     3.8 +extern uint32_t system_reset_counter;
     3.9 +
    3.10  #endif /*__X86_ASM_ACPI_H*/