summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorBen Warren <bwarren@qstreams.com>2007-08-13 21:26:03 -0400
committerBen Warren <bwarren@qstreams.com>2007-08-13 21:26:03 -0400
commitd1bc6c8d5f4a9c7ca9fb2292d5c65f846dcc3995 (patch)
treedd0722cee4758fe40f6a5cc75986ebb1a395aac2 /net
parentf539edc076cfe52bff919dd512ba8d7af0e22092 (diff)
parent8a92b7c60b40ff79e2cc96e13aeac2a531dde473 (diff)
Sync'd u-boot-net with mainline
Merge git://www.denx.de/git/u-boot Conflicts: drivers/bcm570x.c drivers/tigon3.c
Diffstat (limited to 'net')
-rw-r--r--net/bootp.c94
-rw-r--r--net/bootp.h2
-rw-r--r--net/eth.c59
-rw-r--r--net/net.c70
-rw-r--r--net/nfs.c4
-rw-r--r--net/rarp.c6
-rw-r--r--net/sntp.c6
-rw-r--r--net/tftp.c4
8 files changed, 117 insertions, 128 deletions
diff --git a/net/bootp.c b/net/bootp.c
index 1de9a8f2c6..80f53bc886 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -31,7 +31,7 @@
#define BOOTP_VENDOR_MAGIC 0x63825363 /* RFC1048 Magic Cookie */
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
#define TIMEOUT 5 /* Seconds before trying BOOTP again */
#ifndef CONFIG_NET_RETRY_COUNT
@@ -53,7 +53,7 @@ int BootpTry;
ulong seed1, seed2;
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
dhcp_state_t dhcp_state = INIT;
unsigned long dhcp_leasetime = 0;
IPaddr_t NetDHCPServerIP = 0;
@@ -76,12 +76,12 @@ static char *dhcpmsg2str(int type)
}
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
+#if defined(CONFIG_BOOTP_VENDOREX)
extern u8 *dhcp_vendorex_prep (u8 *e); /*rtn new e after add own opts. */
extern u8 *dhcp_vendorex_proc (u8 *e); /*rtn next e if mine,else NULL */
#endif
-#endif /* CFG_CMD_DHCP */
+#endif
static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
{
@@ -148,7 +148,7 @@ static int truncate_sz (const char *name, int maxlen, int curlen)
return (curlen);
}
-#if !(CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if !defined(CONFIG_CMD_DHCP)
static void BootpVendorFieldProcess (u8 * ext)
{
@@ -181,7 +181,7 @@ static void BootpVendorFieldProcess (u8 * ext)
if (NetOurDNSIP == 0) {
NetCopyIP (&NetOurDNSIP, (IPaddr_t *) (ext + 2));
}
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
+#if defined(CONFIG_BOOTP_DNS2)
if ((NetOurDNS2IP == 0) && (size > 4)) {
NetCopyIP (&NetOurDNS2IP, (IPaddr_t *) (ext + 2 + 4));
}
@@ -344,7 +344,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
*/
NetState = NETLOOP_SUCCESS;
return;
-#if (CONFIG_COMMANDS & CFG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
} else if (strcmp(s, "NFS") == 0) {
/*
* Use NFS to load the bootfile.
@@ -357,7 +357,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
TftpStart();
}
-#endif /* !CFG_CMD_DHCP */
+#endif
/*
* Timeout on BOOTP/DHCP request.
@@ -377,16 +377,16 @@ BootpTimeout(void)
/*
* Initialize BOOTP extension fields in the request.
*/
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t RequestedIP)
{
u8 *start = e;
u8 *cnt;
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
+#if defined(CONFIG_BOOTP_VENDOREX)
u8 *x;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
+#if defined(CONFIG_BOOTP_SEND_HOSTNAME)
char *hostname;
#endif
@@ -425,7 +425,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
*e++ = tmp >> 8;
*e++ = tmp & 0xff;
}
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
+#if defined(CONFIG_BOOTP_SEND_HOSTNAME)
if ((hostname = getenv ("hostname"))) {
int hostnamelen = strlen (hostname);
@@ -436,7 +436,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
}
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
+#if defined(CONFIG_BOOTP_VENDOREX)
if ((x = dhcp_vendorex_prep (e)))
return x - start;
#endif
@@ -444,39 +444,39 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
*e++ = 55; /* Parameter Request List */
cnt = e++; /* Pointer to count of requested items */
*cnt = 0;
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SUBNETMASK)
+#if defined(CONFIG_BOOTP_SUBNETMASK)
*e++ = 1; /* Subnet Mask */
*cnt += 1;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_TIMEOFFSET)
+#if defined(CONFIG_BOOTP_TIMEOFFSET)
*e++ = 2;
*cnt += 1;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_GATEWAY)
+#if defined(CONFIG_BOOTP_GATEWAY)
*e++ = 3; /* Router Option */
*cnt += 1;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS)
+#if defined(CONFIG_BOOTP_DNS)
*e++ = 6; /* DNS Server(s) */
*cnt += 1;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_HOSTNAME)
+#if defined(CONFIG_BOOTP_HOSTNAME)
*e++ = 12; /* Hostname */
*cnt += 1;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTFILESIZE)
+#if defined(CONFIG_BOOTP_BOOTFILESIZE)
*e++ = 13; /* Boot File Size */
*cnt += 1;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTPATH)
+#if defined(CONFIG_BOOTP_BOOTPATH)
*e++ = 17; /* Boot path */
*cnt += 1;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NISDOMAIN)
+#if defined(CONFIG_BOOTP_NISDOMAIN)
*e++ = 40; /* NIS Domain name request */
*cnt += 1;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NTPSERVER)
+#if defined(CONFIG_BOOTP_NTPSERVER)
*e++ = 42;
*cnt += 1;
#endif
@@ -491,9 +491,9 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
return e - start;
}
-#else /* CFG_CMD_DHCP */
+#else
/*
- * Warning: no field size check - change CONFIG_BOOTP_MASK at your own risk!
+ * Warning: no field size check - change CONFIG_BOOTP_* at your own risk!
*/
static int BootpExtended (u8 * e)
{
@@ -504,7 +504,7 @@ static int BootpExtended (u8 * e)
*e++ = 83;
*e++ = 99;
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
*e++ = 53; /* DHCP Message Type */
*e++ = 1;
*e++ = DHCP_DISCOVER;
@@ -513,45 +513,45 @@ static int BootpExtended (u8 * e)
*e++ = 2;
*e++ = (576 - 312 + OPT_SIZE) >> 16;
*e++ = (576 - 312 + OPT_SIZE) & 0xff;
-#endif /* CFG_CMD_DHCP */
+#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SUBNETMASK)
+#if defined(CONFIG_BOOTP_SUBNETMASK)
*e++ = 1; /* Subnet mask request */
*e++ = 4;
e += 4;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_GATEWAY)
+#if defined(CONFIG_BOOTP_GATEWAY)
*e++ = 3; /* Default gateway request */
*e++ = 4;
e += 4;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS)
+#if defined(CONFIG_BOOTP_DNS)
*e++ = 6; /* Domain Name Server */
*e++ = 4;
e += 4;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_HOSTNAME)
+#if defined(CONFIG_BOOTP_HOSTNAME)
*e++ = 12; /* Host name request */
*e++ = 32;
e += 32;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTFILESIZE)
+#if defined(CONFIG_BOOTP_BOOTFILESIZE)
*e++ = 13; /* Boot file size */
*e++ = 2;
e += 2;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTPATH)
+#if defined(CONFIG_BOOTP_BOOTPATH)
*e++ = 17; /* Boot path */
*e++ = 32;
e += 32;
#endif
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NISDOMAIN)
+#if defined(CONFIG_BOOTP_NISDOMAIN)
*e++ = 40; /* NIS Domain name request */
*e++ = 32;
e += 32;
@@ -561,7 +561,7 @@ static int BootpExtended (u8 * e)
return e - start;
}
-#endif /* CFG_CMD_DHCP */
+#endif
void
BootpRequest (void)
@@ -570,7 +570,7 @@ BootpRequest (void)
Bootp_t *bp;
int ext_len, pktlen, iplen;
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
dhcp_state = INIT;
#endif
@@ -678,11 +678,11 @@ BootpRequest (void)
copy_filename (bp->bp_file, BootFile, sizeof(bp->bp_file));
/* Request additional information from the BOOTP/DHCP server */
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
ext_len = DhcpExtended((u8 *)bp->bp_vend, DHCP_DISCOVER, 0, 0);
#else
ext_len = BootpExtended((u8 *)bp->bp_vend);
-#endif /* CFG_CMD_DHCP */
+#endif
/*
* Bootp ID is the lower 4 bytes of our ethernet address
@@ -705,16 +705,16 @@ BootpRequest (void)
NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
NetSetTimeout(SELECT_TIMEOUT * CFG_HZ, BootpTimeout);
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
dhcp_state = SELECTING;
NetSetHandler(DhcpHandler);
#else
NetSetHandler(BootpHandler);
-#endif /* CFG_CMD_DHCP */
+#endif
NetSendPacket(NetTxPacket, pktlen);
}
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
{
uchar *end = popt + BOOTP_HDR_SIZE;
@@ -726,7 +726,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
case 1:
NetCopyIP (&NetOurSubnetMask, (popt + 2));
break;
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP) && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_TIMEOFFSET)
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
case 2: /* Time offset */
NetCopyLong (&NetTimeOffset, (ulong *) (popt + 2));
NetTimeOffset = ntohl (NetTimeOffset);
@@ -737,7 +737,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
break;
case 6:
NetCopyIP (&NetOurDNSIP, (popt + 2));
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
+#if defined(CONFIG_BOOTP_DNS2)
if (*(popt + 1) > 4) {
NetCopyIP (&NetOurDNS2IP, (popt + 2 + 4));
}
@@ -755,7 +755,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
memcpy (&NetOurRootPath, popt + 2, size);
NetOurRootPath[size] = 0;
break;
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP) && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NTPSERVER)
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
case 42: /* NTP server IP */
NetCopyIP (&NetNtpServerIP, (popt + 2));
break;
@@ -801,7 +801,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
}
break;
default:
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
+#if defined(CONFIG_BOOTP_VENDOREX)
if (dhcp_vendorex_proc (popt))
break;
#endif
@@ -950,7 +950,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
*/
NetState = NETLOOP_SUCCESS;
return;
-#if (CONFIG_COMMANDS & CFG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
} else if (strcmp(s, "NFS") == 0) {
/*
* Use NFS to load the bootfile.
@@ -975,6 +975,6 @@ void DhcpRequest(void)
{
BootpRequest();
}
-#endif /* CFG_CMD_DHCP */
+#endif
-#endif /* CFG_CMD_NET */
+#endif
diff --git a/net/bootp.h b/net/bootp.h
index 0b3163901e..ba9826e914 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -18,7 +18,7 @@
/*
* BOOTP header.
*/
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
#define OPT_SIZE 312 /* Minimum DHCP Options size per RFC2131 - results in 576 byte pkt */
#else
#define OPT_SIZE 64
diff --git a/net/eth.c b/net/eth.c
index 0fc22115dc..c8f92a5263 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -26,7 +26,7 @@
#include <net.h>
#include <miiphy.h>
-#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI)
+#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
#ifdef CFG_GT_6426x
extern int gt6426x_eth_initialize(bd_t *bis);
@@ -40,6 +40,7 @@ extern int eth_3com_initialize(bd_t*);
extern int fec_initialize(bd_t*);
extern int inca_switch_initialize(bd_t*);
extern int mpc5xxx_fec_initialize(bd_t*);
+extern int mpc512x_fec_initialize(bd_t*);
extern int mpc8220_fec_initialize(bd_t*);
extern int mv6436x_eth_initialize(bd_t *);
extern int mv6446x_eth_initialize(bd_t *);
@@ -142,7 +143,8 @@ int eth_initialize(bd_t *bis)
eth_devices = NULL;
eth_current = NULL;
-#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
+ show_boot_progress (64);
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
miiphy_init();
#endif
@@ -167,34 +169,29 @@ int eth_initialize(bd_t *bis)
#if defined(CONFIG_MPC5xxx_FEC)
mpc5xxx_fec_initialize(bis);
#endif
+#if defined(CONFIG_MPC512x_FEC)
+ mpc512x_fec_initialize (bis);
+#endif
#if defined(CONFIG_MPC8220_FEC)
mpc8220_fec_initialize(bis);
#endif
#if defined(CONFIG_SK98)
skge_initialize(bis);
#endif
-#if defined(CONFIG_MPC85XX_TSEC1)
- tsec_initialize(bis, 0, CONFIG_MPC85XX_TSEC1_NAME);
-#elif defined(CONFIG_MPC83XX_TSEC1)
- tsec_initialize(bis, 0, CONFIG_MPC83XX_TSEC1_NAME);
+#if defined(CONFIG_TSEC1)
+ tsec_initialize(bis, 0, CONFIG_TSEC1_NAME);
#endif
-#if defined(CONFIG_MPC85XX_TSEC2)
- tsec_initialize(bis, 1, CONFIG_MPC85XX_TSEC2_NAME);
-#elif defined(CONFIG_MPC83XX_TSEC2)
- tsec_initialize(bis, 1, CONFIG_MPC83XX_TSEC2_NAME);
+#if defined(CONFIG_TSEC2)
+ tsec_initialize(bis, 1, CONFIG_TSEC2_NAME);
#endif
#if defined(CONFIG_MPC85XX_FEC)
tsec_initialize(bis, 2, CONFIG_MPC85XX_FEC_NAME);
#else
-# if defined(CONFIG_MPC85XX_TSEC3)
- tsec_initialize(bis, 2, CONFIG_MPC85XX_TSEC3_NAME);
-# elif defined(CONFIG_MPC83XX_TSEC3)
- tsec_initialize(bis, 2, CONFIG_MPC83XX_TSEC3_NAME);
+# if defined(CONFIG_TSEC3)
+ tsec_initialize(bis, 2, CONFIG_TSEC3_NAME);
# endif
-# if defined(CONFIG_MPC85XX_TSEC4)
- tsec_initialize(bis, 3, CONFIG_MPC85XX_TSEC4_NAME);
-# elif defined(CONFIG_MPC83XX_TSEC4)
- tsec_initialize(bis, 3, CONFIG_MPC83XX_TSEC4_NAME);
+# if defined(CONFIG_TSEC4)
+ tsec_initialize(bis, 3, CONFIG_TSEC4_NAME);
# endif
#endif
#if defined(CONFIG_UEC_ETH1)
@@ -203,21 +200,6 @@ int eth_initialize(bd_t *bis)
#if defined(CONFIG_UEC_ETH2)
uec_initialize(1);
#endif
-#if defined(CONFIG_MPC86XX_TSEC1)
- tsec_initialize(bis, 0, CONFIG_MPC86XX_TSEC1_NAME);
-#endif
-
-#if defined(CONFIG_MPC86XX_TSEC2)
- tsec_initialize(bis, 1, CONFIG_MPC86XX_TSEC2_NAME);
-#endif
-
-#if defined(CONFIG_MPC86XX_TSEC3)
- tsec_initialize(bis, 2, CONFIG_MPC86XX_TSEC3_NAME);
-#endif
-
-#if defined(CONFIG_MPC86XX_TSEC4)
- tsec_initialize(bis, 3, CONFIG_MPC86XX_TSEC4_NAME);
-#endif
#if defined(FEC_ENET) || defined(CONFIG_ETHER_ON_FCC)
fec_initialize(bis);
@@ -270,10 +252,12 @@ int eth_initialize(bd_t *bis)
if (!eth_devices) {
puts ("No ethernet found.\n");
+ show_boot_progress (-64);
} else {
struct eth_device *dev = eth_devices;
char *ethprime = getenv ("ethprime");
+ show_boot_progress (65);
do {
if (eth_number)
puts (", ");
@@ -474,16 +458,18 @@ char *eth_get_name (void)
{
return (eth_current ? eth_current->name : "unknown");
}
-#elif (CONFIG_COMMANDS & CFG_CMD_NET) && !defined(CONFIG_NET_MULTI)
+#elif defined(CONFIG_CMD_NET) && !defined(CONFIG_NET_MULTI)
extern int at91rm9200_miiphy_initialize(bd_t *bis);
extern int emac4xx_miiphy_initialize(bd_t *bis);
extern int mcf52x2_miiphy_initialize(bd_t *bis);
extern int ns7520_miiphy_initialize(bd_t *bis);
+extern int dm644x_eth_miiphy_initialize(bd_t *bis);
+
int eth_initialize(bd_t *bis)
{
-#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
miiphy_init();
#endif
@@ -500,6 +486,9 @@ int eth_initialize(bd_t *bis)
#if defined(CONFIG_NETARM)
ns7520_miiphy_initialize(bis);
#endif
+#if defined(CONFIG_DRIVER_TI_EMAC)
+ dm644x_eth_miiphy_initialize(bis);
+#endif
return 0;
}
#endif
diff --git a/net/net.c b/net/net.c
index 2ff7bfc09f..e9d7757641 100644
--- a/net/net.c
+++ b/net/net.c
@@ -86,11 +86,11 @@
#include <status_led.h>
#include <miiphy.h>
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+#if defined(CONFIG_CMD_SNTP)
#include "sntp.h"
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
DECLARE_GLOBAL_DATA_PTR;
@@ -110,7 +110,7 @@ DECLARE_GLOBAL_DATA_PTR;
IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */
IPaddr_t NetOurGatewayIP=0; /* Our gateways IP address */
IPaddr_t NetOurDNSIP=0; /* Our DNS IP address */
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
+#if defined(CONFIG_BOOTP_DNS2)
IPaddr_t NetOurDNS2IP=0; /* Our 2nd DNS IP address */
#endif
char NetOurNISDomain[32]={0,}; /* Our NIS domain */
@@ -133,7 +133,7 @@ uchar NetBcastAddr[6] = /* Ethernet bcast address */
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
uchar NetEtherNullAddr[6] =
{ 0, 0, 0, 0, 0, 0 };
-#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+#if defined(CONFIG_CMD_CDP)
uchar NetCDPAddr[6] = /* Ethernet bcast address */
{ 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
#endif
@@ -150,17 +150,17 @@ ushort NetOurNativeVLAN = 0xFFFF; /* ditto */
char BootFile[128]; /* Boot File name */
-#if (CONFIG_COMMANDS & CFG_CMD_PING)
+#if defined(CONFIG_CMD_PING)
IPaddr_t NetPingIP; /* the ip address to ping */
static void PingStart(void);
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+#if defined(CONFIG_CMD_CDP)
static void CDPStart(void);
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+#if defined(CONFIG_CMD_SNTP)
IPaddr_t NetNtpServerIP; /* NTP server IP address */
int NetTimeOffset=0; /* offset time from UTC */
#endif
@@ -326,13 +326,13 @@ restart:
*/
switch (protocol) {
-#if (CONFIG_COMMANDS & CFG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
case NFS:
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_PING)
+#if defined(CONFIG_CMD_PING)
case PING:
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+#if defined(CONFIG_CMD_SNTP)
case SNTP:
#endif
case NETCONS:
@@ -344,19 +344,19 @@ restart:
NetOurNativeVLAN = getenv_VLAN("nvlan");
switch (protocol) {
-#if (CONFIG_COMMANDS & CFG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
case NFS:
#endif
case NETCONS:
case TFTP:
NetServerIP = getenv_IPaddr ("serverip");
break;
-#if (CONFIG_COMMANDS & CFG_CMD_PING)
+#if defined(CONFIG_CMD_PING)
case PING:
/* nothing */
break;
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+#if defined(CONFIG_CMD_SNTP)
case SNTP:
/* nothing */
break;
@@ -406,7 +406,7 @@ restart:
TftpStart();
break;
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
case DHCP:
/* Start with a clean slate... */
BootpTry = 0;
@@ -414,7 +414,7 @@ restart:
NetServerIP = getenv_IPaddr ("serverip");
DhcpRequest(); /* Basically same as BOOTP */
break;
-#endif /* CFG_CMD_DHCP */
+#endif
case BOOTP:
BootpTry = 0;
@@ -425,17 +425,17 @@ restart:
RarpTry = 0;
RarpRequest ();
break;
-#if (CONFIG_COMMANDS & CFG_CMD_PING)
+#if defined(CONFIG_CMD_PING)
case PING:
PingStart();
break;
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
case NFS:
NfsStart();
break;
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+#if defined(CONFIG_CMD_CDP)
case CDP:
CDPStart();
break;
@@ -445,7 +445,7 @@ restart:
NcStart();
break;
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+#if defined(CONFIG_CMD_SNTP)
case SNTP:
SntpStart();
break;
@@ -458,7 +458,7 @@ restart:
break;
}
-#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
#if defined(CFG_FAULT_ECHO_LINK_DOWN) && defined(CONFIG_STATUS_LED) && defined(STATUS_LED_RED)
/*
* Echo the inverted link state to the fault LED.
@@ -507,7 +507,7 @@ restart:
if (timeHandler && ((get_timer(0) - timeStart) > timeDelta)) {
thand_f *x;
-#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
# if defined(CFG_FAULT_ECHO_LINK_DOWN) && \
defined(CONFIG_STATUS_LED) && \
defined(STATUS_LED_RED)
@@ -687,7 +687,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
return 0; /* transmitted */
}
-#if (CONFIG_COMMANDS & CFG_CMD_PING)
+#if defined(CONFIG_CMD_PING)
static ushort PingSeqNo;
int PingSend(void)
@@ -775,9 +775,9 @@ static void PingStart(void)
PingSend();
}
-#endif /* CFG_CMD_PING */
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+#if defined(CONFIG_CMD_CDP)
#define CDP_DEVICE_ID_TLV 0x0001
#define CDP_ADDRESS_TLV 0x0002
@@ -1128,7 +1128,7 @@ static void CDPStart(void)
CDPSendTrigger();
}
-#endif /* CFG_CMD_CDP */
+#endif
void
@@ -1140,7 +1140,7 @@ NetReceive(volatile uchar * inpkt, int len)
IPaddr_t tmp;
int x;
uchar *pkt;
-#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+#if defined(CONFIG_CMD_CDP)
int iscdp;
#endif
ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid;
@@ -1157,7 +1157,7 @@ NetReceive(volatile uchar * inpkt, int len)
if (len < ETHER_HDR_SIZE)
return;
-#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+#if defined(CONFIG_CMD_CDP)
/* keep track if packet is CDP */
iscdp = memcmp(et->et_dest, NetCDPAddr, 6) == 0;
#endif
@@ -1200,7 +1200,7 @@ NetReceive(volatile uchar * inpkt, int len)
/* if no VLAN active */
if ((ntohs(NetOurVLAN) & VLAN_IDMASK) == VLAN_NONE
-#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+#if defined(CONFIG_CMD_CDP)
&& iscdp == 0
#endif
)
@@ -1218,7 +1218,7 @@ NetReceive(volatile uchar * inpkt, int len)
printf("Receive from protocol 0x%x\n", x);
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+#if defined(CONFIG_CMD_CDP)
if (iscdp) {
CDPHandler((uchar *)ip, len);
return;
@@ -1416,7 +1416,7 @@ NetReceive(volatile uchar * inpkt, int len)
print_IPaddr(icmph->un.gateway);
putc(' ');
return;
-#if (CONFIG_COMMANDS & CFG_CMD_PING)
+#if defined(CONFIG_CMD_PING)
case ICMP_ECHO_REPLY:
/*
* IP header OK. Pass the packet to the current handler.
@@ -1516,7 +1516,7 @@ static int net_check_prereq (proto_t protocol)
{
switch (protocol) {
/* Fall through */
-#if (CONFIG_COMMANDS & CFG_CMD_PING)
+#if defined(CONFIG_CMD_PING)
case PING:
if (NetPingIP == 0) {
puts ("*** ERROR: ping address not given\n");
@@ -1524,7 +1524,7 @@ static int net_check_prereq (proto_t protocol)
}
goto common;
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+#if defined(CONFIG_CMD_SNTP)
case SNTP:
if (NetNtpServerIP == 0) {
puts ("*** ERROR: NTP server address not given\n");
@@ -1532,7 +1532,7 @@ static int net_check_prereq (proto_t protocol)
}
goto common;
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
case NFS:
#endif
case NETCONS:
@@ -1541,7 +1541,7 @@ static int net_check_prereq (proto_t protocol)
puts ("*** ERROR: `serverip' not set\n");
return (1);
}
-#if (CONFIG_COMMANDS & (CFG_CMD_PING | CFG_CMD_SNTP))
+#if defined(CONFIG_CMD_PING) || defined(CONFIG_CMD_SNTP)
common:
#endif
@@ -1693,7 +1693,7 @@ void copy_filename (char *dst, char *src, int size)
*dst = '\0';
}
-#endif /* CFG_CMD_NET */
+#endif
void ip_to_string (IPaddr_t x, char *s)
{
diff --git a/net/nfs.c b/net/nfs.c
index de789e1f84..df2caac48c 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -31,7 +31,7 @@
/*#define NFS_DEBUG*/
-#if ((CONFIG_COMMANDS & CFG_CMD_NET) && (CONFIG_COMMANDS & CFG_CMD_NFS))
+#if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */
#define NFS_TIMEOUT 60
@@ -775,4 +775,4 @@ NfsStart (void)
NfsSend ();
}
-#endif /* CONFIG_COMMANDS & CFG_CMD_NFS */
+#endif
diff --git a/net/rarp.c b/net/rarp.c
index 1ba60e803c..21dfa529c9 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -29,7 +29,7 @@
#include "rarp.h"
#include "tftp.h"
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
#define TIMEOUT 5 /* Seconds before trying BOOTP again */
#ifndef CONFIG_NET_RETRY_COUNT
@@ -59,7 +59,7 @@ RarpHandler(uchar * dummi0, unsigned dummi1, unsigned dummi2, unsigned dummi3)
*/
NetState = NETLOOP_SUCCESS;
return;
-#if (CONFIG_COMMANDS & CFG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
} else if ((s != NULL) && !strcmp(s, "NFS")) {
NfsStart();
return;
@@ -119,4 +119,4 @@ RarpRequest (void)
NetSetHandler(RarpHandler);
}
-#endif /* CFG_CMD_NET */
+#endif
diff --git a/net/sntp.c b/net/sntp.c
index db8c2c2799..95e75422c1 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -12,7 +12,7 @@
#include "sntp.h"
-#if ((CONFIG_COMMANDS & CFG_CMD_NET) && (CONFIG_COMMANDS & CFG_CMD_SNTP))
+#if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_SNTP)
#define SNTP_TIMEOUT 10
@@ -67,7 +67,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
memcpy (&seconds, &rpktp->transmit_timestamp, sizeof(ulong));
to_tm(ntohl(seconds) - 2208988800UL + NetTimeOffset, &tm);
-#if (CONFIG_COMMANDS & CFG_CMD_DATE)
+#if defined(CONFIG_CMD_DATE)
rtc_set (&tm);
#endif
printf ("Date: %4d-%02d-%02d Time: %2d:%02d:%02d\n",
@@ -89,4 +89,4 @@ SntpStart (void)
SntpSend ();
}
-#endif /* CONFIG_COMMANDS & CFG_CMD_SNTP */
+#endif
diff --git a/net/tftp.c b/net/tftp.c
index f3a5471483..d56e30b5b5 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -12,7 +12,7 @@
#undef ET_DEBUG
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
#define WELL_KNOWN_PORT 69 /* Well known TFTP port # */
#define TIMEOUT 5 /* Seconds to timeout for a lost pkt */
@@ -386,4 +386,4 @@ TftpStart (void)
TftpSend ();
}
-#endif /* CFG_CMD_NET */
+#endif