]> www.infradead.org Git - users/rw/armboot.git/commitdiff
* Patch by Robert Kaiser <rob@sysgo.de>:
authormariusgroeger <mariusgroeger>
Mon, 23 Sep 2002 08:44:51 +0000 (08:44 +0000)
committermariusgroeger <mariusgroeger>
Mon, 23 Sep 2002 08:44:51 +0000 (08:44 +0000)
  - flush caches before executing code that may have been downloaded
  - fix bug request ID #589159: print_IPaddr bug

CHANGELOG
common/armlinux.c
common/cmd_boot.c
common/cmd_bootm.c
include/cmd_boot.h
net/net.c

index 755d336bdc170fa56dae9a107119c20b43f080eb..cc2607935f2de4510cda4a46e564d79ef00ae47c 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,11 @@
 Recent Modifications
 ======================================================================
 
+* Patch by Robert Kaiser <rob@sysgo.de>:
+
+  - flush caches before executing code that may have been downloaded
+  - fix bug request ID #589159: print_IPaddr bug
+
 * Patch by David Müller <d.mueller@elsoft.ch>:
 
  - fix some little bugs and typos in the code for the SMDK2410 eval board
index 66e433060a361769ba1d6cb90a3f03effbfe8b45..cd9d31912c8aade7c121625f96b107e91a10d856 100644 (file)
@@ -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);
 }
 
index 1c2ab33f7e689297ea384fe6a864e471d59c4b62..9ef8c8fe51303811953cdb9d0d2a7e32c35609bf 100644 (file)
@@ -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
index c23b8e1b42ffbae7795cc1749a3b3f28a6ac7bab..4405442e203f434bf57b58b45eacfeebabef6a25 100644 (file)
@@ -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)
index d97bc3c5a25884515445f8063e4b1a732f266390..a4d2db0cf410d1060b58da8cf72f6e3e7215e0fd 100644 (file)
@@ -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,                      \
index 9571cd82411a5bf3d3e49efcf14d2983d7bccbec..824fd4a89f0f75141b48739e27ff60affd8f8073 100644 (file)
--- 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);