From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Hershberger Date: Sun, 22 Mar 2015 17:09:08 -0500 Subject: [U-Boot] [PATCH v7 11/27] net: Access mapped physmem in net functions In-Reply-To: <1427062165-17838-1-git-send-email-joe.hershberger@ni.com> References: <1426117465-16072-1-git-send-email-joe.hershberger@ni.com> <1427062165-17838-1-git-send-email-joe.hershberger@ni.com> Message-ID: <1427062165-17838-12-git-send-email-joe.hershberger@ni.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Reviewed-by: Simon Glass --- Changes in v7: None Changes in v6: None Changes in v5: -Include new mapmem.h header -Unmap memory for consistency Changes in v4: -New to v4 Changes in v3: None Changes in v2: None net/nfs.c | 6 +++++- net/tftp.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/net/nfs.c b/net/nfs.c index 381b75f..8e05ae5 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -26,6 +26,7 @@ #include #include #include +#include #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)) diff --git a/net/tftp.c b/net/tftp.c index 0a2c533..51c67be 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -8,6 +8,7 @@ #include #include +#include #include #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) -- 1.7.11.5