]> git.sur5r.net Git - u-boot/commitdiff
efi: Add a hook to allow adding memory mapping
authorYork Sun <york.sun@nxp.com>
Mon, 6 Mar 2017 17:02:27 +0000 (09:02 -0800)
committerYork Sun <york.sun@nxp.com>
Tue, 14 Mar 2017 15:44:03 +0000 (08:44 -0700)
Instead of adding all memory banks, add a hook so individual SoC/board
can has its own implementation.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Alexander Graf <agraf@suse.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
lib/efi_loader/efi_memory.c

index 95aa590c8af7a4d53697091b4292e2bac59a1f9e..db2ae19f590d1beacfb104533e5807bf7c93b2a2 100644 (file)
@@ -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;