]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
net: Access mapped physmem in net functions
authorJoe Hershberger <joe.hershberger@ni.com>
Sun, 22 Mar 2015 22:09:08 +0000 (17:09 -0500)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 19:47:30 +0000 (21:47 +0200)
Previously the net functions would access memory assuming physmem did
not need to be mapped.  In sandbox, that's not the case.

Now we map the physmem specified by the user in loadaddr to the buffer
that represents that space.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
net/nfs.c
net/tftp.c

index 381b75f1c5b091799876aa77ec8997c97ea14fa9..8e05ae57cd883cc8ac23cd8b1dabb0a1db86d725 100644 (file)
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -26,6 +26,7 @@
 #include <command.h>
 #include <net.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include "nfs.h"
 #include "bootp.h"
 
@@ -93,7 +94,10 @@ store_block(uchar *src, unsigned offset, unsigned len)
        } else
 #endif /* CONFIG_SYS_DIRECT_FLASH_NFS */
        {
-               (void)memcpy((void *)(load_addr + offset), src, len);
+               void *ptr = map_sysmem(load_addr + offset, len);
+
+               memcpy(ptr, src, len);
+               unmap_sysmem(ptr);
        }
 
        if (NetBootFileXferSize < (offset+len))
index 0a2c53302cab1edacacd88f439b888f4837e7d4a..51c67be952222200df6a0ab04ef8a08089641d27 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <mapmem.h>
 #include <net.h>
 #include "tftp.h"
 #include "bootp.h"
@@ -184,7 +185,10 @@ store_block(int block, uchar *src, unsigned len)
        } else
 #endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */
        {
-               (void)memcpy((void *)(load_addr + offset), src, len);
+               void *ptr = map_sysmem(load_addr + offset, len);
+
+               memcpy(ptr, src, len);
+               unmap_sysmem(ptr);
        }
 #ifdef CONFIG_MCAST_TFTP
        if (Multicast)