diff options
-rw-r--r-- | arch/x86/kernel/efi.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c index 77d424cf68b3..4a1a26d5931f 100644 --- a/arch/x86/kernel/efi.c +++ b/arch/x86/kernel/efi.c | |||
@@ -213,6 +213,31 @@ unsigned long efi_get_time(void) | |||
213 | eft.minute, eft.second); | 213 | eft.minute, eft.second); |
214 | } | 214 | } |
215 | 215 | ||
216 | /* | ||
217 | * Tell the kernel about the EFI memory map. This might include | ||
218 | * more than the max 128 entries that can fit in the e820 legacy | ||
219 | * (zeropage) memory map. | ||
220 | */ | ||
221 | |||
222 | static void __init add_efi_memmap(void) | ||
223 | { | ||
224 | void *p; | ||
225 | |||
226 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | ||
227 | efi_memory_desc_t *md = p; | ||
228 | unsigned long long start = md->phys_addr; | ||
229 | unsigned long long size = md->num_pages << EFI_PAGE_SHIFT; | ||
230 | int e820_type; | ||
231 | |||
232 | if (md->attribute & EFI_MEMORY_WB) | ||
233 | e820_type = E820_RAM; | ||
234 | else | ||
235 | e820_type = E820_RESERVED; | ||
236 | add_memory_region(start, size, e820_type); | ||
237 | } | ||
238 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | ||
239 | } | ||
240 | |||
216 | #if EFI_DEBUG | 241 | #if EFI_DEBUG |
217 | static void __init print_efi_memmap(void) | 242 | static void __init print_efi_memmap(void) |
218 | { | 243 | { |
@@ -370,6 +395,7 @@ void __init efi_init(void) | |||
370 | if (memmap.desc_size != sizeof(efi_memory_desc_t)) | 395 | if (memmap.desc_size != sizeof(efi_memory_desc_t)) |
371 | printk(KERN_WARNING "Kernel-defined memdesc" | 396 | printk(KERN_WARNING "Kernel-defined memdesc" |
372 | "doesn't match the one from EFI!\n"); | 397 | "doesn't match the one from EFI!\n"); |
398 | add_efi_memmap(); | ||
373 | 399 | ||
374 | /* Setup for EFI runtime service */ | 400 | /* Setup for EFI runtime service */ |
375 | reboot_type = BOOT_EFI; | 401 | reboot_type = BOOT_EFI; |