summaryrefslogtreecommitdiff
path: root/net/tftp.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2012-05-20 20:33:44 (GMT)
committerWolfgang Denk <wd@denx.de>2012-05-20 20:33:44 (GMT)
commit8bd07c9aaf4628931ab8da6eb0f83e517d9381a7 (patch)
treea0b3d31f7b56426cef184f8e6c21fff2aedf49ce /net/tftp.c
parentee3a55fdf00b54391e406217e53674449e70d78b (diff)
parentde30122bb58fee7b0f94bcfabab595b6ad757336 (diff)
downloadu-boot-8bd07c9aaf4628931ab8da6eb0f83e517d9381a7.tar.xz
Merge branch 'master' of git://git.denx.de/u-boot-net
* 'master' of git://git.denx.de/u-boot-net: net: move bootfile init into eth_initialize net: punt bd->bi_ip_addr net: cosmetic: netconsole.c checkpatch compliance net: cosmetic: tftp.* checkpatch compliance net: cosmetic: sntp.* checkpatch compliance net: cosmetic: rarp.* checkpatch compliance net: cosmetic: nfs.* checkpatch compliance net: cosmetic: net.c checkpatch compliance net: cosmetic: eth.c checkpatch compliance net: cosmetic: bootp.* checkpatch compliance net: cosmetic: net.h checkpatch compliance net: Remove volatile from net API
Diffstat (limited to 'net/tftp.c')
-rw-r--r--net/tftp.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/net/tftp.c b/net/tftp.c
index 7aa3e23..bc7fe05 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -11,6 +11,9 @@
#include <net.h>
#include "tftp.h"
#include "bootp.h"
+#ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
+#include <flash.h>
+#endif
/* Well known TFTP port # */
#define WELL_KNOWN_PORT 69
@@ -112,10 +115,6 @@ static char default_filename[DEFAULT_NAME_LEN];
static char tftp_filename[MAX_LEN];
-#ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
-extern flash_info_t flash_info[];
-#endif
-
/* 512 is poor choice for ethernet, MTU is typically 1500.
* Minus eth.hdrs thats 1468. Can get 2x better throughput with
* almost-MTU block sizes. At least try... fall back to 512 if need be.
@@ -137,7 +136,6 @@ static unsigned *Bitmap;
static int PrevBitmapHole, Mapsize = MTFTP_BITMAPSIZE;
static uchar ProhibitMcast, MasterClient;
static uchar Multicast;
-extern IPaddr_t Mcast_addr;
static int Mcast_port;
static ulong TftpEndingBlock; /* can get 'last' block before done..*/
@@ -157,7 +155,7 @@ mcast_cleanup(void)
#endif /* CONFIG_MCAST_TFTP */
-static __inline__ void
+static inline void
store_block(unsigned block, uchar *src, unsigned len)
{
ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;
@@ -182,8 +180,7 @@ store_block(unsigned block, uchar *src, unsigned len)
NetState = NETLOOP_FAIL;
return;
}
- }
- else
+ } else
#endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */
{
(void)memcpy((void *)(load_addr + offset), src, len);
@@ -310,9 +307,9 @@ static void
TftpSend(void)
{
uchar *pkt;
- volatile uchar *xp;
- int len = 0;
- volatile ushort *s;
+ uchar *xp;
+ int len = 0;
+ ushort *s;
#ifdef CONFIG_MCAST_TFTP
/* Multicast TFTP.. non-MasterClients do not ACK data. */
@@ -357,12 +354,14 @@ TftpSend(void)
0, TftpBlkSizeOption, 0);
#ifdef CONFIG_MCAST_TFTP
/* Check all preconditions before even trying the option */
- if (!ProhibitMcast
- && (Bitmap = malloc(Mapsize))
- && eth_get_dev()->mcast) {
- free(Bitmap);
- Bitmap = NULL;
- pkt += sprintf((char *)pkt, "multicast%c%c", 0, 0);
+ if (!ProhibitMcast) {
+ Bitmap = malloc(Mapsize);
+ if (Bitmap && eth_get_dev()->mcast) {
+ free(Bitmap);
+ Bitmap = NULL;
+ pkt += sprintf((char *)pkt, "multicast%c%c",
+ 0, 0);
+ }
}
#endif /* CONFIG_MCAST_TFTP */
len = pkt - xp;
@@ -630,8 +629,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
mcast_cleanup();
NetState = NETLOOP_SUCCESS;
}
- }
- else
+ } else
#endif
if (len < TftpBlkSize)
tftp_complete();