[U-Boot] [RFC PATCH 08/20] sandbox: Add board info for architecture

Simon Glass sjg at chromium.org
Sat Sep 17 18:48:47 CEST 2011


This is required for the bdinfo command to work.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
 common/cmd_bdinfo.c |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 6051120..0faca6f 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -31,11 +31,14 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void print_num(const char *, ulong);
 
-#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET)
+#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_SANDBOX))
+	|| defined(CONFIG_CMD_NET)
+#define HAVE_PRINT_ETH
 static void print_eth(int idx);
 #endif
 
-#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86))
+#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86) && !defined(CONFIG_SANDBOX))
+#define HAVE_PRINT_LNUM
 static void print_lnum(const char *, u64);
 #endif
 
@@ -413,6 +416,29 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
+#elif defined(CONFIG_SANDBOX)
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	int i;
+	bd_t *bd = gd->bd;
+
+	print_num("boot_params", (ulong)bd->bi_boot_params);
+
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
+		print_num("DRAM bank", i);
+		print_num("-> start", bd->bi_dram[i].start);
+		print_num("-> size", bd->bi_dram[i].size);
+	}
+
+#if defined(CONFIG_CMD_NET)
+	print_eth(0);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+#endif
+	print_num("FB base  ", gd->fb_base);
+	return 0;
+}
+
 #else
  #error "a case for this architecture does not exist!"
 #endif
@@ -422,7 +448,7 @@ static void print_num(const char *name, ulong value)
 	printf("%-12s= 0x%08lX\n", name, value);
 }
 
-#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET)
+#ifdef HAVE_PRINT_ETH
 static void print_eth(int idx)
 {
 	char name[10], *val;
@@ -437,7 +463,7 @@ static void print_eth(int idx)
 }
 #endif
 
-#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86))
+#ifdef HAVE_PRINT_LNUM
 static void print_lnum(const char *name, u64 value)
 {
 	printf("%-12s= 0x%.8llX\n", name, value);
-- 
1.7.3.1



More information about the U-Boot mailing list