summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-16 11:16:08 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-16 11:16:08 +0200
commitca8ae5695a417202f4e4d0f915fd7983e19b481e (patch)
tree4efb1dbf90e0459dc60b9d177ea10f87d8c31567
parent1ef73a95bedb32f82017e8891ff917d47396021e (diff)
downloadbarebox-ca8ae5695a417202f4e4d0f915fd7983e19b481e.tar.gz
barebox-ca8ae5695a417202f4e4d0f915fd7983e19b481e.tar.xz
add the possibility to have a arch specific 'go' command. Some
architectures need this (e.g. blackfin and i386)
-rw-r--r--arch/blackfin/lib/board.c13
-rw-r--r--commands/go.c23
-rw-r--r--include/common.h4
3 files changed, 16 insertions, 24 deletions
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index 9a9a83dfbd..df64aadfc8 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -32,7 +32,7 @@
#include <init.h>
#include <environment.h>
#include <mem_malloc.h>
-#include "blackfin_board.h"
+#include <asm/cpu.h>
int blackfin_mem_malloc_init(void)
{
@@ -43,8 +43,13 @@ int blackfin_mem_malloc_init(void)
core_initcall(blackfin_mem_malloc_init);
-void reset_cpu(ulong ignored)
+int arch_execute(unsigned long address, int argc, char *argv[])
{
- printf("do not ave a reset function\n");
- while (1);
+ int ret;
+
+ icache_disable();
+ ret = ((ulong (*)(int, char *[]))address) (argc, &argv[0]);
+ icache_enable();
+
+ return ret;
}
diff --git a/commands/go.c b/commands/go.c
index accda18da1..6f0179464c 100644
--- a/commands/go.c
+++ b/commands/go.c
@@ -34,7 +34,7 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int rcode = 0;
if (argc < 2) {
- printf ("Usage:\n%s\n", cmdtp->usage);
+ u_boot_cmd_usage(cmdtp);
return 1;
}
@@ -42,26 +42,11 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("## Starting application at 0x%08lX ...\n", addr);
- /*
- * 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
- */
- argv[0] = (char *)gd;
-#endif
-#if !defined(CONFIG_NIOS)
- rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
+#ifdef ARCH_HAS_EXECUTE
+ rc = arch_execute(addr, argc, &argv[1]);
#else
- /*
- * Nios function pointers are address >> 1
- */
- rc = ((ulong (*)(int, char *[]))(addr>>1)) (--argc, &argv[1]);
+ rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
#endif
- if (rc != 0) rcode = 1;
printf ("## Application terminated, rc = 0x%lX\n", rc);
return rcode;
diff --git a/include/common.h b/include/common.h
index 981a3a5d12..f95c8f1b03 100644
--- a/include/common.h
+++ b/include/common.h
@@ -164,6 +164,8 @@ int parse_area_spec(const char *str, ulong *start, ulong *size);
/* Just like simple_strtoul(), but this one honors a K/M/G suffix */
unsigned long strtoul_suffix(const char *str, char **endp, int base);
-extern void start_uboot(void);
+void start_uboot(void);
+
+int arch_execute(unsigned long address, int argc, char *argv[]);
#endif /* __COMMON_H_ */