public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC] efi_loader: Handle 32-bit memory overflows
@ 2016-04-13  3:24 Andreas Färber
  2016-04-13  5:50 ` Alexander Graf
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Färber @ 2016-04-13  3:24 UTC (permalink / raw)
  To: u-boot

jetson-tk1 has 2 GB of RAM at 0x80000000, causing gd->ram_top to be zero.
Handle this by replacing it with 0x100000000 in that case.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas F?rber <afaerber@suse.de>
---
 lib/efi_loader/efi_memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 138736f..7b87108 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -225,7 +225,7 @@ efi_status_t efi_allocate_pages(int type, int memory_type,
 	switch (type) {
 	case 0:
 		/* Any page */
-		addr = efi_find_free_memory(len, gd->ram_top);
+		addr = efi_find_free_memory(len, gd->ram_top == 0 ? 0x100000000ull : gd->ram_top);
 		if (!addr) {
 			r = EFI_NOT_FOUND;
 			break;
@@ -343,7 +343,7 @@ int efi_memory_init(void)
 
 	/* Add U-Boot */
 	uboot_start = (gd->start_addr_sp - uboot_stack_size) & ~EFI_PAGE_MASK;
-	uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT;
+	uboot_pages = ((gd->ram_top == 0 ? 0x100000000ull : gd->ram_top) - uboot_start) >> EFI_PAGE_SHIFT;
 	efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, false);
 
 	/* Add Runtime Services */
-- 
2.6.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-13 11:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-13  3:24 [U-Boot] [RFC] efi_loader: Handle 32-bit memory overflows Andreas Färber
2016-04-13  5:50 ` Alexander Graf
2016-04-13 11:26   ` Andreas Färber
2016-04-13 11:48     ` Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox