diff options
-rw-r--r-- | arch/x86/platform/efi/efi.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index a46a73ecc5f3..b30aa26a8df2 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -502,7 +502,8 @@ void __init efi_enter_virtual_mode(void) | |||
502 | efi_status_t status; | 502 | efi_status_t status; |
503 | unsigned long size; | 503 | unsigned long size; |
504 | u64 end, systab, addr, npages, end_pfn; | 504 | u64 end, systab, addr, npages, end_pfn; |
505 | void *p, *va; | 505 | void *p, *va, *new_memmap = NULL; |
506 | int count = 0; | ||
506 | 507 | ||
507 | efi.systab = NULL; | 508 | efi.systab = NULL; |
508 | 509 | ||
@@ -569,15 +570,21 @@ void __init efi_enter_virtual_mode(void) | |||
569 | systab += md->virt_addr - md->phys_addr; | 570 | systab += md->virt_addr - md->phys_addr; |
570 | efi.systab = (efi_system_table_t *) (unsigned long) systab; | 571 | efi.systab = (efi_system_table_t *) (unsigned long) systab; |
571 | } | 572 | } |
573 | new_memmap = krealloc(new_memmap, | ||
574 | (count + 1) * memmap.desc_size, | ||
575 | GFP_KERNEL); | ||
576 | memcpy(new_memmap + (count * memmap.desc_size), md, | ||
577 | memmap.desc_size); | ||
578 | count++; | ||
572 | } | 579 | } |
573 | 580 | ||
574 | BUG_ON(!efi.systab); | 581 | BUG_ON(!efi.systab); |
575 | 582 | ||
576 | status = phys_efi_set_virtual_address_map( | 583 | status = phys_efi_set_virtual_address_map( |
577 | memmap.desc_size * memmap.nr_map, | 584 | memmap.desc_size * count, |
578 | memmap.desc_size, | 585 | memmap.desc_size, |
579 | memmap.desc_version, | 586 | memmap.desc_version, |
580 | memmap.phys_map); | 587 | (efi_memory_desc_t *)__pa(new_memmap)); |
581 | 588 | ||
582 | if (status != EFI_SUCCESS) { | 589 | if (status != EFI_SUCCESS) { |
583 | printk(KERN_ALERT "Unable to switch EFI into virtual mode " | 590 | printk(KERN_ALERT "Unable to switch EFI into virtual mode " |
@@ -605,6 +612,7 @@ void __init efi_enter_virtual_mode(void) | |||
605 | runtime_code_page_mkexec(); | 612 | runtime_code_page_mkexec(); |
606 | early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); | 613 | early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); |
607 | memmap.map = NULL; | 614 | memmap.map = NULL; |
615 | kfree(new_memmap); | ||
608 | } | 616 | } |
609 | 617 | ||
610 | /* | 618 | /* |