[U-Boot] [PATCH 01/28] net: Remove volatile from all of net except the eth driver interface

Joe Hershberger joe.hershberger at ni.com
Fri Jan 20 01:53:04 CET 2012


The mv_eth driver should not redefine the net function definition

Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
Cc: Wolfgang Denk <wd at denx.de>
---
 board/Marvell/db64360/mv_eth.c |    2 --
 board/Marvell/db64460/mv_eth.c |    2 --
 board/esd/cpci750/mv_eth.c     |    2 --
 board/prodrive/p3mx/mv_eth.c   |    2 --
 include/net.h                  |   16 ++++++++--------
 net/bootp.c                    |    4 ++--
 net/net.c                      |   40 ++++++++++++++++++++--------------------
 net/rarp.c                     |    2 +-
 net/tftp.c                     |    6 +++---
 9 files changed, 34 insertions(+), 42 deletions(-)

diff --git a/board/Marvell/db64360/mv_eth.c b/board/Marvell/db64360/mv_eth.c
index 6340585..550610e 100644
--- a/board/Marvell/db64360/mv_eth.c
+++ b/board/Marvell/db64360/mv_eth.c
@@ -95,8 +95,6 @@ int mv64360_eth_xmit (struct eth_device *, volatile void *packet, int length);
 #ifndef  UPDATE_STATS_BY_SOFTWARE
 static void mv64360_eth_print_stat (struct eth_device *dev);
 #endif
-/* Processes a received packet */
-extern void NetReceive (volatile uchar *, int);
 
 extern unsigned int INTERNAL_REG_BASE_ADDR;
 
diff --git a/board/Marvell/db64460/mv_eth.c b/board/Marvell/db64460/mv_eth.c
index 4aefbaf..c447229 100644
--- a/board/Marvell/db64460/mv_eth.c
+++ b/board/Marvell/db64460/mv_eth.c
@@ -95,8 +95,6 @@ int mv64460_eth_xmit (struct eth_device *, volatile void *packet, int length);
 #ifndef  UPDATE_STATS_BY_SOFTWARE
 static void mv64460_eth_print_stat (struct eth_device *dev);
 #endif
-/* Processes a received packet */
-extern void NetReceive (volatile uchar *, int);
 
 extern unsigned int INTERNAL_REG_BASE_ADDR;
 
diff --git a/board/esd/cpci750/mv_eth.c b/board/esd/cpci750/mv_eth.c
index 001c1ad..db2324b 100644
--- a/board/esd/cpci750/mv_eth.c
+++ b/board/esd/cpci750/mv_eth.c
@@ -95,8 +95,6 @@ int mv64360_eth_xmit (struct eth_device *, volatile void *packet, int length);
 #ifndef  UPDATE_STATS_BY_SOFTWARE
 static void mv64360_eth_print_stat (struct eth_device *dev);
 #endif
-/* Processes a received packet */
-extern void NetReceive (volatile uchar *, int);
 
 extern unsigned int INTERNAL_REG_BASE_ADDR;
 
diff --git a/board/prodrive/p3mx/mv_eth.c b/board/prodrive/p3mx/mv_eth.c
index 15b3bfc..f26ded8 100644
--- a/board/prodrive/p3mx/mv_eth.c
+++ b/board/prodrive/p3mx/mv_eth.c
@@ -109,8 +109,6 @@ int phy_setup_aneg (char *devname, unsigned char addr);
 #ifndef	 UPDATE_STATS_BY_SOFTWARE
 static void mv64460_eth_print_stat (struct eth_device *dev);
 #endif
-/* Processes a received packet */
-extern void NetReceive (volatile uchar *, int);
 
 extern unsigned int INTERNAL_REG_BASE_ADDR;
 
diff --git a/include/net.h b/include/net.h
index e4d42c2..ccdb01d 100644
--- a/include/net.h
+++ b/include/net.h
@@ -342,9 +342,9 @@ extern uchar		NetOurEther[6];		/* Our ethernet address		*/
 extern uchar		NetServerEther[6];	/* Boot server enet address	*/
 extern IPaddr_t		NetOurIP;		/* Our    IP addr (0 = unknown)	*/
 extern IPaddr_t		NetServerIP;		/* Server IP addr (0 = unknown)	*/
-extern volatile uchar * NetTxPacket;		/* THE transmit packet		*/
-extern volatile uchar * NetRxPackets[PKTBUFSRX];/* Receive packets		*/
-extern volatile uchar * NetRxPacket;		/* Current receive packet	*/
+extern uchar		*NetTxPacket;		/* THE transmit packet */
+extern uchar		*NetRxPackets[PKTBUFSRX];/* Receive packets */
+extern uchar		*NetRxPacket;		/* Current receive packet */
 extern int		NetRxPacketLen;		/* Current rx packet length	*/
 extern unsigned		NetIPID;		/* IP ID (counting)		*/
 extern uchar		NetBcastAddr[6];	/* Ethernet boardcast address	*/
@@ -408,10 +408,10 @@ extern void	NetStartAgain(void);
 extern int	NetEthHdrSize(void);
 
 /* Set ethernet header; returns the size of the header */
-extern int	NetSetEther(volatile uchar *, uchar *, uint);
+extern int NetSetEther(uchar *, uchar *, uint);
 
 /* Set IP header */
-extern void	NetSetIP(volatile uchar *, IPaddr_t, int, int, int);
+extern void NetSetIP(uchar *, IPaddr_t, int, int, int);
 
 /* Checksum */
 extern int	NetCksumOk(uchar *, int);	/* Return true if cksum OK	*/
@@ -423,7 +423,7 @@ extern void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */
 extern void	NetSetTimeout(ulong, thand_f *);/* Set timeout handler		*/
 
 /* Transmit "NetTxPacket" */
-extern void	NetSendPacket(volatile uchar *, int);
+extern void NetSendPacket(uchar *, int);
 
 /* Transmit UDP packet, performing ARP request if needed */
 extern int	NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len);
@@ -445,7 +445,7 @@ void net_auto_load(void);
  * footprint in our tests.
  */
 /* return IP *in network byteorder* */
-static inline IPaddr_t NetReadIP(volatile void *from)
+static inline IPaddr_t NetReadIP(void *from)
 {
 	IPaddr_t ip;
 	memcpy((void*)&ip, (void*)from, sizeof(ip));
@@ -467,7 +467,7 @@ static inline void NetWriteIP(void *to, IPaddr_t ip)
 }
 
 /* copy IP */
-static inline void NetCopyIP(volatile void *to, void *from)
+static inline void NetCopyIP(void *to, void *from)
 {
 	memcpy((void*)to, from, sizeof(IPaddr_t));
 }
diff --git a/net/bootp.c b/net/bootp.c
index 34124b8..6d40608 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -585,7 +585,7 @@ static int BootpExtended (u8 * e)
 void
 BootpRequest (void)
 {
-	volatile uchar *pkt, *iphdr;
+	uchar *pkt, *iphdr;
 	Bootp_t *bp;
 	int ext_len, pktlen, iplen;
 
@@ -837,7 +837,7 @@ static int DhcpMessageType(unsigned char *popt)
 
 static void DhcpSendRequestPkt(Bootp_t *bp_offer)
 {
-	volatile uchar *pkt, *iphdr;
+	uchar *pkt, *iphdr;
 	Bootp_t *bp;
 	int pktlen, iplen, extlen;
 	IPaddr_t OfferedIP;
diff --git a/net/net.c b/net/net.c
index 045405b..29e018c 100644
--- a/net/net.c
+++ b/net/net.c
@@ -152,7 +152,7 @@ IPaddr_t	NetOurIP;
 /* Server IP addr (0 = unknown) */
 IPaddr_t	NetServerIP;
 /* Current receive packet */
-volatile uchar *NetRxPacket;
+uchar *NetRxPacket;
 /* Current rx packet length */
 int		NetRxPacketLen;
 /* IP packet ID */
@@ -208,10 +208,10 @@ void NcStart(void);
 int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len);
 #endif
 
-volatile uchar	PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
+uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
 
 /* Receive packet */
-volatile uchar *NetRxPackets[PKTBUFSRX];
+uchar *NetRxPackets[PKTBUFSRX];
 
 /* Current RX packet handler */
 static rxhand_f *packetHandler;
@@ -225,7 +225,7 @@ static ulong	timeStart;
 /* Current timeout value */
 static ulong	timeDelta;
 /* THE transmit packet */
-volatile uchar *NetTxPacket;
+uchar *NetTxPacket;
 
 static int net_check_prereq(enum proto_t protocol);
 
@@ -246,7 +246,7 @@ int		NetArpWaitTry;
 
 void ArpRequest(void)
 {
-	volatile uchar *pkt;
+	uchar *pkt;
 	ARP_t *arp;
 
 	debug("ARP broadcast %d\n", NetArpWaitTry);
@@ -704,7 +704,7 @@ NetSetTimeout(ulong iv, thand_f *f)
 
 
 void
-NetSendPacket(volatile uchar *pkt, int len)
+NetSendPacket(uchar *pkt, int len)
 {
 	(void) eth_send(pkt, len);
 }
@@ -767,8 +767,8 @@ static ushort PingSeqNo;
 int PingSend(void)
 {
 	static uchar mac[6];
-	volatile IP_t *ip;
-	volatile ushort *s;
+	IP_t *ip;
+	ushort *s;
 	uchar *pkt;
 
 	/* XXX always send arp request */
@@ -783,7 +783,7 @@ int PingSend(void)
 	pkt = NetArpWaitTxPacket;
 	pkt += NetSetEther(pkt, mac, PROT_IP);
 
-	ip = (volatile IP_t *)pkt;
+	ip = (IP_t *)pkt;
 
 	/*
 	 * Construct an IP and ICMP header.
@@ -935,9 +935,9 @@ static ushort CDP_compute_csum(const uchar *buff, ushort len)
 
 int CDPSendTrigger(void)
 {
-	volatile uchar *pkt;
-	volatile ushort *s;
-	volatile ushort *cp;
+	uchar *pkt;
+	ushort *s;
+	ushort *cp;
 	Ethernet_t *et;
 	int len;
 	ushort chksum;
@@ -964,7 +964,7 @@ int CDPSendTrigger(void)
 	/* CDP header */
 	*pkt++ = 0x02;				/* CDP version 2 */
 	*pkt++ = 180;				/* TTL */
-	s = (volatile ushort *)pkt;
+	s = (ushort *)pkt;
 	cp = s;
 	/* checksum (0 for later calculation) */
 	*s++ = htons(0);
@@ -1454,9 +1454,9 @@ NetReceive(volatile uchar *inpkt, int len)
 
 	debug("packet received\n");
 
-	NetRxPacket = inpkt;
+	NetRxPacket = (uchar *)inpkt;
 	NetRxPacketLen = len;
-	et = (Ethernet_t *)inpkt;
+	et = (Ethernet_t *)NetRxPacket;
 
 	/* too small packet? */
 	if (len < ETHER_HDR_SIZE)
@@ -1491,11 +1491,11 @@ NetReceive(volatile uchar *inpkt, int len)
 		 */
 		x = ntohs(et->et_prot);
 
-		ip = (IP_t *)(inpkt + E802_HDR_SIZE);
+		ip = (IP_t *)(NetRxPacket + E802_HDR_SIZE);
 		len -= E802_HDR_SIZE;
 
 	} else if (x != PROT_VLAN) {	/* normal packet */
-		ip = (IP_t *)(inpkt + ETHER_HDR_SIZE);
+		ip = (IP_t *)(NetRxPacket + ETHER_HDR_SIZE);
 		len -= ETHER_HDR_SIZE;
 
 	} else {			/* VLAN packet */
@@ -1519,7 +1519,7 @@ NetReceive(volatile uchar *inpkt, int len)
 		vlanid = cti & VLAN_IDMASK;
 		x = ntohs(vet->vet_type);
 
-		ip = (IP_t *)(inpkt + VLAN_ETHER_HDR_SIZE);
+		ip = (IP_t *)(NetRxPacket + VLAN_ETHER_HDR_SIZE);
 		len -= VLAN_ETHER_HDR_SIZE;
 	}
 
@@ -1917,7 +1917,7 @@ NetEthHdrSize(void)
 }
 
 int
-NetSetEther(volatile uchar *xet, uchar * addr, uint prot)
+NetSetEther(uchar *xet, uchar * addr, uint prot)
 {
 	Ethernet_t *et = (Ethernet_t *)xet;
 	ushort myvlanid;
@@ -1942,7 +1942,7 @@ NetSetEther(volatile uchar *xet, uchar * addr, uint prot)
 }
 
 void
-NetSetIP(volatile uchar *xip, IPaddr_t dest, int dport, int sport, int len)
+NetSetIP(uchar *xip, IPaddr_t dest, int dport, int sport, int len)
 {
 	IP_t *ip = (IP_t *)xip;
 
diff --git a/net/rarp.c b/net/rarp.c
index 097f970..77d63e8 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -71,7 +71,7 @@ void
 RarpRequest (void)
 {
 	int i;
-	volatile uchar *pkt;
+	uchar *pkt;
 	ARP_t *	rarp;
 
 	printf("RARP broadcast %d\n", ++RarpTry);
diff --git a/net/tftp.c b/net/tftp.c
index 7aa3e23..e62f229 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -310,9 +310,9 @@ static void
 TftpSend(void)
 {
 	uchar *pkt;
-	volatile uchar *xp;
-	int		len = 0;
-	volatile ushort *s;
+	uchar *xp;
+	int len = 0;
+	ushort *s;
 
 #ifdef CONFIG_MCAST_TFTP
 	/* Multicast TFTP.. non-MasterClients do not ACK data. */
-- 
1.6.0.2



More information about the U-Boot mailing list