diff options
author | Park, Aiden <aiden.park@intel.com> | 2019-09-03 17:43:46 +0000 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2019-09-10 14:31:42 +0800 |
commit | 5793553fa24077e3b91028f8097fb1fdbede1480 (patch) | |
tree | 53e6c509013abc10386289fedfe08ad184f318bf /arch/x86 | |
parent | 74b76357dfd75550cd9a511e71990d414a4d023e (diff) | |
download | u-boot-5793553fa24077e3b91028f8097fb1fdbede1480.tar.gz |
x86: efi_loader: Use efi_add_conventional_memory_map()
Use efi_add_conventional_memory_map() to configure EFI conventional memory
properly with ram_top value. This will give 32-bit mode U-Boot proper
conventional memory regions even if e820 has an entry which is greater than
32-bit address space.
Signed-off-by: Aiden Park <aiden.park@intel.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[bmeng: fixed some typos in the commit message]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/lib/e820.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/arch/x86/lib/e820.c b/arch/x86/lib/e820.c index d6ae2c4e9d..26da4d2f27 100644 --- a/arch/x86/lib/e820.c +++ b/arch/x86/lib/e820.c @@ -41,14 +41,17 @@ void efi_add_known_memory(void) { struct e820_entry e820[E820MAX]; unsigned int i, num; - u64 start, pages; + u64 start, pages, ram_top; int type; num = install_e820_map(ARRAY_SIZE(e820), e820); + ram_top = (u64)gd->ram_top & ~EFI_PAGE_MASK; + if (!ram_top) + ram_top = 0x100000000ULL; + for (i = 0; i < num; ++i) { start = e820[i].addr; - pages = ALIGN(e820[i].size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT; switch (e820[i].type) { case E820_RAM: @@ -69,7 +72,15 @@ void efi_add_known_memory(void) break; } - efi_add_memory_map(start, pages, type, false); + if (type == EFI_CONVENTIONAL_MEMORY) { + efi_add_conventional_memory_map(start, + 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); + } } } #endif /* CONFIG_IS_ENABLED(EFI_LOADER) */ |