diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-04-07 18:50:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-08 18:58:28 -0400 |
commit | 1fbe63235893e5dce28fe91d8465dd231b0cb3d9 (patch) | |
tree | 52d88817b8e23c2784c0e2a33a538f4eab2fcb8f /drivers/net/netxen/netxen_nic_ethtool.c | |
parent | 71dcddbdd35487eb931aa8aab28a2df474008754 (diff) |
netxen: annotate register access functions
o remove unnecessary length parameter since register access
width is fixed 4 byte.
o remove superfluous pci_read_normalize and pci_write_normalize
functions.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_ethtool.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 5fde9e088a94..6c5a111e80bf 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -92,11 +92,11 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) | |||
92 | strncpy(drvinfo->driver, netxen_nic_driver_name, 32); | 92 | strncpy(drvinfo->driver, netxen_nic_driver_name, 32); |
93 | strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); | 93 | strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); |
94 | write_lock_irqsave(&adapter->adapter_lock, flags); | 94 | write_lock_irqsave(&adapter->adapter_lock, flags); |
95 | fw_major = adapter->pci_read_normalize(adapter, | 95 | fw_major = adapter->hw_read_wx(adapter, |
96 | NETXEN_FW_VERSION_MAJOR); | 96 | NETXEN_FW_VERSION_MAJOR); |
97 | fw_minor = adapter->pci_read_normalize(adapter, | 97 | fw_minor = adapter->hw_read_wx(adapter, |
98 | NETXEN_FW_VERSION_MINOR); | 98 | NETXEN_FW_VERSION_MINOR); |
99 | fw_build = adapter->pci_read_normalize(adapter, | 99 | fw_build = adapter->hw_read_wx(adapter, |
100 | NETXEN_FW_VERSION_SUB); | 100 | NETXEN_FW_VERSION_SUB); |
101 | write_unlock_irqrestore(&adapter->adapter_lock, flags); | 101 | write_unlock_irqrestore(&adapter->adapter_lock, flags); |
102 | sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); | 102 | sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); |
@@ -135,7 +135,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
135 | } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { | 135 | } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { |
136 | u32 val; | 136 | u32 val; |
137 | 137 | ||
138 | adapter->hw_read_wx(adapter, NETXEN_PORT_MODE_ADDR, &val, 4); | 138 | val = adapter->hw_read_wx(adapter, NETXEN_PORT_MODE_ADDR); |
139 | if (val == NETXEN_PORT_MODE_802_3_AP) { | 139 | if (val == NETXEN_PORT_MODE_802_3_AP) { |
140 | ecmd->supported = SUPPORTED_1000baseT_Full; | 140 | ecmd->supported = SUPPORTED_1000baseT_Full; |
141 | ecmd->advertising = ADVERTISED_1000baseT_Full; | 141 | ecmd->advertising = ADVERTISED_1000baseT_Full; |
@@ -156,8 +156,8 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
156 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | 156 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { |
157 | u16 pcifn = adapter->ahw.pci_func; | 157 | u16 pcifn = adapter->ahw.pci_func; |
158 | 158 | ||
159 | adapter->hw_read_wx(adapter, | 159 | val = adapter->hw_read_wx(adapter, |
160 | P3_LINK_SPEED_REG(pcifn), &val, 4); | 160 | P3_LINK_SPEED_REG(pcifn)); |
161 | ecmd->speed = P3_LINK_SPEED_MHZ * | 161 | ecmd->speed = P3_LINK_SPEED_MHZ * |
162 | P3_LINK_SPEED_VAL(pcifn, val); | 162 | P3_LINK_SPEED_VAL(pcifn, val); |
163 | } else | 163 | } else |
@@ -423,12 +423,12 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
423 | regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | | 423 | regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | |
424 | (adapter->pdev)->device; | 424 | (adapter->pdev)->device; |
425 | /* which mode */ | 425 | /* which mode */ |
426 | adapter->hw_read_wx(adapter, NETXEN_NIU_MODE, ®s_buff[0], 4); | 426 | regs_buff[0] = adapter->hw_read_wx(adapter, NETXEN_NIU_MODE); |
427 | mode = regs_buff[0]; | 427 | mode = regs_buff[0]; |
428 | 428 | ||
429 | /* Common registers to all the modes */ | 429 | /* Common registers to all the modes */ |
430 | adapter->hw_read_wx(adapter, | 430 | regs_buff[2] = adapter->hw_read_wx(adapter, |
431 | NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER, ®s_buff[2], 4); | 431 | NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER); |
432 | /* GB/XGB Mode */ | 432 | /* GB/XGB Mode */ |
433 | mode = (mode / 2) - 1; | 433 | mode = (mode / 2) - 1; |
434 | window = 0; | 434 | window = 0; |
@@ -439,9 +439,8 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
439 | window = adapter->physical_port * | 439 | window = adapter->physical_port * |
440 | NETXEN_NIC_PORT_WINDOW; | 440 | NETXEN_NIC_PORT_WINDOW; |
441 | 441 | ||
442 | adapter->hw_read_wx(adapter, | 442 | regs_buff[i] = adapter->hw_read_wx(adapter, |
443 | niu_registers[mode].reg[i - 3] + window, | 443 | niu_registers[mode].reg[i - 3] + window); |
444 | ®s_buff[i], 4); | ||
445 | } | 444 | } |
446 | 445 | ||
447 | } | 446 | } |
@@ -465,7 +464,7 @@ static u32 netxen_nic_test_link(struct net_device *dev) | |||
465 | return !val; | 464 | return !val; |
466 | } | 465 | } |
467 | } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { | 466 | } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { |
468 | val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); | 467 | val = adapter->hw_read_wx(adapter, CRB_XG_STATE); |
469 | return (val == XG_LINK_UP) ? 0 : 1; | 468 | return (val == XG_LINK_UP) ? 0 : 1; |
470 | } | 469 | } |
471 | return -EIO; | 470 | return -EIO; |
@@ -529,10 +528,10 @@ netxen_nic_get_pauseparam(struct net_device *dev, | |||
529 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 528 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) |
530 | return; | 529 | return; |
531 | /* get flow control settings */ | 530 | /* get flow control settings */ |
532 | netxen_nic_read_w0(adapter,NETXEN_NIU_GB_MAC_CONFIG_0(port), | 531 | val = netxen_nic_read_w0(adapter, |
533 | &val); | 532 | NETXEN_NIU_GB_MAC_CONFIG_0(port)); |
534 | pause->rx_pause = netxen_gb_get_rx_flowctl(val); | 533 | pause->rx_pause = netxen_gb_get_rx_flowctl(val); |
535 | netxen_nic_read_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL, &val); | 534 | val = netxen_nic_read_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL); |
536 | switch (port) { | 535 | switch (port) { |
537 | case 0: | 536 | case 0: |
538 | pause->tx_pause = !(netxen_gb_get_gb0_mask(val)); | 537 | pause->tx_pause = !(netxen_gb_get_gb0_mask(val)); |
@@ -552,7 +551,7 @@ netxen_nic_get_pauseparam(struct net_device *dev, | |||
552 | if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) | 551 | if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) |
553 | return; | 552 | return; |
554 | pause->rx_pause = 1; | 553 | pause->rx_pause = 1; |
555 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL, &val); | 554 | val = netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL); |
556 | if (port == 0) | 555 | if (port == 0) |
557 | pause->tx_pause = !(netxen_xg_get_xg0_mask(val)); | 556 | pause->tx_pause = !(netxen_xg_get_xg0_mask(val)); |
558 | else | 557 | else |
@@ -575,8 +574,8 @@ netxen_nic_set_pauseparam(struct net_device *dev, | |||
575 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 574 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) |
576 | return -EIO; | 575 | return -EIO; |
577 | /* set flow control */ | 576 | /* set flow control */ |
578 | netxen_nic_read_w0(adapter, | 577 | val = netxen_nic_read_w0(adapter, |
579 | NETXEN_NIU_GB_MAC_CONFIG_0(port), &val); | 578 | NETXEN_NIU_GB_MAC_CONFIG_0(port)); |
580 | 579 | ||
581 | if (pause->rx_pause) | 580 | if (pause->rx_pause) |
582 | netxen_gb_rx_flowctl(val); | 581 | netxen_gb_rx_flowctl(val); |
@@ -586,7 +585,7 @@ netxen_nic_set_pauseparam(struct net_device *dev, | |||
586 | netxen_nic_write_w0(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), | 585 | netxen_nic_write_w0(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), |
587 | val); | 586 | val); |
588 | /* set autoneg */ | 587 | /* set autoneg */ |
589 | netxen_nic_read_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL, &val); | 588 | val = netxen_nic_read_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL); |
590 | switch (port) { | 589 | switch (port) { |
591 | case 0: | 590 | case 0: |
592 | if (pause->tx_pause) | 591 | if (pause->tx_pause) |
@@ -618,7 +617,7 @@ netxen_nic_set_pauseparam(struct net_device *dev, | |||
618 | } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { | 617 | } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { |
619 | if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) | 618 | if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) |
620 | return -EIO; | 619 | return -EIO; |
621 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL, &val); | 620 | val = netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL); |
622 | if (port == 0) { | 621 | if (port == 0) { |
623 | if (pause->tx_pause) | 622 | if (pause->tx_pause) |
624 | netxen_xg_unset_xg0_mask(val); | 623 | netxen_xg_unset_xg0_mask(val); |
@@ -644,14 +643,14 @@ static int netxen_nic_reg_test(struct net_device *dev) | |||
644 | struct netxen_adapter *adapter = netdev_priv(dev); | 643 | struct netxen_adapter *adapter = netdev_priv(dev); |
645 | u32 data_read, data_written; | 644 | u32 data_read, data_written; |
646 | 645 | ||
647 | netxen_nic_read_w0(adapter, NETXEN_PCIX_PH_REG(0), &data_read); | 646 | data_read = netxen_nic_read_w0(adapter, NETXEN_PCIX_PH_REG(0)); |
648 | if ((data_read & 0xffff) != PHAN_VENDOR_ID) | 647 | if ((data_read & 0xffff) != PHAN_VENDOR_ID) |
649 | return 1; | 648 | return 1; |
650 | 649 | ||
651 | data_written = (u32)0xa5a5a5a5; | 650 | data_written = (u32)0xa5a5a5a5; |
652 | 651 | ||
653 | netxen_nic_reg_write(adapter, CRB_SCRATCHPAD_TEST, data_written); | 652 | netxen_nic_reg_write(adapter, CRB_SCRATCHPAD_TEST, data_written); |
654 | data_read = adapter->pci_read_normalize(adapter, CRB_SCRATCHPAD_TEST); | 653 | data_read = adapter->hw_read_wx(adapter, CRB_SCRATCHPAD_TEST); |
655 | if (data_written != data_read) | 654 | if (data_written != data_read) |
656 | return 1; | 655 | return 1; |
657 | 656 | ||