diff options
author | Huang, Ying <ying.huang@intel.com> | 2008-06-02 02:26:21 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-06-05 09:10:02 -0400 |
commit | ecacf09f7d26b2317e8b1d59fa40f62081fad0bb (patch) | |
tree | ec54663f20002c4275b6e0f3ea194d616e4b222e /arch/x86/kernel/efi.c | |
parent | d0ec2c6f2c2f0478b34ae78b3e65f60a561ac807 (diff) |
x86: reserve EFI memory map with reserve_early
This patch reserves the EFI memory map with reserve_early(). Because EFI
memory map is allocated by bootloader, if it is not reserved by
reserved_early(), it may be overwritten through address returned by
find_e820_area().
Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: andi@firstfloor.org
Cc: mingo@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/efi.c')
-rw-r--r-- | arch/x86/kernel/efi.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c index 4a1a26d5931f..d5c7fcdd1861 100644 --- a/arch/x86/kernel/efi.c +++ b/arch/x86/kernel/efi.c | |||
@@ -238,6 +238,23 @@ static void __init add_efi_memmap(void) | |||
238 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 238 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); |
239 | } | 239 | } |
240 | 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 | |||
241 | #if EFI_DEBUG | 258 | #if EFI_DEBUG |
242 | static void __init print_efi_memmap(void) | 259 | static void __init print_efi_memmap(void) |
243 | { | 260 | { |
@@ -267,21 +284,11 @@ void __init efi_init(void) | |||
267 | int i = 0; | 284 | int i = 0; |
268 | void *tmp; | 285 | void *tmp; |
269 | 286 | ||
270 | #ifdef CONFIG_X86_32 | ||
271 | 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; |
272 | memmap.phys_map = (void *)boot_params.efi_info.efi_memmap; | 288 | #ifdef CONFIG_X86_64 |
273 | #else | 289 | efi_phys.systab = (void *)efi_phys.systab + |
274 | efi_phys.systab = (efi_system_table_t *) | 290 | ((__u64)boot_params.efi_info.efi_systab_hi<<32); |
275 | (boot_params.efi_info.efi_systab | | ||
276 | ((__u64)boot_params.efi_info.efi_systab_hi<<32)); | ||
277 | memmap.phys_map = (void *) | ||
278 | (boot_params.efi_info.efi_memmap | | ||
279 | ((__u64)boot_params.efi_info.efi_memmap_hi<<32)); | ||
280 | #endif | 291 | #endif |
281 | memmap.nr_map = boot_params.efi_info.efi_memmap_size / | ||
282 | boot_params.efi_info.efi_memdesc_size; | ||
283 | memmap.desc_version = boot_params.efi_info.efi_memdesc_version; | ||
284 | memmap.desc_size = boot_params.efi_info.efi_memdesc_size; | ||
285 | 292 | ||
286 | efi.systab = early_ioremap((unsigned long)efi_phys.systab, | 293 | efi.systab = early_ioremap((unsigned long)efi_phys.systab, |
287 | sizeof(efi_system_table_t)); | 294 | sizeof(efi_system_table_t)); |