From: York Sun Date: Wed, 15 Feb 2017 15:17:52 -0800 Subject: [U-Boot] [PATCH v2 04/10] efi: Add a hook to allow adding memory mapping In-Reply-To: <1487200678-28887-1-git-send-email-york.sun@nxp.com> References: <1487200678-28887-1-git-send-email-york.sun@nxp.com> Message-ID: <1487200678-28887-5-git-send-email-york.sun@nxp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Instead of adding all memory banks, add a hook so individual SoC/board can has its own implementation. Signed-off-by: York Sun CC: Alexander Graf --- Changes in v2: Add change to efi mapping lib/efi_loader/efi_memory.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 95aa590..db2ae19 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -431,11 +431,8 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size, return EFI_SUCCESS; } -int efi_memory_init(void) +__weak void efi_add_known_memory(void) { - unsigned long runtime_start, runtime_end, runtime_pages; - unsigned long uboot_start, uboot_pages; - unsigned long uboot_stack_size = 16 * 1024 * 1024; int i; /* Add RAM */ @@ -448,6 +445,15 @@ int efi_memory_init(void) efi_add_memory_map(start, pages, EFI_CONVENTIONAL_MEMORY, false); } +} + +int efi_memory_init(void) +{ + unsigned long runtime_start, runtime_end, runtime_pages; + unsigned long uboot_start, uboot_pages; + unsigned long uboot_stack_size = 16 * 1024 * 1024; + + efi_add_known_memory(); /* Add U-Boot */ uboot_start = (gd->start_addr_sp - uboot_stack_size) & ~EFI_PAGE_MASK; -- 2.7.4