[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86, hpet: Avoud double initialisation on boot or after S3.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1227098911 0
# Node ID 876bffced2b8d9102bcba20d154f72ffbdeb7ac5
# Parent  9958ef441af035913f5c595350c5dfe1196f206b
x86, hpet: Avoud double initialisation on boot or after S3.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/acpi/power.c  |    3 +++
 xen/arch/x86/hpet.c        |    8 +++++---
 xen/include/asm-x86/acpi.h |    3 +++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff -r 9958ef441af0 -r 876bffced2b8 xen/arch/x86/acpi/power.c
--- a/xen/arch/x86/acpi/power.c Wed Nov 19 12:40:23 2008 +0000
+++ b/xen/arch/x86/acpi/power.c Wed Nov 19 12:48:31 2008 +0000
@@ -30,6 +30,8 @@
 
 #include <acpi/cpufreq/cpufreq.h>
 
+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 -r 9958ef441af0 -r 876bffced2b8 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Wed Nov 19 12:40:23 2008 +0000
+++ b/xen/arch/x86/hpet.c       Wed Nov 19 12:48:31 2008 +0000
@@ -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 -r 9958ef441af0 -r 876bffced2b8 xen/include/asm-x86/acpi.h
--- a/xen/include/asm-x86/acpi.h        Wed Nov 19 12:40:23 2008 +0000
+++ b/xen/include/asm-x86/acpi.h        Wed Nov 19 12:48:31 2008 +0000
@@ -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*/

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.