aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-15 23:01:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-15 23:01:36 -0400
commitd10902812c9cd5583130a4ebb9ad19c60b68149d (patch)
treeb1b28587970e8cebf74ba4d61edf49537f619ab7 /arch/x86/kernel/apic
parent181f977d134a9f8e3f8839f42af655b045fc059e (diff)
parent25874a299ef8037df03ce4ada570bc4e42f9748f (diff)
Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (27 commits) x86: Clean up apic.c and apic.h x86: Remove superflous goal definition of tsc_sync x86: dt: Correct local apic documentation in device tree bindings x86: dt: Cleanup local apic setup x86: dt: Fix OLPC=y/INTEL_CE=n build rtc: cmos: Add OF bindings x86: ce4100: Use OF to setup devices x86: ioapic: Add OF bindings for IO_APIC x86: dtb: Add generic bus probe x86: dtb: Add support for PCI devices backed by dtb nodes x86: dtb: Add device tree support for HPET x86: dtb: Add early parsing of IO_APIC x86: dtb: Add irq domain abstraction x86: dtb: Add a device tree for CE4100 x86: Add device tree support x86: e820: Remove conditional early mapping in parse_e820_ext x86: OLPC: Make OLPC=n build again x86: OLPC: Remove extra OLPC_OPENFIRMWARE_DT indirection x86: OLPC: Cleanup config maze completely x86: OLPC: Hide OLPC_OPENFIRMWARE config switch ... Fix up conflicts in arch/x86/platform/ce4100/ce4100.c
Diffstat (limited to 'arch/x86/kernel/apic')
-rw-r--r--arch/x86/kernel/apic/apic.c69
1 files changed, 24 insertions, 45 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 562a8325cc1c..966673f44141 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -93,7 +93,7 @@ DEFINE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid, BAD_APICID);
93 * 93 *
94 * +1=force-enable 94 * +1=force-enable
95 */ 95 */
96static int force_enable_local_apic; 96static int force_enable_local_apic __initdata;
97/* 97/*
98 * APIC command line parameters 98 * APIC command line parameters
99 */ 99 */
@@ -163,7 +163,7 @@ early_param("nox2apic", setup_nox2apic);
163unsigned long mp_lapic_addr; 163unsigned long mp_lapic_addr;
164int disable_apic; 164int disable_apic;
165/* Disable local APIC timer from the kernel commandline or via dmi quirk */ 165/* Disable local APIC timer from the kernel commandline or via dmi quirk */
166static int disable_apic_timer __cpuinitdata; 166static int disable_apic_timer __initdata;
167/* Local APIC timer works in C2 */ 167/* Local APIC timer works in C2 */
168int local_apic_timer_c2_ok; 168int local_apic_timer_c2_ok;
169EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); 169EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
@@ -187,29 +187,8 @@ static struct resource lapic_resource = {
187 187
188static unsigned int calibration_result; 188static unsigned int calibration_result;
189 189
190static int lapic_next_event(unsigned long delta,
191 struct clock_event_device *evt);
192static void lapic_timer_setup(enum clock_event_mode mode,
193 struct clock_event_device *evt);
194static void lapic_timer_broadcast(const struct cpumask *mask);
195static void apic_pm_activate(void); 190static void apic_pm_activate(void);
196 191
197/*
198 * The local apic timer can be used for any function which is CPU local.
199 */
200static struct clock_event_device lapic_clockevent = {
201 .name = "lapic",
202 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT
203 | CLOCK_EVT_FEAT_C3STOP | CLOCK_EVT_FEAT_DUMMY,
204 .shift = 32,
205 .set_mode = lapic_timer_setup,
206 .set_next_event = lapic_next_event,
207 .broadcast = lapic_timer_broadcast,
208 .rating = 100,
209 .irq = -1,
210};
211static DEFINE_PER_CPU(struct clock_event_device, lapic_events);
212
213static unsigned long apic_phys; 192static unsigned long apic_phys;
214 193
215/* 194/*
@@ -248,7 +227,7 @@ static int modern_apic(void)
248 * right after this call apic become NOOP driven 227 * right after this call apic become NOOP driven
249 * so apic->write/read doesn't do anything 228 * so apic->write/read doesn't do anything
250 */ 229 */
251void apic_disable(void) 230static void __init apic_disable(void)
252{ 231{
253 pr_info("APIC: switched to apic NOOP\n"); 232 pr_info("APIC: switched to apic NOOP\n");
254 apic = &apic_noop; 233 apic = &apic_noop;
@@ -292,23 +271,6 @@ u64 native_apic_icr_read(void)
292 return icr1 | ((u64)icr2 << 32); 271 return icr1 | ((u64)icr2 << 32);
293} 272}
294 273
295/**
296 * enable_NMI_through_LVT0 - enable NMI through local vector table 0
297 */
298void __cpuinit enable_NMI_through_LVT0(void)
299{
300 unsigned int v;
301
302 /* unmask and set to NMI */
303 v = APIC_DM_NMI;
304
305 /* Level triggered for 82489DX (32bit mode) */
306 if (!lapic_is_integrated())
307 v |= APIC_LVT_LEVEL_TRIGGER;
308
309 apic_write(APIC_LVT0, v);
310}
311
312#ifdef CONFIG_X86_32 274#ifdef CONFIG_X86_32
313/** 275/**
314 * get_physical_broadcast - Get number of physical broadcast IDs 276 * get_physical_broadcast - Get number of physical broadcast IDs
@@ -518,6 +480,23 @@ static void lapic_timer_broadcast(const struct cpumask *mask)
518#endif 480#endif
519} 481}
520 482
483
484/*
485 * The local apic timer can be used for any function which is CPU local.
486 */
487static struct clock_event_device lapic_clockevent = {
488 .name = "lapic",
489 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT
490 | CLOCK_EVT_FEAT_C3STOP | CLOCK_EVT_FEAT_DUMMY,
491 .shift = 32,
492 .set_mode = lapic_timer_setup,
493 .set_next_event = lapic_next_event,
494 .broadcast = lapic_timer_broadcast,
495 .rating = 100,
496 .irq = -1,
497};
498static DEFINE_PER_CPU(struct clock_event_device, lapic_events);
499
521/* 500/*
522 * Setup the local APIC timer for this CPU. Copy the initialized values 501 * Setup the local APIC timer for this CPU. Copy the initialized values
523 * of the boot CPU and register the clock event in the framework. 502 * of the boot CPU and register the clock event in the framework.
@@ -1560,7 +1539,7 @@ static int __init detect_init_APIC(void)
1560} 1539}
1561#else 1540#else
1562 1541
1563static int apic_verify(void) 1542static int __init apic_verify(void)
1564{ 1543{
1565 u32 features, h, l; 1544 u32 features, h, l;
1566 1545
@@ -1585,7 +1564,7 @@ static int apic_verify(void)
1585 return 0; 1564 return 0;
1586} 1565}
1587 1566
1588int apic_force_enable(void) 1567int __init apic_force_enable(unsigned long addr)
1589{ 1568{
1590 u32 h, l; 1569 u32 h, l;
1591 1570
@@ -1601,7 +1580,7 @@ int apic_force_enable(void)
1601 if (!(l & MSR_IA32_APICBASE_ENABLE)) { 1580 if (!(l & MSR_IA32_APICBASE_ENABLE)) {
1602 pr_info("Local APIC disabled by BIOS -- reenabling.\n"); 1581 pr_info("Local APIC disabled by BIOS -- reenabling.\n");
1603 l &= ~MSR_IA32_APICBASE_BASE; 1582 l &= ~MSR_IA32_APICBASE_BASE;
1604 l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE; 1583 l |= MSR_IA32_APICBASE_ENABLE | addr;
1605 wrmsr(MSR_IA32_APICBASE, l, h); 1584 wrmsr(MSR_IA32_APICBASE, l, h);
1606 enabled_via_apicbase = 1; 1585 enabled_via_apicbase = 1;
1607 } 1586 }
@@ -1642,7 +1621,7 @@ static int __init detect_init_APIC(void)
1642 "you can enable it with \"lapic\"\n"); 1621 "you can enable it with \"lapic\"\n");
1643 return -1; 1622 return -1;
1644 } 1623 }
1645 if (apic_force_enable()) 1624 if (apic_force_enable(APIC_DEFAULT_PHYS_BASE))
1646 return -1; 1625 return -1;
1647 } else { 1626 } else {
1648 if (apic_verify()) 1627 if (apic_verify())