summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/eth.c8
-rw-r--r--net/net.c26
2 files changed, 22 insertions, 12 deletions
diff --git a/net/eth.c b/net/eth.c
index bb4d95be8e..49458c8db9 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -121,12 +121,8 @@ static struct {
static unsigned int eth_rcv_current, eth_rcv_last;
#endif
-static struct eth_device *eth_devices, *eth_current;
-
-struct eth_device *eth_get_dev(void)
-{
- return eth_current;
-}
+static struct eth_device *eth_devices;
+struct eth_device *eth_current;
struct eth_device *eth_get_dev_by_name(const char *devname)
{
diff --git a/net/net.c b/net/net.c
index f4404342f7..a89946ebe0 100644
--- a/net/net.c
+++ b/net/net.c
@@ -315,12 +315,15 @@ int NetLoop(enum proto_t protocol)
bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start");
net_init();
- eth_halt();
- eth_set_current();
- if (eth_init(bd) < 0) {
+ if (eth_is_on_demand_init() || protocol != NETCONS) {
eth_halt();
- return -1;
- }
+ eth_set_current();
+ if (eth_init(bd) < 0) {
+ eth_halt();
+ return -1;
+ }
+ } else
+ eth_init_state_only(bd);
restart:
net_set_state(NETLOOP_CONTINUE);
@@ -460,6 +463,9 @@ restart:
net_cleanup_loop();
eth_halt();
+ /* Invalidate the last protocol */
+ eth_set_last_protocol(BOOTP);
+
puts("\nAbort\n");
/* include a debug print as well incase the debug
messages are directed to stderr */
@@ -517,13 +523,21 @@ restart:
sprintf(buf, "%lX", (unsigned long)load_addr);
setenv("fileaddr", buf);
}
- eth_halt();
+ if (protocol != NETCONS)
+ eth_halt();
+ else
+ eth_halt_state_only();
+
+ eth_set_last_protocol(protocol);
+
ret = NetBootFileXferSize;
debug_cond(DEBUG_INT_STATE, "--- NetLoop Success!\n");
goto done;
case NETLOOP_FAIL:
net_cleanup_loop();
+ /* Invalidate the last protocol */
+ eth_set_last_protocol(BOOTP);
debug_cond(DEBUG_INT_STATE, "--- NetLoop Fail!\n");
goto done;
OpenPOWER on IntegriCloud