]> git.sur5r.net Git - u-boot/blobdiff - common/cmd_elf.c
IDE: fix bug in reset sequence
[u-boot] / common / cmd_elf.c
index 1d92bb37d3f9b4c1b435faa5b2651abcc7d88fb9..4683554040caaab119b5d4d6bda7799b279e3e66 100644 (file)
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
-#if (CONFIG_COMMANDS & CFG_CMD_ELF)
-
 #ifndef MAX
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 #endif
 
+static inline void bootelf_setup(int argc, char *argv[])
+{
+       /*
+        * QNX images require the data cache is disabled.
+        * Data cache is already flushed, so just turn it off.
+        */
+       if (dcache_status ())
+               dcache_disable ();
+
+#ifdef CONFIG_BLACKFIN
+       if (icache_status ())
+               icache_disable ();
+#endif
+}
+
 int valid_elf_image (unsigned long addr);
 unsigned long load_elf_image (unsigned long addr);
 
@@ -55,12 +68,7 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
        printf ("## Starting application at 0x%08lx ...\n", addr);
 
-       /*
-        * QNX images require the data cache is disabled.
-        * Data cache is already flushed, so just turn it off.
-        */
-       if (dcache_status ())
-               dcache_disable ();
+       bootelf_setup(argc, argv);
 
        /*
         * pass address parameter as argv[0] (aka command name),
@@ -79,7 +87,7 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  * be either an ELF image or a raw binary.  Will attempt to setup the
  * bootline and other parameters correctly.
  * ====================================================================== */
-int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        unsigned long addr;             /* Address of image            */
        unsigned long bootaddr;         /* Address to put the bootline */
@@ -96,14 +104,12 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
         * If we don't know where the image is then we're done.
         */
 
-       if ((tmp = getenv ("loadaddr")) != NULL) {
-               addr = simple_strtoul (tmp, NULL, 16);
-       } else {
-               puts ("No load address provided\n");
-               return 1;
-       }
+       if (argc < 2)
+               addr = load_addr;
+       else
+               addr = simple_strtoul (argv[1], NULL, 16);
 
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
        /* Check to see if we need to tftp the image ourselves before starting */
 
        if ((argc == 2) && (strcmp (argv[1], "tftp") == 0)) {
@@ -325,5 +331,3 @@ U_BOOT_CMD(
        "bootvx  - Boot vxWorks from an ELF image\n",
        " [address] - load address of vxWorks ELF image.\n"
 );
-
-#endif /* CFG_CMD_ELF */