mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
net: Remove volatile from net API
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
0a6deb3251
commit
db288a9602
6 changed files with 41 additions and 42 deletions
|
@ -81,7 +81,7 @@ struct eth_device {
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
int (*init) (struct eth_device*, bd_t*);
|
int (*init) (struct eth_device*, bd_t*);
|
||||||
int (*send) (struct eth_device*, volatile void* packet, int length);
|
int (*send) (struct eth_device*, void *packet, int length);
|
||||||
int (*recv) (struct eth_device*);
|
int (*recv) (struct eth_device*);
|
||||||
void (*halt) (struct eth_device*);
|
void (*halt) (struct eth_device*);
|
||||||
#ifdef CONFIG_MCAST_TFTP
|
#ifdef CONFIG_MCAST_TFTP
|
||||||
|
@ -120,10 +120,11 @@ extern int eth_getenv_enetaddr_by_index(const char *base_name, int index,
|
||||||
|
|
||||||
extern int usb_eth_initialize(bd_t *bi);
|
extern int usb_eth_initialize(bd_t *bi);
|
||||||
extern int eth_init(bd_t *bis); /* Initialize the device */
|
extern int eth_init(bd_t *bis); /* Initialize the device */
|
||||||
extern int eth_send(volatile void *packet, int length); /* Send a packet */
|
extern int eth_send(void *packet, int length); /* Send a packet */
|
||||||
|
|
||||||
#ifdef CONFIG_API
|
#ifdef CONFIG_API
|
||||||
extern int eth_receive(volatile void *packet, int length); /* Receive a packet*/
|
extern int eth_receive(void *packet, int length); /* Receive a packet*/
|
||||||
|
extern void (*push_packet)(void *packet, int length);
|
||||||
#endif
|
#endif
|
||||||
extern int eth_rx(void); /* Check for received packets */
|
extern int eth_rx(void); /* Check for received packets */
|
||||||
extern void eth_halt(void); /* stop SCC */
|
extern void eth_halt(void); /* stop SCC */
|
||||||
|
@ -342,9 +343,9 @@ extern uchar NetOurEther[6]; /* Our ethernet address */
|
||||||
extern uchar NetServerEther[6]; /* Boot server enet address */
|
extern uchar NetServerEther[6]; /* Boot server enet address */
|
||||||
extern IPaddr_t NetOurIP; /* Our IP addr (0 = unknown) */
|
extern IPaddr_t NetOurIP; /* Our IP addr (0 = unknown) */
|
||||||
extern IPaddr_t NetServerIP; /* Server IP addr (0 = unknown) */
|
extern IPaddr_t NetServerIP; /* Server IP addr (0 = unknown) */
|
||||||
extern volatile uchar * NetTxPacket; /* THE transmit packet */
|
extern uchar *NetTxPacket; /* THE transmit packet */
|
||||||
extern volatile uchar * NetRxPackets[PKTBUFSRX];/* Receive packets */
|
extern uchar *NetRxPackets[PKTBUFSRX];/* Receive packets */
|
||||||
extern volatile uchar * NetRxPacket; /* Current receive packet */
|
extern uchar *NetRxPacket; /* Current receive packet */
|
||||||
extern int NetRxPacketLen; /* Current rx packet length */
|
extern int NetRxPacketLen; /* Current rx packet length */
|
||||||
extern unsigned NetIPID; /* IP ID (counting) */
|
extern unsigned NetIPID; /* IP ID (counting) */
|
||||||
extern uchar NetBcastAddr[6]; /* Ethernet boardcast address */
|
extern uchar NetBcastAddr[6]; /* Ethernet boardcast address */
|
||||||
|
@ -408,10 +409,10 @@ extern void NetStartAgain(void);
|
||||||
extern int NetEthHdrSize(void);
|
extern int NetEthHdrSize(void);
|
||||||
|
|
||||||
/* Set ethernet header; returns the size of the header */
|
/* 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 */
|
/* Set IP header */
|
||||||
extern void NetSetIP(volatile uchar *, IPaddr_t, int, int, int);
|
extern void NetSetIP(uchar *, IPaddr_t, int, int, int);
|
||||||
|
|
||||||
/* Checksum */
|
/* Checksum */
|
||||||
extern int NetCksumOk(uchar *, int); /* Return true if cksum OK */
|
extern int NetCksumOk(uchar *, int); /* Return true if cksum OK */
|
||||||
|
@ -423,13 +424,13 @@ extern void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */
|
||||||
extern void NetSetTimeout(ulong, thand_f *);/* Set timeout handler */
|
extern void NetSetTimeout(ulong, thand_f *);/* Set timeout handler */
|
||||||
|
|
||||||
/* Transmit "NetTxPacket" */
|
/* Transmit "NetTxPacket" */
|
||||||
extern void NetSendPacket(volatile uchar *, int);
|
extern void NetSendPacket(uchar *, int);
|
||||||
|
|
||||||
/* Transmit UDP packet, performing ARP request if needed */
|
/* Transmit UDP packet, performing ARP request if needed */
|
||||||
extern int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len);
|
extern int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len);
|
||||||
|
|
||||||
/* Processes a received packet */
|
/* Processes a received packet */
|
||||||
extern void NetReceive(volatile uchar *, int);
|
extern void NetReceive(uchar *, int);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if autoload is enabled. If so, use either NFS or TFTP to download
|
* Check if autoload is enabled. If so, use either NFS or TFTP to download
|
||||||
|
@ -445,7 +446,7 @@ void net_auto_load(void);
|
||||||
* footprint in our tests.
|
* footprint in our tests.
|
||||||
*/
|
*/
|
||||||
/* return IP *in network byteorder* */
|
/* return IP *in network byteorder* */
|
||||||
static inline IPaddr_t NetReadIP(volatile void *from)
|
static inline IPaddr_t NetReadIP(void *from)
|
||||||
{
|
{
|
||||||
IPaddr_t ip;
|
IPaddr_t ip;
|
||||||
memcpy((void*)&ip, (void*)from, sizeof(ip));
|
memcpy((void*)&ip, (void*)from, sizeof(ip));
|
||||||
|
@ -467,7 +468,7 @@ static inline void NetWriteIP(void *to, IPaddr_t ip)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy 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));
|
memcpy((void*)to, from, sizeof(IPaddr_t));
|
||||||
}
|
}
|
||||||
|
|
|
@ -586,7 +586,7 @@ static int BootpExtended (u8 * e)
|
||||||
void
|
void
|
||||||
BootpRequest (void)
|
BootpRequest (void)
|
||||||
{
|
{
|
||||||
volatile uchar *pkt, *iphdr;
|
uchar *pkt, *iphdr;
|
||||||
Bootp_t *bp;
|
Bootp_t *bp;
|
||||||
int ext_len, pktlen, iplen;
|
int ext_len, pktlen, iplen;
|
||||||
|
|
||||||
|
@ -839,7 +839,7 @@ static int DhcpMessageType(unsigned char *popt)
|
||||||
|
|
||||||
static void DhcpSendRequestPkt(Bootp_t *bp_offer)
|
static void DhcpSendRequestPkt(Bootp_t *bp_offer)
|
||||||
{
|
{
|
||||||
volatile uchar *pkt, *iphdr;
|
uchar *pkt, *iphdr;
|
||||||
Bootp_t *bp;
|
Bootp_t *bp;
|
||||||
int pktlen, iplen, extlen;
|
int pktlen, iplen, extlen;
|
||||||
IPaddr_t OfferedIP;
|
IPaddr_t OfferedIP;
|
||||||
|
|
12
net/eth.c
12
net/eth.c
|
@ -82,8 +82,6 @@ int cpu_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
|
||||||
int board_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
|
int board_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
|
||||||
|
|
||||||
#ifdef CONFIG_API
|
#ifdef CONFIG_API
|
||||||
extern void (*push_packet)(volatile void *, int);
|
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
uchar data[PKTSIZE];
|
uchar data[PKTSIZE];
|
||||||
int length;
|
int length;
|
||||||
|
@ -407,7 +405,7 @@ void eth_halt(void)
|
||||||
eth_current->state = ETH_STATE_PASSIVE;
|
eth_current->state = ETH_STATE_PASSIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int eth_send(volatile void *packet, int length)
|
int eth_send(void *packet, int length)
|
||||||
{
|
{
|
||||||
if (!eth_current)
|
if (!eth_current)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -424,9 +422,9 @@ int eth_rx(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_API
|
#ifdef CONFIG_API
|
||||||
static void eth_save_packet(volatile void *packet, int length)
|
static void eth_save_packet(void *packet, int length)
|
||||||
{
|
{
|
||||||
volatile char *p = packet;
|
char *p = packet;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((eth_rcv_last+1) % PKTBUFSRX == eth_rcv_current)
|
if ((eth_rcv_last+1) % PKTBUFSRX == eth_rcv_current)
|
||||||
|
@ -442,9 +440,9 @@ static void eth_save_packet(volatile void *packet, int length)
|
||||||
eth_rcv_last = (eth_rcv_last + 1) % PKTBUFSRX;
|
eth_rcv_last = (eth_rcv_last + 1) % PKTBUFSRX;
|
||||||
}
|
}
|
||||||
|
|
||||||
int eth_receive(volatile void *packet, int length)
|
int eth_receive(void *packet, int length)
|
||||||
{
|
{
|
||||||
volatile char *p = packet;
|
char *p = packet;
|
||||||
void *pp = push_packet;
|
void *pp = push_packet;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
34
net/net.c
34
net/net.c
|
@ -152,7 +152,7 @@ IPaddr_t NetOurIP;
|
||||||
/* Server IP addr (0 = unknown) */
|
/* Server IP addr (0 = unknown) */
|
||||||
IPaddr_t NetServerIP;
|
IPaddr_t NetServerIP;
|
||||||
/* Current receive packet */
|
/* Current receive packet */
|
||||||
volatile uchar *NetRxPacket;
|
uchar *NetRxPacket;
|
||||||
/* Current rx packet length */
|
/* Current rx packet length */
|
||||||
int NetRxPacketLen;
|
int NetRxPacketLen;
|
||||||
/* IP packet ID */
|
/* IP packet ID */
|
||||||
|
@ -161,7 +161,7 @@ unsigned NetIPID;
|
||||||
uchar NetBcastAddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
uchar NetBcastAddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||||
uchar NetEtherNullAddr[6];
|
uchar NetEtherNullAddr[6];
|
||||||
#ifdef CONFIG_API
|
#ifdef CONFIG_API
|
||||||
void (*push_packet)(volatile void *, int len) = 0;
|
void (*push_packet)(void *, int len) = 0;
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_CMD_CDP)
|
#if defined(CONFIG_CMD_CDP)
|
||||||
/* Ethernet bcast address */
|
/* Ethernet bcast address */
|
||||||
|
@ -208,10 +208,10 @@ void NcStart(void);
|
||||||
int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len);
|
int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
volatile uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
|
uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
|
||||||
|
|
||||||
/* Receive packet */
|
/* Receive packet */
|
||||||
volatile uchar *NetRxPackets[PKTBUFSRX];
|
uchar *NetRxPackets[PKTBUFSRX];
|
||||||
|
|
||||||
/* Current RX packet handler */
|
/* Current RX packet handler */
|
||||||
static rxhand_f *packetHandler;
|
static rxhand_f *packetHandler;
|
||||||
|
@ -225,7 +225,7 @@ static ulong timeStart;
|
||||||
/* Current timeout value */
|
/* Current timeout value */
|
||||||
static ulong timeDelta;
|
static ulong timeDelta;
|
||||||
/* THE transmit packet */
|
/* THE transmit packet */
|
||||||
volatile uchar *NetTxPacket;
|
uchar *NetTxPacket;
|
||||||
|
|
||||||
static int net_check_prereq(enum proto_t protocol);
|
static int net_check_prereq(enum proto_t protocol);
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ int NetArpWaitTry;
|
||||||
|
|
||||||
void ArpRequest(void)
|
void ArpRequest(void)
|
||||||
{
|
{
|
||||||
volatile uchar *pkt;
|
uchar *pkt;
|
||||||
ARP_t *arp;
|
ARP_t *arp;
|
||||||
|
|
||||||
debug("ARP broadcast %d\n", NetArpWaitTry);
|
debug("ARP broadcast %d\n", NetArpWaitTry);
|
||||||
|
@ -705,7 +705,7 @@ NetSetTimeout(ulong iv, thand_f *f)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NetSendPacket(volatile uchar *pkt, int len)
|
NetSendPacket(uchar *pkt, int len)
|
||||||
{
|
{
|
||||||
(void) eth_send(pkt, len);
|
(void) eth_send(pkt, len);
|
||||||
}
|
}
|
||||||
|
@ -768,8 +768,8 @@ static ushort PingSeqNo;
|
||||||
int PingSend(void)
|
int PingSend(void)
|
||||||
{
|
{
|
||||||
static uchar mac[6];
|
static uchar mac[6];
|
||||||
volatile IP_t *ip;
|
IP_t *ip;
|
||||||
volatile ushort *s;
|
ushort *s;
|
||||||
uchar *pkt;
|
uchar *pkt;
|
||||||
|
|
||||||
/* XXX always send arp request */
|
/* XXX always send arp request */
|
||||||
|
@ -784,7 +784,7 @@ int PingSend(void)
|
||||||
pkt = NetArpWaitTxPacket;
|
pkt = NetArpWaitTxPacket;
|
||||||
pkt += NetSetEther(pkt, mac, PROT_IP);
|
pkt += NetSetEther(pkt, mac, PROT_IP);
|
||||||
|
|
||||||
ip = (volatile IP_t *)pkt;
|
ip = (IP_t *)pkt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct an IP and ICMP header.
|
* Construct an IP and ICMP header.
|
||||||
|
@ -936,9 +936,9 @@ static ushort CDP_compute_csum(const uchar *buff, ushort len)
|
||||||
|
|
||||||
int CDPSendTrigger(void)
|
int CDPSendTrigger(void)
|
||||||
{
|
{
|
||||||
volatile uchar *pkt;
|
uchar *pkt;
|
||||||
volatile ushort *s;
|
ushort *s;
|
||||||
volatile ushort *cp;
|
ushort *cp;
|
||||||
Ethernet_t *et;
|
Ethernet_t *et;
|
||||||
int len;
|
int len;
|
||||||
ushort chksum;
|
ushort chksum;
|
||||||
|
@ -965,7 +965,7 @@ int CDPSendTrigger(void)
|
||||||
/* CDP header */
|
/* CDP header */
|
||||||
*pkt++ = 0x02; /* CDP version 2 */
|
*pkt++ = 0x02; /* CDP version 2 */
|
||||||
*pkt++ = 180; /* TTL */
|
*pkt++ = 180; /* TTL */
|
||||||
s = (volatile ushort *)pkt;
|
s = (ushort *)pkt;
|
||||||
cp = s;
|
cp = s;
|
||||||
/* checksum (0 for later calculation) */
|
/* checksum (0 for later calculation) */
|
||||||
*s++ = htons(0);
|
*s++ = htons(0);
|
||||||
|
@ -1439,7 +1439,7 @@ static void receive_icmp(IP_t *ip, int len, IPaddr_t src_ip, Ethernet_t *et)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NetReceive(volatile uchar *inpkt, int len)
|
NetReceive(uchar *inpkt, int len)
|
||||||
{
|
{
|
||||||
Ethernet_t *et;
|
Ethernet_t *et;
|
||||||
IP_t *ip;
|
IP_t *ip;
|
||||||
|
@ -1918,7 +1918,7 @@ NetEthHdrSize(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
NetSetEther(volatile uchar *xet, uchar * addr, uint prot)
|
NetSetEther(uchar *xet, uchar * addr, uint prot)
|
||||||
{
|
{
|
||||||
Ethernet_t *et = (Ethernet_t *)xet;
|
Ethernet_t *et = (Ethernet_t *)xet;
|
||||||
ushort myvlanid;
|
ushort myvlanid;
|
||||||
|
@ -1943,7 +1943,7 @@ NetSetEther(volatile uchar *xet, uchar * addr, uint prot)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
IP_t *ip = (IP_t *)xip;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ void
|
||||||
RarpRequest (void)
|
RarpRequest (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
volatile uchar *pkt;
|
uchar *pkt;
|
||||||
ARP_t * rarp;
|
ARP_t * rarp;
|
||||||
|
|
||||||
printf("RARP broadcast %d\n", ++RarpTry);
|
printf("RARP broadcast %d\n", ++RarpTry);
|
||||||
|
|
|
@ -310,9 +310,9 @@ static void
|
||||||
TftpSend(void)
|
TftpSend(void)
|
||||||
{
|
{
|
||||||
uchar *pkt;
|
uchar *pkt;
|
||||||
volatile uchar *xp;
|
uchar *xp;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
volatile ushort *s;
|
ushort *s;
|
||||||
|
|
||||||
#ifdef CONFIG_MCAST_TFTP
|
#ifdef CONFIG_MCAST_TFTP
|
||||||
/* Multicast TFTP.. non-MasterClients do not ACK data. */
|
/* Multicast TFTP.. non-MasterClients do not ACK data. */
|
||||||
|
|
Loading…
Reference in a new issue