public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] efi_loader: Handle memory overflows
@ 2016-04-13 12:04 Andreas Färber
  2016-04-13 12:07 ` Alexander Graf
  2016-04-21 11:24 ` [U-Boot] [U-Boot,v2] " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Färber @ 2016-04-13 12:04 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 either avoiding ram_top or by using the same type as
ram_top to reverse the overflow effect.

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

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 138736f..82003d7 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->start_addr_sp);
 		if (!addr) {
 			r = EFI_NOT_FOUND;
 			break;
@@ -325,9 +325,9 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
 
 int efi_memory_init(void)
 {
-	uint64_t runtime_start, runtime_end, runtime_pages;
-	uint64_t uboot_start, uboot_pages;
-	uint64_t uboot_stack_size = 16 * 1024 * 1024;
+	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 */
-- 
2.6.6

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

* [U-Boot] [PATCH v2] efi_loader: Handle memory overflows
  2016-04-13 12:04 [U-Boot] [PATCH v2] efi_loader: Handle memory overflows Andreas Färber
@ 2016-04-13 12:07 ` Alexander Graf
  2016-04-21 11:24 ` [U-Boot] [U-Boot,v2] " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Graf @ 2016-04-13 12:07 UTC (permalink / raw)
  To: u-boot

On 04/13/2016 02:04 PM, Andreas F?rber wrote:
> jetson-tk1 has 2 GB of RAM at 0x80000000, causing gd->ram_top to be zero.
> Handle this by either avoiding ram_top or by using the same type as
> ram_top to reverse the overflow effect.
>
> Cc: Alexander Graf <agraf@suse.de>
> Signed-off-by: Andreas F?rber <afaerber@suse.de>

Reviewed-by: Alexander Graf <agraf@suse.de>


Alex

> ---
>   lib/efi_loader/efi_memory.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index 138736f..82003d7 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->start_addr_sp);
>   		if (!addr) {
>   			r = EFI_NOT_FOUND;
>   			break;
> @@ -325,9 +325,9 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
>   
>   int efi_memory_init(void)
>   {
> -	uint64_t runtime_start, runtime_end, runtime_pages;
> -	uint64_t uboot_start, uboot_pages;
> -	uint64_t uboot_stack_size = 16 * 1024 * 1024;
> +	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 */

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

* [U-Boot] [U-Boot,v2] efi_loader: Handle memory overflows
  2016-04-13 12:04 [U-Boot] [PATCH v2] efi_loader: Handle memory overflows Andreas Färber
  2016-04-13 12:07 ` Alexander Graf
@ 2016-04-21 11:24 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2016-04-21 11:24 UTC (permalink / raw)
  To: u-boot

On Wed, Apr 13, 2016 at 02:04:38PM +0200, Andreas F?rber wrote:

> jetson-tk1 has 2 GB of RAM at 0x80000000, causing gd->ram_top to be zero.
> Handle this by either avoiding ram_top or by using the same type as
> ram_top to reverse the overflow effect.
> 
> Cc: Alexander Graf <agraf@suse.de>
> Signed-off-by: Andreas F?rber <afaerber@suse.de>
> Reviewed-by: Alexander Graf <agraf@suse.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160421/3d9160fd/attachment.sig>

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-13 12:04 [U-Boot] [PATCH v2] efi_loader: Handle memory overflows Andreas Färber
2016-04-13 12:07 ` Alexander Graf
2016-04-21 11:24 ` [U-Boot] [U-Boot,v2] " Tom Rini

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