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

[Xen-changelog] [xen-unstable] x86, hpet: Fix initialisation of secondary timers.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1227190550 0
# Node ID e3a0c3c9fd7b1d25e27397fd9c2e26d4d1a020a5
# Parent  368e072feb29003c57914facb23f62f9ce42757a
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@xxxxxxxxx>
---
 xen/arch/x86/hpet.c        |   10 +++++-----
 xen/include/asm-x86/hpet.h |    4 ++++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff -r 368e072feb29 -r e3a0c3c9fd7b xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Thu Nov 20 14:14:20 2008 +0000
+++ b/xen/arch/x86/hpet.c       Thu Nov 20 14:15:50 2008 +0000
@@ -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 )
-    {
-        printk("BAD HPET vendor id.\n");
+    if ( (hpet_id & HPET_ID_REV) == 0 )
+    {
+        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 -r 368e072feb29 -r e3a0c3c9fd7b xen/include/asm-x86/hpet.h
--- a/xen/include/asm-x86/hpet.h        Thu Nov 20 14:14:20 2008 +0000
+++ b/xen/include/asm-x86/hpet.h        Thu Nov 20 14:15:50 2008 +0000
@@ -23,6 +23,10 @@
 #define HPET_T2_CFG    0x140
 #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

_______________________________________________
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®.