x86, boot: Support loading bzImage, boot_params and ramdisk above 4G
authorYinghai Lu <yinghai@kernel.org>
Tue, 29 Jan 2013 04:16:44 +0000 (20:16 -0800)
committerH. Peter Anvin <hpa@linux.intel.com>
Wed, 30 Jan 2013 03:32:33 +0000 (19:32 -0800)
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>
arch/x86/boot/compressed/cmdline.c
arch/x86/boot/header.S
arch/x86/kernel/head64.c
arch/x86/kernel/setup.c

index b4c913c5c4add0d66d57465bd6a29e6b7c6487e4..bffd73b45b1f27a4dc6cdd2ab6ee5451cd1bbd0d 100644 (file)
@@ -17,6 +17,8 @@ static unsigned long get_cmd_line_ptr(void)
 {
        unsigned long cmd_line_ptr = real_mode->hdr.cmd_line_ptr;
 
+       cmd_line_ptr |= (u64)real_mode->ext_cmd_line_ptr << 32;
+
        return cmd_line_ptr;
 }
 int cmdline_find_option(const char *option, char *buffer, int bufsize)
index 944ce595f767621f07a47d6c89cdea9415627663..9ec06a1f6d61b2d64f6520bb68d1b0e047af1276 100644 (file)
@@ -374,6 +374,14 @@ xloadflags:
 #else
 # define XLF0 0
 #endif
+
+#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_X86_64)
+   /* kernel/boot_param/ramdisk could be loaded above 4g */
+# define XLF1 XLF_CAN_BE_LOADED_ABOVE_4G
+#else
+# define XLF1 0
+#endif
+
 #ifdef CONFIG_EFI_STUB
 # ifdef CONFIG_X86_64
 #  define XLF23 XLF_EFI_HANDOVER_64            /* 64-bit EFI handover ok */
@@ -383,7 +391,7 @@ xloadflags:
 #else
 # define XLF23 0
 #endif
-                       .word XLF0 | XLF23
+                       .word XLF0 | XLF1 | XLF23
 
 cmdline_size:   .long   COMMAND_LINE_SIZE-1     #length of the command line,
                                                 #added with boot protocol
index 62c8ce44cac437124324bc30cef664969ea157e8..6873b070d72cba1c8aeefb082cf8f7acef835854 100644 (file)
@@ -116,6 +116,8 @@ static unsigned long get_cmd_line_ptr(void)
 {
        unsigned long cmd_line_ptr = boot_params.hdr.cmd_line_ptr;
 
+       cmd_line_ptr |= (u64)boot_params.ext_cmd_line_ptr << 32;
+
        return cmd_line_ptr;
 }
 
index 83b38617ff59a8dae58ccbdcebd2cd15b3c1c840..519f2bc4950a58aab993d17d87703ca2750659d9 100644 (file)
@@ -298,12 +298,16 @@ static u64 __init get_ramdisk_image(void)
 {
        u64 ramdisk_image = boot_params.hdr.ramdisk_image;
 
+       ramdisk_image |= (u64)boot_params.ext_ramdisk_image << 32;
+
        return ramdisk_image;
 }
 static u64 __init get_ramdisk_size(void)
 {
        u64 ramdisk_size = boot_params.hdr.ramdisk_size;
 
+       ramdisk_size |= (u64)boot_params.ext_ramdisk_size << 32;
+
        return ramdisk_size;
 }