diff options
author | Yinghai Lu <yinghai@kernel.org> | 2013-01-28 23:16:44 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-01-29 22:32:33 -0500 |
commit | ee92d815027a76ef92f3ec7b155b0c8aa345f239 (patch) | |
tree | a5315ec33bba27ada3247e7e045912827f05a5e1 | |
parent | 0e691cf824f76adefb4498fe39c300aba2c2575a (diff) |
x86, boot: Support loading bzImage, boot_params and ramdisk above 4G
xloadflags bit 1 indicates that we can load the kernel and all data
structures above 4G; it is set if kernel is relocatable and 64bit.
bootloader will check if xloadflags bit 1 is set to decide if
it could load ramdisk and kernel high above 4G.
bootloader will fill value to ext_ramdisk_image/size for high 32bits
when it load ramdisk above 4G.
kernel use get_ramdisk_image/size to use ext_ramdisk_image/size to get
right positon for ramdisk.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Rob Landley <rob@landley.net>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Gokul Caushik <caushik1@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Joe Millenbach <jmillenbach@gmail.com>
Link: http://lkml.kernel.org/r/1359058816-7615-26-git-send-email-yinghai@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | arch/x86/boot/compressed/cmdline.c | 2 | ||||
-rw-r--r-- | arch/x86/boot/header.S | 10 | ||||
-rw-r--r-- | arch/x86/kernel/head64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 4 |
4 files changed, 17 insertions, 1 deletions
diff --git a/arch/x86/boot/compressed/cmdline.c b/arch/x86/boot/compressed/cmdline.c index b4c913c5c4ad..bffd73b45b1f 100644 --- a/arch/x86/boot/compressed/cmdline.c +++ b/arch/x86/boot/compressed/cmdline.c | |||
@@ -17,6 +17,8 @@ static unsigned long get_cmd_line_ptr(void) | |||
17 | { | 17 | { |
18 | unsigned long cmd_line_ptr = real_mode->hdr.cmd_line_ptr; | 18 | unsigned long cmd_line_ptr = real_mode->hdr.cmd_line_ptr; |
19 | 19 | ||
20 | cmd_line_ptr |= (u64)real_mode->ext_cmd_line_ptr << 32; | ||
21 | |||
20 | return cmd_line_ptr; | 22 | return cmd_line_ptr; |
21 | } | 23 | } |
22 | int cmdline_find_option(const char *option, char *buffer, int bufsize) | 24 | int cmdline_find_option(const char *option, char *buffer, int bufsize) |
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 944ce595f767..9ec06a1f6d61 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
@@ -374,6 +374,14 @@ xloadflags: | |||
374 | #else | 374 | #else |
375 | # define XLF0 0 | 375 | # define XLF0 0 |
376 | #endif | 376 | #endif |
377 | |||
378 | #if defined(CONFIG_RELOCATABLE) && defined(CONFIG_X86_64) | ||
379 | /* kernel/boot_param/ramdisk could be loaded above 4g */ | ||
380 | # define XLF1 XLF_CAN_BE_LOADED_ABOVE_4G | ||
381 | #else | ||
382 | # define XLF1 0 | ||
383 | #endif | ||
384 | |||
377 | #ifdef CONFIG_EFI_STUB | 385 | #ifdef CONFIG_EFI_STUB |
378 | # ifdef CONFIG_X86_64 | 386 | # ifdef CONFIG_X86_64 |
379 | # define XLF23 XLF_EFI_HANDOVER_64 /* 64-bit EFI handover ok */ | 387 | # define XLF23 XLF_EFI_HANDOVER_64 /* 64-bit EFI handover ok */ |
@@ -383,7 +391,7 @@ xloadflags: | |||
383 | #else | 391 | #else |
384 | # define XLF23 0 | 392 | # define XLF23 0 |
385 | #endif | 393 | #endif |
386 | .word XLF0 | XLF23 | 394 | .word XLF0 | XLF1 | XLF23 |
387 | 395 | ||
388 | cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line, | 396 | cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line, |
389 | #added with boot protocol | 397 | #added with boot protocol |
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 62c8ce44cac4..6873b070d72c 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
@@ -116,6 +116,8 @@ static unsigned long get_cmd_line_ptr(void) | |||
116 | { | 116 | { |
117 | unsigned long cmd_line_ptr = boot_params.hdr.cmd_line_ptr; | 117 | unsigned long cmd_line_ptr = boot_params.hdr.cmd_line_ptr; |
118 | 118 | ||
119 | cmd_line_ptr |= (u64)boot_params.ext_cmd_line_ptr << 32; | ||
120 | |||
119 | return cmd_line_ptr; | 121 | return cmd_line_ptr; |
120 | } | 122 | } |
121 | 123 | ||
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 83b38617ff59..519f2bc4950a 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -298,12 +298,16 @@ static u64 __init get_ramdisk_image(void) | |||
298 | { | 298 | { |
299 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; | 299 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; |
300 | 300 | ||
301 | ramdisk_image |= (u64)boot_params.ext_ramdisk_image << 32; | ||
302 | |||
301 | return ramdisk_image; | 303 | return ramdisk_image; |
302 | } | 304 | } |
303 | static u64 __init get_ramdisk_size(void) | 305 | static u64 __init get_ramdisk_size(void) |
304 | { | 306 | { |
305 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; | 307 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; |
306 | 308 | ||
309 | ramdisk_size |= (u64)boot_params.ext_ramdisk_size << 32; | ||
310 | |||
307 | return ramdisk_size; | 311 | return ramdisk_size; |
308 | } | 312 | } |
309 | 313 | ||