From: mariusgroeger Date: Mon, 23 Sep 2002 08:44:51 +0000 (+0000) Subject: * Patch by Robert Kaiser : X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d52f87a1856f1247182eed24e5acce8632b30256;p=users%2Frw%2Farmboot.git * Patch by Robert Kaiser : - flush caches before executing code that may have been downloaded - fix bug request ID #589159: print_IPaddr bug --- diff --git a/CHANGELOG b/CHANGELOG index 755d336..cc26079 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,11 @@ Recent Modifications ====================================================================== +* Patch by Robert Kaiser : + + - flush caches before executing code that may have been downloaded + - fix bug request ID #589159: print_IPaddr bug + * Patch by David Müller : - fix some little bugs and typos in the code for the SMDK2410 eval board diff --git a/common/armlinux.c b/common/armlinux.c index 66e4330..cd9d319 100644 --- a/common/armlinux.c +++ b/common/armlinux.c @@ -178,6 +178,8 @@ void boot_linux(cmd_tbl_t *cmdtp, cleanup_before_linux(bd); + /* flush caches before invoking (potentially downloaded) external code */ + flush_all_caches(); theKernel(0, bd->bi_arch_number); } diff --git a/common/cmd_boot.c b/common/cmd_boot.c index 1c2ab33..9ef8c8f 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -43,6 +43,25 @@ static int read_record (char *buf, ulong len); static int do_echo = 1; #endif +void flush_all_caches(void) +{ + /* + * flush all caches if they are enabled. + * this must be called prior to invoking + * code that has been copied/loaded. + */ + if(dcache_status()) + { + dcache_disable(); + dcache_enable(); + } + if(icache_status()) + { + icache_disable(); + icache_enable(); + } +} + #if (CONFIG_COMMANDS & CFG_CMD_BDI) int do_bdinfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) @@ -82,6 +101,12 @@ int do_go (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) printf ("## Starting application at 0x%08lx ...\n", addr); + /* + * flush and invalidate caches: we might be invoking code + * that has been downloaded just before. + */ + flush_all_caches(); + /* * pass address parameter as argv[0] (aka command name), * and all remaining args diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index c23b8e1..4405442 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -186,6 +186,8 @@ int do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) case IH_TYPE_STANDALONE: appl = (int (*)(cmd_tbl_t *, bd_t *, int, int, char *[]))SWAP32(hdr->ih_ep); + /* flush caches before invoking (potentially downloaded) code */ + flush_all_caches(); (*appl)(cmdtp, bd, flag, argc-1, &argv[1]); /* just in case we return */ if (iflag) diff --git a/include/cmd_boot.h b/include/cmd_boot.h index d97bc3c..a4d2db0 100644 --- a/include/cmd_boot.h +++ b/include/cmd_boot.h @@ -27,6 +27,8 @@ #ifndef _CMD_BOOT_H #define _CMD_BOOT_H +void flush_all_caches(void); + #if (CONFIG_COMMANDS & CFG_CMD_BDI) #define CMD_TBL_BDINFO MK_CMD_TBL_ENTRY( \ "bdinfo", 2, 1, 1, do_bdinfo, \ diff --git a/net/net.c b/net/net.c index 9571cd8..824fd4a 100644 --- a/net/net.c +++ b/net/net.c @@ -730,7 +730,7 @@ void ip_to_string (IPaddr_t x, char *s) void print_IPaddr (IPaddr_t x) { - char tmp[12]; + char tmp[16]; ip_to_string(x, tmp);