diff options
author | Henrik Kretzschmar <henne@nachtwindheim.de> | 2011-03-11 02:02:36 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-03-11 02:13:59 -0500 |
commit | 25874a299ef8037df03ce4ada570bc4e42f9748f (patch) | |
tree | 52869835b55dc40d886af1b5e2794ccebe157ecf | |
parent | ec8df88f6bd808db47ac7a06c96dcc90d7ed6ecc (diff) |
x86: Clean up apic.c and apic.h
This patch moves some functions and variables into init
sections, makes a function static and removes some lines of
cruft.
Signed-off-by: Henrik Kretzschmar <henne@nachtwindheim.de>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
LKML-Reference: <1299826956-8607-2-git-send-email-henne@nachtwindheim.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/include/asm/apic.h | 4 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 65 |
2 files changed, 22 insertions, 47 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 4afe512120a9..5b7d5137e167 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -220,7 +220,6 @@ extern void enable_IR_x2apic(void); | |||
220 | 220 | ||
221 | extern int get_physical_broadcast(void); | 221 | extern int get_physical_broadcast(void); |
222 | 222 | ||
223 | extern void apic_disable(void); | ||
224 | extern int lapic_get_maxlvt(void); | 223 | extern int lapic_get_maxlvt(void); |
225 | extern void clear_local_APIC(void); | 224 | extern void clear_local_APIC(void); |
226 | extern void connect_bsp_APIC(void); | 225 | extern void connect_bsp_APIC(void); |
@@ -228,7 +227,6 @@ extern void disconnect_bsp_APIC(int virt_wire_setup); | |||
228 | extern void disable_local_APIC(void); | 227 | extern void disable_local_APIC(void); |
229 | extern void lapic_shutdown(void); | 228 | extern void lapic_shutdown(void); |
230 | extern int verify_local_APIC(void); | 229 | extern int verify_local_APIC(void); |
231 | extern void cache_APIC_registers(void); | ||
232 | extern void sync_Arb_IDs(void); | 230 | extern void sync_Arb_IDs(void); |
233 | extern void init_bsp_APIC(void); | 231 | extern void init_bsp_APIC(void); |
234 | extern void setup_local_APIC(void); | 232 | extern void setup_local_APIC(void); |
@@ -239,7 +237,6 @@ void register_lapic_address(unsigned long address); | |||
239 | extern void setup_boot_APIC_clock(void); | 237 | extern void setup_boot_APIC_clock(void); |
240 | extern void setup_secondary_APIC_clock(void); | 238 | extern void setup_secondary_APIC_clock(void); |
241 | extern int APIC_init_uniprocessor(void); | 239 | extern int APIC_init_uniprocessor(void); |
242 | extern void enable_NMI_through_LVT0(void); | ||
243 | extern int apic_force_enable(unsigned long addr); | 240 | extern int apic_force_enable(unsigned long addr); |
244 | 241 | ||
245 | /* | 242 | /* |
@@ -261,7 +258,6 @@ static inline void lapic_shutdown(void) { } | |||
261 | #define local_apic_timer_c2_ok 1 | 258 | #define local_apic_timer_c2_ok 1 |
262 | static inline void init_apic_mappings(void) { } | 259 | static inline void init_apic_mappings(void) { } |
263 | static inline void disable_local_APIC(void) { } | 260 | static inline void disable_local_APIC(void) { } |
264 | static inline void apic_disable(void) { } | ||
265 | # define setup_boot_APIC_clock x86_init_noop | 261 | # define setup_boot_APIC_clock x86_init_noop |
266 | # define setup_secondary_APIC_clock x86_init_noop | 262 | # define setup_secondary_APIC_clock x86_init_noop |
267 | #endif /* !CONFIG_X86_LOCAL_APIC */ | 263 | #endif /* !CONFIG_X86_LOCAL_APIC */ |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 4f43312cfbf8..ffbf7c21bbc6 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -84,7 +84,7 @@ EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid); | |||
84 | * | 84 | * |
85 | * +1=force-enable | 85 | * +1=force-enable |
86 | */ | 86 | */ |
87 | static int force_enable_local_apic; | 87 | static int force_enable_local_apic __initdata; |
88 | /* | 88 | /* |
89 | * APIC command line parameters | 89 | * APIC command line parameters |
90 | */ | 90 | */ |
@@ -154,7 +154,7 @@ early_param("nox2apic", setup_nox2apic); | |||
154 | unsigned long mp_lapic_addr; | 154 | unsigned long mp_lapic_addr; |
155 | int disable_apic; | 155 | int disable_apic; |
156 | /* Disable local APIC timer from the kernel commandline or via dmi quirk */ | 156 | /* Disable local APIC timer from the kernel commandline or via dmi quirk */ |
157 | static int disable_apic_timer __cpuinitdata; | 157 | static int disable_apic_timer __initdata; |
158 | /* Local APIC timer works in C2 */ | 158 | /* Local APIC timer works in C2 */ |
159 | int local_apic_timer_c2_ok; | 159 | int local_apic_timer_c2_ok; |
160 | EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); | 160 | EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); |
@@ -178,29 +178,8 @@ static struct resource lapic_resource = { | |||
178 | 178 | ||
179 | static unsigned int calibration_result; | 179 | static unsigned int calibration_result; |
180 | 180 | ||
181 | static int lapic_next_event(unsigned long delta, | ||
182 | struct clock_event_device *evt); | ||
183 | static void lapic_timer_setup(enum clock_event_mode mode, | ||
184 | struct clock_event_device *evt); | ||
185 | static void lapic_timer_broadcast(const struct cpumask *mask); | ||
186 | static void apic_pm_activate(void); | 181 | static void apic_pm_activate(void); |
187 | 182 | ||
188 | /* | ||
189 | * The local apic timer can be used for any function which is CPU local. | ||
190 | */ | ||
191 | static struct clock_event_device lapic_clockevent = { | ||
192 | .name = "lapic", | ||
193 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT | ||
194 | | CLOCK_EVT_FEAT_C3STOP | CLOCK_EVT_FEAT_DUMMY, | ||
195 | .shift = 32, | ||
196 | .set_mode = lapic_timer_setup, | ||
197 | .set_next_event = lapic_next_event, | ||
198 | .broadcast = lapic_timer_broadcast, | ||
199 | .rating = 100, | ||
200 | .irq = -1, | ||
201 | }; | ||
202 | static DEFINE_PER_CPU(struct clock_event_device, lapic_events); | ||
203 | |||
204 | static unsigned long apic_phys; | 183 | static unsigned long apic_phys; |
205 | 184 | ||
206 | /* | 185 | /* |
@@ -239,7 +218,7 @@ static int modern_apic(void) | |||
239 | * right after this call apic become NOOP driven | 218 | * right after this call apic become NOOP driven |
240 | * so apic->write/read doesn't do anything | 219 | * so apic->write/read doesn't do anything |
241 | */ | 220 | */ |
242 | void apic_disable(void) | 221 | static void __init apic_disable(void) |
243 | { | 222 | { |
244 | pr_info("APIC: switched to apic NOOP\n"); | 223 | pr_info("APIC: switched to apic NOOP\n"); |
245 | apic = &apic_noop; | 224 | apic = &apic_noop; |
@@ -283,23 +262,6 @@ u64 native_apic_icr_read(void) | |||
283 | return icr1 | ((u64)icr2 << 32); | 262 | return icr1 | ((u64)icr2 << 32); |
284 | } | 263 | } |
285 | 264 | ||
286 | /** | ||
287 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 | ||
288 | */ | ||
289 | void __cpuinit enable_NMI_through_LVT0(void) | ||
290 | { | ||
291 | unsigned int v; | ||
292 | |||
293 | /* unmask and set to NMI */ | ||
294 | v = APIC_DM_NMI; | ||
295 | |||
296 | /* Level triggered for 82489DX (32bit mode) */ | ||
297 | if (!lapic_is_integrated()) | ||
298 | v |= APIC_LVT_LEVEL_TRIGGER; | ||
299 | |||
300 | apic_write(APIC_LVT0, v); | ||
301 | } | ||
302 | |||
303 | #ifdef CONFIG_X86_32 | 265 | #ifdef CONFIG_X86_32 |
304 | /** | 266 | /** |
305 | * get_physical_broadcast - Get number of physical broadcast IDs | 267 | * get_physical_broadcast - Get number of physical broadcast IDs |
@@ -509,6 +471,23 @@ static void lapic_timer_broadcast(const struct cpumask *mask) | |||
509 | #endif | 471 | #endif |
510 | } | 472 | } |
511 | 473 | ||
474 | |||
475 | /* | ||
476 | * The local apic timer can be used for any function which is CPU local. | ||
477 | */ | ||
478 | static struct clock_event_device lapic_clockevent = { | ||
479 | .name = "lapic", | ||
480 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT | ||
481 | | CLOCK_EVT_FEAT_C3STOP | CLOCK_EVT_FEAT_DUMMY, | ||
482 | .shift = 32, | ||
483 | .set_mode = lapic_timer_setup, | ||
484 | .set_next_event = lapic_next_event, | ||
485 | .broadcast = lapic_timer_broadcast, | ||
486 | .rating = 100, | ||
487 | .irq = -1, | ||
488 | }; | ||
489 | static DEFINE_PER_CPU(struct clock_event_device, lapic_events); | ||
490 | |||
512 | /* | 491 | /* |
513 | * Setup the local APIC timer for this CPU. Copy the initialized values | 492 | * Setup the local APIC timer for this CPU. Copy the initialized values |
514 | * of the boot CPU and register the clock event in the framework. | 493 | * of the boot CPU and register the clock event in the framework. |
@@ -1538,7 +1517,7 @@ static int __init detect_init_APIC(void) | |||
1538 | } | 1517 | } |
1539 | #else | 1518 | #else |
1540 | 1519 | ||
1541 | static int apic_verify(void) | 1520 | static int __init apic_verify(void) |
1542 | { | 1521 | { |
1543 | u32 features, h, l; | 1522 | u32 features, h, l; |
1544 | 1523 | ||
@@ -1563,7 +1542,7 @@ static int apic_verify(void) | |||
1563 | return 0; | 1542 | return 0; |
1564 | } | 1543 | } |
1565 | 1544 | ||
1566 | int apic_force_enable(unsigned long addr) | 1545 | int __init apic_force_enable(unsigned long addr) |
1567 | { | 1546 | { |
1568 | u32 h, l; | 1547 | u32 h, l; |
1569 | 1548 | ||