Skip to contentSkip to conversation

Fix condition where bootm_size not set and wrong memory size reported

PATCH New Matthew McClintock 4 participants 6 messages Jul 7, 2010 – Aug 7, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix condition where bootm_size not set and wrong memory size reported

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.

---
 common/image.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
common/image.c +9 -3
index 2b6007e..bf2acb0 100644
@@ -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
 }
 
Signature · 1 line
1.6.6.1
#1 lore raw

PATCH 1/1 Fix condition where bootm_size not set and wrong memory size reported

Hello.

Quoted 32 lines · Matthew McClintock

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.

---
 common/image.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
common/image.c +4 -1
index 2b6007e..bf2acb0 100644
@@ -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);

common/image.c ulong getenv_bootm_low(void) · line 452

Quoted 10 lines
common/image.c +5 -2
+	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

#2 lore raw

PATCH 1/1 Fix condition where bootm_size not set and wrong memory size reported

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.

---
 common/image.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
common/image.c +9 -3
index 2b6007e..2dccf96 100644
@@ -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
 }
 
Signature · 1 line
1.6.6.1
#3 lore raw

PATCH 1/1 Fix condition where bootm_size not set and wrong memory size reported

Quoted 5 lines · Matthew McClintock

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.

Quoted 8 lines

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.

---
common/image.c | 12 +++++++++---

1 files changed, 9 insertions(+), 3 deletions(-)

- k

#4 lore raw

PATCH 1/1 Fix condition where bootm_size not set and wrong memory size reported

Quoted 12 lines · Kumar Gala
Quoted 9 lines · Matthew McClintock

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.

Quoted 6 lines
Quoted 4 lines

---
common/image.c | 12 +++++++++---

1 files changed, 9 insertions(+), 3 deletions(-)

poke on applying this patch.

- k

#5 lore raw

PATCH 1/1 Fix condition where bootm_size not set and wrong memory size reported

In reply to Matthew McClintock

Dear Matthew McClintock,

Quoted 5 lines · In message <[email protected]> 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.

Quoted 8 lines

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.

---
 common/image.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
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