[U-Boot] [PATCH 1/3] efi: fix issue for 32bit targets with ram_top at 4G

Patrick Delaunay patrick.delaunay at st.com
Wed Apr 10 09:02:57 UTC 2019


Avoid ram_end = 0 on 32bit targets with ram_end at 4G.

Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---
example of issue in stm32mp1 board ev1:
  ram_start = c0000000
  size = 40000000
  ram_end = 100000000
  ram_end &= ~EFI_PAGE_MASK => result is 0

 lib/efi_loader/efi_memory.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 55622d2..81dc5fc 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -574,6 +574,10 @@ __weak void efi_add_known_memory(void)
 
 		/* Remove partial pages */
 		ram_end &= ~EFI_PAGE_MASK;
+		/* Fix for 32bit targets with ram_top at 4G */
+		if (!ram_end)
+			ram_end = 0x100000000ULL;
+
 		ram_start = (ram_start + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;
 
 		if (ram_end <= ram_start) {
-- 
2.7.4



More information about the U-Boot mailing list