diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/cpu/efi/payload.c | 37 | ||||
-rw-r--r-- | arch/x86/include/asm/zimage.h | 1 | ||||
-rw-r--r-- | arch/x86/lib/zimage.c | 4 |
3 files changed, 42 insertions, 0 deletions
diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index 0e7c7c1ba4..c323c7b19a 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -8,6 +8,7 @@ #include <efi.h> #include <errno.h> #include <usb.h> +#include <asm/bootparam.h> #include <asm/e820.h> #include <asm/post.h> @@ -250,3 +251,39 @@ unsigned int install_e820_map(unsigned int max_entries, return num_entries; } + +void setup_efi_info(struct efi_info *efi_info) +{ + struct efi_entry_systable *table; + struct efi_entry_memmap *map; + char *signature; + int size, ret; + + memset(efi_info, 0, sizeof(struct efi_info)); + + ret = efi_info_get(EFIET_SYS_TABLE, (void **)&table, &size); + if (ret) { + printf("Cannot find EFI system table, ret=%d\n", ret); + return; + } + efi_info->efi_systab = (u32)(table->sys_table); + + ret = efi_info_get(EFIET_MEMORY_MAP, (void **)&map, &size); + if (ret) { + printf("Cannot find EFI memory map tables, ret=%d\n", ret); + return; + } + efi_info->efi_memdesc_size = map->desc_size; + efi_info->efi_memdesc_version = map->version; + efi_info->efi_memmap = (u32)(map->desc); + efi_info->efi_memmap_size = size - sizeof(struct efi_entry_memmap); + +#ifdef CONFIG_EFI_STUB_64BIT + efi_info->efi_systab_hi = table->sys_table >> 32; + efi_info->efi_memmap_hi = (u64)(u32)(map->desc) >> 32; + signature = EFI64_LOADER_SIGNATURE; +#else + signature = EFI32_LOADER_SIGNATURE; +#endif + memcpy(&efi_info->efi_loader_signature, signature, 4); +} diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h index 03bed54d0b..80e128ccf3 100644 --- a/arch/x86/include/asm/zimage.h +++ b/arch/x86/include/asm/zimage.h @@ -35,5 +35,6 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size, int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, unsigned long initrd_addr, unsigned long initrd_size); void setup_video(struct screen_info *screen_info); +void setup_efi_info(struct efi_info *efi_info); #endif diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 04ed972482..0442fda760 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -295,6 +295,10 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, setup_device_tree(hdr, (const void *)env_get_hex("fdtaddr", 0)); setup_video(&setup_base->screen_info); +#ifdef CONFIG_EFI_STUB + setup_efi_info(&setup_base->efi_info); +#endif + return 0; } |