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

annotate cxgb3

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent ac390c60
...@@ -681,8 +681,8 @@ int t3_phy_intr_handler(struct adapter *adapter); ...@@ -681,8 +681,8 @@ int t3_phy_intr_handler(struct adapter *adapter);
void t3_link_changed(struct adapter *adapter, int port_id); void t3_link_changed(struct adapter *adapter, int port_id);
int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc);
const struct adapter_info *t3_get_adapter_info(unsigned int board_id); const struct adapter_info *t3_get_adapter_info(unsigned int board_id);
int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data); int t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data);
int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data); int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data);
int t3_seeprom_wp(struct adapter *adapter, int enable); int t3_seeprom_wp(struct adapter *adapter, int enable);
int t3_get_tp_version(struct adapter *adapter, u32 *vers); int t3_get_tp_version(struct adapter *adapter, u32 *vers);
int t3_check_tpsram_version(struct adapter *adapter, int *must_load); int t3_check_tpsram_version(struct adapter *adapter, int *must_load);
......
...@@ -1642,7 +1642,7 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e, ...@@ -1642,7 +1642,7 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e,
e->magic = EEPROM_MAGIC; e->magic = EEPROM_MAGIC;
for (i = e->offset & ~3; !err && i < e->offset + e->len; i += 4) for (i = e->offset & ~3; !err && i < e->offset + e->len; i += 4)
err = t3_seeprom_read(adapter, i, (u32 *) & buf[i]); err = t3_seeprom_read(adapter, i, (__le32 *) & buf[i]);
if (!err) if (!err)
memcpy(data, buf + e->offset, e->len); memcpy(data, buf + e->offset, e->len);
...@@ -1655,7 +1655,8 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, ...@@ -1655,7 +1655,8 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
{ {
struct port_info *pi = netdev_priv(dev); struct port_info *pi = netdev_priv(dev);
struct adapter *adapter = pi->adapter; struct adapter *adapter = pi->adapter;
u32 aligned_offset, aligned_len, *p; u32 aligned_offset, aligned_len;
__le32 *p;
u8 *buf; u8 *buf;
int err; int err;
...@@ -1669,11 +1670,11 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, ...@@ -1669,11 +1670,11 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
buf = kmalloc(aligned_len, GFP_KERNEL); buf = kmalloc(aligned_len, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
err = t3_seeprom_read(adapter, aligned_offset, (u32 *) buf); err = t3_seeprom_read(adapter, aligned_offset, (__le32 *) buf);
if (!err && aligned_len > 4) if (!err && aligned_len > 4)
err = t3_seeprom_read(adapter, err = t3_seeprom_read(adapter,
aligned_offset + aligned_len - 4, aligned_offset + aligned_len - 4,
(u32 *) & buf[aligned_len - 4]); (__le32 *) & buf[aligned_len - 4]);
if (err) if (err)
goto out; goto out;
memcpy(buf + (eeprom->offset & 3), data, eeprom->len); 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,7 +1685,7 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
if (err) if (err)
goto out; goto out;
for (p = (u32 *) buf; !err && aligned_len; aligned_len -= 4, p++) { for (p = (__le32 *) buf; !err && aligned_len; aligned_len -= 4, p++) {
err = t3_seeprom_write(adapter, aligned_offset, *p); err = t3_seeprom_write(adapter, aligned_offset, *p);
aligned_offset += 4; aligned_offset += 4;
} }
......
...@@ -1814,7 +1814,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq, ...@@ -1814,7 +1814,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
skb->protocol = eth_type_trans(skb, adap->port[p->iff]); skb->protocol = eth_type_trans(skb, adap->port[p->iff]);
skb->dev->last_rx = jiffies; skb->dev->last_rx = jiffies;
pi = netdev_priv(skb->dev); pi = netdev_priv(skb->dev);
if (pi->rx_csum_offload && p->csum_valid && p->csum == 0xffff && if (pi->rx_csum_offload && p->csum_valid && p->csum == htons(0xffff) &&
!p->fragment) { !p->fragment) {
rspq_to_qset(rq)->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; rspq_to_qset(rq)->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
...@@ -1961,7 +1961,7 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs, ...@@ -1961,7 +1961,7 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs,
int eth, ethpad = 2; int eth, ethpad = 2;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
u32 len, flags = ntohl(r->flags); u32 len, flags = ntohl(r->flags);
u32 rss_hi = *(const u32 *)r, rss_lo = r->rss_hdr.rss_hash_val; __be32 rss_hi = *(const __be32 *)r, rss_lo = r->rss_hdr.rss_hash_val;
eth = r->rss_hdr.opcode == CPL_RX_PKT; eth = r->rss_hdr.opcode == CPL_RX_PKT;
......
...@@ -537,10 +537,11 @@ struct t3_vpd { ...@@ -537,10 +537,11 @@ struct t3_vpd {
* addres is written to the control register. The hardware device will * addres is written to the control register. The hardware device will
* set the flag to 1 when 4 bytes have been read into the data register. * set the flag to 1 when 4 bytes have been read into the data register.
*/ */
int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data) int t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data)
{ {
u16 val; u16 val;
int attempts = EEPROM_MAX_POLL; int attempts = EEPROM_MAX_POLL;
u32 v;
unsigned int base = adapter->params.pci.vpd_cap_addr; unsigned int base = adapter->params.pci.vpd_cap_addr;
if ((addr >= EEPROMSIZE && addr != EEPROM_STAT_ADDR) || (addr & 3)) 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,8 +557,8 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
CH_ERR(adapter, "reading EEPROM address 0x%x failed\n", addr); CH_ERR(adapter, "reading EEPROM address 0x%x failed\n", addr);
return -EIO; return -EIO;
} }
pci_read_config_dword(adapter->pdev, base + PCI_VPD_DATA, data); pci_read_config_dword(adapter->pdev, base + PCI_VPD_DATA, &v);
*data = le32_to_cpu(*data); *data = cpu_to_le32(v);
return 0; return 0;
} }
...@@ -570,7 +571,7 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data) ...@@ -570,7 +571,7 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
* Write a 32-bit word to a location in VPD EEPROM using the card's PCI * Write a 32-bit word to a location in VPD EEPROM using the card's PCI
* VPD ROM capability. * VPD ROM capability.
*/ */
int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data) int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data)
{ {
u16 val; u16 val;
int attempts = EEPROM_MAX_POLL; int attempts = EEPROM_MAX_POLL;
...@@ -580,7 +581,7 @@ int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data) ...@@ -580,7 +581,7 @@ int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data)
return -EINVAL; return -EINVAL;
pci_write_config_dword(adapter->pdev, base + PCI_VPD_DATA, pci_write_config_dword(adapter->pdev, base + PCI_VPD_DATA,
cpu_to_le32(data)); le32_to_cpu(data));
pci_write_config_word(adapter->pdev,base + PCI_VPD_ADDR, pci_write_config_word(adapter->pdev,base + PCI_VPD_ADDR,
addr | PCI_VPD_ADDR_F); addr | PCI_VPD_ADDR_F);
do { do {
...@@ -631,14 +632,14 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) ...@@ -631,14 +632,14 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
* Card information is normally at VPD_BASE but some early cards had * Card information is normally at VPD_BASE but some early cards had
* it at 0. * it at 0.
*/ */
ret = t3_seeprom_read(adapter, VPD_BASE, (u32 *)&vpd); ret = t3_seeprom_read(adapter, VPD_BASE, (__le32 *)&vpd);
if (ret) if (ret)
return ret; return ret;
addr = vpd.id_tag == 0x82 ? VPD_BASE : 0; addr = vpd.id_tag == 0x82 ? VPD_BASE : 0;
for (i = 0; i < sizeof(vpd); i += 4) { for (i = 0; i < sizeof(vpd); i += 4) {
ret = t3_seeprom_read(adapter, addr + i, ret = t3_seeprom_read(adapter, addr + i,
(u32 *)((u8 *)&vpd + i)); (__le32 *)((u8 *)&vpd + i));
if (ret) if (ret)
return ret; return ret;
} }
...@@ -926,7 +927,7 @@ int t3_check_tpsram(struct adapter *adapter, u8 *tp_sram, unsigned int size) ...@@ -926,7 +927,7 @@ int t3_check_tpsram(struct adapter *adapter, u8 *tp_sram, unsigned int size)
{ {
u32 csum; u32 csum;
unsigned int i; unsigned int i;
const u32 *p = (const u32 *)tp_sram; const __be32 *p = (const __be32 *)tp_sram;
/* Verify checksum */ /* Verify checksum */
for (csum = 0, i = 0; i < size / sizeof(csum); i++) 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,7 +1041,7 @@ int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size)
{ {
u32 csum; u32 csum;
unsigned int i; unsigned int i;
const u32 *p = (const u32 *)fw_data; const __be32 *p = (const __be32 *)fw_data;
int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16;
if ((size & 3) || size < FW_MIN_SIZE) if ((size & 3) || size < FW_MIN_SIZE)
...@@ -2877,14 +2878,14 @@ static void ulp_config(struct adapter *adap, const struct tp_params *p) ...@@ -2877,14 +2878,14 @@ static void ulp_config(struct adapter *adap, const struct tp_params *p)
int t3_set_proto_sram(struct adapter *adap, u8 *data) int t3_set_proto_sram(struct adapter *adap, u8 *data)
{ {
int i; int i;
u32 *buf = (u32 *)data; __be32 *buf = (__be32 *)data;
for (i = 0; i < PROTO_SRAM_LINES; i++) { for (i = 0; i < PROTO_SRAM_LINES; i++) {
t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, cpu_to_be32(*buf++)); t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, be32_to_cpu(*buf++));
t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, cpu_to_be32(*buf++)); t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, be32_to_cpu(*buf++));
t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, cpu_to_be32(*buf++)); t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, be32_to_cpu(*buf++));
t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, cpu_to_be32(*buf++)); t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, be32_to_cpu(*buf++));
t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, cpu_to_be32(*buf++)); t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, be32_to_cpu(*buf++));
t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31); t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31);
if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1)) if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1))
......
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