Commit 71f1bb1a authored by Al Viro's avatar Al Viro Committed by Jeff Garzik

typhoon: trivial endianness annotations

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 8cc085c7
...@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID;
first_txd->numDesc = 0; first_txd->numDesc = 0;
first_txd->len = 0; first_txd->len = 0;
first_txd->addr = (u64)((unsigned long) skb) & 0xffffffff; first_txd->tx_addr = (u64)((unsigned long) skb);
first_txd->addrHi = (u64)((unsigned long) skb) >> 32;
first_txd->processFlags = 0; first_txd->processFlags = 0;
if(skb->ip_summed == CHECKSUM_PARTIAL) { if(skb->ip_summed == CHECKSUM_PARTIAL) {
...@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
txd->len = cpu_to_le16(skb->len); txd->len = cpu_to_le16(skb->len);
txd->addr = cpu_to_le32(skb_dma); txd->frag.addr = cpu_to_le32(skb_dma);
txd->addrHi = 0; txd->frag.addrHi = 0;
first_txd->numDesc++; first_txd->numDesc++;
} else { } else {
int i, len; int i, len;
...@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
txd->len = cpu_to_le16(len); txd->len = cpu_to_le16(len);
txd->addr = cpu_to_le32(skb_dma); txd->frag.addr = cpu_to_le32(skb_dma);
txd->addrHi = 0; txd->frag.addrHi = 0;
first_txd->numDesc++; first_txd->numDesc++;
for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) { for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
...@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
txd->len = cpu_to_le16(len); txd->len = cpu_to_le16(len);
txd->addr = cpu_to_le32(skb_dma); txd->frag.addr = cpu_to_le32(skb_dma);
txd->addrHi = 0; txd->frag.addrHi = 0;
first_txd->numDesc++; first_txd->numDesc++;
} }
} }
...@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp) ...@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp)
u8 *image_data; u8 *image_data;
void *dpage; void *dpage;
dma_addr_t dpage_dma; dma_addr_t dpage_dma;
unsigned int csum; __sum16 csum;
u32 irqEnabled; u32 irqEnabled;
u32 irqMasked; u32 irqMasked;
u32 numSections; u32 numSections;
...@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp) ...@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp)
* summing. Fortunately, due to the properties of * summing. Fortunately, due to the properties of
* the checksum, we can do this once, at the end. * the checksum, we can do this once, at the end.
*/ */
csum = csum_partial_copy_nocheck(image_data, dpage, csum = csum_fold(csum_partial_copy_nocheck(image_data,
len, 0); dpage, len,
csum = csum_fold(csum); 0));
csum = le16_to_cpu(csum);
iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH);
iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM); iowrite32(le16_to_cpu((__force __le16)csum),
ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
iowrite32(load_addr, iowrite32(load_addr,
ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); ioaddr + TYPHOON_REG_BOOT_DEST_ADDR);
iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI);
...@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing, ...@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing,
if(type == TYPHOON_TX_DESC) { if(type == TYPHOON_TX_DESC) {
/* This tx_desc describes a packet. /* This tx_desc describes a packet.
*/ */
unsigned long ptr = tx->addr | ((u64)tx->addrHi << 32); unsigned long ptr = tx->tx_addr;
struct sk_buff *skb = (struct sk_buff *) ptr; struct sk_buff *skb = (struct sk_buff *) ptr;
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
} else if(type == TYPHOON_FRAG_DESC) { } else if(type == TYPHOON_FRAG_DESC) {
/* This tx_desc describes a memory mapping. Free it. /* This tx_desc describes a memory mapping. Free it.
*/ */
skb_dma = (dma_addr_t) le32_to_cpu(tx->addr); skb_dma = (dma_addr_t) le32_to_cpu(tx->frag.addr);
dma_len = le16_to_cpu(tx->len); dma_len = le16_to_cpu(tx->len);
pci_unmap_single(tp->pdev, skb_dma, dma_len, pci_unmap_single(tp->pdev, skb_dma, dma_len,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
......
...@@ -166,8 +166,13 @@ struct tx_desc { ...@@ -166,8 +166,13 @@ struct tx_desc {
#define TYPHOON_DESC_VALID 0x80 #define TYPHOON_DESC_VALID 0x80
u8 numDesc; u8 numDesc;
__le16 len; __le16 len;
u32 addr; union {
u32 addrHi; struct {
__le32 addr;
__le32 addrHi;
} frag;
u64 tx_addr; /* opaque for hardware, for TX_DESC */
};
__le32 processFlags; __le32 processFlags;
#define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) #define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001)
#define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) #define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002)
...@@ -240,8 +245,8 @@ struct rx_desc { ...@@ -240,8 +245,8 @@ struct rx_desc {
u8 flags; u8 flags;
u8 numDesc; u8 numDesc;
__le16 frameLen; __le16 frameLen;
u32 addr; u32 addr; /* opaque, comes from virtAddr */
u32 addrHi; u32 addrHi; /* opaque, comes from virtAddrHi */
__le32 rxStatus; __le32 rxStatus;
#define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) #define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000)
#define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) #define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001)
......
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