All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v2 08/20] sandbox: Add board info for architecture
Date: Fri, 23 Sep 2011 09:22:10 -0700	[thread overview]
Message-ID: <1316794942-24709-9-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1316794942-24709-1-git-send-email-sjg@chromium.org>

This is required for the bdinfo command to work.

This also cleans up the #ifdef mess for ethernet and lnum a little.

Signed-off-by: Simon Glass <sjg@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

  parent reply	other threads:[~2011-09-23 16:22 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23 16:22 [U-Boot] [RFC PATCH v2 0/20] New 'sandbox' test architecture for U-Boot Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 01/20] sandbox: Add architecture header files Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 02/20] Fix use of int as pointer in image.c Simon Glass
2011-09-26  5:00   ` Mike Frysinger
2011-09-26 16:51     ` Simon Glass
2011-10-03  5:14       ` Mike Frysinger
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 03/20] sandbox: Add architecture image support Simon Glass
2011-09-26  5:01   ` Mike Frysinger
2011-09-26 19:39     ` Simon Glass
2011-09-26 20:19       ` Mike Frysinger
2011-09-26 20:24         ` Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 04/20] sandbox: Add compiler defines to support a 64-bit x86_64 platform Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 05/20] sandbox: Add cpu files Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 06/20] sandbox: Add architecture lib files Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 07/20] sandbox: Add sandbox board Simon Glass
2011-09-23 16:22 ` Simon Glass [this message]
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 09/20] sandbox: Add bootm support Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 10/20] sandbox: Disable built-in malloc Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 11/20] sandbox: Disable standalone/API support Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 12/20] sandbox: Force command sections to be 4-byte aligned Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 13/20] sandbox: Add OS dependent layer Simon Glass
2011-09-26  5:16   ` Mike Frysinger
2011-09-26 21:04     ` Simon Glass
2011-09-26 21:19       ` Mike Frysinger
2011-09-26 22:03         ` Simon Glass
2011-09-26 23:53           ` Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 14/20] sandbox: Add board_init() Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 15/20] sandbox: Add main program Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 16/20] sandbox: Add serial uart Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 17/20] sandbox: Add basic config file Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 18/20] Remove unused variable warnings in cmd_mem, cmd_nvedit Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 19/20] Use uintptr_t for 32/64-bit compatibility Simon Glass
2011-09-23 16:22 ` [U-Boot] [RFC PATCH v2 20/20] sandbox: Makefile changes to build sandbox architecture Simon Glass
2011-09-26  4:59 ` [U-Boot] [RFC PATCH v2 0/20] New 'sandbox' test architecture for U-Boot Mike Frysinger
2011-09-27  0:07   ` Simon Glass
2011-10-03  5:16     ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1316794942-24709-9-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.