[U-Boot] Fix loading freeze when netconsole is active

Submitted by Frederic Leroy on Sept. 8, 2013, 12:22 p.m.

Details

Message ID 1378642954-16399-1-git-send-email-fredo@starox.org
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Frederic Leroy Sept. 8, 2013, 12:22 p.m.
Netconsole calls eth_halt() before giving control to another operating
system.
But the state machine of netconsole don't take it into account.
Thus, netconsole calls network functions of an halted network device,
making the whole system freeze.
Rather than modifying the state machine of netconsole, we just unregister
the current network device before booting. It does work because
nc_send_packet() verifies that the current network device is not null.

Signed-off-by: Frédéric Leroy <fredo@starox.org>
---
 common/cmd_bootm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Hello Tom,

I have made a cleaner version of my patch against master.
I didn't touch the netconsole code because I don't fully understand it.

Regards,

Patch hide | download patch | download mbox

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 15f4599..beb25b6 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -577,7 +577,7 @@  static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,
 			 * Stop the ethernet stack if NetConsole could have
 			 * left it up
 			 */
-			eth_halt();
+			eth_unregister(eth_get_dev());
 #endif
 			arch_preboot_os();
 			boot_fn(BOOTM_STATE_OS_GO, argc, argv, &images);
@@ -645,7 +645,7 @@  int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #ifdef CONFIG_NETCONSOLE
 	/* Stop the ethernet stack if NetConsole could have left it up */
-	eth_halt();
+	eth_unregister(eth_get_dev());
 #endif
 
 #if defined(CONFIG_CMD_USB)
@@ -1849,7 +1849,7 @@  static int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #ifdef CONFIG_NETCONSOLE
 	/* Stop the ethernet stack if NetConsole could have left it up */
-	eth_halt();
+	eth_unregister(eth_get_dev());
 #endif
 
 #if defined(CONFIG_CMD_USB)