diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2007-12-21 01:21:14 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-12-22 22:53:06 -0500 |
commit | 71f1bb1a8f17db3caba1237dfd478c2a13faf63e (patch) | |
tree | 75b0060d7c93e4438f9fe1098109dc94c517e48f | |
parent | 8cc085c7aceb78d26d0a5355e111b2330f089161 (diff) |
typhoon: trivial endianness annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/typhoon.c | 31 | ||||
-rw-r--r-- | drivers/net/typhoon.h | 13 |
2 files changed, 24 insertions, 20 deletions
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 2550d4cf9609..f50cb520dffb 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
813 | first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; | 813 | first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; |
814 | first_txd->numDesc = 0; | 814 | first_txd->numDesc = 0; |
815 | first_txd->len = 0; | 815 | first_txd->len = 0; |
816 | first_txd->addr = (u64)((unsigned long) skb) & 0xffffffff; | 816 | first_txd->tx_addr = (u64)((unsigned long) skb); |
817 | first_txd->addrHi = (u64)((unsigned long) skb) >> 32; | ||
818 | first_txd->processFlags = 0; | 817 | first_txd->processFlags = 0; |
819 | 818 | ||
820 | if(skb->ip_summed == CHECKSUM_PARTIAL) { | 819 | if(skb->ip_summed == CHECKSUM_PARTIAL) { |
@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
850 | PCI_DMA_TODEVICE); | 849 | PCI_DMA_TODEVICE); |
851 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; | 850 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; |
852 | txd->len = cpu_to_le16(skb->len); | 851 | txd->len = cpu_to_le16(skb->len); |
853 | txd->addr = cpu_to_le32(skb_dma); | 852 | txd->frag.addr = cpu_to_le32(skb_dma); |
854 | txd->addrHi = 0; | 853 | txd->frag.addrHi = 0; |
855 | first_txd->numDesc++; | 854 | first_txd->numDesc++; |
856 | } else { | 855 | } else { |
857 | int i, len; | 856 | int i, len; |
@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
861 | PCI_DMA_TODEVICE); | 860 | PCI_DMA_TODEVICE); |
862 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; | 861 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; |
863 | txd->len = cpu_to_le16(len); | 862 | txd->len = cpu_to_le16(len); |
864 | txd->addr = cpu_to_le32(skb_dma); | 863 | txd->frag.addr = cpu_to_le32(skb_dma); |
865 | txd->addrHi = 0; | 864 | txd->frag.addrHi = 0; |
866 | first_txd->numDesc++; | 865 | first_txd->numDesc++; |
867 | 866 | ||
868 | for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 867 | 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 | PCI_DMA_TODEVICE); | 879 | PCI_DMA_TODEVICE); |
881 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; | 880 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; |
882 | txd->len = cpu_to_le16(len); | 881 | txd->len = cpu_to_le16(len); |
883 | txd->addr = cpu_to_le32(skb_dma); | 882 | txd->frag.addr = cpu_to_le32(skb_dma); |
884 | txd->addrHi = 0; | 883 | txd->frag.addrHi = 0; |
885 | first_txd->numDesc++; | 884 | first_txd->numDesc++; |
886 | } | 885 | } |
887 | } | 886 | } |
@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1358 | u8 *image_data; | 1357 | u8 *image_data; |
1359 | void *dpage; | 1358 | void *dpage; |
1360 | dma_addr_t dpage_dma; | 1359 | dma_addr_t dpage_dma; |
1361 | unsigned int csum; | 1360 | __sum16 csum; |
1362 | u32 irqEnabled; | 1361 | u32 irqEnabled; |
1363 | u32 irqMasked; | 1362 | u32 irqMasked; |
1364 | u32 numSections; | 1363 | u32 numSections; |
@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1450 | * summing. Fortunately, due to the properties of | 1449 | * summing. Fortunately, due to the properties of |
1451 | * the checksum, we can do this once, at the end. | 1450 | * the checksum, we can do this once, at the end. |
1452 | */ | 1451 | */ |
1453 | csum = csum_partial_copy_nocheck(image_data, dpage, | 1452 | csum = csum_fold(csum_partial_copy_nocheck(image_data, |
1454 | len, 0); | 1453 | dpage, len, |
1455 | csum = csum_fold(csum); | 1454 | 0)); |
1456 | csum = le16_to_cpu(csum); | ||
1457 | 1455 | ||
1458 | iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); | 1456 | iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); |
1459 | iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM); | 1457 | iowrite32(le16_to_cpu((__force __le16)csum), |
1458 | ioaddr + TYPHOON_REG_BOOT_CHECKSUM); | ||
1460 | iowrite32(load_addr, | 1459 | iowrite32(load_addr, |
1461 | ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); | 1460 | ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); |
1462 | iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); | 1461 | iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); |
@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing, | |||
1551 | if(type == TYPHOON_TX_DESC) { | 1550 | if(type == TYPHOON_TX_DESC) { |
1552 | /* This tx_desc describes a packet. | 1551 | /* This tx_desc describes a packet. |
1553 | */ | 1552 | */ |
1554 | unsigned long ptr = tx->addr | ((u64)tx->addrHi << 32); | 1553 | unsigned long ptr = tx->tx_addr; |
1555 | struct sk_buff *skb = (struct sk_buff *) ptr; | 1554 | struct sk_buff *skb = (struct sk_buff *) ptr; |
1556 | dev_kfree_skb_irq(skb); | 1555 | dev_kfree_skb_irq(skb); |
1557 | } else if(type == TYPHOON_FRAG_DESC) { | 1556 | } else if(type == TYPHOON_FRAG_DESC) { |
1558 | /* This tx_desc describes a memory mapping. Free it. | 1557 | /* This tx_desc describes a memory mapping. Free it. |
1559 | */ | 1558 | */ |
1560 | skb_dma = (dma_addr_t) le32_to_cpu(tx->addr); | 1559 | skb_dma = (dma_addr_t) le32_to_cpu(tx->frag.addr); |
1561 | dma_len = le16_to_cpu(tx->len); | 1560 | dma_len = le16_to_cpu(tx->len); |
1562 | pci_unmap_single(tp->pdev, skb_dma, dma_len, | 1561 | pci_unmap_single(tp->pdev, skb_dma, dma_len, |
1563 | PCI_DMA_TODEVICE); | 1562 | PCI_DMA_TODEVICE); |
diff --git a/drivers/net/typhoon.h b/drivers/net/typhoon.h index a02e09593970..dd7022ca7354 100644 --- a/drivers/net/typhoon.h +++ b/drivers/net/typhoon.h | |||
@@ -166,8 +166,13 @@ struct tx_desc { | |||
166 | #define TYPHOON_DESC_VALID 0x80 | 166 | #define TYPHOON_DESC_VALID 0x80 |
167 | u8 numDesc; | 167 | u8 numDesc; |
168 | __le16 len; | 168 | __le16 len; |
169 | u32 addr; | 169 | union { |
170 | u32 addrHi; | 170 | struct { |
171 | __le32 addr; | ||
172 | __le32 addrHi; | ||
173 | } frag; | ||
174 | u64 tx_addr; /* opaque for hardware, for TX_DESC */ | ||
175 | }; | ||
171 | __le32 processFlags; | 176 | __le32 processFlags; |
172 | #define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) | 177 | #define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) |
173 | #define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) | 178 | #define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) |
@@ -240,8 +245,8 @@ struct rx_desc { | |||
240 | u8 flags; | 245 | u8 flags; |
241 | u8 numDesc; | 246 | u8 numDesc; |
242 | __le16 frameLen; | 247 | __le16 frameLen; |
243 | u32 addr; | 248 | u32 addr; /* opaque, comes from virtAddr */ |
244 | u32 addrHi; | 249 | u32 addrHi; /* opaque, comes from virtAddrHi */ |
245 | __le32 rxStatus; | 250 | __le32 rxStatus; |
246 | #define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) | 251 | #define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) |
247 | #define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) | 252 | #define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) |