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 | |
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')
-rw-r--r-- | arch/x86/kernel/efi.c | 33 | ||||
-rw-r--r-- | arch/x86/kernel/efi_64.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/setup_32.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/setup_64.c | 7 |
4 files changed, 27 insertions, 24 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)); |
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c index 21a7b759687a..652c5287215f 100644 --- a/arch/x86/kernel/efi_64.c +++ b/arch/x86/kernel/efi_64.c | |||
@@ -97,12 +97,6 @@ void __init efi_call_phys_epilog(void) | |||
97 | early_runtime_code_mapping_set_exec(0); | 97 | early_runtime_code_mapping_set_exec(0); |
98 | } | 98 | } |
99 | 99 | ||
100 | void __init efi_reserve_bootmem(void) | ||
101 | { | ||
102 | reserve_bootmem_generic((unsigned long)memmap.phys_map, | ||
103 | memmap.nr_map * memmap.desc_size); | ||
104 | } | ||
105 | |||
106 | void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size) | 100 | void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size) |
107 | { | 101 | { |
108 | static unsigned pages_mapped __initdata; | 102 | static unsigned pages_mapped __initdata; |
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index 0ec6480aaa27..2960cbecfa5a 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c | |||
@@ -67,6 +67,7 @@ | |||
67 | #include <asm/bios_ebda.h> | 67 | #include <asm/bios_ebda.h> |
68 | #include <asm/cacheflush.h> | 68 | #include <asm/cacheflush.h> |
69 | #include <asm/processor.h> | 69 | #include <asm/processor.h> |
70 | #include <asm/efi.h> | ||
70 | 71 | ||
71 | /* This value is set up by the early boot code to point to the value | 72 | /* This value is set up by the early boot code to point to the value |
72 | immediately after the boot time page tables. It contains a *physical* | 73 | immediately after the boot time page tables. It contains a *physical* |
@@ -683,8 +684,10 @@ void __init setup_arch(char **cmdline_p) | |||
683 | 684 | ||
684 | #ifdef CONFIG_EFI | 685 | #ifdef CONFIG_EFI |
685 | if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, | 686 | if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, |
686 | "EL32", 4)) | 687 | "EL32", 4)) { |
687 | efi_enabled = 1; | 688 | efi_enabled = 1; |
689 | efi_reserve_early(); | ||
690 | } | ||
688 | #endif | 691 | #endif |
689 | 692 | ||
690 | ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); | 693 | ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 2599b2744207..078c02f6f5f9 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
@@ -330,8 +330,10 @@ void __init setup_arch(char **cmdline_p) | |||
330 | #endif | 330 | #endif |
331 | #ifdef CONFIG_EFI | 331 | #ifdef CONFIG_EFI |
332 | if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, | 332 | if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, |
333 | "EL64", 4)) | 333 | "EL64", 4)) { |
334 | efi_enabled = 1; | 334 | efi_enabled = 1; |
335 | efi_reserve_early(); | ||
336 | } | ||
335 | #endif | 337 | #endif |
336 | 338 | ||
337 | ARCH_SETUP | 339 | ARCH_SETUP |
@@ -457,9 +459,6 @@ void __init setup_arch(char **cmdline_p) | |||
457 | acpi_reserve_bootmem(); | 459 | acpi_reserve_bootmem(); |
458 | #endif | 460 | #endif |
459 | 461 | ||
460 | if (efi_enabled) | ||
461 | efi_reserve_bootmem(); | ||
462 | |||
463 | #ifdef CONFIG_X86_MPPARSE | 462 | #ifdef CONFIG_X86_MPPARSE |
464 | /* | 463 | /* |
465 | * Find and reserve possible boot-time SMP configuration: | 464 | * Find and reserve possible boot-time SMP configuration: |