DECLARE_GLOBAL_DATA_PTR;
#endif
+static inline void go_setup(int argc, char *argv[])
+{
+#if defined(CONFIG_I386)
+ /*
+ * x86 does not use a dedicated register to pass the pointer
+ * to the global_data
+ */
+ argv[0] = (char *)gd;
+
+#elif defined(CONFIG_BLACKFIN)
+ if (dcache_status ())
+ dcache_disable ();
+ if (icache_status ())
+ icache_disable ();
+#endif
+}
+
int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr, rc;
printf ("## Starting application at 0x%08lX ...\n", addr);
+ go_setup(argc, argv);
+
+#if defined(CONFIG_NIOS)
/*
- * pass address parameter as argv[0] (aka command name),
- * and all remaining args
- */
-#if defined(CONFIG_I386)
- /*
- * x86 does not use a dedicated register to pass the pointer
- * to the global_data
+ * Nios function pointers are address >> 1
*/
- argv[0] = (char *)gd;
+ addr >>= 1;
#endif
-#if !defined(CONFIG_NIOS)
- rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
-#else
+
/*
- * Nios function pointers are address >> 1
+ * pass address parameter as argv[0] (aka command name),
+ * and all remaining args
*/
- rc = ((ulong (*)(int, char *[]))(addr>>1)) (--argc, &argv[1]);
-#endif
+ rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
if (rc != 0) rcode = 1;
printf ("## Application terminated, rc = 0x%lX\n", rc);
#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);
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),