ia64/xen-unstable

changeset 13231:a578c9703416

[HVM] Minor HPET fixes/ and cleanups.
In particular, the definition of HPET_TN_SIZE_CAP is wrong.

From: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@localhost.localdomain
date Sat Dec 30 12:49:31 2006 +0000 (2006-12-30)
parents 444315d1ca5a
children 63fb88610e1e
files xen/arch/x86/hvm/hpet.c
line diff
     1.1 --- a/xen/arch/x86/hvm/hpet.c	Fri Dec 29 20:17:01 2006 +0000
     1.2 +++ b/xen/arch/x86/hvm/hpet.c	Sat Dec 30 12:49:31 2006 +0000
     1.3 @@ -52,9 +52,9 @@
     1.4  #define HPET_TN_ENABLE           0x004
     1.5  #define HPET_TN_PERIODIC         0x008
     1.6  #define HPET_TN_PERIODIC_CAP     0x010
     1.7 +#define HPET_TN_SIZE_CAP         0x020
     1.8  #define HPET_TN_SETVAL           0x040
     1.9  #define HPET_TN_32BIT            0x100
    1.10 -#define HPET_TN_SIZE_CAP         0x200
    1.11  #define HPET_TN_INT_ROUTE_MASK  0x3e00
    1.12  #define HPET_TN_INT_ROUTE_SHIFT      9
    1.13  #define HPET_TN_INT_ROUTE_CAP_SHIFT 32
    1.14 @@ -91,7 +91,8 @@ static inline uint64_t hpet_read64(HPETS
    1.15      return (addr >= HPET_T3_CFG) ? 0 : *p;
    1.16  }
    1.17  
    1.18 -static int hpet_check_access_length(unsigned long addr, unsigned long len)
    1.19 +static inline int hpet_check_access_length(
    1.20 +    unsigned long addr, unsigned long len)
    1.21  {
    1.22      if ( (addr & (len - 1)) || (len > 8) )
    1.23      {
    1.24 @@ -104,7 +105,7 @@ static int hpet_check_access_length(unsi
    1.25      return 0;
    1.26  }
    1.27  
    1.28 -static uint64_t hpet_update_maincounter(HPETState *h)
    1.29 +static inline uint64_t hpet_read_maincounter(HPETState *h)
    1.30  {
    1.31      if ( hpet_enabled(h) )
    1.32          return hvm_get_guest_time(h->vcpu) + h->mc_offset;
    1.33 @@ -126,7 +127,7 @@ static unsigned long hpet_read(
    1.34  
    1.35      val = hpet_read64(h, addr & ~7);
    1.36      if ( (addr & ~7) == HPET_COUNTER )
    1.37 -        val = hpet_update_maincounter(h);
    1.38 +        val = hpet_read_maincounter(h);
    1.39  
    1.40      result = val;
    1.41      if ( length != 8 )
    1.42 @@ -159,7 +160,7 @@ static void hpet_set_timer(HPETState *h,
    1.43      }
    1.44  
    1.45      tn_cmp   = h->hpet.timers[tn].cmp;
    1.46 -    cur_tick = hpet_update_maincounter(h);
    1.47 +    cur_tick = hpet_read_maincounter(h);
    1.48      if ( timer_is_32bit(h, tn) )
    1.49      {
    1.50          tn_cmp   = (uint32_t)tn_cmp;
    1.51 @@ -173,7 +174,8 @@ static void hpet_set_timer(HPETState *h,
    1.52          set_timer(&h->timers[tn], NOW());
    1.53  }
    1.54  
    1.55 -static uint64_t hpet_fixup_reg(uint64_t new, uint64_t old, uint64_t mask)
    1.56 +static inline uint64_t hpet_fixup_reg(
    1.57 +    uint64_t new, uint64_t old, uint64_t mask)
    1.58  {
    1.59      new &= mask;
    1.60      new |= old & ~mask;
    1.61 @@ -195,7 +197,7 @@ static void hpet_write(
    1.62  
    1.63      old_val = hpet_read64(h, addr & ~7);
    1.64      if ( (addr & ~7) == HPET_COUNTER )
    1.65 -        old_val = hpet_update_maincounter(h);
    1.66 +        old_val = hpet_read_maincounter(h);
    1.67  
    1.68      new_val = val;
    1.69      if ( length != 8 )
    1.70 @@ -340,7 +342,7 @@ static void hpet_timer_fn(void *opaque)
    1.71  
    1.72      if ( timer_is_periodic(h, tn) && (h->period[tn] != 0) )
    1.73      {
    1.74 -        uint64_t mc = hpet_update_maincounter(h);
    1.75 +        uint64_t mc = hpet_read_maincounter(h);
    1.76          if ( timer_is_32bit(h, tn) )
    1.77          {
    1.78              while ( hpet_time_after(mc, h->hpet.timers[tn].cmp) )