#endif
/* Network loop state */
int NetState;
-#ifdef CONFIG_NET_MULTI
/* Tried all network devices */
int NetRestartWrap;
/* Network loop restarted */
static int NetRestarted;
/* At least one device configured */
static int NetDevExists;
-#endif
/* XXX in both little & big endian machines 0xFFFF == ntohs(-1) */
/* default is without VLAN */
/* update only when the environment has changed */
if (env_changed_id != env_id) {
- NetCopyIP(&NetOurIP, &bd->bi_ip_addr);
+ NetOurIP = getenv_IPaddr("ipaddr");
+ NetCopyIP(&bd->bi_ip_addr, &NetOurIP);
NetOurGatewayIP = getenv_IPaddr("gatewayip");
NetOurSubnetMask = getenv_IPaddr("netmask");
NetServerIP = getenv_IPaddr("serverip");
{
bd_t *bd = gd->bd;
-#ifdef CONFIG_NET_MULTI
NetRestarted = 0;
NetDevExists = 0;
-#endif
/* XXX problem with bss workaround */
NetArpWaitPacketMAC = NULL;
}
eth_halt();
-#ifdef CONFIG_NET_MULTI
eth_set_current();
-#endif
if (eth_init(bd) < 0) {
eth_halt();
return -1;
}
restart:
-#ifdef CONFIG_NET_MULTI
memcpy(NetOurEther, eth_get_dev()->enetaddr, 6);
-#else
- eth_getenv_enetaddr("ethaddr", NetOurEther);
-#endif
NetState = NETLOOP_CONTINUE;
eth_halt();
return -1;
-#ifdef CONFIG_NET_MULTI
case 2:
/* network device not configured */
break;
-#endif /* CONFIG_NET_MULTI */
case 0:
-#ifdef CONFIG_NET_MULTI
NetDevExists = 1;
-#endif
switch (protocol) {
case TFTP:
/* always use ARP to get server ethernet address */
TftpStart();
break;
-
+#ifdef CONFIG_CMD_TFTPSRV
+ case TFTPSRV:
+ TftpStartServer();
+ break;
+#endif
#if defined(CONFIG_CMD_DHCP)
case DHCP:
BootpTry = 0;
switch (NetState) {
case NETLOOP_RESTART:
-#ifdef CONFIG_NET_MULTI
NetRestarted = 1;
-#endif
goto restart;
case NETLOOP_SUCCESS:
NetTryCount++;
-#ifndef CONFIG_NET_MULTI
- NetSetTimeout(10000UL, startAgainTimeout);
- NetSetHandler(startAgainHandler);
-#else /* !CONFIG_NET_MULTI*/
eth_halt();
#if !defined(CONFIG_NET_DO_NOT_TRY_ANOTHER)
eth_try_another(!NetRestarted);
} else {
NetState = NETLOOP_RESTART;
}
-#endif /* CONFIG_NET_MULTI */
}
/**********************************************************************/
static void PingStart(void)
{
-#if defined(CONFIG_NET_MULTI)
printf("Using %s device\n", eth_get_name());
-#endif /* CONFIG_NET_MULTI */
NetSetTimeout(10000UL, PingTimeout);
NetSetHandler(PingHandler);
static void CDPStart(void)
{
-#if defined(CONFIG_NET_MULTI)
printf("Using %s device\n", eth_get_name());
-#endif
CDPSeq = 0;
CDPOK = 0;
/* Fall through */
case NETCONS:
+ case TFTPSRV:
if (NetOurIP == 0) {
puts("*** ERROR: `ipaddr' not set\n");
return 1;
case CDP:
case DHCP:
if (memcmp(NetOurEther, "\0\0\0\0\0\0", 6) == 0) {
-#ifdef CONFIG_NET_MULTI
extern int eth_get_dev_index(void);
int num = eth_get_dev_index();
NetStartAgain();
return 2;
-#else
- puts("*** ERROR: `ethaddr' not set\n");
- return 1;
-#endif
}
/* Fall through */
default: