diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-06-09 12:35:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-10 09:52:29 -0400 |
commit | 00dba56465228825ea806e3a7fc0aa6bba7bdc6c (patch) | |
tree | aa1763b72f8396672d3e4697c6327c6d3d5dee0c /arch/x86/kernel/process.c | |
parent | 09fd4b4ef5bc7e5222c13acec1bee8cd252fb63f (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.c | 70 |
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 | */ | ||
51 | unsigned long boot_option_idle_override = 0; | ||
52 | EXPORT_SYMBOL(boot_option_idle_override); | ||
53 | |||
54 | /* | ||
55 | * Powermanagement idle function, if any.. | ||
56 | */ | ||
57 | void (*pm_idle)(void); | ||
58 | EXPORT_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 | */ | ||
65 | static int hlt_counter; | ||
66 | void disable_hlt(void) | ||
67 | { | ||
68 | hlt_counter++; | ||
69 | } | ||
70 | EXPORT_SYMBOL(disable_hlt); | ||
71 | |||
72 | void enable_hlt(void) | ||
73 | { | ||
74 | hlt_counter--; | ||
75 | } | ||
76 | EXPORT_SYMBOL(enable_hlt); | ||
77 | |||
78 | static inline int hlt_use_halt(void) | ||
79 | { | ||
80 | return (!hlt_counter && boot_cpu_data.hlt_works_ok); | ||
81 | } | ||
82 | #else | ||
83 | static 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 | */ | ||
93 | void 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 | ||
115 | EXPORT_SYMBOL(default_idle); | ||
116 | #endif | ||
117 | |||
48 | static void do_nothing(void *unused) | 118 | static void do_nothing(void *unused) |
49 | { | 119 | { |
50 | } | 120 | } |