aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/time_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/time_64.c')
-rw-r--r--arch/x86/kernel/time_64.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index 7db3912b8692..78cbdf5c006b 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -23,7 +23,13 @@
23#include <asm/time.h> 23#include <asm/time.h>
24#include <asm/nmi.h> 24#include <asm/nmi.h>
25 25
26#if defined(CONFIG_X86_32) && defined(CONFIG_X86_IO_APIC)
27int timer_ack;
28#endif
29
30#ifdef CONFIG_X86_64
26volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; 31volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
32#endif
27 33
28unsigned long profile_pc(struct pt_regs *regs) 34unsigned long profile_pc(struct pt_regs *regs)
29{ 35{
@@ -47,8 +53,12 @@ unsigned long profile_pc(struct pt_regs *regs)
47} 53}
48EXPORT_SYMBOL(profile_pc); 54EXPORT_SYMBOL(profile_pc);
49 55
56/*
57 * Default timer interrupt handler for PIT/HPET
58 */
50static irqreturn_t timer_interrupt(int irq, void *dev_id) 59static irqreturn_t timer_interrupt(int irq, void *dev_id)
51{ 60{
61 /* Keep nmi watchdog up to date */
52 inc_irq_stat(irq0_irqs); 62 inc_irq_stat(irq0_irqs);
53 63
54 /* Optimized out for !IO_APIC and x86_64 */ 64 /* Optimized out for !IO_APIC and x86_64 */
@@ -74,8 +84,10 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
74 return IRQ_HANDLED; 84 return IRQ_HANDLED;
75} 85}
76 86
77/* calibrate_cpu is used on systems with fixed rate TSCs to determine 87/*
78 * processor frequency */ 88 * calibrate_cpu is used on systems with fixed rate TSCs to determine
89 * processor frequency
90 */
79#define TICK_COUNT 100000000 91#define TICK_COUNT 100000000
80unsigned long __init calibrate_cpu(void) 92unsigned long __init calibrate_cpu(void)
81{ 93{
@@ -122,18 +134,24 @@ unsigned long __init calibrate_cpu(void)
122 return pmc_now * tsc_khz / (tsc_now - tsc_start); 134 return pmc_now * tsc_khz / (tsc_now - tsc_start);
123} 135}
124 136
125static struct irqaction irq0 = { 137static struct irqaction irq0 = {
126 .handler = timer_interrupt, 138 .handler = timer_interrupt,
127 .flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING | IRQF_TIMER, 139 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
128 .name = "timer" 140 .name = "timer"
129}; 141};
130 142
143void __init setup_default_timer_irq(void)
144{
145 irq0.mask = cpumask_of_cpu(0);
146 setup_irq(0, &irq0);
147}
148
149/* Default timer init function */
131void __init hpet_time_init(void) 150void __init hpet_time_init(void)
132{ 151{
133 if (!hpet_enable()) 152 if (!hpet_enable())
134 setup_pit_timer(); 153 setup_pit_timer();
135 154 setup_default_timer_irq();
136 setup_irq(0, &irq0);
137} 155}
138 156
139static void x86_late_time_init(void) 157static void x86_late_time_init(void)
@@ -141,6 +159,10 @@ static void x86_late_time_init(void)
141 x86_init.timers.timer_init(); 159 x86_init.timers.timer_init();
142} 160}
143 161
162/*
163 * Initialize TSC and delay the periodic timer init to
164 * late x86_late_time_init() so ioremap works.
165 */
144void __init time_init(void) 166void __init time_init(void)
145{ 167{
146 tsc_init(); 168 tsc_init();