2 * linux/arch/x86_64/kernel/head64.c -- prepare to run common code
4 * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE
6 * $Id: head64.c,v 1.22 2001/07/06 14:28:20 ak Exp $
9 #include <linux/init.h>
10 #include <linux/linkage.h>
11 #include <linux/types.h>
12 #include <linux/kernel.h>
13 #include <linux/string.h>
15 #include <asm/processor.h>
16 #include <asm/proto.h>
18 #include <asm/bootsetup.h>
20 /* Don't add a printk in there. printk relies on the PDA which is not initialized
22 static void __init clear_bss(void)
24 extern char __bss_start[], __bss_end[];
25 memset(__bss_start, 0,
26 (unsigned long) __bss_end - (unsigned long) __bss_start);
29 extern char x86_boot_params[2048];
31 #define NEW_CL_POINTER 0x228 /* Relative to real mode data */
32 #define OLD_CL_MAGIC_ADDR 0x90020
33 #define OLD_CL_MAGIC 0xA33F
34 #define OLD_CL_BASE_ADDR 0x90000
35 #define OLD_CL_OFFSET 0x90022
37 extern char saved_command_line[];
39 static void __init copy_bootdata(char *real_mode_data)
44 memcpy(x86_boot_params, real_mode_data, 2048);
45 new_data = *(int *) (x86_boot_params + NEW_CL_POINTER);
47 if (OLD_CL_MAGIC != * (u16 *) OLD_CL_MAGIC_ADDR) {
48 printk("so old bootloader that it does not support commandline?!\n");
51 new_data = OLD_CL_BASE_ADDR + * (u16 *) OLD_CL_OFFSET;
52 printk("old bootloader convention, maybe loadlin?\n");
54 command_line = (char *) ((u64)(new_data));
55 memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
56 printk("Bootdata ok (command line is %s)\n", saved_command_line);
59 static void __init setup_boot_cpu_data(void)
64 cpuid(0, &boot_cpu_data.cpuid_level,
65 (int *)&boot_cpu_data.x86_vendor_id[0],
66 (int *)&boot_cpu_data.x86_vendor_id[8],
67 (int *)&boot_cpu_data.x86_vendor_id[4]);
70 cpuid(1, &eax, &dummy, &dummy, (int *) &boot_cpu_data.x86_capability);
71 boot_cpu_data.x86 = (eax >> 8) & 0xf;
72 boot_cpu_data.x86_model = (eax >> 4) & 0xf;
73 boot_cpu_data.x86_mask = eax & 0xf;
76 void __init x86_64_start_kernel(char * real_mode_data)
82 copy_bootdata(real_mode_data);
83 /* default console: */
84 if (!strstr(saved_command_line, "console="))
85 strcat(saved_command_line, " console=tty0");
86 s = strstr(saved_command_line, "earlyprintk=");
88 setup_early_printk(s);
89 #ifdef CONFIG_DISCONTIGMEM
90 s = strstr(saved_command_line, "numa=");
94 #ifdef CONFIG_X86_IO_APIC
95 if (strstr(saved_command_line, "disableapic"))
98 setup_boot_cpu_data();