x86/hpet: clear unwanted bits
authorJan Beulich <jbeulich@suse.com>
Tue, 27 Mar 2012 13:23:43 +0000 (15:23 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 27 Mar 2012 13:23:43 +0000 (15:23 +0200)
Leaving certain bits set when being started from an environment where
the HPET was already in use can affect functionality. Clear those bits
to be on the safe side.

We should also consider ignoring the HPET altogether if any reserved
bits are found to be set.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/hpet.c
xen/include/asm-x86/hpet.h

index 71f0b815f4996f4cc77087d14bd86b5a4d8da4f4..7394f7456fb9588d19d2d4516b8daf9f1b27f1f6 100644 (file)
@@ -533,7 +533,7 @@ void __init hpet_broadcast_init(void)
     {
         /* set HPET Tn as oneshot */
         cfg = hpet_read32(HPET_Tn_CFG(hpet_events[i].idx));
-        cfg &= ~HPET_TN_PERIODIC;
+        cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC | HPET_TN_FSB);
         cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
         hpet_write32(cfg, HPET_Tn_CFG(hpet_events[i].idx));
 
@@ -590,7 +590,7 @@ void hpet_broadcast_resume(void)
 
         /* set HPET Tn as oneshot */
         cfg = hpet_read32(HPET_Tn_CFG(hpet_events[i].idx));
-        cfg &= ~HPET_TN_PERIODIC;
+        cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC | HPET_TN_FSB);
         cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
         hpet_write32(cfg, HPET_Tn_CFG(hpet_events[i].idx));
 
index bb2c4b4af8587104fe15e35647df69289be3da3c..c6a08c1cbaa9536589118298144f3a8ea87fa018 100644 (file)
 #define        HPET_LEGACY_8254        2
 #define        HPET_LEGACY_RTC         8
 
+#define HPET_TN_LEVEL          0x002
 #define HPET_TN_ENABLE         0x004
 #define HPET_TN_PERIODIC       0x008
 #define HPET_TN_PERIODIC_CAP   0x010
+#define HPET_TN_64BIT_CAP      0x020
 #define HPET_TN_SETVAL         0x040
 #define HPET_TN_32BIT          0x100
 #define HPET_TN_ROUTE          0x3e00