diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-11-20 14:15:50 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-11-20 14:15:50 +0000 |
commit | 9e70091fd71e108c5cb3cf89fa677030b088a0a8 (patch) | |
tree | 7bd1e37310ce8f3e6b60ad9795b38148d5b12f5e | |
parent | c014d5785e7796bfd9bb7cd37de05b41c272f60b (diff) | |
download | xen-9e70091fd71e108c5cb3cf89fa677030b088a0a8.tar.gz xen-9e70091fd71e108c5cb3cf89fa677030b088a0a8.tar.bz2 xen-9e70091fd71e108c5cb3cf89fa677030b088a0a8.zip |
x86, hpet: Fix initialisation of secondary timers.
Each channel may have different settings, and in the original
implementation, other Tn configuration will accidently overwrite T0
configuration.
Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
-rw-r--r-- | xen/arch/x86/hpet.c | 8 | ||||
-rw-r--r-- | xen/include/asm-x86/hpet.h | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index e72e8f94e4..d5e84f4ccd 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -276,9 +276,9 @@ u64 hpet_setup(void) set_fixmap_nocache(FIX_HPET_BASE, hpet_address); hpet_id = hpet_read32(HPET_ID); - if ( hpet_id == 0 ) + if ( (hpet_id & HPET_ID_REV) == 0 ) { - printk("BAD HPET vendor id.\n"); + printk("BAD HPET revision id.\n"); return 0; } @@ -296,9 +296,9 @@ u64 hpet_setup(void) for ( i = 0; i <= ((hpet_id >> 8) & 31); i++ ) { - cfg = hpet_read32(HPET_T0_CFG + i*0x20); + cfg = hpet_read32(HPET_Tn_CFG(i)); cfg &= ~HPET_TN_ENABLE; - hpet_write32(cfg & ~HPET_TN_ENABLE, HPET_T0_CFG); + hpet_write32(cfg, HPET_Tn_CFG(i)); } cfg = hpet_read32(HPET_CFG); diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h index b63f56805d..82c08bc3c5 100644 --- a/xen/include/asm-x86/hpet.h +++ b/xen/include/asm-x86/hpet.h @@ -24,6 +24,10 @@ #define HPET_T2_CMP 0x148 #define HPET_T2_ROUTE 0x150 +#define HPET_Tn_CFG(n) (HPET_T0_CFG + n * 0x20) +#define HPET_Tn_CMP(n) (HPET_T0_CMP + n * 0x20) +#define HPET_Tn_ROUTE(n) (HPET_T0_ROUTE + n * 0x20) + #define HPET_ID_VENDOR 0xffff0000 #define HPET_ID_LEGSUP 0x00008000 #define HPET_ID_NUMBER 0x00001f00 |