aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/time_64.c
diff options
context:
space:
mode:
authorAlok Kataria <akataria@vmware.com>2008-07-01 14:43:34 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-09 01:43:27 -0400
commit8fbbc4b45ce3e4c0eeb15004c79c72b6896a79c2 (patch)
tree3b7c8e4ee74ef5fec07f64ea56bff60afb433c2c /arch/x86/kernel/time_64.c
parent2dbe06faf37b39f9ecffc054dd173b2a1dc2adcd (diff)
x86: merge tsc_init and clocksource code
Unify the clocksource code. Unify the tsc_init code. Signed-off-by: Alok N Kataria <akataria@vmware.com> Signed-off-by: Dan Hecht <dhecht@vmware.com> Cc: Dan Hecht <dhecht@vmware.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/time_64.c')
-rw-r--r--arch/x86/kernel/time_64.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index c6ac4dad41f6..e3d49c553af2 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -56,7 +56,7 @@ static irqreturn_t timer_event_interrupt(int irq, void *dev_id)
56/* calibrate_cpu is used on systems with fixed rate TSCs to determine 56/* calibrate_cpu is used on systems with fixed rate TSCs to determine
57 * processor frequency */ 57 * processor frequency */
58#define TICK_COUNT 100000000 58#define TICK_COUNT 100000000
59static unsigned long __init calibrate_cpu(void) 59unsigned long __init calibrate_cpu(void)
60{ 60{
61 int tsc_start, tsc_now; 61 int tsc_start, tsc_now;
62 int i, no_ctr_free; 62 int i, no_ctr_free;
@@ -114,41 +114,13 @@ void __init hpet_time_init(void)
114 setup_irq(0, &irq0); 114 setup_irq(0, &irq0);
115} 115}
116 116
117extern void set_cyc2ns_scale(unsigned long cpu_khz, int cpu);
118
119void __init time_init(void) 117void __init time_init(void)
120{ 118{
121 int cpu; 119 tsc_init();
122
123 cpu_khz = calculate_cpu_khz();
124 tsc_khz = cpu_khz;
125
126 if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) &&
127 (boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
128 cpu_khz = calibrate_cpu();
129
130 lpj_fine = ((unsigned long)tsc_khz * 1000)/HZ;
131
132 if (unsynchronized_tsc())
133 mark_tsc_unstable("TSCs unsynchronized");
134
135 if (cpu_has(&boot_cpu_data, X86_FEATURE_RDTSCP)) 120 if (cpu_has(&boot_cpu_data, X86_FEATURE_RDTSCP))
136 vgetcpu_mode = VGETCPU_RDTSCP; 121 vgetcpu_mode = VGETCPU_RDTSCP;
137 else 122 else
138 vgetcpu_mode = VGETCPU_LSL; 123 vgetcpu_mode = VGETCPU_LSL;
139 124
140 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
141 cpu_khz / 1000, cpu_khz % 1000);
142
143 /*
144 * Secondary CPUs do not run through tsc_init(), so set up
145 * all the scale factors for all CPUs, assuming the same
146 * speed as the bootup CPU. (cpufreq notifiers will fix this
147 * up if their speed diverges)
148 */
149 for_each_possible_cpu(cpu)
150 set_cyc2ns_scale(cpu_khz, cpu);
151
152 init_tsc_clocksource();
153 late_time_init = choose_time_init(); 125 late_time_init = choose_time_init();
154} 126}