@@ -67,6 +67,7 @@ static int notsc __initdata = 0;
6767
6868unsigned int cpu_khz ; /* TSC clocks / usec, not used here */
6969EXPORT_SYMBOL (cpu_khz );
70+ unsigned long hpet_address ;
7071static unsigned long hpet_period ; /* fsecs / HPET clock */
7172unsigned long hpet_tick ; /* HPET clocks / interrupt */
7273int hpet_use_timer ; /* Use counter of hpet for time keeping, otherwise PIT */
@@ -316,14 +317,15 @@ static noinline void handle_lost_ticks(int lost)
316317 KERN_WARNING "Your time source seems to be instable or "
317318 "some driver is hogging interupts\n" );
318319 print_symbol ("rip %s\n" , get_irq_regs ()-> rip );
319- if (vxtime .mode == VXTIME_TSC && vxtime . hpet_address ) {
320+ if (vxtime .mode == VXTIME_TSC && hpet_address ) {
320321 printk (KERN_WARNING "Falling back to HPET\n" );
321322 if (hpet_use_timer )
322323 vxtime .last = hpet_readl (HPET_T0_CMP ) -
323324 hpet_tick ;
324325 else
325326 vxtime .last = hpet_readl (HPET_COUNTER );
326327 vxtime .mode = VXTIME_HPET ;
328+ vxtime .hpet_address = hpet_address ;
327329 do_gettimeoffset = do_gettimeoffset_hpet ;
328330 }
329331 /* else should fall back to PIT, but code missing. */
@@ -354,7 +356,7 @@ void main_timer_handler(void)
354356
355357 write_seqlock (& xtime_lock );
356358
357- if (vxtime . hpet_address )
359+ if (hpet_address )
358360 offset = hpet_readl (HPET_COUNTER );
359361
360362 if (hpet_use_timer ) {
@@ -739,7 +741,7 @@ static __init int late_hpet_init(void)
739741 struct hpet_data hd ;
740742 unsigned int ntimer ;
741743
742- if (!vxtime . hpet_address )
744+ if (!hpet_address )
743745 return 0 ;
744746
745747 memset (& hd , 0 , sizeof (hd ));
@@ -752,7 +754,7 @@ static __init int late_hpet_init(void)
752754 * Register with driver.
753755 * Timer0 and Timer1 is used by platform.
754756 */
755- hd .hd_phys_address = vxtime . hpet_address ;
757+ hd .hd_phys_address = hpet_address ;
756758 hd .hd_address = (void __iomem * )fix_to_virt (FIX_HPET_BASE );
757759 hd .hd_nirqs = ntimer ;
758760 hd .hd_flags = HPET_DATA_PLATFORM ;
@@ -821,10 +823,10 @@ static int hpet_init(void)
821823{
822824 unsigned int id ;
823825
824- if (!vxtime . hpet_address )
826+ if (!hpet_address )
825827 return -1 ;
826- set_fixmap_nocache (FIX_HPET_BASE , vxtime . hpet_address );
827- __set_fixmap (VSYSCALL_HPET , vxtime . hpet_address , PAGE_KERNEL_VSYSCALL_NOCACHE );
828+ set_fixmap_nocache (FIX_HPET_BASE , hpet_address );
829+ __set_fixmap (VSYSCALL_HPET , hpet_address , PAGE_KERNEL_VSYSCALL_NOCACHE );
828830
829831/*
830832 * Read the period, compute tick and quotient.
@@ -878,7 +880,7 @@ void __init pit_stop_interrupt(void)
878880void __init stop_timer_interrupt (void )
879881{
880882 char * name ;
881- if (vxtime . hpet_address ) {
883+ if (hpet_address ) {
882884 name = "HPET" ;
883885 hpet_timer_stop_set_go (0 );
884886 } else {
@@ -901,8 +903,7 @@ static struct irqaction irq0 = {
901903void __init time_init (void )
902904{
903905 if (nohpet )
904- vxtime .hpet_address = 0 ;
905-
906+ hpet_address = 0 ;
906907 xtime .tv_sec = get_cmos_time ();
907908 xtime .tv_nsec = 0 ;
908909
@@ -912,15 +913,15 @@ void __init time_init(void)
912913 if (!hpet_init ())
913914 vxtime_hz = (FSEC_PER_SEC + hpet_period / 2 ) / hpet_period ;
914915 else
915- vxtime . hpet_address = 0 ;
916+ hpet_address = 0 ;
916917
917918 if (hpet_use_timer ) {
918919 /* set tick_nsec to use the proper rate for HPET */
919920 tick_nsec = TICK_NSEC_HPET ;
920921 cpu_khz = hpet_calibrate_tsc ();
921922 timename = "HPET" ;
922923#ifdef CONFIG_X86_PM_TIMER
923- } else if (pmtmr_ioport && !vxtime . hpet_address ) {
924+ } else if (pmtmr_ioport && !hpet_address ) {
924925 vxtime_hz = PM_TIMER_FREQUENCY ;
925926 timename = "PM" ;
926927 pit_init ();
@@ -990,23 +991,24 @@ void time_init_gtod(void)
990991 if (unsynchronized_tsc ())
991992 notsc = 1 ;
992993
993- if (cpu_has (& boot_cpu_data , X86_FEATURE_RDTSCP ))
994+ if (cpu_has (& boot_cpu_data , X86_FEATURE_RDTSCP ))
994995 vgetcpu_mode = VGETCPU_RDTSCP ;
995996 else
996997 vgetcpu_mode = VGETCPU_LSL ;
997998
998- if (vxtime . hpet_address && notsc ) {
999+ if (hpet_address && notsc ) {
9991000 timetype = hpet_use_timer ? "HPET" : "PIT/HPET" ;
10001001 if (hpet_use_timer )
10011002 vxtime .last = hpet_readl (HPET_T0_CMP ) - hpet_tick ;
10021003 else
10031004 vxtime .last = hpet_readl (HPET_COUNTER );
10041005 vxtime .mode = VXTIME_HPET ;
1006+ vxtime .hpet_address = hpet_address ;
10051007 do_gettimeoffset = do_gettimeoffset_hpet ;
10061008#ifdef CONFIG_X86_PM_TIMER
10071009 /* Using PM for gettimeofday is quite slow, but we have no other
10081010 choice because the TSC is too unreliable on some systems. */
1009- } else if (pmtmr_ioport && !vxtime . hpet_address && notsc ) {
1011+ } else if (pmtmr_ioport && !hpet_address && notsc ) {
10101012 timetype = "PM" ;
10111013 do_gettimeoffset = do_gettimeoffset_pm ;
10121014 vxtime .mode = VXTIME_PMTMR ;
@@ -1066,7 +1068,7 @@ static int timer_resume(struct sys_device *dev)
10661068 sleep_length = 0 ;
10671069 ctime = sleep_start ;
10681070 }
1069- if (vxtime . hpet_address )
1071+ if (hpet_address )
10701072 hpet_reenable ();
10711073 else
10721074 i8254_timer_resume ();
@@ -1150,7 +1152,7 @@ static unsigned int hpet_t1_cmp; /* cached comparator register */
11501152
11511153int is_hpet_enabled (void )
11521154{
1153- return vxtime . hpet_address != 0 ;
1155+ return hpet_address != 0 ;
11541156}
11551157
11561158/*
0 commit comments