aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/efi/libstub/efi-stub-helper.c
diff options
context:
space:
mode:
authorMatt Fleming <matt@codeblueprint.co.uk>2016-04-25 16:06:38 -0400
committerIngo Molnar <mingo@kernel.org>2016-04-28 05:33:50 -0400
commit78ce248faa3c46e24e9bd42db3ab3650659f16dd (patch)
treee40ffbc803346ab0a8d2e0994ab7b20462b20a98 /drivers/firmware/efi/libstub/efi-stub-helper.c
parent30d7bf034c034995f34dae265d96247f7f12044e (diff)
efi: Iterate over efi.memmap in for_each_efi_memory_desc()
Most of the users of for_each_efi_memory_desc() are equally happy iterating over the EFI memory map in efi.memmap instead of 'memmap', since the former is usually a pointer to the latter. For those users that want to specify an EFI memory map other than efi.memmap, that can be done using for_each_efi_memory_desc_in_map(). One such example is in the libstub code where the firmware is queried directly for the memory map, it gets iterated over, and then freed. This change goes part of the way toward deleting the global 'memmap' variable, which is not universally available on all architectures (notably IA64) and is rather poorly named. Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Mark Salter <msalter@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/1461614832-17633-7-git-send-email-matt@codeblueprint.co.uk 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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index 29ed2f9b218c..3bd127f95315 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -125,10 +125,12 @@ unsigned long get_dram_base(efi_system_table_t *sys_table_arg)
125 125
126 map.map_end = map.map + map_size; 126 map.map_end = map.map + map_size;
127 127
128 for_each_efi_memory_desc(&map, md) 128 for_each_efi_memory_desc_in_map(&map, md) {
129 if (md->attribute & EFI_MEMORY_WB) 129 if (md->attribute & EFI_MEMORY_WB) {
130 if (membase > md->phys_addr) 130 if (membase > md->phys_addr)
131 membase = md->phys_addr; 131 membase = md->phys_addr;
132 }
133 }
132 134
133 efi_call_early(free_pool, map.map); 135 efi_call_early(free_pool, map.map);
134 136