diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bootp.c | 2 | ||||
-rw-r--r-- | net/net.c | 23 | ||||
-rw-r--r-- | net/tftp.c | 39 | ||||
-rw-r--r-- | net/wget.c | 9 |
4 files changed, 36 insertions, 37 deletions
diff --git a/net/bootp.c b/net/bootp.c index 9dfb50749b4..512ab2ed7c8 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -15,7 +15,7 @@ #include <log.h> #include <net.h> #include <rand.h> -#include <uuid.h> +#include <u-boot/uuid.h> #include <linux/delay.h> #include <net/tftp.h> #include "bootp.h" diff --git a/net/net.c b/net/net.c index d9bc9df643f..1e0b7c85624 100644 --- a/net/net.c +++ b/net/net.c @@ -334,17 +334,22 @@ void net_auto_load(void) net_set_state(NETLOOP_SUCCESS); return; } - if (net_check_prereq(TFTPGET)) { -/* We aren't expecting to get a serverip, so just accept the assigned IP */ - if (IS_ENABLED(CONFIG_BOOTP_SERVERIP)) { - net_set_state(NETLOOP_SUCCESS); - } else { - printf("Cannot autoload with TFTPGET\n"); - net_set_state(NETLOOP_FAIL); + if (IS_ENABLED(CONFIG_CMD_TFTPBOOT)) { + if (net_check_prereq(TFTPGET)) { + /* + * We aren't expecting to get a serverip, so just + * accept the assigned IP + */ + if (IS_ENABLED(CONFIG_BOOTP_SERVERIP)) { + net_set_state(NETLOOP_SUCCESS); + } else { + printf("Cannot autoload with TFTPGET\n"); + net_set_state(NETLOOP_FAIL); + } + return; } - return; + tftp_start(TFTPGET); } - tftp_start(TFTPGET); } static int net_init_loop(void) diff --git a/net/tftp.c b/net/tftp.c index 2e073183d5a..b5d227d8bc2 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -82,9 +82,7 @@ static ulong tftp_block_wrap; static ulong tftp_block_wrap_offset; static int tftp_state; static ulong tftp_load_addr; -#ifdef CONFIG_LMB static ulong tftp_load_size; -#endif #ifdef CONFIG_TFTP_TSIZE /* The file size reported by the server */ static int tftp_tsize; @@ -160,19 +158,20 @@ static inline int store_block(int block, uchar *src, unsigned int len) ulong store_addr = tftp_load_addr + offset; void *ptr; -#ifdef CONFIG_LMB - ulong end_addr = tftp_load_addr + tftp_load_size; + if (CONFIG_IS_ENABLED(LMB)) { + ulong end_addr = tftp_load_addr + tftp_load_size; - if (!end_addr) - end_addr = ULONG_MAX; + if (!end_addr) + end_addr = ULONG_MAX; - if (store_addr < tftp_load_addr || - store_addr + len > end_addr) { - puts("\nTFTP error: "); - puts("trying to overwrite reserved memory...\n"); - return -1; + if (store_addr < tftp_load_addr || + store_addr + len > end_addr) { + puts("\nTFTP error: "); + puts("trying to overwrite reserved memory...\n"); + return -1; + } } -#endif + ptr = map_sysmem(store_addr, len); memcpy(ptr, src, len); unmap_sysmem(ptr); @@ -716,18 +715,16 @@ static void tftp_timeout_handler(void) /* Initialize tftp_load_addr and tftp_load_size from image_load_addr and lmb */ static int tftp_init_load_addr(void) { -#ifdef CONFIG_LMB - struct lmb lmb; - phys_size_t max_size; + if (CONFIG_IS_ENABLED(LMB)) { + phys_size_t max_size; - lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob); + max_size = lmb_get_free_size(image_load_addr); + if (!max_size) + return -1; - max_size = lmb_get_free_size(&lmb, image_load_addr); - if (!max_size) - return -1; + tftp_load_size = max_size; + } - tftp_load_size = max_size; -#endif tftp_load_addr = image_load_addr; return 0; } diff --git a/net/wget.c b/net/wget.c index 945bfd26693..4a168641c65 100644 --- a/net/wget.c +++ b/net/wget.c @@ -73,12 +73,9 @@ static ulong wget_load_size; */ static int wget_init_load_size(void) { - struct lmb lmb; phys_size_t max_size; - lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob); - - max_size = lmb_get_free_size(&lmb, image_load_addr); + max_size = lmb_get_free_size(image_load_addr); if (!max_size) return -1; @@ -99,7 +96,7 @@ static inline int store_block(uchar *src, unsigned int offset, unsigned int len) ulong newsize = offset + len; uchar *ptr; - if (IS_ENABLED(CONFIG_LMB)) { + if (CONFIG_IS_ENABLED(LMB)) { ulong end_addr = image_load_addr + wget_load_size; if (!end_addr) @@ -496,7 +493,7 @@ void wget_start(void) debug_cond(DEBUG_WGET, "\nwget:Load address: 0x%lx\nLoading: *\b", image_load_addr); - if (IS_ENABLED(CONFIG_LMB)) { + if (CONFIG_IS_ENABLED(LMB)) { if (wget_init_load_size()) { printf("\nwget error: "); printf("trying to overwrite reserved memory...\n"); |