diff options
| author | Huang, Ying <ying.huang@intel.com> | 2008-03-27 22:49:44 -0400 | 
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-04-26 15:34:42 -0400 | 
| commit | 8b664aa66e824a0ddf4ec56d41fa0cf7bb374de6 (patch) | |
| tree | 57c5de72c38f630e126964b922c379c4a7e49100 | |
| parent | 50eae2a7c9862afe263a2003c12f457ecfc9e6a2 (diff) | |
x86, boot: add linked list of struct setup_data
This patch adds a field of 64-bit physical pointer to NULL terminated
single linked list of struct setup_data to real-mode kernel
header. This is used as a more extensible boot parameters passing
mechanism.
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
| -rw-r--r-- | arch/x86/boot/header.S | 6 | ||||
| -rw-r--r-- | arch/x86/kernel/head64.c | 20 | ||||
| -rw-r--r-- | arch/x86/kernel/setup_64.c | 22 | ||||
| -rw-r--r-- | include/asm-x86/bootparam.h | 14 | 
4 files changed, 61 insertions, 1 deletions
| diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 6d2df8d61c54..af86e431acfa 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
| @@ -120,7 +120,7 @@ _start: | |||
| 120 | # Part 2 of the header, from the old setup.S | 120 | # Part 2 of the header, from the old setup.S | 
| 121 | 121 | ||
| 122 | .ascii "HdrS" # header signature | 122 | .ascii "HdrS" # header signature | 
| 123 | .word 0x0208 # header version number (>= 0x0105) | 123 | .word 0x0209 # header version number (>= 0x0105) | 
| 124 | # or else old loadlin-1.5 will fail) | 124 | # or else old loadlin-1.5 will fail) | 
| 125 | .globl realmode_swtch | 125 | .globl realmode_swtch | 
| 126 | realmode_swtch: .word 0, 0 # default_switch, SETUPSEG | 126 | realmode_swtch: .word 0, 0 # default_switch, SETUPSEG | 
| @@ -227,6 +227,10 @@ hardware_subarch_data: .quad 0 | |||
| 227 | payload_offset: .long input_data | 227 | payload_offset: .long input_data | 
| 228 | payload_length: .long input_data_end-input_data | 228 | payload_length: .long input_data_end-input_data | 
| 229 | 229 | ||
| 230 | setup_data: .quad 0 # 64-bit physical pointer to | ||
| 231 | # single linked list of | ||
| 232 | # struct setup_data | ||
| 233 | |||
| 230 | # End of setup header ##################################################### | 234 | # End of setup header ##################################################### | 
| 231 | 235 | ||
| 232 | .section ".inittext", "ax" | 236 | .section ".inittext", "ax" | 
| diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index d31d6b72d60d..e25c57b8aa84 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/string.h> | 11 | #include <linux/string.h> | 
| 12 | #include <linux/percpu.h> | 12 | #include <linux/percpu.h> | 
| 13 | #include <linux/start_kernel.h> | 13 | #include <linux/start_kernel.h> | 
| 14 | #include <linux/io.h> | ||
| 14 | 15 | ||
| 15 | #include <asm/processor.h> | 16 | #include <asm/processor.h> | 
| 16 | #include <asm/proto.h> | 17 | #include <asm/proto.h> | 
| @@ -100,6 +101,24 @@ static void __init reserve_ebda_region(void) | |||
| 100 | reserve_early(lowmem, 0x100000, "BIOS reserved"); | 101 | reserve_early(lowmem, 0x100000, "BIOS reserved"); | 
| 101 | } | 102 | } | 
| 102 | 103 | ||
| 104 | static void __init reserve_setup_data(void) | ||
| 105 | { | ||
| 106 | struct setup_data *data; | ||
| 107 | unsigned long pa_data; | ||
| 108 | char buf[32]; | ||
| 109 | |||
| 110 | if (boot_params.hdr.version < 0x0209) | ||
| 111 | return; | ||
| 112 | pa_data = boot_params.hdr.setup_data; | ||
| 113 | while (pa_data) { | ||
| 114 | data = early_ioremap(pa_data, sizeof(*data)); | ||
| 115 | sprintf(buf, "setup data %x", data->type); | ||
| 116 | reserve_early(pa_data, pa_data+sizeof(*data)+data->len, buf); | ||
| 117 | pa_data = data->next; | ||
| 118 | early_iounmap(data, sizeof(*data)); | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 103 | void __init x86_64_start_kernel(char * real_mode_data) | 122 | void __init x86_64_start_kernel(char * real_mode_data) | 
| 104 | { | 123 | { | 
| 105 | int i; | 124 | int i; | 
| @@ -156,6 +175,7 @@ void __init x86_64_start_kernel(char * real_mode_data) | |||
| 156 | #endif | 175 | #endif | 
| 157 | 176 | ||
| 158 | reserve_ebda_region(); | 177 | reserve_ebda_region(); | 
| 178 | reserve_setup_data(); | ||
| 159 | 179 | ||
| 160 | /* | 180 | /* | 
| 161 | * At this point everything still needed from the boot loader | 181 | * At this point everything still needed from the boot loader | 
| diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 17bdf2343095..e1a21d6b3671 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
| @@ -264,6 +264,26 @@ void __attribute__((weak)) __init memory_setup(void) | |||
| 264 | machine_specific_memory_setup(); | 264 | machine_specific_memory_setup(); | 
| 265 | } | 265 | } | 
| 266 | 266 | ||
| 267 | static void __init parse_setup_data(void) | ||
| 268 | { | ||
| 269 | struct setup_data *data; | ||
| 270 | unsigned long pa_data; | ||
| 271 | |||
| 272 | if (boot_params.hdr.version < 0x0209) | ||
| 273 | return; | ||
| 274 | pa_data = boot_params.hdr.setup_data; | ||
| 275 | while (pa_data) { | ||
| 276 | data = early_ioremap(pa_data, PAGE_SIZE); | ||
| 277 | switch (data->type) { | ||
| 278 | default: | ||
| 279 | break; | ||
| 280 | } | ||
| 281 | free_early(pa_data, pa_data+sizeof(*data)+data->len); | ||
| 282 | pa_data = data->next; | ||
| 283 | early_iounmap(data, PAGE_SIZE); | ||
| 284 | } | ||
| 285 | } | ||
| 286 | |||
| 267 | /* | 287 | /* | 
| 268 | * setup_arch - architecture-specific boot-time initializations | 288 | * setup_arch - architecture-specific boot-time initializations | 
| 269 | * | 289 | * | 
| @@ -316,6 +336,8 @@ void __init setup_arch(char **cmdline_p) | |||
| 316 | strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); | 336 | strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); | 
| 317 | *cmdline_p = command_line; | 337 | *cmdline_p = command_line; | 
| 318 | 338 | ||
| 339 | parse_setup_data(); | ||
| 340 | |||
| 319 | parse_early_param(); | 341 | parse_early_param(); | 
| 320 | 342 | ||
| 321 | #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT | 343 | #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT | 
| diff --git a/include/asm-x86/bootparam.h b/include/asm-x86/bootparam.h index 51151356840f..e8659909e5f6 100644 --- a/include/asm-x86/bootparam.h +++ b/include/asm-x86/bootparam.h | |||
| @@ -9,6 +9,17 @@ | |||
| 9 | #include <asm/ist.h> | 9 | #include <asm/ist.h> | 
| 10 | #include <video/edid.h> | 10 | #include <video/edid.h> | 
| 11 | 11 | ||
| 12 | /* setup data types */ | ||
| 13 | #define SETUP_NONE 0 | ||
| 14 | |||
| 15 | /* extensible setup data list node */ | ||
| 16 | struct setup_data { | ||
| 17 | u64 next; | ||
| 18 | u32 type; | ||
| 19 | u32 len; | ||
| 20 | u8 data[0]; | ||
| 21 | }; | ||
| 22 | |||
| 12 | struct setup_header { | 23 | struct setup_header { | 
| 13 | __u8 setup_sects; | 24 | __u8 setup_sects; | 
| 14 | __u16 root_flags; | 25 | __u16 root_flags; | 
| @@ -46,6 +57,9 @@ struct setup_header { | |||
| 46 | __u32 cmdline_size; | 57 | __u32 cmdline_size; | 
| 47 | __u32 hardware_subarch; | 58 | __u32 hardware_subarch; | 
| 48 | __u64 hardware_subarch_data; | 59 | __u64 hardware_subarch_data; | 
| 60 | __u32 payload_offset; | ||
| 61 | __u32 payload_length; | ||
| 62 | __u64 setup_data; | ||
| 49 | } __attribute__((packed)); | 63 | } __attribute__((packed)); | 
| 50 | 64 | ||
| 51 | struct sys_desc_table { | 65 | struct sys_desc_table { | 
