diff options
Diffstat (limited to 'arch/x86/kernel/efi_64.c')
-rw-r--r-- | arch/x86/kernel/efi_64.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c index a4ee29127fdf..22c3b7828c50 100644 --- a/arch/x86/kernel/efi_64.c +++ b/arch/x86/kernel/efi_64.c | |||
@@ -100,24 +100,11 @@ void __init efi_call_phys_epilog(void) | |||
100 | 100 | ||
101 | void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size) | 101 | void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size) |
102 | { | 102 | { |
103 | static unsigned pages_mapped __initdata; | 103 | unsigned long last_map_pfn; |
104 | unsigned i, pages; | ||
105 | unsigned long offset; | ||
106 | 104 | ||
107 | pages = PFN_UP(phys_addr + size) - PFN_DOWN(phys_addr); | 105 | last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size); |
108 | offset = phys_addr & ~PAGE_MASK; | 106 | if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) |
109 | phys_addr &= PAGE_MASK; | ||
110 | |||
111 | if (pages_mapped + pages > MAX_EFI_IO_PAGES) | ||
112 | return NULL; | 107 | return NULL; |
113 | 108 | ||
114 | for (i = 0; i < pages; i++) { | 109 | return (void __iomem *)__va(phys_addr); |
115 | __set_fixmap(FIX_EFI_IO_MAP_FIRST_PAGE - pages_mapped, | ||
116 | phys_addr, PAGE_KERNEL); | ||
117 | phys_addr += PAGE_SIZE; | ||
118 | pages_mapped++; | ||
119 | } | ||
120 | |||
121 | return (void __iomem *)__fix_to_virt(FIX_EFI_IO_MAP_FIRST_PAGE - \ | ||
122 | (pages_mapped - pages)) + offset; | ||
123 | } | 110 | } |