Skip to contentSkip to conversation

bdinfo not showing correct info about memory size

PATCH New Ricardo Ribalda Delgado 4 participants 13 messages Jul 30, 2008 – Sep 1, 2008 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

---
 common/cmd_bdinfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bdinfo.c +1 -1
index caa467d..583bbc2 100644
@@ -48,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_lnum ("memsize", 	    bd->bi_memsize	);
+	print_num ("memsize", 	    bd->bi_memsize	);
 	print_num ("flashstart",    bd->bi_flashstart	);
 	print_num ("flashsize",	    bd->bi_flashsize	);
 	print_num ("flashoffset",   bd->bi_flashoffset	);
Signature · 1 line
1.5.6.3
#1 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

Quoted 11 lines · In message <[email protected]> you wrote:
---
 common/cmd_bdinfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bdinfo.c +0 -0
index caa467d..583bbc2 100644

common/cmd_bdinfo.c int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 54

Quoted 8 lines
common/cmd_bdinfo.c +1 -1
@@ -48,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_lnum ("memsize", 	    bd->bi_memsize	);
+	print_num ("memsize", 	    bd->bi_memsize	);
 	print_num ("flashstart",    bd->bi_flashstart	);
 	print_num ("flashsize",	    bd->bi_flashsize	);
 	print_num ("flashoffset",   bd->bi_flashoffset	);

This patch is wrong. print_num() takes an ulong argument, but bi_memsize has type phys_size_t.

Rejected.

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
"If you can, help others. If you can't, at least don't hurt  others."
- the Dalai Lama
#2 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

Hello Wolfgang

My board has 0x10000000 bytes of memory, without this patch, bdinfo shows 0x0 bytes of ram, but with this patch it shows the correct amount... maybe the problem is in print_lnum

Best regards

Quoted 37 lines · Wolfgang Denk
Quoted 11 lines · In message <[email protected]> you wrote:
---
 common/cmd_bdinfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bdinfo.c +0 -0
index caa467d..583bbc2 100644

common/cmd_bdinfo.c int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 54

Quoted 8 lines
common/cmd_bdinfo.c +1 -1
@@ -48,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_lnum ("memsize",      bd->bi_memsize      );
+     print_num ("memsize",       bd->bi_memsize      );
      print_num ("flashstart",    bd->bi_flashstart   );
      print_num ("flashsize",     bd->bi_flashsize    );
      print_num ("flashoffset",   bd->bi_flashoffset  );

This patch is wrong. print_num() takes an ulong argument, but bi_memsize has type phys_size_t.

Rejected.

Best regards,

Wolfgang Denk

--
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 "If you can, help others. If you can't, at least don't hurt others."
- the Dalai Lama

Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
#3 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

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

My board has 0x10000000 bytes of memory, without this patch, bdinfo shows 0x0 bytes of ram, but with this patch it shows the correct amount... maybe the problem is in print_lnum

It would be strange if this happened for your board only - I rather suspect that you have a problem with your board configuration.

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
Every revolutionary idea - in science, politics, art, or  whatever  -
evokes three stages of reaction in a hearer:
  1. It is completely impossible - don't waste my time.
  2. It is possible, but it is not worth doing.
  3. I said it was a good idea all along.
#4 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

Hello Wolfwang

I don't think that it is a problem with my board config, otherwhise
it won't show the correct size using print_num...
Maybe other users didn't have any problems because their memory
size is smaller than 256MB.

Best regards

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

My board has 0x10000000 bytes of memory, without this patch, bdinfo shows 0x0 bytes of ram, but with this patch it shows the correct amount... maybe the problem is in print_lnum

It would be strange if this happened for your board only - I rather suspect that you have a problem with your board configuration.

Best regards,

Wolfgang Denk

--
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 Every revolutionary idea - in science, politics, art, or whatever - evokes three stages of reaction in a hearer:
1. It is completely impossible - don't waste my time.
2. It is possible, but it is not worth doing.
3. I said it was a good idea all along.

Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
#5 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

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

I don't think that it is a problem with my board config, otherwhise
it won't show the correct size using print_num...
Maybe other users didn't have any problems because their memory
size is smaller than 256MB.

There are many, many boards with bigger memory as well. And these don't have problems either. For example:

U-Boot 1.3.4-rc1-00012-g1953d12 (Jul 21 2008 - 09:05:23)

CPU: AMCC PowerPC 440SPe Rev. B at 800 MHz (PLB=160, OPB=53, EBC=17 MHz)
RAID 6 support
Bootstrap Option D - Boot ROM Location I2C (Addr 0x50) Internal PCI arbiter enabled
32 kB I-Cache 32 kB D-Cache

Board: Katmai - AMCC 440SPe Evaluation Board
I2C:   ready
DTT:   1 is 27 C
DTT:   2 is 27 C
DRAM:   4 GB (ECC not enabled, 640 MHz, CL5)
FLASH: 16 MB

...
=> bdi
memstart = 0x00000000
memsize = 0x100000000
...

As you can see, this board has 4 GB of RAM and everything works just fine.

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
If you fail to plan, plan to fail.
#6 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

Quoted 7 lines · Wolfgang Denk

=> bdi
memstart = 0x00000000
memsize = 0x100000000
...

As you can see, this board has 4 GB of RAM and everything works just fine.

Yes. But unfortunately not for all boards. As it seems the patch b57ca3e128cc10a133ba79bc7ec3e7b50e7c8fbe [Change bd/gd memsize/ram_size to be phys_size_t.] introduced %llX unconditionally for all non-ARM boards. And many boards don't have support for 64bit printf formats enabled.

So what to do? Enable 64bit format on all boards? Or make this size printing conditionally somehow?

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
=====================================================================

#7 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

In reply to Ricardo Ribalda Delgado

Ricardo,

Quoted 4 lines · Ricardo Ribalda Delgado

I don't think that it is a problem with my board config, otherwhise
it won't show the correct size using print_num...
Maybe other users didn't have any problems because their memory
size is smaller than 256MB.

Most likely you need to enable 64bit printf format (%ll) support:

#define CFG_64BIT_VSPRINTF
#define CFG_64BIT_STRTOUL

This is already done for all 440 PPC's (include/ppc4xx.h) in the current git head. I'll merge this soon into the next branch of my ppc4xx repository, then your problem should go away.

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
=====================================================================

#8 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

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

I don't think that it is a problem with my board config, otherwhise
it won't show the correct size using print_num...
Maybe other users didn't have any problems because their memory
size is smaller than 256MB.

Quoted 8 lines

Most likely you need to enable 64bit printf format (%ll) support:

#define CFG_64BIT_VSPRINTF
#define CFG_64BIT_STRTOUL

This is already done for all 440 PPC's (include/ppc4xx.h) in the current git head. I'll merge this soon into the next branch of my ppc4xx repository, then your problem should go away.

Given the fact that print_lnum() unconditionally takes a u64 arg and unconditionally uses a %llX format, I thinkwe shoudl either fix print_lnum() for non-64bit cases, or drop the CFG_64BIT_VSPRINTF / CFG_64BIT_STRTOUL options completely.

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
If God had a beard, he'd be a UNIX programmer.
#9 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

Quoted 5 lines · Wolfgang Denk
Quoted 5 lines

Most likely you need to enable 64bit printf format (%ll) support:

#define CFG_64BIT_VSPRINTF
#define CFG_64BIT_STRTOUL

Quoted 8 lines
Quoted 3 lines

This is already done for all 440 PPC's (include/ppc4xx.h) in the current git head. I'll merge this soon into the next branch of my ppc4xx repository, then your problem should go away.

Given the fact that print_lnum() unconditionally takes a u64 arg and unconditionally uses a %llX format, I thinkwe shoudl either fix print_lnum() for non-64bit cases, or drop the CFG_64BIT_VSPRINTF / CFG_64BIT_STRTOUL options completely.

Personally, I'm voting for dropping the options completely and enabling the 64bit support unconditionally. I took me some time a few days ago to figure out that this support was *not* enabled by default.

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
=====================================================================

#10 lore raw

PATCH 1/1 bdinfo not showing correct info aboutmemory size

Hello WD and SR:

because my board is one that it is not working, I am open to receive
any snipset and test them on the "real world"

Best Regards

Quoted 38 lines · Stefan Roese
Quoted 5 lines · Wolfgang Denk
Quoted 5 lines

Most likely you need to enable 64bit printf format (%ll) support:

#define CFG_64BIT_VSPRINTF
#define CFG_64BIT_STRTOUL

Quoted 8 lines
Quoted 3 lines

This is already done for all 440 PPC's (include/ppc4xx.h) in the current git head. I'll merge this soon into the next branch of my ppc4xx repository, then your problem should go away.

Given the fact that print_lnum() unconditionally takes a u64 arg and unconditionally uses a %llX format, I thinkwe shoudl either fix print_lnum() for non-64bit cases, or drop the CFG_64BIT_VSPRINTF / CFG_64BIT_STRTOUL options completely.

Personally, I'm voting for dropping the options completely and enabling the 64bit support unconditionally. I took me some time a few days ago to figure out that this support was *not* enabled by default.

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
=====================================================================

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
#11 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

In reply to Stefan Roese
Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 5 lines

Given the fact that print_lnum() unconditionally takes a u64 arg and unconditionally uses a %llX format, I thinkwe shoudl either fix print_lnum() for non-64bit cases, or drop the CFG_64BIT_VSPRINTF / CFG_64BIT_STRTOUL options completely.

Personally, I'm voting for dropping the options completely and enabling the 64bit support unconditionally. I took me some time a few days ago to figure out that this support was *not* enabled by default.

Well, it adds some 2.2 kB of code size for all ssytems - even those who have zero benefit from it.

My personal preference would be to fix print_lnum() to take for example a phys_size_t argument instead of u64.

I guess we need an #ifdef for the %llX (versus %lX) format then (or does anybody know of a clever way to avoid this, maybe something like the %zu we used to fix the size_t issues? )

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
No more blah, blah, blah!
	-- Kirk, "Miri", stardate 2713.6

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw

PATCH 1/1 bdinfo not showing correct info about memory size

For the record:

What Stefan says is completely true. Last version of u-boot does not
give wrong info without my patch.

Regards

Quoted 17 lines · Stefan Roese

Ricardo,

Quoted 4 lines · Ricardo Ribalda Delgado

I don't think that it is a problem with my board config, otherwhise
it won't show the correct size using print_num...
Maybe other users didn't have any problems because their memory
size is smaller than 256MB.

Most likely you need to enable 64bit printf format (%ll) support:

#define CFG_64BIT_VSPRINTF
#define CFG_64BIT_STRTOUL

This is already done for all 440 PPC's (include/ppc4xx.h) in the current git head. I'll merge this soon into the next branch of my ppc4xx repository, then your problem should go away.

Quoted 9 lines

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
=====================================================================

--
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/

Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/