All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Fix condition where bootm_size not set and wrong memory size reported
@ 2010-07-07 20:44 Matthew McClintock
  2010-07-08  9:43 ` Sergei Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew McClintock @ 2010-07-07 20:44 UTC (permalink / raw)
  To: u-boot

If the user sets bootm_low and does not set bootm_size, u-boot will
report the memory node in the flat device tree incorrectly. Instead
of reporting the remaining size of memory, it will report the total
available memory which is incorrect.

Specifically this fixes the situation when booting a relocatable
kernel and the memory is reported as an offset and size in the
device tree, and the size needs to be adjusted accordingly.

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 common/image.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/common/image.c b/common/image.c
index 2b6007e..bf2acb0 100644
--- a/common/image.c
+++ b/common/image.c
@@ -433,17 +433,23 @@ ulong getenv_bootm_low(void)
 
 phys_size_t getenv_bootm_size(void)
 {
+	phys_size_t tmp;
 	char *s = getenv ("bootm_size");
 	if (s) {
-		phys_size_t tmp;
 		tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
 		return tmp;
 	}
+	s = getenv("bootm_low");
+	if (s)
+		tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
+	else
+		tmp = 0;
+
 
 #if defined(CONFIG_ARM)
-	return gd->bd->bi_dram[0].size;
+	return (gd->bd->bi_dram[0].size - tmp);
 #else
-	return gd->bd->bi_memsize;
+	return (gd->bd->bi_memsize - tmp);
 #endif
 }
 
-- 
1.6.6.1

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

* [U-Boot] [PATCH] Fix condition where bootm_size not set and wrong memory size reported
  2010-07-07 20:44 [U-Boot] [PATCH] Fix condition where bootm_size not set and wrong memory size reported Matthew McClintock
@ 2010-07-08  9:43 ` Sergei Shtylyov
  2010-07-08 15:11   ` Matthew McClintock
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2010-07-08  9:43 UTC (permalink / raw)
  To: u-boot

Hello.

Matthew McClintock wrote:

> If the user sets bootm_low and does not set bootm_size, u-boot will
> report the memory node in the flat device tree incorrectly. Instead
> of reporting the remaining size of memory, it will report the total
> available memory which is incorrect.

> Specifically this fixes the situation when booting a relocatable
> kernel and the memory is reported as an offset and size in the
> device tree, and the size needs to be adjusted accordingly.

> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
>  common/image.c |   12 +++++++++---
>  1 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/common/image.c b/common/image.c
> index 2b6007e..bf2acb0 100644
> --- a/common/image.c
> +++ b/common/image.c
> @@ -433,17 +433,23 @@ ulong getenv_bootm_low(void)
>  
>  phys_size_t getenv_bootm_size(void)
>  {
> +	phys_size_t tmp;
>  	char *s = getenv ("bootm_size");
>  	if (s) {
> -		phys_size_t tmp;
>  		tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
>  		return tmp;
>  	}
> +	s = getenv("bootm_low");
> +	if (s)
> +		tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
> +	else
> +		tmp = 0;
> +
>  
>  #if defined(CONFIG_ARM)
> -	return gd->bd->bi_dram[0].size;
> +	return (gd->bd->bi_dram[0].size - tmp);
>  #else
> -	return gd->bd->bi_memsize;
> +	return (gd->bd->bi_memsize - tmp);

    Parens not useful here and above.

WBR, Sergei

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

* [U-Boot] [PATCH] Fix condition where bootm_size not set and wrong memory size reported
  2010-07-08  9:43 ` Sergei Shtylyov
@ 2010-07-08 15:11   ` Matthew McClintock
  2010-07-08 22:19     ` Kumar Gala
  2010-08-07 19:56     ` Wolfgang Denk
  0 siblings, 2 replies; 6+ messages in thread
From: Matthew McClintock @ 2010-07-08 15:11 UTC (permalink / raw)
  To: u-boot

If the user sets bootm_low and does not set bootm_size, u-boot will
report the memory node in the flat device tree incorrectly. Instead
of reporting the remaining size of memory, it will report the total
available memory which is incorrect.

Specifically this fixes the situation when booting a relocatable
kernel and the memory is reported as an offset and size in the
device tree, and the size needs to be adjusted accordingly.

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 common/image.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/common/image.c b/common/image.c
index 2b6007e..2dccf96 100644
--- a/common/image.c
+++ b/common/image.c
@@ -433,17 +433,23 @@ ulong getenv_bootm_low(void)
 
 phys_size_t getenv_bootm_size(void)
 {
+	phys_size_t tmp;
 	char *s = getenv ("bootm_size");
 	if (s) {
-		phys_size_t tmp;
 		tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
 		return tmp;
 	}
+	s = getenv("bootm_low");
+	if (s)
+		tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
+	else
+		tmp = 0;
+
 
 #if defined(CONFIG_ARM)
-	return gd->bd->bi_dram[0].size;
+	return gd->bd->bi_dram[0].size - tmp;
 #else
-	return gd->bd->bi_memsize;
+	return gd->bd->bi_memsize - tmp;
 #endif
 }
 
-- 
1.6.6.1

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

* [U-Boot] [PATCH] Fix condition where bootm_size not set and wrong memory size reported
  2010-07-08 15:11   ` Matthew McClintock
@ 2010-07-08 22:19     ` Kumar Gala
  2010-08-04 18:59       ` Kumar Gala
  2010-08-07 19:56     ` Wolfgang Denk
  1 sibling, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2010-07-08 22:19 UTC (permalink / raw)
  To: u-boot


On Jul 8, 2010, at 10:11 AM, Matthew McClintock wrote:

> If the user sets bootm_low and does not set bootm_size, u-boot will
> report the memory node in the flat device tree incorrectly. Instead
> of reporting the remaining size of memory, it will report the total
> available memory which is incorrect.
> 
> Specifically this fixes the situation when booting a relocatable
> kernel and the memory is reported as an offset and size in the
> device tree, and the size needs to be adjusted accordingly.
> 
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
> common/image.c |   12 +++++++++---
> 1 files changed, 9 insertions(+), 3 deletions(-)

Acked-by: Kumar Gala <galak@kernel.crashing.org>

- k

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

* [U-Boot] [PATCH] Fix condition where bootm_size not set and wrong memory size reported
  2010-07-08 22:19     ` Kumar Gala
@ 2010-08-04 18:59       ` Kumar Gala
  0 siblings, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2010-08-04 18:59 UTC (permalink / raw)
  To: u-boot


On Jul 8, 2010, at 5:19 PM, Kumar Gala wrote:

> 
> On Jul 8, 2010, at 10:11 AM, Matthew McClintock wrote:
> 
>> If the user sets bootm_low and does not set bootm_size, u-boot will
>> report the memory node in the flat device tree incorrectly. Instead
>> of reporting the remaining size of memory, it will report the total
>> available memory which is incorrect.
>> 
>> Specifically this fixes the situation when booting a relocatable
>> kernel and the memory is reported as an offset and size in the
>> device tree, and the size needs to be adjusted accordingly.
>> 
>> Signed-off-by: Matthew McClintock <msm@freescale.com>
>> ---
>> common/image.c |   12 +++++++++---
>> 1 files changed, 9 insertions(+), 3 deletions(-)
> 
> Acked-by: Kumar Gala <galak@kernel.crashing.org>

poke on applying this patch.

- k

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

* [U-Boot] [PATCH] Fix condition where bootm_size not set and wrong memory size reported
  2010-07-08 15:11   ` Matthew McClintock
  2010-07-08 22:19     ` Kumar Gala
@ 2010-08-07 19:56     ` Wolfgang Denk
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2010-08-07 19:56 UTC (permalink / raw)
  To: u-boot

Dear Matthew McClintock,

In message <1278601868-17059-1-git-send-email-msm@freescale.com> you wrote:
> If the user sets bootm_low and does not set bootm_size, u-boot will
> report the memory node in the flat device tree incorrectly. Instead
> of reporting the remaining size of memory, it will report the total
> available memory which is incorrect.
> 
> Specifically this fixes the situation when booting a relocatable
> kernel and the memory is reported as an offset and size in the
> device tree, and the size needs to be adjusted accordingly.
> 
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
>  common/image.c |   12 +++++++++---
>  1 files changed, 9 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"To IBM, 'open' means there is a modicum  of  interoperability  among
some of their equipment."                            - Harv Masterson

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

end of thread, other threads:[~2010-08-07 19:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-07 20:44 [U-Boot] [PATCH] Fix condition where bootm_size not set and wrong memory size reported Matthew McClintock
2010-07-08  9:43 ` Sergei Shtylyov
2010-07-08 15:11   ` Matthew McClintock
2010-07-08 22:19     ` Kumar Gala
2010-08-04 18:59       ` Kumar Gala
2010-08-07 19:56     ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.