changeset 907:a289defa82f0

go command enhancements
author msalter
date Fri, 04 Apr 2003 15:41:16 +0000
parents 371979c5cc1e
children 6aa5728bb6a0
files packages/redboot/current/ChangeLog packages/redboot/current/doc/redboot_cmds.sgml packages/redboot/current/src/main.c
diffstat 3 files changed, 49 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,9 @@
+2003-04-04  Mark Salter  <msalter@redhat.com>
+
+	* src/main.c (do_go): Add -n switch to optionally stop network
+	device. Mask interrupts on all comm channels.
+	* doc/redboot_cmds.sgml: Update go command info.
+
 2003-04-03  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/load.c: Better handling of default download mode.  Also
--- a/packages/redboot/current/doc/redboot_cmds.sgml
+++ b/packages/redboot/current/doc/redboot_cmds.sgml
@@ -10,7 +10,7 @@
 <!-- ####COPYRIGHTBEGIN####                                          -->
 <!--                                                                 -->
 <!-- =============================================================== -->
-<!-- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.  -->
+<!-- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.  -->
 <!-- This material may be distributed only subject to the terms      -->
 <!-- and conditions set forth in the Open Publication License, v1.0  -->
 <!-- or later (the latest version is presently available at          -->
@@ -124,7 +124,7 @@ Manage flash images
 Manage configuration kept in FLASH memory
       fconfig [-i] [-l] [-n] [-f] [-d] | [-d] nickname [value]
 Execute code at a location
-      go [-w &lt;timeout>] [entry]
+      go [-w &lt;timeout>] [-c] [-n] [entry]
 Help about help?
       help [&lt;topic>]
 Set/change IP addresses
@@ -2705,6 +2705,8 @@ or a Linux kernel.</para>
       <cmdsynopsis>
 	<command>go</command>
 	<arg>-w <replaceable> timeout</replaceable></arg>
+	<arg>-c</arg>
+	<arg>-n</arg>
 	<arg><replaceable> start_address</replaceable></arg>
       </cmdsynopsis>
     </refsynopsisdiv>
@@ -2732,6 +2734,18 @@ or a Linux kernel.</para>
 	      <entry>0</entry>	     
 	    </row>
 	    <row>
+	      <entry>-c</entry>	     
+	      <entry>Boolean</entry>
+	      <entry>Go with caches enabled.</entry>	     
+	      <entry>caches off</entry>	     
+	    </row>
+	    <row>
+	      <entry>-n</entry>	     
+	      <entry>Boolean</entry>
+	      <entry>Go with network interface stopped.</entry>	     
+	      <entry>network enabled</entry>	     
+	    </row>
+	    <row>
 	      <entry><replaceable>start_address</replaceable></entry>	     
 	      <entry>Number</entry>
 	      <entry>Address in memory to begin execution.</entry>	     
--- a/packages/redboot/current/src/main.c
+++ b/packages/redboot/current/src/main.c
@@ -61,6 +61,10 @@
 #include <cyg/hal/hal_cache.h>
 #include CYGHWR_MEMORY_LAYOUT_H
 
+#ifdef CYGPKG_IO_ETH_DRIVERS
+#include <cyg/io/eth/eth_drv.h>            // Logical driver interfaces
+#endif
+
 #include <cyg/hal/hal_tables.h>
 
 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
@@ -420,21 +424,25 @@ return_to_redboot(int status)
 void
 do_go(int argc, char *argv[])
 {
+    int i, cur;
     unsigned long entry;
     unsigned long oldints;
     bool wait_time_set;
     int  wait_time, res;
     bool cache_enabled = false;
-    struct option_info opts[2];
+    bool stop_net = false;
+    struct option_info opts[3];
     char line[8];
-    hal_virtual_comm_table_t *__chan = CYGACC_CALL_IF_CONSOLE_PROCS();
+    hal_virtual_comm_table_t *__chan;
 
     entry = entry_address;  // Default from last 'load' operation
     init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
               (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
     init_opts(&opts[1], 'c', false, OPTION_ARG_TYPE_FLG, 
               (void **)&cache_enabled, (bool *)0, "go with caches enabled");
-    if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, OPTION_ARG_TYPE_NUM, "starting address"))
+    init_opts(&opts[2], 'n', false, OPTION_ARG_TYPE_FLG, 
+              (void **)&stop_net, (bool *)0, "go with network driver stopped");
+    if (!scan_opts(argc, argv, 1, opts, 3, (void *)&entry, OPTION_ARG_TYPE_NUM, "starting address"))
     {
         return;
     }
@@ -457,8 +465,24 @@ do_go(int argc, char *argv[])
             script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
         }
     }
+
+    // Mask interrupts on all channels
+    cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
+    for (i = 0;  i < CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS;  i++) {
+	CYGACC_CALL_IF_SET_CONSOLE_COMM(i);
+	__chan = CYGACC_CALL_IF_CONSOLE_PROCS();
+	CYGACC_COMM_IF_CONTROL( *__chan, __COMMCTL_IRQ_DISABLE );
+    }
+    CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
+
+    __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
     CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_ENABLE_LINE_FLUSH);
 
+#ifdef CYGPKG_IO_ETH_DRIVERS
+    if (stop_net)
+	eth_drv_stop();
+#endif
+	
     HAL_DISABLE_INTERRUPTS(oldints);
     HAL_DCACHE_SYNC();
     if (!cache_enabled) {