aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/platform/efi
diff options
context:
space:
mode:
authorBorislav Petkov2013-03-01 17:07:44 +0100
committerMatt Fleming2013-03-04 15:23:56 +0000
commit15b9c359f288b09003cb70f7ed204affc0c6614d (patch)
tree57303057c296b330a3f543919f236f2a57bbb928 /arch/x86/platform/efi
parent073093819d6d9f363060d3f7584ca1ff987081c4 (diff)
x86, efi: Make efi_memblock_x86_reserve_range more readable
So basically this function copies EFI memmap stuff from boot_params into the EFI memmap descriptor and reserves memory for it. Make it much more readable. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Matthew Garret <mjg59@srcf.ucam.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch/x86/platform/efi')
-rw-r--r--arch/x86/platform/efi/efi.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index e075e474245b..430cd784a0de 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -350,24 +350,25 @@ static void __init do_add_efi_memmap(void)
int __init efi_memblock_x86_reserve_range(void)
{
+ struct efi_info *e = &boot_params.efi_info;
unsigned long pmap;
#ifdef CONFIG_X86_32
/* Can't handle data above 4GB at this time */
- if (boot_params.efi_info.efi_memmap_hi) {
+ if (e->efi_memmap_hi) {
pr_err("Memory map is above 4GB, disabling EFI.\n");
return -EINVAL;
}
- pmap = boot_params.efi_info.efi_memmap;
+ pmap = e->efi_memmap;
#else
- pmap = (boot_params.efi_info.efi_memmap |
- ((__u64)boot_params.efi_info.efi_memmap_hi<<32));
+ pmap = (e->efi_memmap | ((__u64)e->efi_memmap_hi << 32));
#endif
- memmap.phys_map = (void *)pmap;
- memmap.nr_map = boot_params.efi_info.efi_memmap_size /
- boot_params.efi_info.efi_memdesc_size;
- memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
- memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
+ memmap.phys_map = (void *)pmap;
+ memmap.nr_map = e->efi_memmap_size /
+ e->efi_memdesc_size;
+ memmap.desc_size = e->efi_memdesc_size;
+ memmap.desc_version = e->efi_memdesc_version;
+
memblock_reserve(pmap, memmap.nr_map * memmap.desc_size);
return 0;