public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] CFG_64BIT_xxx and friends
@ 2008-09-04 14:09 Matthias Fuchs
  2008-09-06 23:12 ` Wolfgang Denk
  0 siblings, 1 reply; 11+ messages in thread
From: Matthias Fuchs @ 2008-09-04 14:09 UTC (permalink / raw)
  To: u-boot

Hi all,

after testing the recent U-Boot code on a couple of 405EP boards I noticed,
that the memsize in the output of the "bdinfo" command is always 0x00000000.

This is caused by using 64 types and format directives in printf that only 
work when CFG_64BIT_VSPRINTF is defined.

So what's the best way to fix this?
Here are four solutions. My favorite is no. 2.

1) Define CFG_64BIT_STRTOUL for all effected board. 
Currently all 405 boards have memsize output as 0 in bdinfo.

2) Define CFG_64BIT_VSPRINTF and CFG_64BIT_STRTOUL for all 4xx boards in
include/ppc4xx.h:

diff --git a/include/ppc4xx.h b/include/ppc4xx.h
index 59a3b06..f0dfa38 100644
--- a/include/ppc4xx.h
+++ b/include/ppc4xx.h
@@ -102,13 +102,14 @@

 #endif /* 440EP/EPX 440GR/GRX 440SP/SPE 460EX/GT/SX 405EX*/

-#if defined(CONFIG_440)
 /*
  * Enable long long (%ll ...) printf format on 440 PPC's since most of
  * them support 36bit physical addressing
  */
 #define CFG_64BIT_VSPRINTF
 #define CFG_64BIT_STRTOUL
+
+#if defined(CONFIG_440)
 #include <ppc440.h>
 #else
 #include <ppc405.h>

3) Generally define CFG_64BIT_VSPRINTF and CFG_64BIT_STRTOUL for all boards.

4) Use an (ugly) workaround in common/cmd_bdinfo.c:

static void print_lnum(const char *name, u64 value)
{
#ifdef CFG_64BIT_VSPRINTF
	printf ("%-12s= 0x%.8llX\n", name, value);
#else
	u32 *value32 = (u32*)&value;
	if (value32[0])
		printf ("%-12s= 0x%lX%.8lX\n", name, value32[0], value32[1]);
	else
		printf ("%-12s= 0x%.8lX\n", name, value32[1]);
#endif
}


So what do you think?

Matthias

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

end of thread, other threads:[~2008-09-09  7:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-04 14:09 [U-Boot] CFG_64BIT_xxx and friends Matthias Fuchs
2008-09-06 23:12 ` Wolfgang Denk
2008-09-06 23:05   ` Jean-Christophe PLAGNIOL-VILLARD
2008-09-06 23:37     ` Wolfgang Denk
2008-09-08  7:43       ` Stefan Roese
2008-09-08 11:00         ` Haavard Skinnemoen
2008-09-08 11:27           ` Matthias Fuchs
2008-09-08 11:54             ` Haavard Skinnemoen
2008-09-08 12:23               ` Haavard Skinnemoen
2008-09-09  1:58                 ` Jerry Van Baren
2008-09-09  7:11                   ` Haavard Skinnemoen

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