aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c121
1 files changed, 71 insertions, 50 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 062600be073b..df99edf3464a 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -56,11 +56,11 @@
56#include "bnx2_fw.h" 56#include "bnx2_fw.h"
57 57
58#define DRV_MODULE_NAME "bnx2" 58#define DRV_MODULE_NAME "bnx2"
59#define DRV_MODULE_VERSION "2.0.18" 59#define DRV_MODULE_VERSION "2.0.21"
60#define DRV_MODULE_RELDATE "Oct 7, 2010" 60#define DRV_MODULE_RELDATE "Dec 23, 2010"
61#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-6.0.15.fw" 61#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-6.2.1.fw"
62#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-6.0.15.fw" 62#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-6.0.15.fw"
63#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-6.0.17.fw" 63#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-6.2.1.fw"
64#define FW_RV2P_FILE_09_Ax "bnx2/bnx2-rv2p-09ax-6.0.17.fw" 64#define FW_RV2P_FILE_09_Ax "bnx2/bnx2-rv2p-09ax-6.0.17.fw"
65#define FW_RV2P_FILE_09 "bnx2/bnx2-rv2p-09-6.0.17.fw" 65#define FW_RV2P_FILE_09 "bnx2/bnx2-rv2p-09-6.0.17.fw"
66 66
@@ -766,13 +766,10 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)
766 int j; 766 int j;
767 767
768 rxr->rx_buf_ring = 768 rxr->rx_buf_ring =
769 vmalloc(SW_RXBD_RING_SIZE * bp->rx_max_ring); 769 vzalloc(SW_RXBD_RING_SIZE * bp->rx_max_ring);
770 if (rxr->rx_buf_ring == NULL) 770 if (rxr->rx_buf_ring == NULL)
771 return -ENOMEM; 771 return -ENOMEM;
772 772
773 memset(rxr->rx_buf_ring, 0,
774 SW_RXBD_RING_SIZE * bp->rx_max_ring);
775
776 for (j = 0; j < bp->rx_max_ring; j++) { 773 for (j = 0; j < bp->rx_max_ring; j++) {
777 rxr->rx_desc_ring[j] = 774 rxr->rx_desc_ring[j] =
778 dma_alloc_coherent(&bp->pdev->dev, 775 dma_alloc_coherent(&bp->pdev->dev,
@@ -785,13 +782,11 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)
785 } 782 }
786 783
787 if (bp->rx_pg_ring_size) { 784 if (bp->rx_pg_ring_size) {
788 rxr->rx_pg_ring = vmalloc(SW_RXPG_RING_SIZE * 785 rxr->rx_pg_ring = vzalloc(SW_RXPG_RING_SIZE *
789 bp->rx_max_pg_ring); 786 bp->rx_max_pg_ring);
790 if (rxr->rx_pg_ring == NULL) 787 if (rxr->rx_pg_ring == NULL)
791 return -ENOMEM; 788 return -ENOMEM;
792 789
793 memset(rxr->rx_pg_ring, 0, SW_RXPG_RING_SIZE *
794 bp->rx_max_pg_ring);
795 } 790 }
796 791
797 for (j = 0; j < bp->rx_max_pg_ring; j++) { 792 for (j = 0; j < bp->rx_max_pg_ring; j++) {
@@ -4645,13 +4640,28 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
4645 4640
4646 /* Wait for the current PCI transaction to complete before 4641 /* Wait for the current PCI transaction to complete before
4647 * issuing a reset. */ 4642 * issuing a reset. */
4648 REG_WR(bp, BNX2_MISC_ENABLE_CLR_BITS, 4643 if ((CHIP_NUM(bp) == CHIP_NUM_5706) ||
4649 BNX2_MISC_ENABLE_CLR_BITS_TX_DMA_ENABLE | 4644 (CHIP_NUM(bp) == CHIP_NUM_5708)) {
4650 BNX2_MISC_ENABLE_CLR_BITS_DMA_ENGINE_ENABLE | 4645 REG_WR(bp, BNX2_MISC_ENABLE_CLR_BITS,
4651 BNX2_MISC_ENABLE_CLR_BITS_RX_DMA_ENABLE | 4646 BNX2_MISC_ENABLE_CLR_BITS_TX_DMA_ENABLE |
4652 BNX2_MISC_ENABLE_CLR_BITS_HOST_COALESCE_ENABLE); 4647 BNX2_MISC_ENABLE_CLR_BITS_DMA_ENGINE_ENABLE |
4653 val = REG_RD(bp, BNX2_MISC_ENABLE_CLR_BITS); 4648 BNX2_MISC_ENABLE_CLR_BITS_RX_DMA_ENABLE |
4654 udelay(5); 4649 BNX2_MISC_ENABLE_CLR_BITS_HOST_COALESCE_ENABLE);
4650 val = REG_RD(bp, BNX2_MISC_ENABLE_CLR_BITS);
4651 udelay(5);
4652 } else { /* 5709 */
4653 val = REG_RD(bp, BNX2_MISC_NEW_CORE_CTL);
4654 val &= ~BNX2_MISC_NEW_CORE_CTL_DMA_ENABLE;
4655 REG_WR(bp, BNX2_MISC_NEW_CORE_CTL, val);
4656 val = REG_RD(bp, BNX2_MISC_NEW_CORE_CTL);
4657
4658 for (i = 0; i < 100; i++) {
4659 msleep(1);
4660 val = REG_RD(bp, BNX2_PCICFG_DEVICE_CONTROL);
4661 if (!(val & BNX2_PCICFG_DEVICE_STATUS_NO_PEND))
4662 break;
4663 }
4664 }
4655 4665
4656 /* Wait for the firmware to tell us it is ok to issue a reset. */ 4666 /* Wait for the firmware to tell us it is ok to issue a reset. */
4657 bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT0 | reset_code, 1, 1); 4667 bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT0 | reset_code, 1, 1);
@@ -4673,7 +4683,7 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
4673 val = BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA | 4683 val = BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA |
4674 BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP; 4684 BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP;
4675 4685
4676 pci_write_config_dword(bp->pdev, BNX2_PCICFG_MISC_CONFIG, val); 4686 REG_WR(bp, BNX2_PCICFG_MISC_CONFIG, val);
4677 4687
4678 } else { 4688 } else {
4679 val = BNX2_PCICFG_MISC_CONFIG_CORE_RST_REQ | 4689 val = BNX2_PCICFG_MISC_CONFIG_CORE_RST_REQ |
@@ -6086,7 +6096,7 @@ bnx2_request_irq(struct bnx2 *bp)
6086} 6096}
6087 6097
6088static void 6098static void
6089bnx2_free_irq(struct bnx2 *bp) 6099__bnx2_free_irq(struct bnx2 *bp)
6090{ 6100{
6091 struct bnx2_irq *irq; 6101 struct bnx2_irq *irq;
6092 int i; 6102 int i;
@@ -6097,6 +6107,13 @@ bnx2_free_irq(struct bnx2 *bp)
6097 free_irq(irq->vector, &bp->bnx2_napi[i]); 6107 free_irq(irq->vector, &bp->bnx2_napi[i]);
6098 irq->requested = 0; 6108 irq->requested = 0;
6099 } 6109 }
6110}
6111
6112static void
6113bnx2_free_irq(struct bnx2 *bp)
6114{
6115
6116 __bnx2_free_irq(bp);
6100 if (bp->flags & BNX2_FLAG_USING_MSI) 6117 if (bp->flags & BNX2_FLAG_USING_MSI)
6101 pci_disable_msi(bp->pdev); 6118 pci_disable_msi(bp->pdev);
6102 else if (bp->flags & BNX2_FLAG_USING_MSIX) 6119 else if (bp->flags & BNX2_FLAG_USING_MSIX)
@@ -6801,28 +6818,30 @@ bnx2_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *_p)
6801 u32 *p = _p, i, offset; 6818 u32 *p = _p, i, offset;
6802 u8 *orig_p = _p; 6819 u8 *orig_p = _p;
6803 struct bnx2 *bp = netdev_priv(dev); 6820 struct bnx2 *bp = netdev_priv(dev);
6804 u32 reg_boundaries[] = { 0x0000, 0x0098, 0x0400, 0x045c, 6821 static const u32 reg_boundaries[] = {
6805 0x0800, 0x0880, 0x0c00, 0x0c10, 6822 0x0000, 0x0098, 0x0400, 0x045c,
6806 0x0c30, 0x0d08, 0x1000, 0x101c, 6823 0x0800, 0x0880, 0x0c00, 0x0c10,
6807 0x1040, 0x1048, 0x1080, 0x10a4, 6824 0x0c30, 0x0d08, 0x1000, 0x101c,
6808 0x1400, 0x1490, 0x1498, 0x14f0, 6825 0x1040, 0x1048, 0x1080, 0x10a4,
6809 0x1500, 0x155c, 0x1580, 0x15dc, 6826 0x1400, 0x1490, 0x1498, 0x14f0,
6810 0x1600, 0x1658, 0x1680, 0x16d8, 6827 0x1500, 0x155c, 0x1580, 0x15dc,
6811 0x1800, 0x1820, 0x1840, 0x1854, 6828 0x1600, 0x1658, 0x1680, 0x16d8,
6812 0x1880, 0x1894, 0x1900, 0x1984, 6829 0x1800, 0x1820, 0x1840, 0x1854,
6813 0x1c00, 0x1c0c, 0x1c40, 0x1c54, 6830 0x1880, 0x1894, 0x1900, 0x1984,
6814 0x1c80, 0x1c94, 0x1d00, 0x1d84, 6831 0x1c00, 0x1c0c, 0x1c40, 0x1c54,
6815 0x2000, 0x2030, 0x23c0, 0x2400, 6832 0x1c80, 0x1c94, 0x1d00, 0x1d84,
6816 0x2800, 0x2820, 0x2830, 0x2850, 6833 0x2000, 0x2030, 0x23c0, 0x2400,
6817 0x2b40, 0x2c10, 0x2fc0, 0x3058, 6834 0x2800, 0x2820, 0x2830, 0x2850,
6818 0x3c00, 0x3c94, 0x4000, 0x4010, 6835 0x2b40, 0x2c10, 0x2fc0, 0x3058,
6819 0x4080, 0x4090, 0x43c0, 0x4458, 6836 0x3c00, 0x3c94, 0x4000, 0x4010,
6820 0x4c00, 0x4c18, 0x4c40, 0x4c54, 6837 0x4080, 0x4090, 0x43c0, 0x4458,
6821 0x4fc0, 0x5010, 0x53c0, 0x5444, 6838 0x4c00, 0x4c18, 0x4c40, 0x4c54,
6822 0x5c00, 0x5c18, 0x5c80, 0x5c90, 6839 0x4fc0, 0x5010, 0x53c0, 0x5444,
6823 0x5fc0, 0x6000, 0x6400, 0x6428, 6840 0x5c00, 0x5c18, 0x5c80, 0x5c90,
6824 0x6800, 0x6848, 0x684c, 0x6860, 6841 0x5fc0, 0x6000, 0x6400, 0x6428,
6825 0x6888, 0x6910, 0x8000 }; 6842 0x6800, 0x6848, 0x684c, 0x6860,
6843 0x6888, 0x6910, 0x8000
6844 };
6826 6845
6827 regs->version = 0; 6846 regs->version = 0;
6828 6847
@@ -7080,6 +7099,7 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
7080 7099
7081 bnx2_netif_stop(bp, true); 7100 bnx2_netif_stop(bp, true);
7082 bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); 7101 bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET);
7102 __bnx2_free_irq(bp);
7083 bnx2_free_skbs(bp); 7103 bnx2_free_skbs(bp);
7084 bnx2_free_mem(bp); 7104 bnx2_free_mem(bp);
7085 } 7105 }
@@ -7092,6 +7112,9 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
7092 7112
7093 rc = bnx2_alloc_mem(bp); 7113 rc = bnx2_alloc_mem(bp);
7094 if (!rc) 7114 if (!rc)
7115 rc = bnx2_request_irq(bp);
7116
7117 if (!rc)
7095 rc = bnx2_init_nic(bp, 0); 7118 rc = bnx2_init_nic(bp, 0);
7096 7119
7097 if (rc) { 7120 if (rc) {
@@ -7914,15 +7937,15 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7914 goto err_out_release; 7937 goto err_out_release;
7915 } 7938 }
7916 7939
7940 bnx2_set_power_state(bp, PCI_D0);
7941
7917 /* Configure byte swap and enable write to the reg_window registers. 7942 /* Configure byte swap and enable write to the reg_window registers.
7918 * Rely on CPU to do target byte swapping on big endian systems 7943 * Rely on CPU to do target byte swapping on big endian systems
7919 * The chip's target access swapping will not swap all accesses 7944 * The chip's target access swapping will not swap all accesses
7920 */ 7945 */
7921 pci_write_config_dword(bp->pdev, BNX2_PCICFG_MISC_CONFIG, 7946 REG_WR(bp, BNX2_PCICFG_MISC_CONFIG,
7922 BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA | 7947 BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA |
7923 BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP); 7948 BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP);
7924
7925 bnx2_set_power_state(bp, PCI_D0);
7926 7949
7927 bp->chip_id = REG_RD(bp, BNX2_MISC_ID); 7950 bp->chip_id = REG_RD(bp, BNX2_MISC_ID);
7928 7951
@@ -8383,8 +8406,6 @@ bnx2_remove_one(struct pci_dev *pdev)
8383 struct net_device *dev = pci_get_drvdata(pdev); 8406 struct net_device *dev = pci_get_drvdata(pdev);
8384 struct bnx2 *bp = netdev_priv(dev); 8407 struct bnx2 *bp = netdev_priv(dev);
8385 8408
8386 flush_scheduled_work();
8387
8388 unregister_netdev(dev); 8409 unregister_netdev(dev);
8389 8410
8390 if (bp->mips_firmware) 8411 if (bp->mips_firmware)
@@ -8421,7 +8442,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
8421 if (!netif_running(dev)) 8442 if (!netif_running(dev))
8422 return 0; 8443 return 0;
8423 8444
8424 flush_scheduled_work(); 8445 cancel_work_sync(&bp->reset_task);
8425 bnx2_netif_stop(bp, true); 8446 bnx2_netif_stop(bp, true);
8426 netif_device_detach(dev); 8447 netif_device_detach(dev);
8427 del_timer_sync(&bp->timer); 8448 del_timer_sync(&bp->timer);