Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a8c9aeb authored by Jarkko Sakkinen's avatar Jarkko Sakkinen Committed by H. Peter Anvin
Browse files

x86, realmode: Move reboot_32.S to unified realmode code



Migrated reboot_32.S from x86_trampoline to the real-mode
blob.

Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@intel.com>
Link: http://lkml.kernel.org/r/1336501366-28617-5-git-send-email-jarkko.sakkinen@intel.com


Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 084ee1c6
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -9,6 +9,10 @@ struct real_mode_header {
	u32	text_start;
	u32	text_start;
	u32	ro_end;
	u32	ro_end;
	u32	end;
	u32	end;
	/* reboot */
#ifdef CONFIG_X86_32
	u32	machine_real_restart_asm;
#endif
} __attribute__((__packed__));
} __attribute__((__packed__));


extern struct real_mode_header real_mode_header;
extern struct real_mode_header real_mode_header;
+0 −1
Original line number Original line Diff line number Diff line
@@ -49,7 +49,6 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-y				+= cpu/
obj-y				+= cpu/
obj-y				+= acpi/
obj-y				+= acpi/
obj-y				+= reboot.o
obj-y				+= reboot.o
obj-$(CONFIG_X86_32)		+= reboot_32.o
obj-$(CONFIG_MCA)		+= mca_32.o
obj-$(CONFIG_MCA)		+= mca_32.o
obj-$(CONFIG_X86_MSR)		+= msr.o
obj-$(CONFIG_X86_MSR)		+= msr.o
obj-$(CONFIG_X86_CPUID)		+= cpuid.o
obj-$(CONFIG_X86_CPUID)		+= cpuid.o
+3 −22
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@
#ifdef CONFIG_X86_32
#ifdef CONFIG_X86_32
# include <linux/ctype.h>
# include <linux/ctype.h>
# include <linux/mc146818rtc.h>
# include <linux/mc146818rtc.h>
# include <asm/realmode.h>
#else
#else
# include <asm/x86_init.h>
# include <asm/x86_init.h>
#endif
#endif
@@ -332,15 +333,10 @@ static int __init reboot_init(void)
}
}
core_initcall(reboot_init);
core_initcall(reboot_init);


extern const unsigned char machine_real_restart_asm[];
extern const u64 machine_real_restart_gdt[3];

void machine_real_restart(unsigned int type)
void machine_real_restart(unsigned int type)
{
{
	void *restart_va;
	void (*restart_lowmem)(unsigned int) = (void (*)(unsigned int))
	unsigned long restart_pa;
		real_mode_header.machine_real_restart_asm;
	void (*restart_lowmem)(unsigned int);
	u64 *lowmem_gdt;


	local_irq_disable();
	local_irq_disable();


@@ -369,21 +365,6 @@ void machine_real_restart(unsigned int type)
	   too. */
	   too. */
	*((unsigned short *)0x472) = reboot_mode;
	*((unsigned short *)0x472) = reboot_mode;


	/* Patch the GDT in the low memory trampoline */
	lowmem_gdt = TRAMPOLINE_SYM(machine_real_restart_gdt);

	restart_va = TRAMPOLINE_SYM(machine_real_restart_asm);
	restart_pa = virt_to_phys(restart_va);
	restart_lowmem = (void (*)(unsigned int))restart_pa;

	/* GDT[0]: GDT self-pointer */
	lowmem_gdt[0] =
		(u64)(sizeof(machine_real_restart_gdt) - 1) +
		((u64)virt_to_phys(lowmem_gdt) << 16);
	/* GDT[1]: 64K real mode code segment */
	lowmem_gdt[1] =
		GDT_ENTRY(0x009b, restart_pa, 0xffff);

	/* Jump to the identity-mapped low memory code */
	/* Jump to the identity-mapped low memory code */
	restart_lowmem(type);
	restart_lowmem(type);
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -12,6 +12,7 @@ subdir- := wakeup
always := realmode.bin
always := realmode.bin


realmode-y			+= header.o
realmode-y			+= header.o
realmode-$(CONFIG_X86_32)	+= reboot_32.o


targets	+= $(realmode-y)
targets	+= $(realmode-y)


+3 −0
Original line number Original line Diff line number Diff line
@@ -13,4 +13,7 @@ ENTRY(real_mode_header)
		.long	pa_text_start
		.long	pa_text_start
		.long	pa_ro_end
		.long	pa_ro_end
		.long	pa_end
		.long	pa_end
#ifdef CONFIG_X86_32
		.long	pa_machine_real_restart_asm
#endif
END(real_mode_header)
END(real_mode_header)
Loading