diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-08 05:14:58 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 05:14:58 -0400 |
commit | 3de352bbd86f890dd0c5e1c09a6a1b0b29e0f8ce (patch) | |
tree | d4c5eba8cd2abefd7c9f16d089393f0f5999cf63 /arch/x86/kernel/efi.c | |
parent | 1b8ba39a3fad9c58532f6dad12c94d6e675be656 (diff) | |
parent | 9340e1ccdf7b9b22a2be7f51cd74e8b5e11961bf (diff) |
Merge branch 'x86/mpparse' into x86/devel
Conflicts:
arch/x86/Kconfig
arch/x86/kernel/io_apic_32.c
arch/x86/kernel/setup_64.c
arch/x86/mm/init_32.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/efi.c')
-rw-r--r-- | arch/x86/kernel/efi.c | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c index 77d424cf68b3..473c89fe5073 100644 --- a/arch/x86/kernel/efi.c +++ b/arch/x86/kernel/efi.c | |||
@@ -213,6 +213,48 @@ 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 | e820_add_region(start, size, e820_type); | ||
237 | } | ||
238 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | ||
239 | } | ||
240 | |||
241 | void __init efi_reserve_early(void) | ||
242 | { | ||
243 | unsigned long pmap; | ||
244 | |||
245 | pmap = boot_params.efi_info.efi_memmap; | ||
246 | #ifdef CONFIG_X86_64 | ||
247 | pmap += (__u64)boot_params.efi_info.efi_memmap_hi << 32; | ||
248 | #endif | ||
249 | memmap.phys_map = (void *)pmap; | ||
250 | memmap.nr_map = boot_params.efi_info.efi_memmap_size / | ||
251 | boot_params.efi_info.efi_memdesc_size; | ||
252 | memmap.desc_version = boot_params.efi_info.efi_memdesc_version; | ||
253 | memmap.desc_size = boot_params.efi_info.efi_memdesc_size; | ||
254 | reserve_early(pmap, pmap + memmap.nr_map * memmap.desc_size, | ||
255 | "EFI memmap"); | ||
256 | } | ||
257 | |||
216 | #if EFI_DEBUG | 258 | #if EFI_DEBUG |
217 | static void __init print_efi_memmap(void) | 259 | static void __init print_efi_memmap(void) |
218 | { | 260 | { |
@@ -242,21 +284,11 @@ void __init efi_init(void) | |||
242 | int i = 0; | 284 | int i = 0; |
243 | void *tmp; | 285 | void *tmp; |
244 | 286 | ||
245 | #ifdef CONFIG_X86_32 | ||
246 | efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab; | 287 | efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab; |
247 | memmap.phys_map = (void *)boot_params.efi_info.efi_memmap; | 288 | #ifdef CONFIG_X86_64 |
248 | #else | 289 | efi_phys.systab = (void *)efi_phys.systab + |
249 | efi_phys.systab = (efi_system_table_t *) | 290 | ((__u64)boot_params.efi_info.efi_systab_hi<<32); |
250 | (boot_params.efi_info.efi_systab | | ||
251 | ((__u64)boot_params.efi_info.efi_systab_hi<<32)); | ||
252 | memmap.phys_map = (void *) | ||
253 | (boot_params.efi_info.efi_memmap | | ||
254 | ((__u64)boot_params.efi_info.efi_memmap_hi<<32)); | ||
255 | #endif | 291 | #endif |
256 | memmap.nr_map = boot_params.efi_info.efi_memmap_size / | ||
257 | boot_params.efi_info.efi_memdesc_size; | ||
258 | memmap.desc_version = boot_params.efi_info.efi_memdesc_version; | ||
259 | memmap.desc_size = boot_params.efi_info.efi_memdesc_size; | ||
260 | 292 | ||
261 | efi.systab = early_ioremap((unsigned long)efi_phys.systab, | 293 | efi.systab = early_ioremap((unsigned long)efi_phys.systab, |
262 | sizeof(efi_system_table_t)); | 294 | sizeof(efi_system_table_t)); |
@@ -370,6 +402,7 @@ void __init efi_init(void) | |||
370 | if (memmap.desc_size != sizeof(efi_memory_desc_t)) | 402 | if (memmap.desc_size != sizeof(efi_memory_desc_t)) |
371 | printk(KERN_WARNING "Kernel-defined memdesc" | 403 | printk(KERN_WARNING "Kernel-defined memdesc" |
372 | "doesn't match the one from EFI!\n"); | 404 | "doesn't match the one from EFI!\n"); |
405 | add_efi_memmap(); | ||
373 | 406 | ||
374 | /* Setup for EFI runtime service */ | 407 | /* Setup for EFI runtime service */ |
375 | reboot_type = BOOT_EFI; | 408 | reboot_type = BOOT_EFI; |