Commit 638c0411 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Ingo Molnar

x86: apic - unify init_bsp_APIC

- remove redundant read of APIC_LVR register in 64bit mode
- APIC is always integrated for 64bit mode so
  gcc will eliminate lapic_is_integrated call
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Acked-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 6f6da97f
...@@ -925,7 +925,7 @@ void __init sync_Arb_IDs(void) ...@@ -925,7 +925,7 @@ void __init sync_Arb_IDs(void)
*/ */
void __init init_bsp_APIC(void) void __init init_bsp_APIC(void)
{ {
unsigned long value; unsigned int value;
/* /*
* Don't do the setup now if we have a SMP BIOS as the * Don't do the setup now if we have a SMP BIOS as the
...@@ -946,11 +946,13 @@ void __init init_bsp_APIC(void) ...@@ -946,11 +946,13 @@ void __init init_bsp_APIC(void)
value &= ~APIC_VECTOR_MASK; value &= ~APIC_VECTOR_MASK;
value |= APIC_SPIV_APIC_ENABLED; value |= APIC_SPIV_APIC_ENABLED;
#ifdef CONFIG_X86_32
/* This bit is reserved on P4/Xeon and should be cleared */ /* This bit is reserved on P4/Xeon and should be cleared */
if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
(boot_cpu_data.x86 == 15)) (boot_cpu_data.x86 == 15))
value &= ~APIC_SPIV_FOCUS_DISABLED; value &= ~APIC_SPIV_FOCUS_DISABLED;
else else
#endif
value |= APIC_SPIV_FOCUS_DISABLED; value |= APIC_SPIV_FOCUS_DISABLED;
value |= SPURIOUS_APIC_VECTOR; value |= SPURIOUS_APIC_VECTOR;
apic_write(APIC_SPIV, value); apic_write(APIC_SPIV, value);
......
...@@ -773,8 +773,6 @@ void __init init_bsp_APIC(void) ...@@ -773,8 +773,6 @@ void __init init_bsp_APIC(void)
if (smp_found_config || !cpu_has_apic) if (smp_found_config || !cpu_has_apic)
return; return;
value = apic_read(APIC_LVR);
/* /*
* Do not trust the local APIC being empty at bootup. * Do not trust the local APIC being empty at bootup.
*/ */
...@@ -786,7 +784,15 @@ void __init init_bsp_APIC(void) ...@@ -786,7 +784,15 @@ void __init init_bsp_APIC(void)
value = apic_read(APIC_SPIV); value = apic_read(APIC_SPIV);
value &= ~APIC_VECTOR_MASK; value &= ~APIC_VECTOR_MASK;
value |= APIC_SPIV_APIC_ENABLED; value |= APIC_SPIV_APIC_ENABLED;
value |= APIC_SPIV_FOCUS_DISABLED;
#ifdef CONFIG_X86_32
/* This bit is reserved on P4/Xeon and should be cleared */
if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
(boot_cpu_data.x86 == 15))
value &= ~APIC_SPIV_FOCUS_DISABLED;
else
#endif
value |= APIC_SPIV_FOCUS_DISABLED;
value |= SPURIOUS_APIC_VECTOR; value |= SPURIOUS_APIC_VECTOR;
apic_write(APIC_SPIV, value); apic_write(APIC_SPIV, value);
...@@ -795,6 +801,8 @@ void __init init_bsp_APIC(void) ...@@ -795,6 +801,8 @@ void __init init_bsp_APIC(void)
*/ */
apic_write(APIC_LVT0, APIC_DM_EXTINT); apic_write(APIC_LVT0, APIC_DM_EXTINT);
value = APIC_DM_NMI; value = APIC_DM_NMI;
if (!lapic_is_integrated()) /* 82489DX */
value |= APIC_LVT_LEVEL_TRIGGER;
apic_write(APIC_LVT1, value); apic_write(APIC_LVT1, value);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment