diff options
-rw-r--r-- | xen/arch/x86/efi/efi-boot.h | 2 | ||||
-rw-r--r-- | xen/common/efi/boot.c | 24 |
2 files changed, 16 insertions, 10 deletions
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 454ffb6fdb..3a3b4fe3b8 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -140,7 +140,7 @@ static void __init efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable, /* Populate E820 table and check trampoline area availability. */ e = e820map - 1; - for ( i = 0; i < map_size; i += desc_size ) + for ( e820nr = i = 0; i < map_size; i += desc_size ) { EFI_MEMORY_DESCRIPTOR *desc = map + i; u64 len = desc->NumberOfPages << EFI_PAGE_SHIFT; diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 3c63c0a395..c68efdb2b5 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -703,7 +703,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL; EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info; union string section = { NULL }, name; - bool_t base_video = 0; + bool_t base_video = 0, retry; char *option_str; bool_t use_cfg_file; @@ -1051,17 +1051,23 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) if ( !efi_memmap ) blexit(L"Unable to allocate memory for EFI memory map"); - status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key, - &efi_mdesc_size, &mdesc_ver); - if ( EFI_ERROR(status) ) - PrintErrMesg(L"Cannot obtain memory map", status); + for ( retry = 0; ; retry = 1 ) + { + status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key, + &efi_mdesc_size, &mdesc_ver); + if ( EFI_ERROR(status) ) + PrintErrMesg(L"Cannot obtain memory map", status); - efi_arch_process_memory_map(SystemTable, efi_memmap, efi_memmap_size, - efi_mdesc_size, mdesc_ver); + efi_arch_process_memory_map(SystemTable, efi_memmap, efi_memmap_size, + efi_mdesc_size, mdesc_ver); - efi_arch_pre_exit_boot(); + efi_arch_pre_exit_boot(); + + status = efi_bs->ExitBootServices(ImageHandle, map_key); + if ( status != EFI_INVALID_PARAMETER || retry ) + break; + } - status = efi_bs->ExitBootServices(ImageHandle, map_key); if ( EFI_ERROR(status) ) PrintErrMesg(L"Cannot exit boot services", status); |