aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Kretzschmar <henne@nachtwindheim.de>2011-03-11 02:02:36 -0500
committerIngo Molnar <mingo@elte.hu>2011-03-11 02:13:59 -0500
commit25874a299ef8037df03ce4ada570bc4e42f9748f (patch)
tree52869835b55dc40d886af1b5e2794ccebe157ecf
parentec8df88f6bd808db47ac7a06c96dcc90d7ed6ecc (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.h4
-rw-r--r--arch/x86/kernel/apic/apic.c65
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
221extern int get_physical_broadcast(void); 221extern int get_physical_broadcast(void);
222 222
223extern void apic_disable(void);
224extern int lapic_get_maxlvt(void); 223extern int lapic_get_maxlvt(void);
225extern void clear_local_APIC(void); 224extern void clear_local_APIC(void);
226extern void connect_bsp_APIC(void); 225extern void connect_bsp_APIC(void);
@@ -228,7 +227,6 @@ extern void disconnect_bsp_APIC(int virt_wire_setup);
228extern void disable_local_APIC(void); 227extern void disable_local_APIC(void);
229extern void lapic_shutdown(void); 228extern void lapic_shutdown(void);
230extern int verify_local_APIC(void); 229extern int verify_local_APIC(void);
231extern void cache_APIC_registers(void);
232extern void sync_Arb_IDs(void); 230extern void sync_Arb_IDs(void);
233extern void init_bsp_APIC(void); 231extern void init_bsp_APIC(void);
234extern void setup_local_APIC(void); 232extern void setup_local_APIC(void);
@@ -239,7 +237,6 @@ void register_lapic_address(unsigned long address);
239extern void setup_boot_APIC_clock(void); 237extern void setup_boot_APIC_clock(void);
240extern void setup_secondary_APIC_clock(void); 238extern void setup_secondary_APIC_clock(void);
241extern int APIC_init_uniprocessor(void); 239extern int APIC_init_uniprocessor(void);
242extern void enable_NMI_through_LVT0(void);
243extern int apic_force_enable(unsigned long addr); 240extern 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
262static inline void init_apic_mappings(void) { } 259static inline void init_apic_mappings(void) { }
263static inline void disable_local_APIC(void) { } 260static inline void disable_local_APIC(void) { }
264static 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 */
87static int force_enable_local_apic; 87static 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);
154unsigned long mp_lapic_addr; 154unsigned long mp_lapic_addr;
155int disable_apic; 155int 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 */
157static int disable_apic_timer __cpuinitdata; 157static int disable_apic_timer __initdata;
158/* Local APIC timer works in C2 */ 158/* Local APIC timer works in C2 */
159int local_apic_timer_c2_ok; 159int local_apic_timer_c2_ok;
160EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); 160EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
@@ -178,29 +178,8 @@ static struct resource lapic_resource = {
178 178
179static unsigned int calibration_result; 179static unsigned int calibration_result;
180 180
181static int lapic_next_event(unsigned long delta,
182 struct clock_event_device *evt);
183static void lapic_timer_setup(enum clock_event_mode mode,
184 struct clock_event_device *evt);
185static void lapic_timer_broadcast(const struct cpumask *mask);
186static void apic_pm_activate(void); 181static void apic_pm_activate(void);
187 182
188/*
189 * The local apic timer can be used for any function which is CPU local.
190 */
191static 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};
202static DEFINE_PER_CPU(struct clock_event_device, lapic_events);
203
204static unsigned long apic_phys; 183static 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 */
242void apic_disable(void) 221static 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 */
289void __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 */
478static 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};
489static 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
1541static int apic_verify(void) 1520static 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
1566int apic_force_enable(unsigned long addr) 1545int __init apic_force_enable(unsigned long addr)
1567{ 1546{
1568 u32 h, l; 1547 u32 h, l;
1569 1548