summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2022-08-08 21:46:03 +0930
committerTom Rini <trini@konsulko.com>2022-10-21 16:04:39 -0400
commit09bd3d0b0a954f250bac61fee7e3c6d037914569 (patch)
tree4f85b9e67aa28ad4505b3cd0a6191a1dcc29281d /net
parent7723828c97bc107d2fba976fc50403ac8747f1bc (diff)
net: NC-SI setup and handling
Add the handling of NC-SI ethernet frames, and add a check at the start of net_loop() to configure NC-SI before starting other network commands. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/net.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/net/net.c b/net/net.c
index f9d11c08d2..6987a3817b 100644
--- a/net/net.c
+++ b/net/net.c
@@ -93,6 +93,7 @@
#include <net.h>
#include <net/fastboot.h>
#include <net/tftp.h>
+#include <net/ncsi.h>
#if defined(CONFIG_CMD_PCAP)
#include <net/pcap.h>
#endif
@@ -410,6 +411,16 @@ int net_loop(enum proto_t protocol)
net_try_count = 1;
debug_cond(DEBUG_INT_STATE, "--- net_loop Entry\n");
+#ifdef CONFIG_PHY_NCSI
+ if (phy_interface_is_ncsi() && protocol != NCSI && !ncsi_active()) {
+ printf("%s: configuring NCSI first\n", __func__);
+ if (net_loop(NCSI) < 0)
+ return ret;
+ eth_init_state_only();
+ goto restart;
+ }
+#endif
+
bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start");
net_init();
if (eth_is_on_demand_init()) {
@@ -527,6 +538,11 @@ restart:
wol_start();
break;
#endif
+#if defined(CONFIG_PHY_NCSI)
+ case NCSI:
+ ncsi_probe_packages();
+ break;
+#endif
default:
break;
}
@@ -637,7 +653,7 @@ restart:
env_set_hex("filesize", net_boot_file_size);
env_set_hex("fileaddr", image_load_addr);
}
- if (protocol != NETCONS)
+ if (protocol != NETCONS && protocol != NCSI)
eth_halt();
else
eth_halt_state_only();
@@ -1322,6 +1338,11 @@ void net_process_received_packet(uchar *in_packet, int len)
wol_receive(ip, len);
break;
#endif
+#ifdef CONFIG_PHY_NCSI
+ case PROT_NCSI:
+ ncsi_receive(et, ip, len);
+ break;
+#endif
}
}
@@ -1382,6 +1403,9 @@ common:
#ifdef CONFIG_CMD_RARP
case RARP:
#endif
+#ifdef CONFIG_PHY_NCSI
+ case NCSI:
+#endif
case BOOTP:
case CDP:
case DHCP: