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

[Xen-devel] [PATCH 2/2] 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>

--- 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))
@@ -701,7 +693,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;
--- 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)    \





_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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