aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/time_32.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2009-08-19 09:37:03 -0400
committerThomas Gleixner <tglx@linutronix.de>2009-08-31 03:35:46 -0400
commit845b3944bbdf9e9247849bf037f27ff3a3f26d87 (patch)
treeb14b40b5ba650996c646ed760cfa4b3283e04953 /arch/x86/kernel/time_32.c
parent736decac643e8982655e22ac7f0e5e61c5b7f9bd (diff)
x86: Add timer_init to x86_init_ops
The timer init code is convoluted with several quirks and the paravirt timer chooser. Figuring out which code path is actually taken is not for the faint hearted. Move the numaq TSC quirk to tsc_pre_init x86_init_ops function and replace the paravirt time chooser and the remaining x86 quirk with a simple x86_init_ops function. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/time_32.c')
-rw-r--r--arch/x86/kernel/time_32.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c
index 5c5d87f0b2e1..89bbb52218b8 100644
--- a/arch/x86/kernel/time_32.c
+++ b/arch/x86/kernel/time_32.c
@@ -72,7 +72,7 @@ EXPORT_SYMBOL(profile_pc);
72 * Time Stamp Counter value at the time of the timer interrupt, so that 72 * Time Stamp Counter value at the time of the timer interrupt, so that
73 * we later on can estimate the time of day more exactly. 73 * we later on can estimate the time of day more exactly.
74 */ 74 */
75irqreturn_t timer_interrupt(int irq, void *dev_id) 75static irqreturn_t timer_interrupt(int irq, void *dev_id)
76{ 76{
77 /* Keep nmi watchdog up to date */ 77 /* Keep nmi watchdog up to date */
78 inc_irq_stat(irq0_irqs); 78 inc_irq_stat(irq0_irqs);
@@ -113,25 +113,37 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
113 return IRQ_HANDLED; 113 return IRQ_HANDLED;
114} 114}
115 115
116/* Duplicate of time_init() below, with hpet_enable part added */ 116static struct irqaction irq0 = {
117 .handler = timer_interrupt,
118 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
119 .name = "timer"
120};
121
122void __init setup_default_timer_irq(void)
123{
124 irq0.mask = cpumask_of_cpu(0);
125 setup_irq(0, &irq0);
126}
127
128/* Default timer init function */
117void __init hpet_time_init(void) 129void __init hpet_time_init(void)
118{ 130{
119 if (!hpet_enable()) 131 if (!hpet_enable())
120 setup_pit_timer(); 132 setup_pit_timer();
121 x86_quirk_time_init(); 133 setup_default_timer_irq();
134}
135
136static void x86_late_time_init(void)
137{
138 x86_init.timers.timer_init();
122} 139}
123 140
124/* 141/*
125 * This is called directly from init code; we must delay timer setup in the 142 * Initialize TSC and delay the periodic timer init to
126 * HPET case as we can't make the decision to turn on HPET this early in the 143 * late x86_late_time_init() so ioremap works.
127 * boot process.
128 *
129 * The chosen time_init function will usually be hpet_time_init, above, but
130 * in the case of virtual hardware, an alternative function may be substituted.
131 */ 144 */
132void __init time_init(void) 145void __init time_init(void)
133{ 146{
134 x86_quirk_pre_time_init();
135 tsc_init(); 147 tsc_init();
136 late_time_init = choose_time_init(); 148 late_time_init = x86_late_time_init;
137} 149}