1 #include <linux/init.h>
2 #include <linux/kernel.h>
3 #include <linux/string.h>
6 #ifdef CONFIG_HPET_TIMER
8 * HPET memory read is slower than tsc reads, but is more dependable as it
9 * always runs at constant frequency and reduces complexity due to
10 * cpufreq. So, we prefer HPET timer to tsc based one. Also, we cannot use
11 * timer_pit when HPET is active. So, we default to timer_tsc.
14 /* list of timers, ordered by preference, NULL terminated */
15 static struct init_timer_opts
* __initdata timers
[] = {
16 #ifdef CONFIG_X86_CYCLONE_TIMER
19 #ifdef CONFIG_HPET_TIMER
22 #ifdef CONFIG_X86_PM_TIMER
30 static char clock_override
[10] __initdata
;
32 static int __init
clock_setup(char* str
)
35 strlcpy(clock_override
, str
, sizeof(clock_override
));
38 __setup("clock=", clock_setup
);
41 /* The chosen timesource has been found to be bad.
42 * Fall back to a known good timesource (the PIT)
44 void clock_fallback(void)
46 cur_timer
= &timer_pit
;
49 /* iterates through the list of timers, returning the first
50 * one that initializes successfully.
52 struct timer_opts
* __init
select_timer(void)
56 /* find most preferred working timer */
59 if (timers
[i
]->init(clock_override
) == 0)
60 return timers
[i
]->opts
;
64 panic("select_timer: Cannot find a suitable timer\n");