Commit 3acf2ad9 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86_64: Remove BIOS reboot code

Remove BIOS reboot code

Remove the never quite working BIOS reboot code.  This gets rid of a lot of
code.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5f120ae0
......@@ -7,7 +7,7 @@ EXTRA_AFLAGS := -traditional
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \
x8664_ksyms.o i387.o syscall.o vsyscall.o \
setup64.o bootflag.o e820.o reboot.o warmreboot.o quirks.o
setup64.o bootflag.o e820.o reboot.o quirks.o
obj-$(CONFIG_X86_MCE) += mce.o
obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o
......
......@@ -22,14 +22,12 @@ void (*pm_power_off)(void);
static long no_idt[3];
static enum {
BOOT_BIOS = 'b',
BOOT_TRIPLE = 't',
BOOT_KBD = 'k'
} reboot_type = BOOT_KBD;
static int reboot_mode = 0;
/* reboot=b[ios] | t[riple] | k[bd] [, [w]arm | [c]old]
bios Use the CPU reboot vector for warm reset
/* reboot=t[riple] | k[bd] [, [w]arm | [c]old]
warm Don't set the cold reboot flag
cold Set the cold reboot flag
triple Force a triple fault (init)
......@@ -63,34 +61,6 @@ static int __init reboot_setup(char *str)
__setup("reboot=", reboot_setup);
/* overwrites random kernel memory. Should not be kernel .text */
#define WARMBOOT_TRAMP 0x1000UL
static void reboot_warm(void)
{
extern unsigned char warm_reboot[], warm_reboot_end[];
printk("warm reboot\n");
local_irq_disable();
/* restore identity mapping */
init_level4_pgt[0] = __pgd(__pa(level3_ident_pgt) | 7);
__flush_tlb_all();
/* Move the trampoline to low memory */
memcpy(__va(WARMBOOT_TRAMP), warm_reboot, warm_reboot_end - warm_reboot);
/* Start it in compatibility mode. */
asm volatile( " pushq $0\n" /* ss */
" pushq $0x2000\n" /* rsp */
" pushfq\n" /* eflags */
" pushq %[cs]\n"
" pushq %[target]\n"
" iretq" ::
[cs] "i" (__KERNEL_COMPAT32_CS),
[target] "b" (WARMBOOT_TRAMP));
}
#ifdef CONFIG_SMP
static void smp_halt(void)
{
......@@ -149,9 +119,6 @@ void machine_restart(char * __unused)
for (;;) {
/* Could also try the reset bit in the Hammer NB */
switch (reboot_type) {
case BOOT_BIOS:
reboot_warm();
case BOOT_KBD:
for (i=0; i<100; i++) {
kb_wait();
......
/*
* Switch back to real mode and call the BIOS reboot vector.
* This is a trampoline copied around in process.c
* Written 2003 by Andi Kleen, SuSE Labs.
*/
#include <asm/msr.h>
#define R(x) x-warm_reboot(%ebx)
#define R64(x) x-warm_reboot(%rbx)
/* running in identity mapping and in the first 64k of memory
and in compatibility mode. This must be position independent */
/* Follows 14.7 "Leaving Long Mode" in the AMD x86-64 manual, volume 2
and 8.9.2 "Switching Back to Real-Address Mode" in the Intel IA32
manual, volume 2 */
/* ebx: self pointer to warm_reboot */
.globl warm_reboot
warm_reboot:
addl %ebx, R64(real_mode_desc) /* relocate tables */
addl %ebx,2+R64(warm_gdt_desc)
movq %cr0,%rax
btr $31,%rax
movq %rax,%cr0 /* disable paging */
jmp 1f /* flush prefetch queue */
.code32
1: movl $MSR_EFER,%ecx
rdmsr
andl $~((1<<_EFER_LME)|(1<<_EFER_SCE)|(1<<_EFER_NX)),%eax
wrmsr /* disable long mode in EFER */
xorl %eax,%eax
movl %eax,%cr3 /* flush tlb */
/* Running protected mode without paging now */
wbinvd /* flush caches. Needed? */
lidt R(warm_idt_desc)
lgdt R(warm_gdt_desc)
movl $0x10,%ecx /* load segment registers with real mode settings */
movl %ecx,%ds
movl %ecx,%es
movl %ecx,%fs
movl %ecx,%gs
movl %ecx,%ss
lea R(real_mode_desc),%eax
ljmp *(%eax)
.code16:
real_mode:
xorl %eax,%eax
movl %eax,%cr0
/* some people claim $0xf000,0xfff0 is better. Use what 32bit linux uses. */
/* code as bytes because gas has problems with it */
.byte 0xea,0xf0,0xff,0x00,0xf0 /* ljmp 0xf000:0xfff0 */
real_mode_desc:
.long real_mode - warm_reboot
.short 8
warm_gdt_desc:
.short 8*3
.long warm_gdt - warm_reboot
warm_gdt:
.quad 0
.quad 0x00009a000000ffff /* 16-bit real-mode 64k code at 0x00000000 */
.quad 0x000092000100ffff /* 16-bit real-mode 64k data at 0x00000100 */
warm_idt_desc:
.short 0x3ff
.long 0
.globl warm_reboot_end
warm_reboot_end:
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