Skip to contentSkip to conversation

powerpc/85xx: Relocate env_addr if we CONFIG_SYS_RAMBOOT

PATCH New Kumar Gala 3 participants 3 messages Nov 17, 2010 PowerPC

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 powerpc/85xx: Relocate env_addr if we CONFIG_SYS_RAMBOOT

We use CONFIG_SYS_RAMBOOT for when boot out of NAND, SPI, SDHC/MMC and utilize a L2 or L3 cache in SRAM mode. In this case we will end up changing the cache from SRAM mode back to cache before we relocate the environment properly in env_relocate().

So we need to manual relocate the env pointer out of SRAM into DDR.

---
 arch/powerpc/lib/board.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/powerpc/lib/board.c +12 -0
index 2e0749d..5ce9caa 100644
@@ -645,6 +645,18 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	gd->cpu += dest_addr - CONFIG_SYS_MONITOR_BASE;
 #endif
 
+#if defined(CONFIG_MPC85xx) && defined(CONFIG_SYS_RAMBOOT)
+	/*
+	 * We use CONFIG_SYS_RAMBOOT for when boot out of NAND, SPI, SDHC/MMC
+	 * and utilize a L2 or L3 cache in SRAM mode.  In this case we will
+	 * end up changing the cache from SRAM mode back to cache before we
+	 * relocate the environment properly in env_relocate().
+	 *
+	 * So we need to manual relocate the env pointer out of SRAM into DDR.
+	 */
+	gd->env_addr += dest_addr - CONFIG_SYS_MONITOR_BASE;
+#endif
+
 #ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
 #endif
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/1 powerpc/85xx: Relocate env_addr if we CONFIG_SYS_RAMBOOT

Dear Kumar Gala,

Quoted 17 lines · In message <[email protected]> you…

We use CONFIG_SYS_RAMBOOT for when boot out of NAND, SPI, SDHC/MMC and utilize a L2 or L3 cache in SRAM mode. In this case we will end up changing the cache from SRAM mode back to cache before we relocate the environment properly in env_relocate().

So we need to manual relocate the env pointer out of SRAM into DDR.

---
 arch/powerpc/lib/board.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/powerpc/lib/board.c +0 -0
index 2e0749d..5ce9caa 100644

arch/powerpc/lib/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 650

Quoted 6 lines
arch/powerpc/lib/board.c +3 -0
@@ -645,6 +645,18 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	gd->cpu += dest_addr - CONFIG_SYS_MONITOR_BASE;
 #endif
 
+#if defined(CONFIG_MPC85xx) && defined(CONFIG_SYS_RAMBOOT)
+	/*
+	 * We use CONFIG_SYS_RAMBOOT for when boot out of NAND, SPI, SDHC/MMC

I think this is a bad misuse of the CONFIG_SYS_RAMBOOT variable here. Assume I have a 85xx system where U-Boot gets loaded by some means into DDR. Of course I will have CONFIG_MPC85xx and CONFIG_SYS_RAMBOOT set, but I do not want in any way that this special mechanism kicks in.

Please use a (new) specific feature-define for this.

Please also make sure to check other parts of the code if they use this obviously unsuitable construct!

Best regards,

Wolfgang Denk

Signature · 6 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
We fight only when there is no other choice. We prefer  the  ways  of
peaceful contact.
	-- Kirk, "Spectre of the Gun", stardate 4385.3
#2 lore raw

PATCH 1/1 powerpc/85xx: Relocate env_addr if we CONFIG_SYS_RAMBOOT

Quoted 23 lines · On Wed, 17 Nov 2010 21:58:31 +0100 Wolfgang Denk <[email protected]> wrote:

Dear Kumar Gala,

Quoted 20 lines · In message <[email protected]> you…

We use CONFIG_SYS_RAMBOOT for when boot out of NAND, SPI, SDHC/MMC and utilize a L2 or L3 cache in SRAM mode. In this case we will end up changing the cache from SRAM mode back to cache before we relocate the environment properly in env_relocate().

So we need to manual relocate the env pointer out of SRAM into DDR.

---
 arch/powerpc/lib/board.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/powerpc/lib/board.c +0 -0
index 2e0749d..5ce9caa 100644
@@ -645,6 +645,18 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	gd->cpu += dest_addr - CONFIG_SYS_MONITOR_BASE;
 #endif
 
Quoted 9 lines

arch/powerpc/lib/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 650

Quoted 3 lines
arch/powerpc/lib/board.c +3 -0
+#if defined(CONFIG_MPC85xx) && defined(CONFIG_SYS_RAMBOOT)
+	/*
+	 * We use CONFIG_SYS_RAMBOOT for when boot out of NAND, SPI, SDHC/MMC

I think this is a bad misuse of the CONFIG_SYS_RAMBOOT variable here. Assume I have a 85xx system where U-Boot gets loaded by some means into DDR. Of course I will have CONFIG_MPC85xx and CONFIG_SYS_RAMBOOT set, but I do not want in any way that this special mechanism kicks in.

Instead of trying to guess whether this is a boot scenario that needs this, how about checking env_addr to see if it falls within the bounds of the old image? If so, relocate it.

-Scott