Skip to contentSkip to conversation

Change bd/gd memsize/ram_size to be phys_size_t.

PATCH New Becky Bruce 2 participants 3 messages Jun 10, 2008 – Jun 11, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 Change bd/gd memsize/ram_size to be phys_size_t.

Currently, both are defined as an unsigned long, but should be phys_size_t. This should result in no real change, since phys_size_t is currently an unsigned long for all the default configs. Also add print_lnum to cmd_bdinfo to deal with the potentially wider memsize.

---
 board/trab/memory.c                |    2 +-
 common/cmd_bdinfo.c                |   24 ++++++++++++++++--------
 include/asm-arm/global_data.h      |    2 +-
 include/asm-blackfin/global_data.h |    2 +-
 include/asm-blackfin/u-boot.h      |    2 +-
 include/asm-i386/global_data.h     |    2 +-
 include/asm-i386/u-boot.h          |    2 +-
 include/asm-m68k/global_data.h     |    2 +-
 include/asm-m68k/u-boot.h          |    2 +-
 include/asm-microblaze/u-boot.h    |    2 +-
 include/asm-mips/global_data.h     |    2 +-
 include/asm-mips/u-boot.h          |    2 +-
 include/asm-nios/global_data.h     |    2 +-
 include/asm-nios/u-boot.h          |    2 +-
 include/asm-nios2/global_data.h    |    2 +-
 include/asm-nios2/u-boot.h         |    2 +-
 include/asm-ppc/global_data.h      |    2 +-
 include/asm-ppc/u-boot.h           |    2 +-
 include/asm-sh/global_data.h       |    2 +-
 include/asm-sh/u-boot.h            |    2 +-
 include/asm-sparc/global_data.h    |    2 +-
 include/asm-sparc/u-boot.h         |    2 +-
 22 files changed, 37 insertions(+), 29 deletions(-)
board/trab/memory.c +1 -1
index 8614be7..052432e 100644
@@ -460,7 +460,7 @@ int memory_post_test (int flags)
 {
 	int ret = 0;
 	bd_t *bd = gd->bd;
-	unsigned long memsize = (bd->bi_memsize >= 256 << 20 ?
+	phys_size_t memsize = (bd->bi_memsize >= 256 << 20 ?
 				 256 << 20 : bd->bi_memsize) - (1 << 20);
 
 
common/cmd_bdinfo.c +16 -8
index 731c1d2..5bb39d8 100644
@@ -33,6 +33,7 @@ DECLARE_GLOBAL_DATA_PTR;
 static void print_num(const char *, ulong);
 
 #ifndef CONFIG_ARM	/* PowerPC and other */
+static void print_lnum(const char *, u64);
 
 #ifdef CONFIG_PPC
 static void print_str(const char *, const char *);
@@ -47,7 +48,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	print_num ("bd address",    (ulong)bd		);
 #endif
 	print_num ("memstart",	    bd->bi_memstart	);
-	print_num ("memsize",	    bd->bi_memsize	);
+	print_lnum ("memsize", 	    bd->bi_memsize	);
 	print_num ("flashstart",    bd->bi_flashstart	);
 	print_num ("flashsize",	    bd->bi_flashsize	);
 	print_num ("flashoffset",   bd->bi_flashoffset	);
@@ -132,7 +133,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	bd_t *bd = gd->bd;
 
 	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_num ("memsize",		(ulong)bd->bi_memsize);
+	print_lnum ("memsize",		(u64)bd->bi_memsize);
 	print_num ("flashstart",	(ulong)bd->bi_flashstart);
 	print_num ("flashsize",		(ulong)bd->bi_flashsize);
 	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
@@ -158,7 +159,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	bd_t *bd = gd->bd;
 
 	print_num ("mem start",		(ulong)bd->bi_memstart);
-	print_num ("mem size",		(ulong)bd->bi_memsize);
+	print_lnum ("mem size",		(u64)bd->bi_memsize);
 	print_num ("flash start",	(ulong)bd->bi_flashstart);
 	print_num ("flash size",	(ulong)bd->bi_flashsize);
 	print_num ("flash offset",	(ulong)bd->bi_flashoffset);
@@ -188,7 +189,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	int i;
 	bd_t *bd = gd->bd;
 	print_num ("mem start      ",	(ulong)bd->bi_memstart);
-	print_num ("mem size       ",	(ulong)bd->bi_memsize);
+	print_lnum ("mem size       ",	(u64)bd->bi_memsize);
 	print_num ("flash start    ",	(ulong)bd->bi_flashstart);
 	print_num ("flash size     ",	(ulong)bd->bi_flashsize);
 	print_num ("flash offset   ",	(ulong)bd->bi_flashoffset);
@@ -220,7 +221,7 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 	print_num("bd address             ", (ulong) bd);
 #endif
 	print_num("memstart               ", bd->bi_memstart);
-	print_num("memsize                ", bd->bi_memsize);
+	print_lnum("memsize                ", bd->bi_memsize);
 	print_num("flashstart             ", bd->bi_flashstart);
 	print_num("CFG_MONITOR_BASE       ", CFG_MONITOR_BASE);
 	print_num("CFG_ENV_ADDR           ", CFG_ENV_ADDR);
@@ -257,7 +258,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	char buf[32];
 
 	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_num ("memsize",		(ulong)bd->bi_memsize);
+	print_lnum ("memsize",		(u64)bd->bi_memsize);
 	print_num ("flashstart",	(ulong)bd->bi_flashstart);
 	print_num ("flashsize",		(ulong)bd->bi_flashsize);
 	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
@@ -328,7 +329,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 	print_num("boot_params", (ulong)bd->bi_boot_params);
 	print_num("memstart",    (ulong)bd->bi_memstart);
-	print_num("memsize",     (ulong)bd->bi_memsize);
+	print_lnum("memsize",    (u64)bd->bi_memsize);
 	print_num("flashstart",  (ulong)bd->bi_flashstart);
 	print_num("flashsize",   (ulong)bd->bi_flashsize);
 	print_num("flashoffset", (ulong)bd->bi_flashoffset);
@@ -352,7 +353,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 	print_num ("boot_params",	(ulong)bd->bi_boot_params);
 	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_num ("memsize",		(ulong)bd->bi_memsize);
+	print_lnum ("memsize",		(u64)bd->bi_memsize);
 	print_num ("flashstart",	(ulong)bd->bi_flashstart);
 	print_num ("flashsize",		(ulong)bd->bi_flashsize);
 	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
@@ -408,6 +409,13 @@ static void print_num(const char *name, ulong value)
 	printf ("%-12s= 0x%08lX\n", name, value);
 }
 
+#ifndef CONFIG_ARM
+static void print_lnum(const char *name, u64 value)
+{
+	printf ("%-12s= 0x%.8llX\n", name, value);
+}
+#endif
+
 #if defined(CONFIG_PPC) || defined(CONFIG_M68K)
 static void print_str(const char *name, const char *str)
 {
include/asm-arm/global_data.h +1 -1
index 7564ff1..7e2a53a 100644
@@ -48,7 +48,7 @@ typedef	struct	global_data {
 #if 0
 	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
 	unsigned long	bus_clk;
-	unsigned long	ram_size;	/* RAM size */
+	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reset_status;	/* reset status register at boot */
 #endif
 	void		**jt;		/* jump table */
include/asm-blackfin/global_data.h +1 -1
index 4c88639..b0b01e4 100644
@@ -43,7 +43,7 @@ typedef struct global_data {
 	unsigned long board_type;
 	unsigned long baudrate;
 	unsigned long have_console;	/* serial_init() was called */
-	unsigned long ram_size;	/* RAM size */
+	phys_size_t ram_size;		/* RAM size */
 	unsigned long reloc_off;	/* Relocation Offset */
 	unsigned long env_addr;	/* Address  of Environment struct */
 	unsigned long env_valid;	/* Checksum of Environment valid? */
include/asm-blackfin/u-boot.h +1 -1
index 84f1553..9d2903b 100644
@@ -34,7 +34,7 @@ typedef struct bd_info {
 	unsigned char bi_enetaddr[6];	/* Ethernet adress */
 	unsigned long bi_boot_params;	/* where this board expects params */
 	unsigned long bi_memstart;	/* start of DRAM memory */
-	unsigned long bi_memsize;	/* size  of DRAM memory in bytes */
+	phys_size_t bi_memsize;		/* size  of DRAM memory in bytes */
 	unsigned long bi_flashstart;	/* start of FLASH memory */
 	unsigned long bi_flashsize;	/* size  of FLASH memory */
 	unsigned long bi_flashoffset;	/* reserved area for startup monitor */
include/asm-i386/global_data.h +1 -1
index 3235063..5dfb595 100644
@@ -43,7 +43,7 @@ typedef	struct {
 	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
 	unsigned long	bus_clk;
-	unsigned long	ram_size;	/* RAM size */
+	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reset_status;	/* reset status register at boot */
 	void		**jt;		/* jump table */
 } gd_t;
include/asm-i386/u-boot.h +1 -1
index 1e19f8f..fc5a2ae 100644
@@ -38,7 +38,7 @@
 
 typedef struct bd_info {
 	unsigned long	bi_memstart;	/* start of DRAM memory */
-	unsigned long	bi_memsize;	/* size	 of DRAM memory in bytes */
+	phys_size_t	bi_memsize;	/* size	 of DRAM memory in bytes */
 	unsigned long	bi_flashstart;	/* start of FLASH memory */
 	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
 	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
include/asm-m68k/global_data.h +1 -1
index 7377d31..10c6931 100644
@@ -51,7 +51,7 @@ typedef	struct	global_data {
 	unsigned long	i2c1_clk;
 	unsigned long	i2c2_clk;
 #endif
-	unsigned long	ram_size;	/* RAM size */
+	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	reset_status;	/* reset status register at boot	*/
 	unsigned long	env_addr;	/* Address  of Environment struct	*/
include/asm-m68k/u-boot.h +1 -1
index 93a6959..5a0d5fe 100644
@@ -38,7 +38,7 @@
 
 typedef struct bd_info {
 	unsigned long bi_memstart;	/* start of DRAM memory */
-	unsigned long bi_memsize;	/* size  of DRAM memory in bytes */
+	phys_size_t bi_memsize;		/* size  of DRAM memory in bytes */
 	unsigned long bi_flashstart;	/* start of FLASH memory */
 	unsigned long bi_flashsize;	/* size  of FLASH memory */
 	unsigned long bi_flashoffset;	/* reserved area for startup monitor */
include/asm-microblaze/u-boot.h +1 -1
index e2035bd..9db491e 100644
@@ -34,7 +34,7 @@
 
 typedef struct bd_info {
 	unsigned long	bi_memstart;	/* start of DRAM memory */
-	unsigned long	bi_memsize;	/* size	 of DRAM memory in bytes */
+	phys_size_t	bi_memsize;	/* size	 of DRAM memory in bytes */
 	unsigned long	bi_flashstart;	/* start of FLASH memory */
 	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
 	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
include/asm-mips/global_data.h +1 -1
index 0c0ba50..ecee6de 100644
@@ -41,7 +41,7 @@ typedef	struct	global_data {
 	unsigned long	flags;
 	unsigned long	baudrate;
 	unsigned long	have_console;	/* serial_init() was called */
-	unsigned long	ram_size;	/* RAM size */
+	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	env_addr;	/* Address  of Environment struct */
 	unsigned long	env_valid;	/* Checksum of Environment valid? */
include/asm-mips/u-boot.h +1 -1
index d1273a4..9ecb9ac 100644
@@ -38,7 +38,7 @@ typedef struct bd_info {
 	unsigned long	bi_arch_number;	/* unique id for this board */
 	unsigned long	bi_boot_params;	/* where this board expects params */
 	unsigned long	bi_memstart;	/* start of DRAM memory */
-	unsigned long	bi_memsize;	/* size	 of DRAM memory in bytes */
+	phys_size_t	bi_memsize;	/* size	 of DRAM memory in bytes */
 	unsigned long	bi_flashstart;	/* start of FLASH memory */
 	unsigned long	bi_flashsize;	/* size  of FLASH memory */
 	unsigned long	bi_flashoffset;	/* reserved area for startup monitor */
include/asm-nios/global_data.h +1 -1
index a8cc987..a56f939 100644
@@ -30,7 +30,7 @@ typedef	struct	global_data {
 	unsigned long	baudrate;
 	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
 	unsigned long	have_console;	/* serial_init() was called */
-	unsigned long	ram_size;	/* RAM size */
+	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	env_addr;	/* Address  of Environment struct */
 	unsigned long	env_valid;	/* Checksum of Environment valid */
include/asm-nios/u-boot.h +1 -1
index aae4be1..3436185 100644
@@ -34,7 +34,7 @@
 
 typedef struct bd_info {
 	unsigned long	bi_memstart;	/* start of DRAM memory */
-	unsigned long	bi_memsize;	/* size	 of DRAM memory in bytes */
+	phys_size_t	bi_memsize;	/* size	 of DRAM memory in bytes */
 	unsigned long	bi_flashstart;	/* start of FLASH memory */
 	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
 	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
include/asm-nios2/global_data.h +1 -1
index 7290489..cd17e08 100644
@@ -29,7 +29,7 @@ typedef	struct	global_data {
 	unsigned long	baudrate;
 	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
 	unsigned long	have_console;	/* serial_init() was called */
-	unsigned long	ram_size;	/* RAM size */
+	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	env_addr;	/* Address  of Environment struct */
 	unsigned long	env_valid;	/* Checksum of Environment valid */
include/asm-nios2/u-boot.h +1 -1
index 3f29962..de8c405 100644
@@ -33,7 +33,7 @@
 
 typedef struct bd_info {
 	unsigned long	bi_memstart;	/* start of DRAM memory */
-	unsigned long	bi_memsize;	/* size	 of DRAM memory in bytes */
+	phys_size_t	bi_memsize;	/* size	 of DRAM memory in bytes */
 	unsigned long	bi_flashstart;	/* start of FLASH memory */
 	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
 	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
include/asm-ppc/global_data.h +1 -1
index ea70266..d1c37a0 100644
@@ -113,7 +113,7 @@ typedef	struct	global_data {
 	unsigned long   pev_clk;
 	unsigned long   flb_clk;
 #endif
-	unsigned long	ram_size;	/* RAM size */
+	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	reset_status;	/* reset status register at boot	*/
 	unsigned long	env_addr;	/* Address  of Environment struct	*/
include/asm-ppc/u-boot.h +1 -1
index 83af2f5..54ac01d 100644
@@ -38,7 +38,7 @@
 
 typedef struct bd_info {
 	unsigned long	bi_memstart;	/* start of DRAM memory */
-	unsigned long	bi_memsize;	/* size	 of DRAM memory in bytes */
+	phys_size_t	bi_memsize;	/* size	 of DRAM memory in bytes */
 	unsigned long	bi_flashstart;	/* start of FLASH memory */
 	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
 	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
include/asm-sh/global_data.h +1 -1
index 69af24a..d61421b 100644
@@ -34,7 +34,7 @@ typedef	struct global_data
 	unsigned long	baudrate;
 	unsigned long	cpu_clk;	/* CPU clock in Hz! */
 	unsigned long	have_console;	/* serial_init() was called */
-	unsigned long	ram_size;	/* RAM size */
+	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	env_addr;	/* Address  of Environment struct */
 	unsigned long	env_valid;	/* Checksum of Environment valid */
include/asm-sh/u-boot.h +1 -1
index b79644c..e89c193 100644
@@ -27,7 +27,7 @@
 
 typedef struct bd_info {
 	unsigned long   bi_memstart;    /* start of DRAM memory */
-	unsigned long   bi_memsize;     /* size  of DRAM memory in bytes */
+	phys_size_t	bi_memsize;     /* size  of DRAM memory in bytes */
 	unsigned long   bi_flashstart;  /* start of FLASH memory */
 	unsigned long   bi_flashsize;   /* size  of FLASH memory */
 	unsigned long   bi_flashoffset; /* reserved area for startup monitor */
include/asm-sparc/global_data.h +1 -1
index de2c84b..a8d85f1 100644
@@ -46,7 +46,7 @@ typedef struct global_data {
 	unsigned long cpu_clk;	/* CPU clock in Hz!             */
 	unsigned long bus_clk;
 
-	unsigned long ram_size;	/* RAM size */
+	phys_size_t ram_size;		/* RAM size */
 	unsigned long reloc_off;	/* Relocation Offset */
 	unsigned long reset_status;	/* reset status register at boot        */
 	unsigned long env_addr;	/* Address  of Environment struct       */
include/asm-sparc/u-boot.h +1 -1
index 9c594e1..c42e93c 100644
@@ -44,7 +44,7 @@
 
 typedef struct bd_info {
 	unsigned long bi_memstart;	/* start of DRAM memory */
-	unsigned long bi_memsize;	/* size  of DRAM memory in bytes */
+	phys_size_t bi_memsize;		/* size  of DRAM memory in bytes */
 	unsigned long bi_flashstart;	/* start of FLASH memory */
 	unsigned long bi_flashsize;	/* size  of FLASH memory */
 	unsigned long bi_flashoffset;	/* reserved area for startup monitor */
Signature · 1 line
1.5.4.1
#1 lore raw

PATCH 2/4 Change bd/gd memsize/ram_size to be phys_size_t.

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

Currently, both are defined as an unsigned long, but should be phys_size_t. This should result in no real change, since phys_size_t is currently an unsigned long for all the default configs. Also add print_lnum to cmd_bdinfo to deal with the potentially wider memsize.

---
 board/trab/memory.c                |    2 +-
 common/cmd_bdinfo.c                |   24 ++++++++++++++++--------
 include/asm-arm/global_data.h      |    2 +-
 include/asm-blackfin/global_data.h |    2 +-
 include/asm-blackfin/u-boot.h      |    2 +-
 include/asm-i386/global_data.h     |    2 +-
 include/asm-i386/u-boot.h          |    2 +-
 include/asm-m68k/global_data.h     |    2 +-
 include/asm-m68k/u-boot.h          |    2 +-
 include/asm-microblaze/u-boot.h    |    2 +-
 include/asm-mips/global_data.h     |    2 +-
 include/asm-mips/u-boot.h          |    2 +-
 include/asm-nios/global_data.h     |    2 +-
 include/asm-nios/u-boot.h          |    2 +-
 include/asm-nios2/global_data.h    |    2 +-
Quoted 8 lines
 include/asm-nios2/u-boot.h         |    2 +-
 include/asm-ppc/global_data.h      |    2 +-
 include/asm-ppc/u-boot.h           |    2 +-
 include/asm-sh/global_data.h       |    2 +-
 include/asm-sh/u-boot.h            |    2 +-
 include/asm-sparc/global_data.h    |    2 +-
 include/asm-sparc/u-boot.h         |    2 +-
 22 files changed, 37 insertions(+), 29 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 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
Always leave room to add an explanation if it doesn't work out.
#2 lore raw

PATCH 2/4 Change bd/gd memsize/ram_size to be phys_size_t.

In reply to Becky Bruce
Quoted 23 lines · In message <[email protected]> you…

Currently, both are defined as an unsigned long, but should be phys_size_t. This should result in no real change, since phys_size_t is currently an unsigned long for all the default configs. Also add print_lnum to cmd_bdinfo to deal with the potentially wider memsize.

---
 board/trab/memory.c                |    2 +-
 common/cmd_bdinfo.c                |   24 ++++++++++++++++--------
 include/asm-arm/global_data.h      |    2 +-
 include/asm-blackfin/global_data.h |    2 +-
 include/asm-blackfin/u-boot.h      |    2 +-
 include/asm-i386/global_data.h     |    2 +-
 include/asm-i386/u-boot.h          |    2 +-
 include/asm-m68k/global_data.h     |    2 +-
 include/asm-m68k/u-boot.h          |    2 +-
 include/asm-microblaze/u-boot.h    |    2 +-
 include/asm-mips/global_data.h     |    2 +-
 include/asm-mips/u-boot.h          |    2 +-
 include/asm-nios/global_data.h     |    2 +-
 include/asm-nios/u-boot.h          |    2 +-
 include/asm-nios2/global_data.h    |    2 +-
Quoted 8 lines
 include/asm-nios2/u-boot.h         |    2 +-
 include/asm-ppc/global_data.h      |    2 +-
 include/asm-ppc/u-boot.h           |    2 +-
 include/asm-sh/global_data.h       |    2 +-
 include/asm-sh/u-boot.h            |    2 +-
 include/asm-sparc/global_data.h    |    2 +-
 include/asm-sparc/u-boot.h         |    2 +-
 22 files changed, 37 insertions(+), 29 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 8 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
The universe contains any amount of horrible ways  to  be  woken  up,
such as the noise of the mob breaking down the front door, the scream
of fire engines, or the realization that today is the Monday which on
Friday night was a comfortably long way off.
                                 - Terry Pratchett, _Moving Pictures_