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] bootm: Disable interrupts before loading OS
Date: Fri, 28 Jun 2013 00:46:12 -0700	[thread overview]
Message-ID: <1372405572-6961-1-git-send-email-sjg@chromium.org> (raw)

This restores the ordering of interrupt disable to what it what before
commit 35fc84fa. It seems that on some archiectures (e.g. PowerPC) the
OS is loaded into an interrupt region, which can cause problems if
interrupts are still running.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 common/cmd_bootm.c | 53 +++++++++++++++++++++++++++--------------------------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index ba0bcd4..e166027 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -504,36 +504,13 @@ static cmd_tbl_t cmd_bootm_sub[] = {
 };
 
 static int boot_selected_os(int argc, char * const argv[], int state,
-		bootm_headers_t *images, boot_os_fn *boot_fn, ulong *iflag)
+		bootm_headers_t *images, boot_os_fn *boot_fn)
 {
 	if (images->os.type == IH_TYPE_STANDALONE) {
 		/* This may return when 'autostart' is 'no' */
 		bootm_start_standalone(argc, argv);
 		return 0;
 	}
-	/*
-	 * We have reached the point of no return: we are going to
-	 * overwrite all exception vector code, so we cannot easily
-	 * recover from any failures any more...
-	 */
-	*iflag = disable_interrupts();
-#ifdef CONFIG_NETCONSOLE
-	/* Stop the ethernet stack if NetConsole could have left it up */
-	eth_halt();
-#endif
-
-#if defined(CONFIG_CMD_USB)
-	/*
-	 * turn off USB to prevent the host controller from writing to the
-	 * SDRAM while Linux is booting. This could happen (at least for OHCI
-	 * controller), because the HCCA (Host Controller Communication Area)
-	 * lies within the SDRAM and the host controller writes continously to
-	 * this area (as busmaster!). The HccaFrameNumber is for example
-	 * updated every 1 ms within the HCCA structure in SDRAM! For more
-	 * details see the OpenHCI specification.
-	 */
-	usb_stop();
-#endif
 #ifdef CONFIG_SILENT_CONSOLE
 	if (images->os.os == IH_OS_LINUX)
 		fixup_silent_linux();
@@ -595,6 +572,30 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,
 		argc = 0;	/* consume the args */
 	}
 
+	/*
+	 * We have reached the point of no return: we are going to
+	 * overwrite all exception vector code, so we cannot easily
+	 * recover from any failures any more...
+	 */
+	iflag = disable_interrupts();
+#ifdef CONFIG_NETCONSOLE
+	/* Stop the ethernet stack if NetConsole could have left it up */
+	eth_halt();
+#endif
+
+#if defined(CONFIG_CMD_USB)
+	/*
+	 * turn off USB to prevent the host controller from writing to the
+	 * SDRAM while Linux is booting. This could happen (at least for OHCI
+	 * controller), because the HCCA (Host Controller Communication Area)
+	 * lies within the SDRAM and the host controller writes continously to
+	 * this area (as busmaster!). The HccaFrameNumber is for example
+	 * updated every 1 ms within the HCCA structure in SDRAM! For more
+	 * details see the OpenHCI specification.
+	 */
+	usb_stop();
+#endif
+
 	/* Load the OS */
 	if (!ret && (states & BOOTM_STATE_LOADOS)) {
 		ulong load_end;
@@ -654,7 +655,7 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,
 		char *cmd_list = getenv("fakegocmd");
 
 		ret = boot_selected_os(argc, argv, BOOTM_STATE_OS_FAKE_GO,
-				images, boot_fn, &iflag);
+				images, boot_fn);
 		if (!ret && cmd_list)
 			ret = run_command_list(cmd_list, -1, flag);
 	}
@@ -662,7 +663,7 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,
 	/* Now run the OS! We hope this doesn't return */
 	if (!ret && (states & BOOTM_STATE_OS_GO))
 		ret = boot_selected_os(argc, argv, BOOTM_STATE_OS_GO,
-				images, boot_fn, &iflag);
+				images, boot_fn);
 
 	/* Deal with any fallout */
 	if (ret < 0) {
-- 
1.8.3

             reply	other threads:[~2013-06-28  7:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28  7:46 Simon Glass [this message]
2013-06-28  8:00 ` [U-Boot] [PATCH] bootm: Disable interrupts before loading OS Stefan Roese
2013-06-28 22:07   ` Tom Rini

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=1372405572-6961-1-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.