From 081c4d400db24790b43ce344e6b5449b0800c253 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Tue, 8 Oct 2013 11:09:22 +0200 Subject: x86/HPET: basic cleanup * Strip trailing whitespace * Remove redundant definitions * Update stale documentation links * Move hpet_address into __initdata Signed-off-by: Andrew Cooper --- xen/arch/x86/hpet.c | 6 +++--- xen/arch/x86/hvm/hpet.c | 18 +++++++++--------- xen/include/asm-x86/hpet.h | 6 ++---- 3 files changed, 14 insertions(+), 16 deletions(-) (limited to 'xen') diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index 7e0d3325fd..99882b1e5a 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -1,6 +1,6 @@ /****************************************************************************** * arch/x86/hpet.c - * + * * HPET management. */ @@ -50,7 +50,7 @@ static unsigned int __read_mostly num_hpets_used; DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel); -unsigned long __read_mostly hpet_address; +unsigned long __initdata hpet_address; u8 __initdata hpet_blockid; /* @@ -540,7 +540,7 @@ static void handle_rtc_once(uint8_t index, uint8_t value) { if ( index != RTC_REG_B ) return; - + /* RTC Reg B, contain PIE/AIE/UIE */ if ( value & (RTC_PIE | RTC_AIE | RTC_UIE ) ) { diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c index 4b4b905095..4324b52108 100644 --- a/xen/arch/x86/hvm/hpet.c +++ b/xen/arch/x86/hvm/hpet.c @@ -47,7 +47,7 @@ /* can be routed to IOAPIC.redirect_table[23..20] */ #define HPET_TN_INT_ROUTE_CAP (0x00f00000ULL \ - << HPET_TN_INT_ROUTE_CAP_SHIFT) + << HPET_TN_INT_ROUTE_CAP_SHIFT) #define HPET_TN_INT_ROUTE_CAP_MASK (0xffffffffULL \ << HPET_TN_INT_ROUTE_CAP_SHIFT) @@ -79,7 +79,7 @@ static inline uint64_t hpet_read_maincounter(HPETState *h) if ( hpet_enabled(h) ) return guest_time_hpet(h) + h->mc_offset; - else + else return h->hpet.mc64; } @@ -100,7 +100,7 @@ static uint64_t hpet_get_comparator(HPETState *h, unsigned int tn) h->hpet.comparator64[tn] = comparator; } } - + /* truncate if timer is in 32 bit mode */ if ( timer_is_32bit(h, tn) ) comparator = (uint32_t)comparator; @@ -249,7 +249,7 @@ static void hpet_set_timer(HPETState *h, unsigned int tn) irq = timer_int_route(h, tn); /* - * diff is the time from now when the timer should fire, for a periodic + * diff is the time from now when the timer should fire, for a periodic * timer we also need the period which may be different because time may * have elapsed between the time the comparator was written and the timer * being enabled (now). @@ -331,7 +331,7 @@ static int hpet_write( h->hpet.mc64 = new_val; if ( hpet_enabled(h) ) { - gdprintk(XENLOG_WARNING, + gdprintk(XENLOG_WARNING, "HPET: writing main counter but it's not halted!\n"); for ( i = 0; i < HPET_TIMER_NUM; i++ ) if ( timer_enabled(h, i) ) @@ -396,7 +396,7 @@ static int hpet_write( * timer's accumulator." That is, set the comparator without * adjusting the period. Much the same as just setting the * comparator on an enabled one-shot timer. - * + * * This configuration bit clears when the comparator is written. */ h->hpet.timers[tn].config &= ~HPET_TN_SETVAL; @@ -553,7 +553,7 @@ static int hpet_load(struct domain *d, hvm_domain_context_t *h) hp->hpet.timers[i].cmp = cmp; } #undef C - + /* Recalculate the offset between the main counter and guest time */ hp->mc_offset = hp->hpet.mc64 - guest_time_hpet(hp); @@ -563,7 +563,7 @@ static int hpet_load(struct domain *d, hvm_domain_context_t *h) for ( i = 0; i < HPET_TIMER_NUM; i++ ) if ( timer_enabled(hp, i) ) hpet_set_timer(hp, i); - + spin_unlock(&hp->lock); return 0; @@ -595,7 +595,7 @@ void hpet_init(struct vcpu *v) for ( i = 0; i < HPET_TIMER_NUM; i++ ) { - h->hpet.timers[i].config = + h->hpet.timers[i].config = HPET_TN_INT_ROUTE_CAP | HPET_TN_64BIT_CAP | HPET_TN_PERIODIC_CAP; h->hpet.timers[i].cmp = ~0ULL; h->pt[i].source = PTSRC_isa; diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h index 98c123700c..875f1de42a 100644 --- a/xen/include/asm-x86/hpet.h +++ b/xen/include/asm-x86/hpet.h @@ -3,8 +3,8 @@ /* * Documentation on HPET can be found at: - * http://www.intel.com/ial/home/sp/pcmmspec.htm - * ftp://download.intel.com/ial/home/sp/mmts098.pdf + * http://www.intel.com/content/dam/www/public/us/en/documents/ + * technical-specifications/software-developers-hpet-spec-1-0a.pdf */ #define HPET_MMAP_SIZE 1024 @@ -24,9 +24,7 @@ #define HPET_ID_NUMBER 0x00001f00 #define HPET_ID_REV 0x000000ff #define HPET_ID_NUMBER_SHIFT 8 - #define HPET_ID_VENDOR_SHIFT 16 -#define HPET_ID_VENDOR_8086 0x8086 #define HPET_CFG_ENABLE 0x001 #define HPET_CFG_LEGACY 0x002 -- cgit v1.2.3