Commit 55d5fd9a84ced5c5feb5eda0db1523fa3c2fc742
Committed by
Simon Glass
1 parent
5c421331d5
Exists in
v2017.01-smarct4x
and in
34 other branches
net: Access mapped physmem in net functions
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>
Showing 2 changed files with 10 additions and 2 deletions Side-by-side Diff
net/nfs.c
... | ... | @@ -26,6 +26,7 @@ |
26 | 26 | #include <command.h> |
27 | 27 | #include <net.h> |
28 | 28 | #include <malloc.h> |
29 | +#include <mapmem.h> | |
29 | 30 | #include "nfs.h" |
30 | 31 | #include "bootp.h" |
31 | 32 | |
... | ... | @@ -93,7 +94,10 @@ |
93 | 94 | } else |
94 | 95 | #endif /* CONFIG_SYS_DIRECT_FLASH_NFS */ |
95 | 96 | { |
96 | - (void)memcpy((void *)(load_addr + offset), src, len); | |
97 | + void *ptr = map_sysmem(load_addr + offset, len); | |
98 | + | |
99 | + memcpy(ptr, src, len); | |
100 | + unmap_sysmem(ptr); | |
97 | 101 | } |
98 | 102 | |
99 | 103 | if (NetBootFileXferSize < (offset+len)) |
net/tftp.c
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | |
9 | 9 | #include <common.h> |
10 | 10 | #include <command.h> |
11 | +#include <mapmem.h> | |
11 | 12 | #include <net.h> |
12 | 13 | #include "tftp.h" |
13 | 14 | #include "bootp.h" |
... | ... | @@ -184,7 +185,10 @@ |
184 | 185 | } else |
185 | 186 | #endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */ |
186 | 187 | { |
187 | - (void)memcpy((void *)(load_addr + offset), src, len); | |
188 | + void *ptr = map_sysmem(load_addr + offset, len); | |
189 | + | |
190 | + memcpy(ptr, src, len); | |
191 | + unmap_sysmem(ptr); | |
188 | 192 | } |
189 | 193 | #ifdef CONFIG_MCAST_TFTP |
190 | 194 | if (Multicast) |