aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-06-09 12:35:28 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-10 09:52:29 -0400
commit00dba56465228825ea806e3a7fc0aa6bba7bdc6c (patch)
treeaa1763b72f8396672d3e4697c6327c6d3d5dee0c /arch/x86/kernel/process.c
parent09fd4b4ef5bc7e5222c13acec1bee8cd252fb63f (diff)
x86: move more common idle functions/variables to process.c
more unification. Should cause no change in functionality. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r--arch/x86/kernel/process.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index fe415ba606e0..9fea14607dfe 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -45,6 +45,76 @@ void arch_task_cache_init(void)
45 SLAB_PANIC, NULL); 45 SLAB_PANIC, NULL);
46} 46}
47 47
48/*
49 * Idle related variables and functions
50 */
51unsigned long boot_option_idle_override = 0;
52EXPORT_SYMBOL(boot_option_idle_override);
53
54/*
55 * Powermanagement idle function, if any..
56 */
57void (*pm_idle)(void);
58EXPORT_SYMBOL(pm_idle);
59
60#ifdef CONFIG_X86_32
61/*
62 * This halt magic was a workaround for ancient floppy DMA
63 * wreckage. It should be safe to remove.
64 */
65static int hlt_counter;
66void disable_hlt(void)
67{
68 hlt_counter++;
69}
70EXPORT_SYMBOL(disable_hlt);
71
72void enable_hlt(void)
73{
74 hlt_counter--;
75}
76EXPORT_SYMBOL(enable_hlt);
77
78static inline int hlt_use_halt(void)
79{
80 return (!hlt_counter && boot_cpu_data.hlt_works_ok);
81}
82#else
83static inline int hlt_use_halt(void)
84{
85 return 1;
86}
87#endif
88
89/*
90 * We use this if we don't have any better
91 * idle routine..
92 */
93void default_idle(void)
94{
95 if (hlt_use_halt()) {
96 current_thread_info()->status &= ~TS_POLLING;
97 /*
98 * TS_POLLING-cleared state must be visible before we
99 * test NEED_RESCHED:
100 */
101 smp_mb();
102
103 if (!need_resched())
104 safe_halt(); /* enables interrupts racelessly */
105 else
106 local_irq_enable();
107 current_thread_info()->status |= TS_POLLING;
108 } else {
109 local_irq_enable();
110 /* loop is done by the caller */
111 cpu_relax();
112 }
113}
114#ifdef CONFIG_APM_MODULE
115EXPORT_SYMBOL(default_idle);
116#endif
117
48static void do_nothing(void *unused) 118static void do_nothing(void *unused)
49{ 119{
50} 120}