aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2007-12-22 13:56:23 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:10:30 -0500
commit05e5c1165393a2d6044b01288f089d2e74a49d58 (patch)
treebab583a44c814d4daf3cd2e617a1f3a52ee1c7a9 /drivers/net/cxgb3
parentac390c60a833192e87fb09ed8d67f5d1a84306c8 (diff)
annotate cxgb3
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r--drivers/net/cxgb3/common.h4
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c11
-rw-r--r--drivers/net/cxgb3/sge.c4
-rw-r--r--drivers/net/cxgb3/t3_hw.c31
4 files changed, 26 insertions, 24 deletions
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 99c75d30f67a..91ee7277b813 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -681,8 +681,8 @@ int t3_phy_intr_handler(struct adapter *adapter);
681void t3_link_changed(struct adapter *adapter, int port_id); 681void t3_link_changed(struct adapter *adapter, int port_id);
682int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); 682int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc);
683const struct adapter_info *t3_get_adapter_info(unsigned int board_id); 683const struct adapter_info *t3_get_adapter_info(unsigned int board_id);
684int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data); 684int t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data);
685int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data); 685int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data);
686int t3_seeprom_wp(struct adapter *adapter, int enable); 686int t3_seeprom_wp(struct adapter *adapter, int enable);
687int t3_get_tp_version(struct adapter *adapter, u32 *vers); 687int t3_get_tp_version(struct adapter *adapter, u32 *vers);
688int t3_check_tpsram_version(struct adapter *adapter, int *must_load); 688int t3_check_tpsram_version(struct adapter *adapter, int *must_load);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 0e3dcbff002d..fd2e05bbb903 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1642,7 +1642,7 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e,
1642 1642
1643 e->magic = EEPROM_MAGIC; 1643 e->magic = EEPROM_MAGIC;
1644 for (i = e->offset & ~3; !err && i < e->offset + e->len; i += 4) 1644 for (i = e->offset & ~3; !err && i < e->offset + e->len; i += 4)
1645 err = t3_seeprom_read(adapter, i, (u32 *) & buf[i]); 1645 err = t3_seeprom_read(adapter, i, (__le32 *) & buf[i]);
1646 1646
1647 if (!err) 1647 if (!err)
1648 memcpy(data, buf + e->offset, e->len); 1648 memcpy(data, buf + e->offset, e->len);
@@ -1655,7 +1655,8 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
1655{ 1655{
1656 struct port_info *pi = netdev_priv(dev); 1656 struct port_info *pi = netdev_priv(dev);
1657 struct adapter *adapter = pi->adapter; 1657 struct adapter *adapter = pi->adapter;
1658 u32 aligned_offset, aligned_len, *p; 1658 u32 aligned_offset, aligned_len;
1659 __le32 *p;
1659 u8 *buf; 1660 u8 *buf;
1660 int err; 1661 int err;
1661 1662
@@ -1669,11 +1670,11 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
1669 buf = kmalloc(aligned_len, GFP_KERNEL); 1670 buf = kmalloc(aligned_len, GFP_KERNEL);
1670 if (!buf) 1671 if (!buf)
1671 return -ENOMEM; 1672 return -ENOMEM;
1672 err = t3_seeprom_read(adapter, aligned_offset, (u32 *) buf); 1673 err = t3_seeprom_read(adapter, aligned_offset, (__le32 *) buf);
1673 if (!err && aligned_len > 4) 1674 if (!err && aligned_len > 4)
1674 err = t3_seeprom_read(adapter, 1675 err = t3_seeprom_read(adapter,
1675 aligned_offset + aligned_len - 4, 1676 aligned_offset + aligned_len - 4,
1676 (u32 *) & buf[aligned_len - 4]); 1677 (__le32 *) & buf[aligned_len - 4]);
1677 if (err) 1678 if (err)
1678 goto out; 1679 goto out;
1679 memcpy(buf + (eeprom->offset & 3), data, eeprom->len); 1680 memcpy(buf + (eeprom->offset & 3), data, eeprom->len);
@@ -1684,7 +1685,7 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
1684 if (err) 1685 if (err)
1685 goto out; 1686 goto out;
1686 1687
1687 for (p = (u32 *) buf; !err && aligned_len; aligned_len -= 4, p++) { 1688 for (p = (__le32 *) buf; !err && aligned_len; aligned_len -= 4, p++) {
1688 err = t3_seeprom_write(adapter, aligned_offset, *p); 1689 err = t3_seeprom_write(adapter, aligned_offset, *p);
1689 aligned_offset += 4; 1690 aligned_offset += 4;
1690 } 1691 }
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 6367cee0d66a..cb684d30831f 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1814,7 +1814,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
1814 skb->protocol = eth_type_trans(skb, adap->port[p->iff]); 1814 skb->protocol = eth_type_trans(skb, adap->port[p->iff]);
1815 skb->dev->last_rx = jiffies; 1815 skb->dev->last_rx = jiffies;
1816 pi = netdev_priv(skb->dev); 1816 pi = netdev_priv(skb->dev);
1817 if (pi->rx_csum_offload && p->csum_valid && p->csum == 0xffff && 1817 if (pi->rx_csum_offload && p->csum_valid && p->csum == htons(0xffff) &&
1818 !p->fragment) { 1818 !p->fragment) {
1819 rspq_to_qset(rq)->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; 1819 rspq_to_qset(rq)->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
1820 skb->ip_summed = CHECKSUM_UNNECESSARY; 1820 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -1961,7 +1961,7 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs,
1961 int eth, ethpad = 2; 1961 int eth, ethpad = 2;
1962 struct sk_buff *skb = NULL; 1962 struct sk_buff *skb = NULL;
1963 u32 len, flags = ntohl(r->flags); 1963 u32 len, flags = ntohl(r->flags);
1964 u32 rss_hi = *(const u32 *)r, rss_lo = r->rss_hdr.rss_hash_val; 1964 __be32 rss_hi = *(const __be32 *)r, rss_lo = r->rss_hdr.rss_hash_val;
1965 1965
1966 eth = r->rss_hdr.opcode == CPL_RX_PKT; 1966 eth = r->rss_hdr.opcode == CPL_RX_PKT;
1967 1967
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 6e5b4992f17e..7469935877bd 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -537,10 +537,11 @@ struct t3_vpd {
537 * addres is written to the control register. The hardware device will 537 * addres is written to the control register. The hardware device will
538 * set the flag to 1 when 4 bytes have been read into the data register. 538 * set the flag to 1 when 4 bytes have been read into the data register.
539 */ 539 */
540int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data) 540int t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data)
541{ 541{
542 u16 val; 542 u16 val;
543 int attempts = EEPROM_MAX_POLL; 543 int attempts = EEPROM_MAX_POLL;
544 u32 v;
544 unsigned int base = adapter->params.pci.vpd_cap_addr; 545 unsigned int base = adapter->params.pci.vpd_cap_addr;
545 546
546 if ((addr >= EEPROMSIZE && addr != EEPROM_STAT_ADDR) || (addr & 3)) 547 if ((addr >= EEPROMSIZE && addr != EEPROM_STAT_ADDR) || (addr & 3))
@@ -556,8 +557,8 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
556 CH_ERR(adapter, "reading EEPROM address 0x%x failed\n", addr); 557 CH_ERR(adapter, "reading EEPROM address 0x%x failed\n", addr);
557 return -EIO; 558 return -EIO;
558 } 559 }
559 pci_read_config_dword(adapter->pdev, base + PCI_VPD_DATA, data); 560 pci_read_config_dword(adapter->pdev, base + PCI_VPD_DATA, &v);
560 *data = le32_to_cpu(*data); 561 *data = cpu_to_le32(v);
561 return 0; 562 return 0;
562} 563}
563 564
@@ -570,7 +571,7 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
570 * Write a 32-bit word to a location in VPD EEPROM using the card's PCI 571 * Write a 32-bit word to a location in VPD EEPROM using the card's PCI
571 * VPD ROM capability. 572 * VPD ROM capability.
572 */ 573 */
573int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data) 574int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data)
574{ 575{
575 u16 val; 576 u16 val;
576 int attempts = EEPROM_MAX_POLL; 577 int attempts = EEPROM_MAX_POLL;
@@ -580,7 +581,7 @@ int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data)
580 return -EINVAL; 581 return -EINVAL;
581 582
582 pci_write_config_dword(adapter->pdev, base + PCI_VPD_DATA, 583 pci_write_config_dword(adapter->pdev, base + PCI_VPD_DATA,
583 cpu_to_le32(data)); 584 le32_to_cpu(data));
584 pci_write_config_word(adapter->pdev,base + PCI_VPD_ADDR, 585 pci_write_config_word(adapter->pdev,base + PCI_VPD_ADDR,
585 addr | PCI_VPD_ADDR_F); 586 addr | PCI_VPD_ADDR_F);
586 do { 587 do {
@@ -631,14 +632,14 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
631 * Card information is normally at VPD_BASE but some early cards had 632 * Card information is normally at VPD_BASE but some early cards had
632 * it at 0. 633 * it at 0.
633 */ 634 */
634 ret = t3_seeprom_read(adapter, VPD_BASE, (u32 *)&vpd); 635 ret = t3_seeprom_read(adapter, VPD_BASE, (__le32 *)&vpd);
635 if (ret) 636 if (ret)
636 return ret; 637 return ret;
637 addr = vpd.id_tag == 0x82 ? VPD_BASE : 0; 638 addr = vpd.id_tag == 0x82 ? VPD_BASE : 0;
638 639
639 for (i = 0; i < sizeof(vpd); i += 4) { 640 for (i = 0; i < sizeof(vpd); i += 4) {
640 ret = t3_seeprom_read(adapter, addr + i, 641 ret = t3_seeprom_read(adapter, addr + i,
641 (u32 *)((u8 *)&vpd + i)); 642 (__le32 *)((u8 *)&vpd + i));
642 if (ret) 643 if (ret)
643 return ret; 644 return ret;
644 } 645 }
@@ -926,7 +927,7 @@ int t3_check_tpsram(struct adapter *adapter, u8 *tp_sram, unsigned int size)
926{ 927{
927 u32 csum; 928 u32 csum;
928 unsigned int i; 929 unsigned int i;
929 const u32 *p = (const u32 *)tp_sram; 930 const __be32 *p = (const __be32 *)tp_sram;
930 931
931 /* Verify checksum */ 932 /* Verify checksum */
932 for (csum = 0, i = 0; i < size / sizeof(csum); i++) 933 for (csum = 0, i = 0; i < size / sizeof(csum); i++)
@@ -1040,7 +1041,7 @@ int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size)
1040{ 1041{
1041 u32 csum; 1042 u32 csum;
1042 unsigned int i; 1043 unsigned int i;
1043 const u32 *p = (const u32 *)fw_data; 1044 const __be32 *p = (const __be32 *)fw_data;
1044 int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; 1045 int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16;
1045 1046
1046 if ((size & 3) || size < FW_MIN_SIZE) 1047 if ((size & 3) || size < FW_MIN_SIZE)
@@ -2877,14 +2878,14 @@ static void ulp_config(struct adapter *adap, const struct tp_params *p)
2877int t3_set_proto_sram(struct adapter *adap, u8 *data) 2878int t3_set_proto_sram(struct adapter *adap, u8 *data)
2878{ 2879{
2879 int i; 2880 int i;
2880 u32 *buf = (u32 *)data; 2881 __be32 *buf = (__be32 *)data;
2881 2882
2882 for (i = 0; i < PROTO_SRAM_LINES; i++) { 2883 for (i = 0; i < PROTO_SRAM_LINES; i++) {
2883 t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, cpu_to_be32(*buf++)); 2884 t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, be32_to_cpu(*buf++));
2884 t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, cpu_to_be32(*buf++)); 2885 t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, be32_to_cpu(*buf++));
2885 t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, cpu_to_be32(*buf++)); 2886 t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, be32_to_cpu(*buf++));
2886 t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, cpu_to_be32(*buf++)); 2887 t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, be32_to_cpu(*buf++));
2887 t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, cpu_to_be32(*buf++)); 2888 t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, be32_to_cpu(*buf++));
2888 2889
2889 t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31); 2890 t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31);
2890 if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1)) 2891 if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1))