From: Keir Fraser Date: Wed, 19 Nov 2008 12:48:31 +0000 (+0000) Subject: x86, hpet: Avoud double initialisation on boot or after S3. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14043^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f8b45adac4aae896f3c70665aa0667c726e94ab3;p=xen.git x86, hpet: Avoud double initialisation on boot or after S3. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index 7e96bfc796..2eb6860070 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -30,6 +30,8 @@ #include +uint32_t system_reset_counter = 1; + static char opt_acpi_sleep[20]; string_param("acpi_sleep", opt_acpi_sleep); @@ -163,6 +165,7 @@ static int enter_state(u32 state) { case ACPI_STATE_S3: do_suspend_lowlevel(); + system_reset_counter++; break; case ACPI_STATE_S5: acpi_enter_sleep_state(ACPI_STATE_S5); diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index 5c2bc02885..e72e8f94e4 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -264,12 +264,14 @@ int hpet_legacy_irq_tick(void) u64 hpet_setup(void) { - u64 hpet_rate; + static u64 hpet_rate; + static u32 system_reset_latch; u32 hpet_id, hpet_period, cfg; int i; - if ( hpet_address == 0 ) - return 0; + if ( system_reset_latch == system_reset_counter ) + return hpet_rate; + system_reset_latch = system_reset_counter; set_fixmap_nocache(FIX_HPET_BASE, hpet_address); diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h index 5ae806faa9..459978e491 100644 --- a/xen/include/asm-x86/acpi.h +++ b/xen/include/asm-x86/acpi.h @@ -166,4 +166,7 @@ extern u8 x86_acpiid_to_apicid[]; extern int acpi_dmar_init(void); +/* Incremented whenever we transition through S3. Value is 1 during boot. */ +extern uint32_t system_reset_counter; + #endif /*__X86_ASM_ACPI_H*/