summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-08-02 21:11:11 +0000
committerwdenk <wdenk>2004-08-02 21:11:11 +0000
commit68ceb29e7133a0f972f53d3d61fd61207374baec (patch)
treeaea2bf247ffeabcab9e908c152b316e269e2e5ee /net
parent9aea95307fdb0ffe0d3a98a17ac73e5040c9756a (diff)
downloadu-boot-imx-68ceb29e7133a0f972f53d3d61fd61207374baec.zip
u-boot-imx-68ceb29e7133a0f972f53d3d61fd61207374baec.tar.gz
u-boot-imx-68ceb29e7133a0f972f53d3d61fd61207374baec.tar.bz2
Add support for console over UDP (compatible to Ingo Molnar's
netconsole patch under Linux)
Diffstat (limited to 'net')
-rw-r--r--net/net.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/net/net.c b/net/net.c
index 6e0288d..261f7c1 100644
--- a/net/net.c
+++ b/net/net.c
@@ -148,6 +148,11 @@ static void PingStart(void);
static void CDPStart(void);
#endif
+#ifdef CONFIG_NETCONSOLE
+void NcStart(void);
+int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len);
+#endif
+
volatile uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
volatile uchar *NetRxPackets[PKTBUFSRX]; /* Receive packets */
@@ -308,6 +313,7 @@ restart:
#if (CONFIG_COMMANDS & CFG_CMD_PING)
case PING:
#endif
+ case NETCONS:
case TFTP:
NetCopyIP(&NetOurIP, &bd->bi_ip_addr);
NetOurGatewayIP = getenv_IPaddr ("gatewayip");
@@ -319,6 +325,7 @@ restart:
#if (CONFIG_COMMANDS & CFG_CMD_NFS)
case NFS:
#endif
+ case NETCONS:
case TFTP:
NetServerIP = getenv_IPaddr ("serverip");
break;
@@ -404,6 +411,11 @@ restart:
CDPStart();
break;
#endif
+#ifdef CONFIG_NETCONSOLE
+ case NETCONS:
+ NcStart();
+ break;
+#endif
default:
break;
}
@@ -1259,6 +1271,9 @@ NetReceive(volatile uchar * inpkt, int len)
/* save address for later use */
memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6);
+#ifdef CONFIG_NETCONSOLE
+ (*packetHandler)(0,0,0,0);
+#endif
/* modify header, and transmit it */
memcpy(((Ethernet_t *)NetArpWaitTxPacket)->et_dest, NetArpWaitPacketMAC, 6);
(void) eth_send(NetArpWaitTxPacket, NetArpWaitTxPacketSize);
@@ -1377,6 +1392,12 @@ NetReceive(volatile uchar * inpkt, int len)
return;
}
+#ifdef CONFIG_NETCONSOLE
+ nc_input_packet((uchar *)ip +IP_HDR_SIZE,
+ ntohs(ip->udp_dst),
+ ntohs(ip->udp_src),
+ ntohs(ip->udp_len) - 8);
+#endif
/*
* IP header OK. Pass the packet to the current handler.
*/
@@ -1406,6 +1427,7 @@ static int net_check_prereq (proto_t protocol)
#if (CONFIG_COMMANDS & CFG_CMD_NFS)
case NFS:
#endif
+ case NETCONS:
case TFTP:
if (NetServerIP == 0) {
puts ("*** ERROR: `serverip' not set\n");