summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Young <dyoung@redhat.com>2013-12-20 18:05:46 +0800
committerSimon Horman <horms@verge.net.au>2014-01-21 14:01:28 +0900
commit9c200a85de2245a850546fded96a1977b84ad24d (patch)
tree6cee0ea5570ea4eb9aedab009cae7c6086de90b4
parentfe8a7c2ce02c407bdd7304bd2abfa637e26b6442 (diff)
Add efi_info in x86 setup header
For supporting efi runtime on kexec kernel we need to fill the efi_info struct in setup_header. I just get the info in kernel exported boot_params data in debugfs. Signed-off-by: Dave Young <dyoung@redhat.com> Tested-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--include/x86/x86-linux.h3
-rw-r--r--kexec/arch/i386/crashdump-x86.c4
-rw-r--r--kexec/arch/i386/x86-linux-setup.c9
-rw-r--r--kexec/arch/i386/x86-linux-setup.h1
-rw-r--r--kexec/arch/x86_64/kexec-bzImage64.c6
5 files changed, 21 insertions, 2 deletions
diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
index c41e5f2..50c7324 100644
--- a/include/x86/x86-linux.h
+++ b/include/x86/x86-linux.h
@@ -113,7 +113,8 @@ struct x86_linux_param_header {
uint32_t ext_ramdisk_image; /* 0xc0 */
uint32_t ext_ramdisk_size; /* 0xc4 */
uint32_t ext_cmd_line_ptr; /* 0xc8 */
- uint8_t reserved4_1[0x1e0 - 0xcc]; /* 0xcc */
+ uint8_t reserved4_1[0x1c0 - 0xcc]; /* 0xe4 */
+ uint8_t efi_info[32]; /* 0x1c0 */
uint32_t alt_mem_k; /* 0x1e0 */
uint8_t reserved5[4]; /* 0x1e4 */
uint8_t e820_map_nr; /* 0x1e8 */
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index ca98165..53bd077 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -41,6 +41,7 @@
#include "../../crashdump.h"
#include "kexec-x86.h"
#include "crashdump-x86.h"
+#include "x86-linux-setup.h"
#ifdef HAVE_LIBXENCTRL
#include <xenctrl.h>
@@ -935,7 +936,8 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
if (delete_memmap(memmap_p, elfcorehdr, memsz) < 0)
return -1;
cmdline_add_memmap(mod_cmdline, memmap_p);
- cmdline_add_efi(mod_cmdline);
+ if (!bzImage_support_efi_boot)
+ cmdline_add_efi(mod_cmdline);
cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr);
/* Inform second kernel about the presence of ACPI tables. */
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 7b4c65d..38bd9dd 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -480,6 +480,13 @@ void setup_subarch(struct x86_linux_param_header *real_mode)
get_bootparam(&real_mode->hardware_subarch, offset, sizeof(uint32_t));
}
+static void setup_efi_info(struct x86_linux_param_header *real_mode)
+{
+ off_t offset = offsetof(typeof(*real_mode), efi_info);
+
+ get_bootparam(&real_mode->efi_info, offset, 32);
+}
+
void setup_linux_system_parameters(struct kexec_info *info,
struct x86_linux_param_header *real_mode)
{
@@ -489,6 +496,8 @@ void setup_linux_system_parameters(struct kexec_info *info,
/* get subarch from running kernel */
setup_subarch(real_mode);
+ if (bzImage_support_efi_boot)
+ setup_efi_info(real_mode);
/* Default screen size */
real_mode->orig_x = 0;
diff --git a/kexec/arch/i386/x86-linux-setup.h b/kexec/arch/i386/x86-linux-setup.h
index 2afe97c..6fb84b4 100644
--- a/kexec/arch/i386/x86-linux-setup.h
+++ b/kexec/arch/i386/x86-linux-setup.h
@@ -29,5 +29,6 @@ void setup_linux_system_parameters(struct kexec_info *info,
/* command line parameter may be appended by purgatory */
#define PURGATORY_CMDLINE_SIZE 64
+extern int bzImage_support_efi_boot;
#endif /* X86_LINUX_SETUP_H */
diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
index a7b9f15..1983bcf 100644
--- a/kexec/arch/x86_64/kexec-bzImage64.c
+++ b/kexec/arch/x86_64/kexec-bzImage64.c
@@ -42,6 +42,7 @@
#include <arch/options.h>
static const int probe_debug = 0;
+int bzImage_support_efi_boot;
int bzImage64_probe(const char *buf, off_t len)
{
@@ -82,6 +83,11 @@ int bzImage64_probe(const char *buf, off_t len)
/* Must be KERNEL_64 and CAN_BE_LOADED_ABOVE_4G */
return -1;
}
+
+#define XLF_EFI_KEXEC (1 << 4)
+ if ((header->xloadflags & XLF_EFI_KEXEC) == XLF_EFI_KEXEC)
+ bzImage_support_efi_boot = 1;
+
/* I've got a relocatable bzImage64 */
if (probe_debug)
fprintf(stderr, "It's a relocatable bzImage64\n");