Skip to content

Commit

Permalink
x86: apic - unify disable_local_APIC
Browse files Browse the repository at this point in the history
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Cyrill Gorcunov authored and Ingo Molnar committed Aug 19, 2008
1 parent f1ee378 commit 990b183
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/x86/kernel/apic_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ void clear_local_APIC(void)
*/
void disable_local_APIC(void)
{
unsigned long value;
unsigned int value;

clear_local_APIC();

Expand All @@ -808,6 +808,7 @@ void disable_local_APIC(void)
value &= ~APIC_SPIV_APIC_ENABLED;
apic_write(APIC_SPIV, value);

#ifdef CONFIG_X86_32
/*
* When LAPIC was disabled by the BIOS and enabled by the kernel,
* restore the disabled state.
Expand All @@ -819,6 +820,7 @@ void disable_local_APIC(void)
l &= ~MSR_IA32_APICBASE_ENABLE;
wrmsr(MSR_IA32_APICBASE, l, h);
}
#endif
}

/*
Expand Down
14 changes: 14 additions & 0 deletions arch/x86/kernel/apic_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,20 @@ void disable_local_APIC(void)
value = apic_read(APIC_SPIV);
value &= ~APIC_SPIV_APIC_ENABLED;
apic_write(APIC_SPIV, value);

#ifdef CONFIG_X86_32
/*
* When LAPIC was disabled by the BIOS and enabled by the kernel,
* restore the disabled state.
*/
if (enabled_via_apicbase) {
unsigned int l, h;

rdmsr(MSR_IA32_APICBASE, l, h);
l &= ~MSR_IA32_APICBASE_ENABLE;
wrmsr(MSR_IA32_APICBASE, l, h);
}
#endif
}

void lapic_shutdown(void)
Expand Down

0 comments on commit 990b183

Please sign in to comment.