Commit 52cccc64 authored by Ingo Molnar's avatar Ingo Molnar

x86/boot: Clean up the arch/x86/boot/main.c code a bit

 - Don't line break user-visible strings

 - Use consistent comment style

 - Remove unnecessary col80 line breaks
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Uros Bizjak <ubizjak@gmail.com>
Cc: linux-kernel@vger.kernel.org
parent b855cc58
...@@ -27,34 +27,32 @@ char *heap_end = _end; /* Default end of heap = no heap */ ...@@ -27,34 +27,32 @@ char *heap_end = _end; /* Default end of heap = no heap */
* screws up the old-style command line protocol, adjust by * screws up the old-style command line protocol, adjust by
* filling in the new-style command line pointer instead. * filling in the new-style command line pointer instead.
*/ */
static void copy_boot_params(void) static void copy_boot_params(void)
{ {
struct old_cmdline { struct old_cmdline {
u16 cl_magic; u16 cl_magic;
u16 cl_offset; u16 cl_offset;
}; };
const struct old_cmdline * const oldcmd = const struct old_cmdline * const oldcmd = absolute_pointer(OLD_CL_ADDRESS);
absolute_pointer(OLD_CL_ADDRESS);
BUILD_BUG_ON(sizeof(boot_params) != 4096); BUILD_BUG_ON(sizeof(boot_params) != 4096);
memcpy(&boot_params.hdr, &hdr, sizeof(hdr)); memcpy(&boot_params.hdr, &hdr, sizeof(hdr));
if (!boot_params.hdr.cmd_line_ptr && if (!boot_params.hdr.cmd_line_ptr && oldcmd->cl_magic == OLD_CL_MAGIC) {
oldcmd->cl_magic == OLD_CL_MAGIC) { /* Old-style command line protocol */
/* Old-style command line protocol. */
u16 cmdline_seg; u16 cmdline_seg;
/* Figure out if the command line falls in the region /*
of memory that an old kernel would have copied up * Figure out if the command line falls in the region
to 0x90000... */ * of memory that an old kernel would have copied up
* to 0x90000...
*/
if (oldcmd->cl_offset < boot_params.hdr.setup_move_size) if (oldcmd->cl_offset < boot_params.hdr.setup_move_size)
cmdline_seg = ds(); cmdline_seg = ds();
else else
cmdline_seg = 0x9000; cmdline_seg = 0x9000;
boot_params.hdr.cmd_line_ptr = boot_params.hdr.cmd_line_ptr = (cmdline_seg << 4) + oldcmd->cl_offset;
(cmdline_seg << 4) + oldcmd->cl_offset;
} }
} }
...@@ -66,6 +64,7 @@ static void copy_boot_params(void) ...@@ -66,6 +64,7 @@ static void copy_boot_params(void)
static void keyboard_init(void) static void keyboard_init(void)
{ {
struct biosregs ireg, oreg; struct biosregs ireg, oreg;
initregs(&ireg); initregs(&ireg);
ireg.ah = 0x02; /* Get keyboard status */ ireg.ah = 0x02; /* Get keyboard status */
...@@ -83,8 +82,10 @@ static void query_ist(void) ...@@ -83,8 +82,10 @@ static void query_ist(void)
{ {
struct biosregs ireg, oreg; struct biosregs ireg, oreg;
/* Some older BIOSes apparently crash on this call, so filter /*
it from machines too old to have SpeedStep at all. */ * Some older BIOSes apparently crash on this call, so filter
* it from machines too old to have SpeedStep at all.
*/
if (cpu.level < 6) if (cpu.level < 6)
return; return;
...@@ -119,16 +120,13 @@ static void init_heap(void) ...@@ -119,16 +120,13 @@ static void init_heap(void)
char *stack_end; char *stack_end;
if (boot_params.hdr.loadflags & CAN_USE_HEAP) { if (boot_params.hdr.loadflags & CAN_USE_HEAP) {
stack_end = (char *) stack_end = (char *) (current_stack_pointer - STACK_SIZE);
(current_stack_pointer - STACK_SIZE); heap_end = (char *) ((size_t)boot_params.hdr.heap_end_ptr + 0x200);
heap_end = (char *)
((size_t)boot_params.hdr.heap_end_ptr + 0x200);
if (heap_end > stack_end) if (heap_end > stack_end)
heap_end = stack_end; heap_end = stack_end;
} else { } else {
/* Boot protocol 2.00 only, no heap available */ /* Boot protocol 2.00 only, no heap available */
puts("WARNING: Ancient bootloader, some functionality " puts("WARNING: Ancient bootloader, some functionality may be limited!\n");
"may be limited!\n");
} }
} }
...@@ -149,12 +147,11 @@ void main(void) ...@@ -149,12 +147,11 @@ void main(void)
/* Make sure we have all the proper CPU support */ /* Make sure we have all the proper CPU support */
if (validate_cpu()) { if (validate_cpu()) {
puts("Unable to boot - please use a kernel appropriate " puts("Unable to boot - please use a kernel appropriate for your CPU.\n");
"for your CPU.\n");
die(); die();
} }
/* Tell the BIOS what CPU mode we intend to run in. */ /* Tell the BIOS what CPU mode we intend to run in */
set_bios_mode(); set_bios_mode();
/* Detect memory layout */ /* Detect memory layout */
......
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