Commit e4a3d57dc79e8c94e3272c4a82b146df0fe3dda6
Committed by
Wolfgang Denk
1 parent
ed1ada712a
Exists in
master
and in
54 other branches
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>
Showing 4 changed files with 39 additions and 49 deletions Side-by-side Diff
include/net.h
... | ... | @@ -430,6 +430,12 @@ |
430 | 430 | extern void NetReceive(volatile uchar *, int); |
431 | 431 | |
432 | 432 | /* |
433 | + * Check if autoload is enabled. If so, use either NFS or TFTP to download | |
434 | + * the boot file. | |
435 | + */ | |
436 | +void net_auto_load(void); | |
437 | + | |
438 | +/* | |
433 | 439 | * The following functions are a bit ugly, but necessary to deal with |
434 | 440 | * alignment restrictions on ARM. |
435 | 441 | * |
net/bootp.c
... | ... | @@ -138,36 +138,6 @@ |
138 | 138 | return (curlen); |
139 | 139 | } |
140 | 140 | |
141 | -/* | |
142 | - * Check if autoload is enabled. If so, use either NFS or TFTP to download | |
143 | - * the boot file. | |
144 | - */ | |
145 | -static void auto_load(void) | |
146 | -{ | |
147 | - const char *s = getenv("autoload"); | |
148 | - | |
149 | - if (s != NULL) { | |
150 | - if (*s == 'n') { | |
151 | - /* | |
152 | - * Just use BOOTP to configure system; | |
153 | - * Do not use TFTP to load the bootfile. | |
154 | - */ | |
155 | - NetState = NETLOOP_SUCCESS; | |
156 | - return; | |
157 | - } | |
158 | -#if defined(CONFIG_CMD_NFS) | |
159 | - if (strcmp(s, "NFS") == 0) { | |
160 | - /* | |
161 | - * Use NFS to load the bootfile. | |
162 | - */ | |
163 | - NfsStart(); | |
164 | - return; | |
165 | - } | |
166 | -#endif | |
167 | - } | |
168 | - TftpStart(TFTPGET); | |
169 | -} | |
170 | - | |
171 | 141 | #if !defined(CONFIG_CMD_DHCP) |
172 | 142 | |
173 | 143 | static void BootpVendorFieldProcess (u8 * ext) |
... | ... | @@ -354,7 +324,7 @@ |
354 | 324 | |
355 | 325 | debug("Got good BOOTP\n"); |
356 | 326 | |
357 | - auto_load(); | |
327 | + net_auto_load(); | |
358 | 328 | } |
359 | 329 | #endif |
360 | 330 | |
... | ... | @@ -979,7 +949,7 @@ |
979 | 949 | dhcp_state = BOUND; |
980 | 950 | printf ("DHCP client bound to address %pI4\n", &NetOurIP); |
981 | 951 | |
982 | - auto_load(); | |
952 | + net_auto_load(); | |
983 | 953 | return; |
984 | 954 | } |
985 | 955 | break; |
net/net.c
... | ... | @@ -309,6 +309,36 @@ |
309 | 309 | } |
310 | 310 | } |
311 | 311 | |
312 | +/* | |
313 | + * Check if autoload is enabled. If so, use either NFS or TFTP to download | |
314 | + * the boot file. | |
315 | + */ | |
316 | +void net_auto_load(void) | |
317 | +{ | |
318 | + const char *s = getenv("autoload"); | |
319 | + | |
320 | + if (s != NULL) { | |
321 | + if (*s == 'n') { | |
322 | + /* | |
323 | + * Just use BOOTP/RARP to configure system; | |
324 | + * Do not use TFTP to load the bootfile. | |
325 | + */ | |
326 | + NetState = NETLOOP_SUCCESS; | |
327 | + return; | |
328 | + } | |
329 | +#if defined(CONFIG_CMD_NFS) | |
330 | + if (strcmp(s, "NFS") == 0) { | |
331 | + /* | |
332 | + * Use NFS to load the bootfile. | |
333 | + */ | |
334 | + NfsStart(); | |
335 | + return; | |
336 | + } | |
337 | +#endif | |
338 | + } | |
339 | + TftpStart(TFTPGET); | |
340 | +} | |
341 | + | |
312 | 342 | static void NetInitLoop(enum proto_t protocol) |
313 | 343 | { |
314 | 344 | static int env_changed_id; |
net/rarp.c
... | ... | @@ -46,24 +46,8 @@ |
46 | 46 | RarpHandler(uchar *dummi0, unsigned dummi1, IPaddr_t sip, unsigned dummi2, |
47 | 47 | unsigned dummi3) |
48 | 48 | { |
49 | - char *s; | |
50 | 49 | debug("Got good RARP\n"); |
51 | - if ((s = getenv("autoload")) != NULL) { | |
52 | - if (*s == 'n') { | |
53 | - /* | |
54 | - * Just use RARP to configure system; | |
55 | - * Do not use TFTP/NFS to to load the bootfile. | |
56 | - */ | |
57 | - NetState = NETLOOP_SUCCESS; | |
58 | - return; | |
59 | -#if defined(CONFIG_CMD_NFS) | |
60 | - } else if ((s != NULL) && !strcmp(s, "NFS")) { | |
61 | - NfsStart(); | |
62 | - return; | |
63 | -#endif | |
64 | - } | |
65 | - } | |
66 | - TftpStart (); | |
50 | + net_auto_load(); | |
67 | 51 | } |
68 | 52 | |
69 | 53 |