From: Matthias Brugger Date: Mon, 18 May 2020 08:21:17 +0200 Subject: [PATCH v2] efi_loader: round the memory area in efi_add_memory_map() In-Reply-To: <20200517102919.12043-1-michael@walle.cc> References: <20200517102919.12043-1-michael@walle.cc> Message-ID: <933a0e11-7fde-84b7-e274-dcc7f6c872e8@suse.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 17/05/2020 12:29, Michael Walle wrote: > 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 > --- > changes since v1: > - rebased to latest master > - fixed grammar > > I split off this patch of the following series because it touches > many files: > https://lists.denx.de/pipermail/u-boot/2020-May/412065.html > > This patch supersede patch 2 and patch 3 of said series. > > arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 10 ++--- > arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 5 +-- > arch/arm/mach-meson/board-common.c | 7 +--- > arch/x86/lib/e820.c | 6 +-- > board/raspberrypi/rpi/rpi.c | 4 +- > cmd/bootefi.c | 8 +--- > drivers/video/meson/meson_vpu.c | 4 +- > drivers/video/sunxi/sunxi_de2.c | 6 +-- > drivers/video/sunxi/sunxi_display.c | 6 +-- > include/efi_loader.h | 3 +- > lib/efi_loader/efi_memory.c | 54 ++++++++++++++++++------- > lib/efi_loader/efi_runtime.c | 3 +- > 12 files changed, 62 insertions(+), 54 deletions(-) > [...] > diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c > index 0206a093d4..45caa4d49e 100644 > --- a/board/raspberrypi/rpi/rpi.c > +++ b/board/raspberrypi/rpi/rpi.c > @@ -489,8 +489,8 @@ int ft_board_setup(void *blob, bd_t *bd) > > #ifdef CONFIG_EFI_LOADER > /* Reserve the spin table */ > - efi_add_memory_map(0, CONFIG_RPI_EFI_NR_SPIN_PAGES, > - EFI_RESERVED_MEMORY_TYPE, 0); > + efi_add_memory_map(0, CONFIG_RPI_EFI_NR_SPIN_PAGES << EFI_PAGE_SHIFT, > + EFI_RESERVED_MEMORY_TYPE); > #endif > Reviewed-by: Matthias Brugger