diff options
author | Baoquan He <bhe@redhat.com> | 2017-08-16 16:46:51 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-08-17 11:50:57 +0300 |
commit | 02e43c2dcd3b3cf7244f6dda65a07e8dacadaf8d (patch) | |
tree | a33b802734e0ee58aa4dd3bd1539bf09b6e22901 /drivers/firmware/efi/libstub/efi-stub-helper.c | |
parent | 2257e268b1154966c5b0141b23695db1043ff39d (diff) | |
download | linux-02e43c2dcd3b3cf7244f6dda65a07e8dacadaf8d.tar.xz |
efi: Introduce efi_early_memdesc_ptr to get pointer to memmap descriptor
The existing map iteration helper for_each_efi_memory_desc_in_map can
only be used after the kernel initializes the EFI subsystem to set up
struct efi_memory_map.
Before that we also need iterate map descriptors which are stored in several
intermediate structures, like struct efi_boot_memmap for arch independent
usage and struct efi_info for x86 arch only.
Introduce efi_early_memdesc_ptr() to get pointer to a map descriptor, and
replace several places where that primitive is open coded.
Signed-off-by: Baoquan He <bhe@redhat.com>
[ Various improvements to the text. ]
Acked-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: ard.biesheuvel@linaro.org
Cc: fanc.fnst@cn.fujitsu.com
Cc: izumi.taku@jp.fujitsu.com
Cc: keescook@chromium.org
Cc: linux-efi@vger.kernel.org
Cc: n-horiguchi@ah.jp.nec.com
Cc: thgarnie@google.com
Link: http://lkml.kernel.org/r/20170816134651.GF21273@x1
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/efi-stub-helper.c')
-rw-r--r-- | drivers/firmware/efi/libstub/efi-stub-helper.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index b0184360efc6..50a9cab5a834 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -205,7 +205,7 @@ again: unsigned long m = (unsigned long)map; u64 start, end; - desc = (efi_memory_desc_t *)(m + (i * desc_size)); + desc = efi_early_memdesc_ptr(m, desc_size, i); if (desc->type != EFI_CONVENTIONAL_MEMORY) continue; @@ -298,7 +298,7 @@ efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, unsigned long m = (unsigned long)map; u64 start, end; - desc = (efi_memory_desc_t *)(m + (i * desc_size)); + desc = efi_early_memdesc_ptr(m, desc_size, i); if (desc->type != EFI_CONVENTIONAL_MEMORY) continue; |