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

[Xen-changelog] [xen master] x86/HPET: adjustments to constants and their use



commit 82237773dc13b81ea548943f3416c66abeb0ab2e
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jul 18 10:38:03 2018 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jul 18 10:38:03 2018 +0200

    x86/HPET: adjustments to constants and their use
    
    Drop HPET_TN_ROUTE_SHIFT as redundant with HPET_TN_ROUTE.
    
    Introduce HPET_TN_INT_ROUTE_CAP paralleling the other HPET_TN_*_CAP
    constants, making it necessary to rename the such named constant in
    hvm/hpet.c. Use MASK_EXTR() / MASK_INSR() instead of kind of open-
    coding them.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hpet.c    | 18 +++++-------------
 xen/include/asm-x86/hpet.h |  2 +-
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index 51407d5383..171afe9ac2 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -41,14 +41,8 @@
 #define guest_time_hpet(hpet) \
     (hvm_get_guest_time(vhpet_vcpu(hpet)) / STIME_PER_HPET_TICK)
 
-#define HPET_TN_INT_ROUTE_CAP_SHIFT 32
-
 /* can be routed to IOAPIC.redirect_table[23..20] */
-#define HPET_TN_INT_ROUTE_CAP      (0x00f00000ULL \
-                    << HPET_TN_INT_ROUTE_CAP_SHIFT)
-
-#define HPET_TN_INT_ROUTE_CAP_MASK (0xffffffffULL \
-                    << HPET_TN_INT_ROUTE_CAP_SHIFT)
+#define HPET_TN_INT_ROUTE_CAP_VAL MASK_INSR(0x00f00000, HPET_TN_INT_ROUTE_CAP)
 
 #define HPET_TN(reg, addr) (((addr) - HPET_Tn_##reg(0)) / \
                             (HPET_Tn_##reg(1) - HPET_Tn_##reg(0)))
@@ -64,12 +58,10 @@
 #define hpet_enabled(h)          (h->hpet.config & HPET_CFG_ENABLE)
 #define timer_level(h, n)        (timer_config(h, n) & HPET_TN_LEVEL)
 
-#define timer_int_route(h, n)   \
-    ((timer_config(h, n) & HPET_TN_ROUTE) >> HPET_TN_ROUTE_SHIFT)
+#define timer_int_route(h, n)    MASK_EXTR(timer_config(h, n), HPET_TN_ROUTE)
 
-#define timer_int_route_cap(h, n)   \
-    ((timer_config(h, n) & HPET_TN_INT_ROUTE_CAP_MASK) \
-        >> HPET_TN_INT_ROUTE_CAP_SHIFT)
+#define timer_int_route_cap(h, n) \
+    MASK_EXTR(timer_config(h, n), HPET_TN_INT_ROUTE_CAP)
 
 #define timer_int_route_valid(h, n) \
     ((1u << timer_int_route(h, n)) & timer_int_route_cap(h, n))
@@ -699,7 +691,7 @@ static void hpet_set(HPETState *h)
     for ( i = 0; i < HPET_TIMER_NUM; i++ )
     {
         h->hpet.timers[i].config =
-            HPET_TN_INT_ROUTE_CAP | HPET_TN_64BIT_CAP | HPET_TN_PERIODIC_CAP;
+            HPET_TN_INT_ROUTE_CAP_VAL | HPET_TN_64BIT_CAP | 
HPET_TN_PERIODIC_CAP;
         h->hpet.timers[i].cmp = ~0ULL;
         h->hpet.comparator64[i] = ~0ULL;
         h->pt[i].source = PTSRC_isa;
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index 10c4a5694d..fb6bf05065 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -42,7 +42,7 @@
 #define HPET_TN_FSB            0x4000
 #define HPET_TN_FSB_CAP                0x8000
 #define HPET_TN_RESERVED       0xffff0081
-#define HPET_TN_ROUTE_SHIFT    9
+#define HPET_TN_INT_ROUTE_CAP  (0xffffffffULL << 32)
 
 
 #define hpet_read32(x)    \
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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