aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic_64.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2008-08-16 15:21:51 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-17 08:41:48 -0400
commit92206c909ad1d4f9c355b4842722d5a355d6b76b (patch)
treea27464b6008d77ef5314bd364405d73c5f3a3168 /arch/x86/kernel/apic_64.c
parent6764014bc8bb4849f6a4f336477e873ad5861ed2 (diff)
x86: apic - unify lapic_resume
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic_64.c')
-rw-r--r--arch/x86/kernel/apic_64.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index d834b7583624..e542a2d08de5 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -1412,13 +1412,22 @@ static int lapic_resume(struct sys_device *dev)
1412 maxlvt = lapic_get_maxlvt(); 1412 maxlvt = lapic_get_maxlvt();
1413 1413
1414 local_irq_save(flags); 1414 local_irq_save(flags);
1415 if (!x2apic) { 1415
1416#ifdef CONFIG_X86_64
1417 if (x2apic)
1418 enable_x2apic();
1419 else
1420#endif
1421 /*
1422 * Make sure the APICBASE points to the right address
1423 *
1424 * FIXME! This will be wrong if we ever support suspend on
1425 * SMP! We'll need to do this as part of the CPU restore!
1426 */
1416 rdmsr(MSR_IA32_APICBASE, l, h); 1427 rdmsr(MSR_IA32_APICBASE, l, h);
1417 l &= ~MSR_IA32_APICBASE_BASE; 1428 l &= ~MSR_IA32_APICBASE_BASE;
1418 l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; 1429 l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
1419 wrmsr(MSR_IA32_APICBASE, l, h); 1430 wrmsr(MSR_IA32_APICBASE, l, h);
1420 } else
1421 enable_x2apic();
1422 1431
1423 apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); 1432 apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED);
1424 apic_write(APIC_ID, apic_pm_state.apic_id); 1433 apic_write(APIC_ID, apic_pm_state.apic_id);
@@ -1428,7 +1437,7 @@ static int lapic_resume(struct sys_device *dev)
1428 apic_write(APIC_SPIV, apic_pm_state.apic_spiv); 1437 apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
1429 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0); 1438 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0);
1430 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1); 1439 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
1431#ifdef CONFIG_X86_MCE_INTEL 1440#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL)
1432 if (maxlvt >= 5) 1441 if (maxlvt >= 5)
1433 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr); 1442 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
1434#endif 1443#endif
@@ -1442,7 +1451,9 @@ static int lapic_resume(struct sys_device *dev)
1442 apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr); 1451 apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
1443 apic_write(APIC_ESR, 0); 1452 apic_write(APIC_ESR, 0);
1444 apic_read(APIC_ESR); 1453 apic_read(APIC_ESR);
1454
1445 local_irq_restore(flags); 1455 local_irq_restore(flags);
1456
1446 return 0; 1457 return 0;
1447} 1458}
1448 1459