diff options
Diffstat (limited to 'arch/x86/kernel/efi.c')
-rw-r--r-- | arch/x86/kernel/efi.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c index 759e02bec070..77d424cf68b3 100644 --- a/arch/x86/kernel/efi.c +++ b/arch/x86/kernel/efi.c | |||
@@ -383,6 +383,7 @@ static void __init runtime_code_page_mkexec(void) | |||
383 | { | 383 | { |
384 | efi_memory_desc_t *md; | 384 | efi_memory_desc_t *md; |
385 | void *p; | 385 | void *p; |
386 | u64 addr, npages; | ||
386 | 387 | ||
387 | /* Make EFI runtime service code area executable */ | 388 | /* Make EFI runtime service code area executable */ |
388 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | 389 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { |
@@ -391,7 +392,10 @@ static void __init runtime_code_page_mkexec(void) | |||
391 | if (md->type != EFI_RUNTIME_SERVICES_CODE) | 392 | if (md->type != EFI_RUNTIME_SERVICES_CODE) |
392 | continue; | 393 | continue; |
393 | 394 | ||
394 | set_memory_x(md->virt_addr, md->num_pages); | 395 | addr = md->virt_addr; |
396 | npages = md->num_pages; | ||
397 | memrange_efi_to_native(&addr, &npages); | ||
398 | set_memory_x(addr, npages); | ||
395 | } | 399 | } |
396 | } | 400 | } |
397 | 401 | ||
@@ -408,7 +412,7 @@ void __init efi_enter_virtual_mode(void) | |||
408 | efi_memory_desc_t *md; | 412 | efi_memory_desc_t *md; |
409 | efi_status_t status; | 413 | efi_status_t status; |
410 | unsigned long size; | 414 | unsigned long size; |
411 | u64 end, systab; | 415 | u64 end, systab, addr, npages; |
412 | void *p, *va; | 416 | void *p, *va; |
413 | 417 | ||
414 | efi.systab = NULL; | 418 | efi.systab = NULL; |
@@ -420,7 +424,7 @@ void __init efi_enter_virtual_mode(void) | |||
420 | size = md->num_pages << EFI_PAGE_SHIFT; | 424 | size = md->num_pages << EFI_PAGE_SHIFT; |
421 | end = md->phys_addr + size; | 425 | end = md->phys_addr + size; |
422 | 426 | ||
423 | if ((end >> PAGE_SHIFT) <= max_pfn_mapped) | 427 | if (PFN_UP(end) <= max_pfn_mapped) |
424 | va = __va(md->phys_addr); | 428 | va = __va(md->phys_addr); |
425 | else | 429 | else |
426 | va = efi_ioremap(md->phys_addr, size); | 430 | va = efi_ioremap(md->phys_addr, size); |
@@ -433,8 +437,12 @@ void __init efi_enter_virtual_mode(void) | |||
433 | continue; | 437 | continue; |
434 | } | 438 | } |
435 | 439 | ||
436 | if (!(md->attribute & EFI_MEMORY_WB)) | 440 | if (!(md->attribute & EFI_MEMORY_WB)) { |
437 | set_memory_uc(md->virt_addr, md->num_pages); | 441 | addr = md->virt_addr; |
442 | npages = md->num_pages; | ||
443 | memrange_efi_to_native(&addr, &npages); | ||
444 | set_memory_uc(addr, npages); | ||
445 | } | ||
438 | 446 | ||
439 | systab = (u64) (unsigned long) efi_phys.systab; | 447 | systab = (u64) (unsigned long) efi_phys.systab; |
440 | if (md->phys_addr <= systab && systab < end) { | 448 | if (md->phys_addr <= systab && systab < end) { |