summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2020-05-17 12:29:19 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-05-17 21:59:53 +0200
commit714497e327e7304a2b67d5f780f415c6e1c300d0 (patch)
treed6182ed8caa040cc042b4f86a4abfaab65f68ff8 /arch
parent515f613253cf0a892c3a321770ab927fa3d925cf (diff)
downloadu-boot-714497e327e7304a2b67d5f780f415c6e1c300d0.tar.gz
u-boot-714497e327e7304a2b67d5f780f415c6e1c300d0.tar.bz2
u-boot-714497e327e7304a2b67d5f780f415c6e1c300d0.zip
efi_loader: round the memory area in efi_add_memory_map()
Virtually all callers of this function do the rounding on their own. Some do it right, some don't. Instead of doing this in each caller, do the rounding in efi_add_memory_map(). Change the size parameter to bytes instead of pages and remove aligning and size calculation in all callers. There is no more need to make the original efi_add_memory_map() (which takes pages as size) available outside the module. Thus rename it to efi_add_memory_map_pg() and make it static to prevent further misuse outside the module. Signed-off-by: Michael Walle <michael@walle.cc> Add missing comma in sunxi_display.c. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/cpu.c10
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/fdt.c5
-rw-r--r--arch/arm/mach-meson/board-common.c7
-rw-r--r--arch/x86/lib/e820.c6
4 files changed, 9 insertions, 19 deletions
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index b3f5c2f641..2cf3f4bb98 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -1529,9 +1529,8 @@ int dram_init_banksize(void)
void efi_add_known_memory(void)
{
int i;
- phys_addr_t ram_start, start;
+ phys_addr_t ram_start;
phys_size_t ram_size;
- u64 pages;
/* Add RAM */
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
@@ -1549,11 +1548,8 @@ void efi_add_known_memory(void)
gd->arch.resv_ram < ram_start + ram_size)
ram_size = gd->arch.resv_ram - ram_start;
#endif
- start = (ram_start + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;
- pages = (ram_size + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
-
- efi_add_memory_map(start, pages, EFI_CONVENTIONAL_MEMORY,
- false);
+ efi_add_memory_map(ram_start, ram_size,
+ EFI_CONVENTIONAL_MEMORY);
}
}
#endif
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 3bbad827cb..0696ea6d35 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -146,9 +146,8 @@ remove_psci_node:
fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
*boot_code_size);
#if CONFIG_IS_ENABLED(EFI_LOADER)
- efi_add_memory_map((uintptr_t)&secondary_boot_code,
- ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
- EFI_RESERVED_MEMORY_TYPE, false);
+ efi_add_memory_map((uintptr_t)&secondary_boot_code, *boot_code_size,
+ EFI_RESERVED_MEMORY_TYPE);
#endif
}
#endif
diff --git a/arch/arm/mach-meson/board-common.c b/arch/arm/mach-meson/board-common.c
index bc4c92074c..747791b10e 100644
--- a/arch/arm/mach-meson/board-common.c
+++ b/arch/arm/mach-meson/board-common.c
@@ -69,11 +69,8 @@ void meson_board_add_reserved_memory(void *fdt, u64 start, u64 size)
if (ret)
printf("Could not reserve zone @ 0x%llx\n", start);
- if (IS_ENABLED(CONFIG_EFI_LOADER)) {
- efi_add_memory_map(start,
- ALIGN(size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
- EFI_RESERVED_MEMORY_TYPE, false);
- }
+ if (IS_ENABLED(CONFIG_EFI_LOADER))
+ efi_add_memory_map(start, size, EFI_RESERVED_MEMORY_TYPE);
}
int meson_generate_serial_ethaddr(void)
diff --git a/arch/x86/lib/e820.c b/arch/x86/lib/e820.c
index 26da4d2f27..1f20c5c8c6 100644
--- a/arch/x86/lib/e820.c
+++ b/arch/x86/lib/e820.c
@@ -41,7 +41,7 @@ void efi_add_known_memory(void)
{
struct e820_entry e820[E820MAX];
unsigned int i, num;
- u64 start, pages, ram_top;
+ u64 start, ram_top;
int type;
num = install_e820_map(ARRAY_SIZE(e820), e820);
@@ -77,9 +77,7 @@ void efi_add_known_memory(void)
start + e820[i].size,
ram_top);
} else {
- pages = ALIGN(e820[i].size, EFI_PAGE_SIZE)
- >> EFI_PAGE_SHIFT;
- efi_add_memory_map(start, pages, type, false);
+ efi_add_memory_map(start, e820[i].size, type);
}
}
}