diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-01-29 18:21:05 -0500 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-04-13 13:53:45 -0700 |
commit | 1f1d88dd40815332df32982e739f2ddd2da6fe1a (patch) | |
tree | 84880cf65619d0b5d195804d73c1f7ba2739fe23 /common/cmd_boot.c | |
parent | e6dfed705efa44ebf00d21bb1588c6ccc8f3ad32 (diff) | |
download | u-boot-imx-1f1d88dd40815332df32982e739f2ddd2da6fe1a.zip u-boot-imx-1f1d88dd40815332df32982e739f2ddd2da6fe1a.tar.gz u-boot-imx-1f1d88dd40815332df32982e739f2ddd2da6fe1a.tar.bz2 |
disable caches before booting an app for Blackfin apps
It isn't generally save to execute applications outside of U-Boot with caches
enabled due to the way the Blackfin processor handles caches (requires
software assistance). This patch disables caches before booting an ELF or
just booting raw code. The previous discussion on the patch was that we
wanted to use weaks instead, but that proved to not be feasible when multiple
symbols are involved, which puts us back at the ifdef solution. I've
minimized the ugliness by moving the setup step outside of the main function.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'common/cmd_boot.c')
-rw-r--r-- | common/cmd_boot.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/common/cmd_boot.c b/common/cmd_boot.c index e68f16f..9d4f026 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -32,6 +32,23 @@ 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; @@ -46,25 +63,20 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) 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); |