public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization
@ 2009-10-07  2:13 Nishanth Menon
  2009-10-07  2:13 ` [U-Boot] [PATCH] OMAP3: remove SZ definition in config definitions Nishanth Menon
  2009-10-07  2:52 ` [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization Graeme Russ
  0 siblings, 2 replies; 5+ messages in thread
From: Nishanth Menon @ 2009-10-07  2:13 UTC (permalink / raw)
  To: u-boot

Remove the predefined static initialization
and generate the map dynamically to reduce
code size.

This patch benefits were pointed out by Peter:
http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25523748&page=y

Signed-off-by: Nishanth Menon <nm@ti.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Sandeep Paulraj <s-paulraj@ti.com>
Cc: Tom Rix <tom.rix@windriver.com>
---
 common/dlmalloc.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index 241db8c..25e5314 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1474,6 +1474,7 @@ typedef struct malloc_chunk* mbinptr;
 
 #define IAV(i)  bin_at(i), bin_at(i)
 
+#ifdef CONFIG_X86
 static mbinptr av_[NAV * 2 + 2] = {
  0, 0,
  IAV(0),   IAV(1),   IAV(2),   IAV(3),   IAV(4),   IAV(5),   IAV(6),   IAV(7),
@@ -1493,6 +1494,9 @@ static mbinptr av_[NAV * 2 + 2] = {
  IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119),
  IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
 };
+#else
+static mbinptr av_[NAV * 2 + 2];
+#endif
 
 void malloc_bin_reloc (void)
 {
@@ -1527,6 +1531,11 @@ void *sbrk(ptrdiff_t increment)
  */
 void mem_malloc_init(ulong start, ulong size)
 {
+	u8 i;
+	av_[0] = av_[1] = 0;
+	for (i = 0; i < 128; i++)
+		av_[2 + i * 2] = av_[2 + i * 2 + 1] = bin_at(i);
+
 	mem_malloc_start = start;
 	mem_malloc_end = start + size;
 	mem_malloc_brk = start;
-- 
1.6.0.4

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

* [U-Boot] [PATCH] OMAP3: remove SZ definition in config definitions
  2009-10-07  2:13 [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization Nishanth Menon
@ 2009-10-07  2:13 ` Nishanth Menon
  2009-10-07  2:26   ` Paulraj, Sandeep
  2009-10-07  2:52 ` [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization Graeme Russ
  1 sibling, 1 reply; 5+ messages in thread
From: Nishanth Menon @ 2009-10-07  2:13 UTC (permalink / raw)
  To: u-boot

SZ definitions are deprecated as indicated by wd here:
http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25584065&page=y

Fix by running the following script
I=`cat include/asm-arm/sizes.h |grep SZ_|cut -d ' ' -f2`
I=`cat include/asm-arm/sizes.h |grep SZ_|cut -d ' ' -f4-`
sz_array=( $I )
val_array=( $J )
for file in include/configs/omap3_*;
do
	x=0
	for i in $I
	do
		o=${sz_array[$x]}
		n=${val_array[$x]}
		cat $file |sed -e "s/$o/$n/g">b
		mv b $file
		x=$(( x + 1 ))
	done
done

Signed-off-by: Nishanth Menon <nm@ti.com>
Cc: Vikram Pandita <vikram.pandita@ti.com>
Cc: Sandeep Paulraj <s-paulraj@ti.com>
Cc: Tom Rix <tom.rix@windriver.com>
Cc: Dirk Behme <dirk.behme@googlemail.com>
---
 include/configs/omap3_beagle.h  |   16 ++++++++--------
 include/configs/omap3_evm.h     |   16 ++++++++--------
 include/configs/omap3_overo.h   |   16 ++++++++--------
 include/configs/omap3_pandora.h |   16 ++++++++--------
 include/configs/omap3_zoom1.h   |   16 ++++++++--------
 include/configs/omap3_zoom2.h   |   16 ++++++++--------
 6 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index 55eeb94..14754c3 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -61,10 +61,10 @@
 
 /*
  * Size of malloc() pool
+ * Total env = 128K, malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 
@@ -239,10 +239,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -250,7 +250,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -269,7 +269,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
index 72e9626..f615a4e 100644
--- a/include/configs/omap3_evm.h
+++ b/include/configs/omap3_evm.h
@@ -66,10 +66,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 /*
@@ -231,10 +231,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -242,7 +242,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -261,7 +261,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors */
 						/* on one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index 1a91921..3ba9b69 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -53,10 +53,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 
@@ -224,10 +224,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -235,7 +235,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -254,7 +254,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
diff --git a/include/configs/omap3_pandora.h b/include/configs/omap3_pandora.h
index 064c0bc..517df23 100644
--- a/include/configs/omap3_pandora.h
+++ b/include/configs/omap3_pandora.h
@@ -56,10 +56,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 
@@ -228,10 +228,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -239,7 +239,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -258,7 +258,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
diff --git a/include/configs/omap3_zoom1.h b/include/configs/omap3_zoom1.h
index b55b8f0..f428039 100644
--- a/include/configs/omap3_zoom1.h
+++ b/include/configs/omap3_zoom1.h
@@ -62,10 +62,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 
@@ -236,10 +236,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -247,7 +247,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -266,7 +266,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
index 75ab980..d1989f7 100644
--- a/include/configs/omap3_zoom2.h
+++ b/include/configs/omap3_zoom2.h
@@ -63,10 +63,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 /*
@@ -201,10 +201,10 @@
  *
  * The stack sizes are set up in start.S using these settings
  */
-#define CONFIG_STACKSIZE	SZ_128K
+#define CONFIG_STACKSIZE	0x00020000
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K
-#define CONFIG_STACKSIZE_FIQ	SZ_4K
+#define CONFIG_STACKSIZE_IRQ	0x00001000
+#define CONFIG_STACKSIZE_FIQ	0x00001000
 #endif
 
 /*-----------------------------------------------------------------------
@@ -212,7 +212,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -231,7 +231,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
-- 
1.6.0.4

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

* [U-Boot] [PATCH] OMAP3: remove SZ definition in config definitions
  2009-10-07  2:13 ` [U-Boot] [PATCH] OMAP3: remove SZ definition in config definitions Nishanth Menon
@ 2009-10-07  2:26   ` Paulraj, Sandeep
  0 siblings, 0 replies; 5+ messages in thread
From: Paulraj, Sandeep @ 2009-10-07  2:26 UTC (permalink / raw)
  To: u-boot



> Subject: [PATCH] OMAP3: remove SZ definition in config definitions
> 
> SZ definitions are deprecated as indicated by wd here:
> http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25584065&page
> =y
> 
> Fix by running the following script
> I=`cat include/asm-arm/sizes.h |grep SZ_|cut -d ' ' -f2`
> I=`cat include/asm-arm/sizes.h |grep SZ_|cut -d ' ' -f4-`
> sz_array=( $I )
> val_array=( $J )
> for file in include/configs/omap3_*;
> do
> 	x=0
> 	for i in $I
> 	do
> 		o=${sz_array[$x]}
> 		n=${val_array[$x]}
> 		cat $file |sed -e "s/$o/$n/g">b
> 		mv b $file
> 		x=$(( x + 1 ))
> 	done
> done
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>
> Cc: Vikram Pandita <vikram.pandita@ti.com>
> Cc: Sandeep Paulraj <s-paulraj@ti.com>
> Cc: Tom Rix <tom.rix@windriver.com>
> Cc: Dirk Behme <dirk.behme@googlemail.com>
> ---
Nishanth, a general comment.

I submitted a similar patch for DaVinci. I had done the same things as you have done. But Wolfgang commented that instead of 0x00001000 it is better to use (4 << 10)

-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */

Taking the above as an example according to Wolfgang , you should have

+#define CONFIG_STACKSIZE_FIQ	(4 << 10)	/* IRQ stack of 4K */


Infact I have already submitted a patch for the above for OMAP, but I had to address some comments from Tom. Tom had commented on OMAP 2420 H4 specific code which had similar references. 

Thanks,
Sandeep


>  include/configs/omap3_beagle.h  |   16 ++++++++--------
>  include/configs/omap3_evm.h     |   16 ++++++++--------
>  include/configs/omap3_overo.h   |   16 ++++++++--------
>  include/configs/omap3_pandora.h |   16 ++++++++--------
>  include/configs/omap3_zoom1.h   |   16 ++++++++--------
>  include/configs/omap3_zoom2.h   |   16 ++++++++--------
>  6 files changed, 48 insertions(+), 48 deletions(-)
> 
> diff --git a/include/configs/omap3_beagle.h
> b/include/configs/omap3_beagle.h
> index 55eeb94..14754c3 100644
> --- a/include/configs/omap3_beagle.h
> +++ b/include/configs/omap3_beagle.h
> @@ -61,10 +61,10 @@
> 
>  /*
>   * Size of malloc() pool
> + * Total env = 128K, malloc = 128K
>   */
> -#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size
> Environment */
> -						/* Sector */
> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
> +#define CONFIG_ENV_SIZE			0x00020000
> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
>  #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
>  						/* initial data */
> 
> @@ -239,10 +239,10 @@
>   *
>   * The stack sizes are set up in start.S using the settings below
>   */
> -#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
> +#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
>  #ifdef CONFIG_USE_IRQ
> -#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
> -#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
> +#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
> +#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
>  #endif
> 
>  /*-----------------------------------------------------------------------
> @@ -250,7 +250,7 @@
>   */
>  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
>  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
> -#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
> +#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
>  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
> 
>  /* SDRAM Bank Allocation method */
> @@ -269,7 +269,7 @@
>  #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
>  						/* one chip */
>  #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
> -#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
> */
> +#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
> */
> 
>  #define CONFIG_SYS_FLASH_BASE		boot_flash_base
> 
> diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
> index 72e9626..f615a4e 100644
> --- a/include/configs/omap3_evm.h
> +++ b/include/configs/omap3_evm.h
> @@ -66,10 +66,10 @@
> 
>  /*
>   * Size of malloc() pool
> + * Total Environment = 128K + malloc = 128K
>   */
> -#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size
> Environment */
> -						/* Sector */
> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
> +#define CONFIG_ENV_SIZE			0x00020000
> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
>  #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
>  						/* initial data */
>  /*
> @@ -231,10 +231,10 @@
>   *
>   * The stack sizes are set up in start.S using the settings below
>   */
> -#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
> +#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
>  #ifdef CONFIG_USE_IRQ
> -#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
> -#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
> +#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
> +#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
>  #endif
> 
>  /*-----------------------------------------------------------------------
> @@ -242,7 +242,7 @@
>   */
>  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
>  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
> -#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
> +#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
>  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
> 
>  /* SDRAM Bank Allocation method */
> @@ -261,7 +261,7 @@
>  #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors */
>  						/* on one chip */
>  #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
> -#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
> */
> +#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
> */
> 
>  #define CONFIG_SYS_FLASH_BASE		boot_flash_base
> 
> diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
> index 1a91921..3ba9b69 100644
> --- a/include/configs/omap3_overo.h
> +++ b/include/configs/omap3_overo.h
> @@ -53,10 +53,10 @@
> 
>  /*
>   * Size of malloc() pool
> + * Total Environment = 128K + malloc = 128K
>   */
> -#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size
> Environment */
> -						/* Sector */
> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
> +#define CONFIG_ENV_SIZE			0x00020000
> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
>  #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
>  						/* initial data */
> 
> @@ -224,10 +224,10 @@
>   *
>   * The stack sizes are set up in start.S using the settings below
>   */
> -#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
> +#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
>  #ifdef CONFIG_USE_IRQ
> -#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
> -#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
> +#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
> +#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
>  #endif
> 
>  /*-----------------------------------------------------------------------
> @@ -235,7 +235,7 @@
>   */
>  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
>  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
> -#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
> +#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
>  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
> 
>  /* SDRAM Bank Allocation method */
> @@ -254,7 +254,7 @@
>  #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
>  						/* one chip */
>  #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
> -#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
> */
> +#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
> */
> 
>  #define CONFIG_SYS_FLASH_BASE		boot_flash_base
> 
> diff --git a/include/configs/omap3_pandora.h
> b/include/configs/omap3_pandora.h
> index 064c0bc..517df23 100644
> --- a/include/configs/omap3_pandora.h
> +++ b/include/configs/omap3_pandora.h
> @@ -56,10 +56,10 @@
> 
>  /*
>   * Size of malloc() pool
> + * Total Environment = 128K + malloc = 128K
>   */
> -#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size
> Environment */
> -						/* Sector */
> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
> +#define CONFIG_ENV_SIZE			0x00020000
> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
>  #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
>  						/* initial data */
> 
> @@ -228,10 +228,10 @@
>   *
>   * The stack sizes are set up in start.S using the settings below
>   */
> -#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
> +#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
>  #ifdef CONFIG_USE_IRQ
> -#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
> -#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
> +#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
> +#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
>  #endif
> 
>  /*-----------------------------------------------------------------------
> @@ -239,7 +239,7 @@
>   */
>  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
>  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
> -#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
> +#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
>  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
> 
>  /* SDRAM Bank Allocation method */
> @@ -258,7 +258,7 @@
>  #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
>  						/* one chip */
>  #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
> -#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
> */
> +#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
> */
> 
>  #define CONFIG_SYS_FLASH_BASE		boot_flash_base
> 
> diff --git a/include/configs/omap3_zoom1.h b/include/configs/omap3_zoom1.h
> index b55b8f0..f428039 100644
> --- a/include/configs/omap3_zoom1.h
> +++ b/include/configs/omap3_zoom1.h
> @@ -62,10 +62,10 @@
> 
>  /*
>   * Size of malloc() pool
> + * Total Environment = 128K + malloc = 128K
>   */
> -#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size
> Environment */
> -						/* Sector */
> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
> +#define CONFIG_ENV_SIZE			0x00020000
> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
>  #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
>  						/* initial data */
> 
> @@ -236,10 +236,10 @@
>   *
>   * The stack sizes are set up in start.S using the settings below
>   */
> -#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
> +#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
>  #ifdef CONFIG_USE_IRQ
> -#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
> -#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
> +#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
> +#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
>  #endif
> 
>  /*-----------------------------------------------------------------------
> @@ -247,7 +247,7 @@
>   */
>  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
>  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
> -#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
> +#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
>  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
> 
>  /* SDRAM Bank Allocation method */
> @@ -266,7 +266,7 @@
>  #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
>  						/* one chip */
>  #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
> -#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
> */
> +#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
> */
> 
>  #define CONFIG_SYS_FLASH_BASE		boot_flash_base
> 
> diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
> index 75ab980..d1989f7 100644
> --- a/include/configs/omap3_zoom2.h
> +++ b/include/configs/omap3_zoom2.h
> @@ -63,10 +63,10 @@
> 
>  /*
>   * Size of malloc() pool
> + * Total Environment = 128K + malloc = 128K
>   */
> -#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size
> Environment */
> -						/* Sector */
> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
> +#define CONFIG_ENV_SIZE			0x00020000
> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
>  #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
>  						/* initial data */
>  /*
> @@ -201,10 +201,10 @@
>   *
>   * The stack sizes are set up in start.S using these settings
>   */
> -#define CONFIG_STACKSIZE	SZ_128K
> +#define CONFIG_STACKSIZE	0x00020000
>  #ifdef CONFIG_USE_IRQ
> -#define CONFIG_STACKSIZE_IRQ	SZ_4K
> -#define CONFIG_STACKSIZE_FIQ	SZ_4K
> +#define CONFIG_STACKSIZE_IRQ	0x00001000
> +#define CONFIG_STACKSIZE_FIQ	0x00001000
>  #endif
> 
>  /*-----------------------------------------------------------------------
> @@ -212,7 +212,7 @@
>   */
>  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
>  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
> -#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
> +#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
>  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
> 
>  /* SDRAM Bank Allocation method */
> @@ -231,7 +231,7 @@
>  #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
>  						/* one chip */
>  #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
> -#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
> */
> +#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
> */
> 
>  #define CONFIG_SYS_FLASH_BASE		boot_flash_base
> 
> --
> 1.6.0.4

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

* [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization
  2009-10-07  2:13 [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization Nishanth Menon
  2009-10-07  2:13 ` [U-Boot] [PATCH] OMAP3: remove SZ definition in config definitions Nishanth Menon
@ 2009-10-07  2:52 ` Graeme Russ
  2009-10-07  3:14   ` Nishanth Menon
  1 sibling, 1 reply; 5+ messages in thread
From: Graeme Russ @ 2009-10-07  2:52 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 7, 2009 at 1:13 PM, Nishanth Menon <nm@ti.com> wrote:
> Remove the predefined static initialization
> and generate the map dynamically to reduce
> code size.
>
> This patch benefits were pointed out by Peter:
> http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25523748&page=y
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> Cc: Peter Tyser <ptyser@xes-inc.com>
> Cc: Sandeep Paulraj <s-paulraj@ti.com>
> Cc: Tom Rix <tom.rix@windriver.com>
> ---
>  common/dlmalloc.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/common/dlmalloc.c b/common/dlmalloc.c
> index 241db8c..25e5314 100644
> --- a/common/dlmalloc.c
> +++ b/common/dlmalloc.c
> @@ -1474,6 +1474,7 @@ typedef struct malloc_chunk* mbinptr;
>
>  #define IAV(i)  bin_at(i), bin_at(i)
>
> +#ifdef CONFIG_X86
>  static mbinptr av_[NAV * 2 + 2] = {
>  0, 0,
>  IAV(0),   IAV(1),   IAV(2),   IAV(3),   IAV(4),   IAV(5),   IAV(6),   IAV(7),
> @@ -1493,6 +1494,9 @@ static mbinptr av_[NAV * 2 + 2] = {
>  IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119),
>  IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
>  };
> +#else
> +static mbinptr av_[NAV * 2 + 2];
> +#endif

Is there any reason why X86 is treated differently? I know the previous
patch to dlmalloc.c did, but in the end it really didn't need to and ended
up breaking the x86 build anyway (my fault for not getting time to test it
before it went mainline)

Feel free to remove this #ifdef unless you are 100% sure it IS needed.
Mainline x86 is broken anyway - if this change introduces another break, I
will submit a consolidated fix soon

>
>  void malloc_bin_reloc (void)
>  {
> @@ -1527,6 +1531,11 @@ void *sbrk(ptrdiff_t increment)
>  */
>  void mem_malloc_init(ulong start, ulong size)
>  {
> +       u8 i;
> +       av_[0] = av_[1] = 0;
> +       for (i = 0; i < 128; i++)
> +               av_[2 + i * 2] = av_[2 + i * 2 + 1] = bin_at(i);
> +
>        mem_malloc_start = start;
>        mem_malloc_end = start + size;
>        mem_malloc_brk = start;
> --
> 1.6.0.4

Regards,

Graeme

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

* [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization
  2009-10-07  2:52 ` [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization Graeme Russ
@ 2009-10-07  3:14   ` Nishanth Menon
  0 siblings, 0 replies; 5+ messages in thread
From: Nishanth Menon @ 2009-10-07  3:14 UTC (permalink / raw)
  To: u-boot

Graeme Russ had written, on 10/06/2009 09:52 PM, the following:
> On Wed, Oct 7, 2009 at 1:13 PM, Nishanth Menon <nm@ti.com> wrote:
>> Remove the predefined static initialization
>> and generate the map dynamically to reduce
>> code size.
>>
>> This patch benefits were pointed out by Peter:
>> http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25523748&page=y
>>
>> Signed-off-by: Nishanth Menon <nm@ti.com>
>> Cc: Peter Tyser <ptyser@xes-inc.com>
>> Cc: Sandeep Paulraj <s-paulraj@ti.com>
>> Cc: Tom Rix <tom.rix@windriver.com>
>> ---
>>  common/dlmalloc.c |    9 +++++++++
>>  1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/common/dlmalloc.c b/common/dlmalloc.c
>> index 241db8c..25e5314 100644
>> --- a/common/dlmalloc.c
>> +++ b/common/dlmalloc.c
>> @@ -1474,6 +1474,7 @@ typedef struct malloc_chunk* mbinptr;
>>
>>  #define IAV(i)  bin_at(i), bin_at(i)
>>
>> +#ifdef CONFIG_X86
>>  static mbinptr av_[NAV * 2 + 2] = {
>>  0, 0,
>>  IAV(0),   IAV(1),   IAV(2),   IAV(3),   IAV(4),   IAV(5),   IAV(6),   IAV(7),
>> @@ -1493,6 +1494,9 @@ static mbinptr av_[NAV * 2 + 2] = {
>>  IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119),
>>  IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
>>  };
>> +#else
>> +static mbinptr av_[NAV * 2 + 2];
>> +#endif
> 
> Is there any reason why X86 is treated differently? I know the previous
> patch to dlmalloc.c did, but in the end it really didn't need to and ended
> up breaking the x86 build anyway (my fault for not getting time to test it
> before it went mainline)
> 
> Feel free to remove this #ifdef unless you are 100% sure it IS needed.
> Mainline x86 is broken anyway - if this change introduces another break, I
> will submit a consolidated fix soon

I dont have any rationale to retain the #ifdef.. it is ugly.. will kick 
it out and send out a v3 of this patch in a short while.

> 
>>  void malloc_bin_reloc (void)
>>  {
>> @@ -1527,6 +1531,11 @@ void *sbrk(ptrdiff_t increment)
>>  */
>>  void mem_malloc_init(ulong start, ulong size)
>>  {
>> +       u8 i;
>> +       av_[0] = av_[1] = 0;
>> +       for (i = 0; i < 128; i++)
>> +               av_[2 + i * 2] = av_[2 + i * 2 + 1] = bin_at(i);
>> +
>>        mem_malloc_start = start;
>>        mem_malloc_end = start + size;
>>        mem_malloc_brk = start;
>> --
>> 1.6.0.4
> 
> Regards,
> 
> Graeme
> 


-- 
Regards,
Nishanth Menon

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

end of thread, other threads:[~2009-10-07  3:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-07  2:13 [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization Nishanth Menon
2009-10-07  2:13 ` [U-Boot] [PATCH] OMAP3: remove SZ definition in config definitions Nishanth Menon
2009-10-07  2:26   ` Paulraj, Sandeep
2009-10-07  2:52 ` [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization Graeme Russ
2009-10-07  3:14   ` Nishanth Menon

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