Commit aaf918ba authored by Al Viro's avatar Al Viro Committed by David S. Miller

e100 endianness annotations

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 5bb7ea26
...@@ -401,12 +401,12 @@ enum cb_command { ...@@ -401,12 +401,12 @@ enum cb_command {
}; };
struct rfd { struct rfd {
u16 status; __le16 status;
u16 command; __le16 command;
u32 link; __le32 link;
u32 rbd; __le32 rbd;
u16 actual_size; __le16 actual_size;
u16 size; __le16 size;
}; };
struct rx { struct rx {
...@@ -461,19 +461,19 @@ struct config { ...@@ -461,19 +461,19 @@ struct config {
#define E100_MAX_MULTICAST_ADDRS 64 #define E100_MAX_MULTICAST_ADDRS 64
struct multi { struct multi {
u16 count; __le16 count;
u8 addr[E100_MAX_MULTICAST_ADDRS * ETH_ALEN + 2/*pad*/]; u8 addr[E100_MAX_MULTICAST_ADDRS * ETH_ALEN + 2/*pad*/];
}; };
/* Important: keep total struct u32-aligned */ /* Important: keep total struct u32-aligned */
#define UCODE_SIZE 134 #define UCODE_SIZE 134
struct cb { struct cb {
u16 status; __le16 status;
u16 command; __le16 command;
u32 link; __le32 link;
union { union {
u8 iaaddr[ETH_ALEN]; u8 iaaddr[ETH_ALEN];
u32 ucode[UCODE_SIZE]; __le32 ucode[UCODE_SIZE];
struct config config; struct config config;
struct multi multi; struct multi multi;
struct { struct {
...@@ -482,12 +482,12 @@ struct cb { ...@@ -482,12 +482,12 @@ struct cb {
u8 threshold; u8 threshold;
u8 tbd_count; u8 tbd_count;
struct { struct {
u32 buf_addr; __le32 buf_addr;
u16 size; __le16 size;
u16 eol; u16 eol;
} tbd; } tbd;
} tcb; } tcb;
u32 dump_buffer_addr; __le32 dump_buffer_addr;
} u; } u;
struct cb *next, *prev; struct cb *next, *prev;
dma_addr_t dma_addr; dma_addr_t dma_addr;
...@@ -499,15 +499,15 @@ enum loopback { ...@@ -499,15 +499,15 @@ enum loopback {
}; };
struct stats { struct stats {
u32 tx_good_frames, tx_max_collisions, tx_late_collisions, __le32 tx_good_frames, tx_max_collisions, tx_late_collisions,
tx_underruns, tx_lost_crs, tx_deferred, tx_single_collisions, tx_underruns, tx_lost_crs, tx_deferred, tx_single_collisions,
tx_multiple_collisions, tx_total_collisions; tx_multiple_collisions, tx_total_collisions;
u32 rx_good_frames, rx_crc_errors, rx_alignment_errors, __le32 rx_good_frames, rx_crc_errors, rx_alignment_errors,
rx_resource_errors, rx_overrun_errors, rx_cdt_errors, rx_resource_errors, rx_overrun_errors, rx_cdt_errors,
rx_short_frame_errors; rx_short_frame_errors;
u32 fc_xmt_pause, fc_rcv_pause, fc_rcv_unsupported; __le32 fc_xmt_pause, fc_rcv_pause, fc_rcv_unsupported;
u16 xmt_tco_frames, rcv_tco_frames; __le16 xmt_tco_frames, rcv_tco_frames;
u32 complete; __le32 complete;
}; };
struct mem { struct mem {
...@@ -552,7 +552,7 @@ struct nic { ...@@ -552,7 +552,7 @@ struct nic {
struct cb *cb_to_use; struct cb *cb_to_use;
struct cb *cb_to_send; struct cb *cb_to_send;
struct cb *cb_to_clean; struct cb *cb_to_clean;
u16 tx_command; __le16 tx_command;
/* End: frequently used values: keep adjacent for cache effect */ /* End: frequently used values: keep adjacent for cache effect */
enum { enum {
...@@ -593,7 +593,7 @@ struct nic { ...@@ -593,7 +593,7 @@ struct nic {
u16 leds; u16 leds;
u16 eeprom_wc; u16 eeprom_wc;
u16 eeprom[256]; __le16 eeprom[256];
spinlock_t mdio_lock; spinlock_t mdio_lock;
}; };
...@@ -671,7 +671,7 @@ static int e100_self_test(struct nic *nic) ...@@ -671,7 +671,7 @@ static int e100_self_test(struct nic *nic)
return 0; return 0;
} }
static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data) static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, __le16 data)
{ {
u32 cmd_addr_data[3]; u32 cmd_addr_data[3];
u8 ctrl; u8 ctrl;
...@@ -680,7 +680,7 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data) ...@@ -680,7 +680,7 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data)
/* Three cmds: write/erase enable, write data, write/erase disable */ /* Three cmds: write/erase enable, write data, write/erase disable */
cmd_addr_data[0] = op_ewen << (addr_len - 2); cmd_addr_data[0] = op_ewen << (addr_len - 2);
cmd_addr_data[1] = (((op_write << addr_len) | addr) << 16) | cmd_addr_data[1] = (((op_write << addr_len) | addr) << 16) |
cpu_to_le16(data); le16_to_cpu(data);
cmd_addr_data[2] = op_ewds << (addr_len - 2); cmd_addr_data[2] = op_ewds << (addr_len - 2);
/* Bit-bang cmds to write word to eeprom */ /* Bit-bang cmds to write word to eeprom */
...@@ -709,7 +709,7 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data) ...@@ -709,7 +709,7 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data)
}; };
/* General technique stolen from the eepro100 driver - very clever */ /* General technique stolen from the eepro100 driver - very clever */
static u16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr) static __le16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
{ {
u32 cmd_addr_data; u32 cmd_addr_data;
u16 data = 0; u16 data = 0;
...@@ -746,7 +746,7 @@ static u16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr) ...@@ -746,7 +746,7 @@ static u16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
iowrite8(0, &nic->csr->eeprom_ctrl_lo); iowrite8(0, &nic->csr->eeprom_ctrl_lo);
e100_write_flush(nic); udelay(4); e100_write_flush(nic); udelay(4);
return le16_to_cpu(data); return cpu_to_le16(data);
}; };
/* Load entire EEPROM image into driver cache and validate checksum */ /* Load entire EEPROM image into driver cache and validate checksum */
...@@ -761,13 +761,12 @@ static int e100_eeprom_load(struct nic *nic) ...@@ -761,13 +761,12 @@ static int e100_eeprom_load(struct nic *nic)
for(addr = 0; addr < nic->eeprom_wc; addr++) { for(addr = 0; addr < nic->eeprom_wc; addr++) {
nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr); nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr);
if(addr < nic->eeprom_wc - 1) if(addr < nic->eeprom_wc - 1)
checksum += cpu_to_le16(nic->eeprom[addr]); checksum += le16_to_cpu(nic->eeprom[addr]);
} }
/* The checksum, stored in the last word, is calculated such that /* The checksum, stored in the last word, is calculated such that
* the sum of words should be 0xBABA */ * the sum of words should be 0xBABA */
checksum = le16_to_cpu(0xBABA - checksum); if (cpu_to_le16(0xBABA - checksum) != nic->eeprom[nic->eeprom_wc - 1]) {
if(checksum != nic->eeprom[nic->eeprom_wc - 1]) {
DPRINTK(PROBE, ERR, "EEPROM corrupted\n"); DPRINTK(PROBE, ERR, "EEPROM corrupted\n");
if (!eeprom_bad_csum_allow) if (!eeprom_bad_csum_allow)
return -EAGAIN; return -EAGAIN;
...@@ -794,8 +793,8 @@ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count) ...@@ -794,8 +793,8 @@ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count)
/* The checksum, stored in the last word, is calculated such that /* The checksum, stored in the last word, is calculated such that
* the sum of words should be 0xBABA */ * the sum of words should be 0xBABA */
for(addr = 0; addr < nic->eeprom_wc - 1; addr++) for(addr = 0; addr < nic->eeprom_wc - 1; addr++)
checksum += cpu_to_le16(nic->eeprom[addr]); checksum += le16_to_cpu(nic->eeprom[addr]);
nic->eeprom[nic->eeprom_wc - 1] = le16_to_cpu(0xBABA - checksum); nic->eeprom[nic->eeprom_wc - 1] = cpu_to_le16(0xBABA - checksum);
e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1, e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1,
nic->eeprom[nic->eeprom_wc - 1]); nic->eeprom[nic->eeprom_wc - 1]);
...@@ -1493,15 +1492,15 @@ static void e100_update_stats(struct nic *nic) ...@@ -1493,15 +1492,15 @@ static void e100_update_stats(struct nic *nic)
struct net_device *dev = nic->netdev; struct net_device *dev = nic->netdev;
struct net_device_stats *ns = &dev->stats; struct net_device_stats *ns = &dev->stats;
struct stats *s = &nic->mem->stats; struct stats *s = &nic->mem->stats;
u32 *complete = (nic->mac < mac_82558_D101_A4) ? &s->fc_xmt_pause : __le32 *complete = (nic->mac < mac_82558_D101_A4) ? &s->fc_xmt_pause :
(nic->mac < mac_82559_D101M) ? (u32 *)&s->xmt_tco_frames : (nic->mac < mac_82559_D101M) ? (__le32 *)&s->xmt_tco_frames :
&s->complete; &s->complete;
/* Device's stats reporting may take several microseconds to /* Device's stats reporting may take several microseconds to
* complete, so where always waiting for results of the * complete, so where always waiting for results of the
* previous command. */ * previous command. */
if(*complete == le32_to_cpu(cuc_dump_reset_complete)) { if(*complete == cpu_to_le32(cuc_dump_reset_complete)) {
*complete = 0; *complete = 0;
nic->tx_frames = le32_to_cpu(s->tx_good_frames); nic->tx_frames = le32_to_cpu(s->tx_good_frames);
nic->tx_collisions = le32_to_cpu(s->tx_total_collisions); nic->tx_collisions = le32_to_cpu(s->tx_total_collisions);
...@@ -1791,7 +1790,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) ...@@ -1791,7 +1790,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data, rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data,
RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
if(pci_dma_mapping_error(rx->dma_addr)) { if (pci_dma_mapping_error(rx->dma_addr)) {
dev_kfree_skb_any(rx->skb); dev_kfree_skb_any(rx->skb);
rx->skb = NULL; rx->skb = NULL;
rx->dma_addr = 0; rx->dma_addr = 0;
...@@ -1801,10 +1800,9 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) ...@@ -1801,10 +1800,9 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
/* Link the RFD to end of RFA by linking previous RFD to /* Link the RFD to end of RFA by linking previous RFD to
* this one. We are safe to touch the previous RFD because * this one. We are safe to touch the previous RFD because
* it is protected by the before last buffer's el bit being set */ * it is protected by the before last buffer's el bit being set */
if(rx->prev->skb) { if (rx->prev->skb) {
struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data; struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data;
put_unaligned(cpu_to_le32(rx->dma_addr), put_unaligned(cpu_to_le32(rx->dma_addr), &prev_rfd->link);
(u32 *)&prev_rfd->link);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment