mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-30 08:07:59 +00:00
net: Export auto_load, use it in rarp
The rarp code includes another instance of the auto_load logic, so call what is now net_auto_load() instead. This also fixes an incorrect call to TftpStart() which was never seen since apparently no boards enable rarp. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
ed1ada712a
commit
e4a3d57dc7
4 changed files with 39 additions and 49 deletions
|
@ -429,6 +429,12 @@ extern int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, i
|
||||||
/* Processes a received packet */
|
/* Processes a received packet */
|
||||||
extern void NetReceive(volatile uchar *, int);
|
extern void NetReceive(volatile uchar *, int);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if autoload is enabled. If so, use either NFS or TFTP to download
|
||||||
|
* the boot file.
|
||||||
|
*/
|
||||||
|
void net_auto_load(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following functions are a bit ugly, but necessary to deal with
|
* The following functions are a bit ugly, but necessary to deal with
|
||||||
* alignment restrictions on ARM.
|
* alignment restrictions on ARM.
|
||||||
|
|
34
net/bootp.c
34
net/bootp.c
|
@ -138,36 +138,6 @@ static int truncate_sz (const char *name, int maxlen, int curlen)
|
||||||
return (curlen);
|
return (curlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if autoload is enabled. If so, use either NFS or TFTP to download
|
|
||||||
* the boot file.
|
|
||||||
*/
|
|
||||||
static void auto_load(void)
|
|
||||||
{
|
|
||||||
const char *s = getenv("autoload");
|
|
||||||
|
|
||||||
if (s != NULL) {
|
|
||||||
if (*s == 'n') {
|
|
||||||
/*
|
|
||||||
* Just use BOOTP to configure system;
|
|
||||||
* Do not use TFTP to load the bootfile.
|
|
||||||
*/
|
|
||||||
NetState = NETLOOP_SUCCESS;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#if defined(CONFIG_CMD_NFS)
|
|
||||||
if (strcmp(s, "NFS") == 0) {
|
|
||||||
/*
|
|
||||||
* Use NFS to load the bootfile.
|
|
||||||
*/
|
|
||||||
NfsStart();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
TftpStart(TFTPGET);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(CONFIG_CMD_DHCP)
|
#if !defined(CONFIG_CMD_DHCP)
|
||||||
|
|
||||||
static void BootpVendorFieldProcess (u8 * ext)
|
static void BootpVendorFieldProcess (u8 * ext)
|
||||||
|
@ -354,7 +324,7 @@ BootpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
|
||||||
|
|
||||||
debug("Got good BOOTP\n");
|
debug("Got good BOOTP\n");
|
||||||
|
|
||||||
auto_load();
|
net_auto_load();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -979,7 +949,7 @@ DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
|
||||||
dhcp_state = BOUND;
|
dhcp_state = BOUND;
|
||||||
printf ("DHCP client bound to address %pI4\n", &NetOurIP);
|
printf ("DHCP client bound to address %pI4\n", &NetOurIP);
|
||||||
|
|
||||||
auto_load();
|
net_auto_load();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
30
net/net.c
30
net/net.c
|
@ -309,6 +309,36 @@ void ArpTimeoutCheck(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if autoload is enabled. If so, use either NFS or TFTP to download
|
||||||
|
* the boot file.
|
||||||
|
*/
|
||||||
|
void net_auto_load(void)
|
||||||
|
{
|
||||||
|
const char *s = getenv("autoload");
|
||||||
|
|
||||||
|
if (s != NULL) {
|
||||||
|
if (*s == 'n') {
|
||||||
|
/*
|
||||||
|
* Just use BOOTP/RARP to configure system;
|
||||||
|
* Do not use TFTP to load the bootfile.
|
||||||
|
*/
|
||||||
|
NetState = NETLOOP_SUCCESS;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#if defined(CONFIG_CMD_NFS)
|
||||||
|
if (strcmp(s, "NFS") == 0) {
|
||||||
|
/*
|
||||||
|
* Use NFS to load the bootfile.
|
||||||
|
*/
|
||||||
|
NfsStart();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
TftpStart(TFTPGET);
|
||||||
|
}
|
||||||
|
|
||||||
static void NetInitLoop(enum proto_t protocol)
|
static void NetInitLoop(enum proto_t protocol)
|
||||||
{
|
{
|
||||||
static int env_changed_id;
|
static int env_changed_id;
|
||||||
|
|
18
net/rarp.c
18
net/rarp.c
|
@ -46,24 +46,8 @@ static void
|
||||||
RarpHandler(uchar *dummi0, unsigned dummi1, IPaddr_t sip, unsigned dummi2,
|
RarpHandler(uchar *dummi0, unsigned dummi1, IPaddr_t sip, unsigned dummi2,
|
||||||
unsigned dummi3)
|
unsigned dummi3)
|
||||||
{
|
{
|
||||||
char *s;
|
|
||||||
debug("Got good RARP\n");
|
debug("Got good RARP\n");
|
||||||
if ((s = getenv("autoload")) != NULL) {
|
net_auto_load();
|
||||||
if (*s == 'n') {
|
|
||||||
/*
|
|
||||||
* Just use RARP to configure system;
|
|
||||||
* Do not use TFTP/NFS to to load the bootfile.
|
|
||||||
*/
|
|
||||||
NetState = NETLOOP_SUCCESS;
|
|
||||||
return;
|
|
||||||
#if defined(CONFIG_CMD_NFS)
|
|
||||||
} else if ((s != NULL) && !strcmp(s, "NFS")) {
|
|
||||||
NfsStart();
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TftpStart ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue