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] [PATCH v4 6/8] sandbox: Allow processing instead of or before main loop
Date: Wed, 15 Feb 2012 15:51:16 -0800	[thread overview]
Message-ID: <1329349878-16664-6-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1329349878-16664-1-git-send-email-sjg@chromium.org>

In order to pass command line arguments to sandbox we need to be able
to act on them. So take control back at the end of board_init_r() from
where we can call the main loop or do something else.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Call cpu_main_loop() from board_init_r()

 arch/sandbox/cpu/start.c                  |    8 ++++++++
 arch/sandbox/include/asm/u-boot-sandbox.h |    3 +++
 arch/sandbox/lib/board.c                  |    7 ++++---
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index b3442e8..d7402be 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -22,6 +22,14 @@
 #include <common.h>
 #include <asm/arch/state.h>
 
+#include <os.h>
+
+void start_main_loop(void)
+{
+	for (;;)
+		main_loop();
+}
+
 int main(int argc, char *argv[])
 {
 	struct sandbox_state *state = NULL;
diff --git a/arch/sandbox/include/asm/u-boot-sandbox.h b/arch/sandbox/include/asm/u-boot-sandbox.h
index 236b4ee..3743289 100644
--- a/arch/sandbox/include/asm/u-boot-sandbox.h
+++ b/arch/sandbox/include/asm/u-boot-sandbox.h
@@ -35,4 +35,7 @@
 int board_init(void);
 int dram_init(void);
 
+/* start.c */
+void start_main_loop(void);
+
 #endif	/* _U_BOOT_SANDBOX_H_ */
diff --git a/arch/sandbox/lib/board.c b/arch/sandbox/lib/board.c
index 6d464d6..331ce16 100644
--- a/arch/sandbox/lib/board.c
+++ b/arch/sandbox/lib/board.c
@@ -270,11 +270,12 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #endif
 
 	/*
-	 * For now, run the main loop. Later we might let this be done
-	 * in the main program.
+	 * This function can't return (to match other archs) so call back
+	 * into start.c so that sandbox can do something other than the main
+	 * loop if it likes
 	 */
 	while (1)
-		main_loop();
+		start_main_loop();
 
 	/* NOTREACHED - no way out of command loop except booting */
 }
-- 
1.7.7.3

  parent reply	other threads:[~2012-02-15 23:51 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 23:51 [PATCH v4 1/8] sandbox: fdt: Add support for CONFIG_OF_CONTROL Simon Glass
2012-02-15 23:51 ` [U-Boot] " Simon Glass
2012-02-15 23:51 ` [U-Boot] [PATCH v4 2/8] sandbox: config: Enable fdt and snprintf() options Simon Glass
2012-02-16  6:03   ` Mike Frysinger
2012-02-15 23:51 ` [U-Boot] [PATCH v4 3/8] sandbox: gpio: Add basic driver for simulating GPIOs Simon Glass
2012-02-21  6:11   ` Mike Frysinger
2012-02-21  6:27     ` Simon Glass
2012-02-21 16:04       ` Mike Frysinger
2012-02-21 21:55         ` Simon Glass
2012-02-21 22:13           ` Mike Frysinger
2012-02-21 22:21             ` Simon Glass
2012-02-22  5:08               ` [U-Boot] [PATCH v5] " Mike Frysinger
2012-02-22  5:45                 ` Simon Glass
2012-02-22 18:31                   ` Mike Frysinger
2012-02-15 23:51 ` [U-Boot] [PATCH v4 4/8] sandbox: Enable GPIO driver Simon Glass
2012-02-15 23:51 ` [U-Boot] [PATCH v4 5/8] sandbox: Add concept of sandbox state Simon Glass
2012-02-15 23:51 ` Simon Glass [this message]
2012-02-15 23:51 ` [U-Boot] [PATCH v4 7/8] sandbox: Add flags for open() call Simon Glass
2012-02-16  6:09   ` Mike Frysinger
2012-02-21  4:32     ` Simon Glass
2012-02-15 23:51 ` [U-Boot] [PATCH v4 8/8] sandbox: Add basic command line parsing Simon Glass
2012-02-26 21:04   ` Mike Frysinger
2012-02-27  2:50     ` Simon Glass
2012-02-27  4:08       ` Mike Frysinger
2012-02-27  4:33         ` Simon Glass
2012-02-27  4:42           ` Mike Frysinger
2012-02-27  5:43             ` Simon Glass
2012-02-27 18:32               ` Mike Frysinger
2012-02-27 20:55                 ` Simon Glass
2012-02-16  6:03 ` [PATCH v4 1/8] sandbox: fdt: Add support for CONFIG_OF_CONTROL Mike Frysinger
2012-02-16  6:03   ` [U-Boot] " Mike Frysinger
2012-02-16 10:50 ` Marek Vasut
2012-02-16 10:50   ` [U-Boot] " Marek Vasut
2012-02-16 19:16   ` Simon Glass
2012-02-16 19:16     ` [U-Boot] " Simon Glass

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=1329349878-16664-6-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.