Skip to contentSkip to conversation

lib_arch/board.c: Move malloc initialization before flash_init()

PATCH New Stefan Roese 5 participants 7 messages May 11, 2009 – May 15, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib_arch/board.c: Move malloc initialization before flash_init()

This patch moves the malloc initialization before calling flash_init(). Upcoming changes to the NOR FLASH common CFI driver with optional MTD infrastructure and MTD concatenation support will call malloc(). And nothing really speaks against enabling malloc just a little earlier in the boot stage. Some architectures already enable malloc before calling flash_init() so they don't need any changes here.

Cc Wolfgang Denk <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc Scott McNutt <[email protected]>
Cc Shinya Kuribayashi <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc John Rigby <[email protected]>

---
If nobody from the platforms custodians objects against this patch then I suggest that Wolfgang pulls it directly into next.

Thanks,
Stefan

 lib_arm/board.c      |    6 +++---
 lib_blackfin/board.c |    7 ++++---
 lib_m68k/board.c     |    8 ++++----
 lib_mips/board.c     |    8 ++++----
 lib_nios/board.c     |    6 ++++--
 lib_nios2/board.c    |    6 ++++--
 lib_ppc/board.c      |    8 ++++----
 lib_sh/board.c       |    2 +-
 lib_sparc/board.c    |    9 ++++-----
 9 files changed, 32 insertions(+), 28 deletions(-)
lib_arm/board.c +3 -3
index 09eaaf2..bbed820 100644
@@ -313,6 +313,9 @@ void start_armboot (void)
 		}
 	}
 
+	/* armboot_start is defined in the board-specific linker script */
+	mem_malloc_init (_armboot_start - CONFIG_SYS_MALLOC_LEN);
+
 #ifndef CONFIG_SYS_NO_FLASH
 	/* configure available FLASH banks */
 	display_flash_config (flash_init ());
@@ -347,9 +350,6 @@ void start_armboot (void)
 	}
 #endif /* CONFIG_LCD */
 
-	/* armboot_start is defined in the board-specific linker script */
-	mem_malloc_init (_armboot_start - CONFIG_SYS_MALLOC_LEN);
-
 #if defined(CONFIG_CMD_NAND)
 	puts ("NAND:  ");
 	nand_init();		/* go init the NAND */
lib_blackfin/board.c +4 -3
index c223711..1df8370 100644
@@ -309,6 +309,10 @@ void board_init_r(gd_t * id, ulong dest_addr)
 	post_reloc();
 #endif
 
+	/* initialize malloc() area */
+	mem_malloc_init();
+	malloc_bin_reloc();
+
 #if	!defined(CONFIG_SYS_NO_FLASH)
 	/* Initialize the flash and protect u-boot by default */
 	extern flash_info_t flash_info[];
@@ -326,9 +330,6 @@ void board_init_r(gd_t * id, ulong dest_addr)
 	bd->bi_flashsize = 0;
 	bd->bi_flashoffset = 0;
 #endif
-	/* initialize malloc() area */
-	mem_malloc_init();
-	malloc_bin_reloc();
 
 #ifdef CONFIG_CMD_NAND
 	puts("NAND:  ");
lib_m68k/board.c +4 -4
index 583ce10..76b1f54 100644
@@ -519,6 +519,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	 */
 	trap_init (CONFIG_SYS_SDRAM_BASE);
 
+	/* initialize malloc() area */
+	mem_malloc_init ();
+	malloc_bin_reloc ();
+
 #if !defined(CONFIG_SYS_NO_FLASH)
 	puts ("FLASH: ");
 
@@ -563,10 +567,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	WATCHDOG_RESET ();
 
-	/* initialize malloc() area */
-	mem_malloc_init ();
-	malloc_bin_reloc ();
-
 #ifdef CONFIG_SPI
 # if !defined(CONFIG_ENV_IS_IN_EEPROM)
 	spi_init_f ();
lib_mips/board.c +4 -4
index dfe6831..f483211 100644
@@ -371,6 +371,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	bd = gd->bd;
 
+	/* initialize malloc() area */
+	mem_malloc_init();
+	malloc_bin_reloc();
+
 #ifndef CONFIG_SYS_NO_FLASH
 	/* configure available FLASH banks */
 	size = flash_init();
@@ -385,10 +389,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	bd->bi_flashoffset = 0;
 #endif
 
-	/* initialize malloc() area */
-	mem_malloc_init();
-	malloc_bin_reloc();
-
 #ifdef CONFIG_CMD_NAND
 	puts ("NAND:  ");
 	nand_init ();		/* go init the NAND */
lib_nios/board.c +4 -2
index 024beb5..fc63793 100644
@@ -143,11 +143,13 @@ void board_init (void)
 	}
 
 	WATCHDOG_RESET ();
+	mem_malloc_init();
+	malloc_bin_reloc();
+
+	WATCHDOG_RESET ();
 	bd->bi_flashsize = flash_init();
 
 	WATCHDOG_RESET ();
-	mem_malloc_init();
-	malloc_bin_reloc();
 	env_relocate();
 
 	bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
lib_nios2/board.c +4 -2
index d759f0f..7986bdc 100644
@@ -149,11 +149,13 @@ void board_init (void)
 	}
 
 	WATCHDOG_RESET ();
+	mem_malloc_init();
+	malloc_bin_reloc();
+
+	WATCHDOG_RESET ();
 	bd->bi_flashsize = flash_init();
 
 	WATCHDOG_RESET ();
-	mem_malloc_init();
-	malloc_bin_reloc();
 	env_relocate();
 
 	bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
lib_ppc/board.c +4 -4
index f69c5f4..7b76886 100644
@@ -761,6 +761,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	asm ("sync ; isync");
 
+	/* initialize malloc() area */
+	mem_malloc_init ();
+	malloc_bin_reloc ();
+
 #if !defined(CONFIG_SYS_NO_FLASH)
 	puts ("FLASH: ");
 
@@ -818,10 +822,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	WATCHDOG_RESET ();
 
-	/* initialize malloc() area */
-	mem_malloc_init ();
-	malloc_bin_reloc ();
-
 #ifdef CONFIG_SPI
 # if !defined(CONFIG_ENV_IS_IN_EEPROM)
 	spi_init_f ();
lib_sh/board.c +1 -1
index d4cc85c..d0dcf31 100644
@@ -156,8 +156,8 @@ init_fnc_t *init_sequence[] =
 	checkboard,		/* Check support board */
 	dram_init,		/* SDRAM init */
 	timer_init,		/* SuperH Timer (TCNT0 only) init */
-	sh_flash_init,	/* Flash memory(NOR) init*/
 	sh_mem_env_init,
+	sh_flash_init,	/* Flash memory(NOR) init*/
 	INIT_FUNC_NAND_INIT/* Flash memory (NAND) init */
 	INIT_FUNC_PCI_INIT	/* PCI init */
 	devices_init,
lib_sparc/board.c +4 -5
index e972d3e..862bce8 100644
@@ -331,6 +331,10 @@ void board_init_f(ulong bootflag)
 	 */
 	interrupt_init();
 
+	/* initialize malloc() area */
+	mem_malloc_init();
+	malloc_bin_reloc();
+
 #if !defined(CONFIG_SYS_NO_FLASH)
 	puts("FLASH: ");
 
@@ -371,11 +375,6 @@ void board_init_f(ulong bootflag)
 	bd->bi_flashoffset = 0;
 #endif				/* !CONFIG_SYS_NO_FLASH */
 
-	/* initialize malloc() area */
-	mem_malloc_init();
-
-	malloc_bin_reloc();
-
 #ifdef CONFIG_SPI
 # if !defined(CONFIG_ENV_IS_IN_EEPROM)
 	spi_init_f();
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 1/1 lib_arch/board.c: Move malloc initialization before flash_init()

Quoted 16 lines · On Mon, 11 May 2009 15:50:12 +0200 Stefan Roese <[email protected]> wrote:

This patch moves the malloc initialization before calling flash_init(). Upcoming changes to the NOR FLASH common CFI driver with optional MTD infrastructure and MTD concatenation support will call malloc(). And nothing really speaks against enabling malloc just a little earlier in the boot stage. Some architectures already enable malloc before calling flash_init() so they don't need any changes here.

Cc Wolfgang Denk <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc Scott McNutt <[email protected]>
Cc Shinya Kuribayashi <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc John Rigby <[email protected]>
Quoted 3 lines

---
If nobody from the platforms custodians objects against this patch then I suggest that Wolfgang pulls it directly into next.

fyi, you've only cc:d Scott McNutt and John Rigby on this mail, yet you indicate otherwise...

Kim

#2 lore raw

PATCH 1/1 lib_arch/board.c: Move malloc initialization before flash_init()

Quoted 13 lines · On Tuesday 12 May 2009 22:09:11 Kim Phillips wrote:
Quoted 9 lines
Cc Wolfgang Denk <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc Scott McNutt <[email protected]>
Cc Shinya Kuribayashi <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc John Rigby <[email protected]>
Quoted 3 lines

---
If nobody from the platforms custodians objects against this patch then I suggest that Wolfgang pulls it directly into next.

Quoted 2 lines

fyi, you've only cc:d Scott McNutt and John Rigby on this mail, yet you indicate otherwise...

Hmmm. I used "git send-email" for sending and I'm pretty sure that I saw all those email addresses added by this command. Perhaps the mailing list server removed some? I've seen this happen on other lists as well.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#3 lore raw

PATCH 1/1 lib_arch/board.c: Move malloc initialization before flash_init()

Quoted 14 lines · On Wednesday 13 May 2009 00:20:52 Stefan Roese wrote:
Quoted 13 lines · On Tuesday 12 May 2009 22:09:11 Kim Phillips wrote:
Quoted 12 lines
Cc Wolfgang Denk <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc Scott McNutt <[email protected]>
Cc Shinya Kuribayashi <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc John Rigby <[email protected]>

---
If nobody from the platforms custodians objects against this patch then I suggest that Wolfgang pulls it directly into next.

Quoted 6 lines
Quoted 2 lines

fyi, you've only cc:d Scott McNutt and John Rigby on this mail, yet you indicate otherwise...

Hmmm. I used "git send-email" for sending and I'm pretty sure that I saw all those email addresses added by this command. Perhaps the mailing list server removed some? I've seen this happen on other lists as well.

full CC list looks fine on the e-mail i received
-mike

#4 lore raw

PATCH 1/1 lib_arch/board.c: Move malloc initialization before flash_init()

Quoted 18 lines · On Wed, 13 May 2009 00:58:06 -0400 Mike Frysinger <[email protected]> wrote:
Quoted 17 lines · On Wednesday 13 May 2009 00:20:52 Stefan Roese wrote:
Quoted 15 lines · On Tuesday 12 May 2009 22:09:11 Kim Phillips wrote:
Quoted 9 lines
Cc Wolfgang Denk <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc Scott McNutt <[email protected]>
Cc Shinya Kuribayashi <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc John Rigby <[email protected]>
Quoted 3 lines

---
If nobody from the platforms custodians objects against this patch then I suggest that Wolfgang pulls it directly into next.

fyi, you've only cc:d Scott McNutt and John Rigby on this mail, yet you indicate otherwise...

Quoted 6 lines
Quoted 3 lines

Hmmm. I used "git send-email" for sending and I'm pretty sure that I saw all those email addresses added by this command. Perhaps the mailing list server removed some? I've seen this happen on other lists as well.

full CC list looks fine on the e-mail i received
-mike

ok, makes sense; I thought I was over having problems with my mail server, but I guess not.

sorry for the noise.

Kim

#5 lore raw

PATCH 1/1 lib_arch/board.c: Move malloc initialization before flash_init()

In reply to Stefan Roese

Hi Stefan,

Quoted 14 lines · On Tuesday 12 May 2009 22:09:11 Kim Phillips wrote:
Quoted 13 lines
Quoted 12 lines
Cc Wolfgang Denk <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc Scott McNutt <[email protected]>
Cc Shinya Kuribayashi <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc John Rigby <[email protected]>

---
If nobody from the platforms custodians objects against this patch then I suggest that Wolfgang pulls it directly into next.

Quoted 6 lines
Quoted 2 lines

fyi, you've only cc:d Scott McNutt and John Rigby on this mail, yet you indicate otherwise...

Hmmm. I used "git send-email" for sending and I'm pretty sure that I saw all those email addresses added by this command. Perhaps the mailing list server removed some? I've seen this happen on other lists as well.

It's pretty certain that there is a problem somewhere, as I also noted discrepancies between what I sent and what I see on the ML. I dare not point a finger to any component of this chain without further research however...

Cheers
Detlev

Signature · 6 lines
14474011154664524427946373126085988481573677491474835889066354349131199152128
If you know why this number is perfect - you're probably a mathematician...
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#6 lore raw

PATCH 1/1 lib_arch/board.c: Move malloc initialization before flash_init()

In reply to Stefan Roese

Dear Stefan Roese,

Quoted 16 lines · In message <[email protected]> you wrote:

This patch moves the malloc initialization before calling flash_init(). Upcoming changes to the NOR FLASH common CFI driver with optional MTD infrastructure and MTD concatenation support will call malloc(). And nothing really speaks against enabling malloc just a little earlier in the boot stage. Some architectures already enable malloc before calling flash_init() so they don't need any changes here.

Cc Wolfgang Denk <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc Scott McNutt <[email protected]>
Cc Shinya Kuribayashi <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc John Rigby <[email protected]>
Quoted 3 lines

---
If nobody from the platforms custodians objects against this patch then I suggest that Wolfgang pulls it directly into next.

Done, 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
It is better to marry than to burn.
                                - Bible ``I Corinthians'' ch. 7, v. 9