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.c213
1 files changed, 134 insertions, 79 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 34aebc6e7589..8b552c6dd2e7 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -56,8 +56,8 @@
56 56
57#define DRV_MODULE_NAME "bnx2" 57#define DRV_MODULE_NAME "bnx2"
58#define PFX DRV_MODULE_NAME ": " 58#define PFX DRV_MODULE_NAME ": "
59#define DRV_MODULE_VERSION "1.7.2" 59#define DRV_MODULE_VERSION "1.7.3"
60#define DRV_MODULE_RELDATE "January 21, 2008" 60#define DRV_MODULE_RELDATE "January 29, 2008"
61 61
62#define RUN_AT(x) (jiffies + (x)) 62#define RUN_AT(x) (jiffies + (x))
63 63
@@ -266,6 +266,18 @@ bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val)
266} 266}
267 267
268static void 268static void
269bnx2_shmem_wr(struct bnx2 *bp, u32 offset, u32 val)
270{
271 bnx2_reg_wr_ind(bp, bp->shmem_base + offset, val);
272}
273
274static u32
275bnx2_shmem_rd(struct bnx2 *bp, u32 offset)
276{
277 return (bnx2_reg_rd_ind(bp, bp->shmem_base + offset));
278}
279
280static void
269bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val) 281bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val)
270{ 282{
271 offset += cid_addr; 283 offset += cid_addr;
@@ -685,7 +697,7 @@ bnx2_report_fw_link(struct bnx2 *bp)
685 else 697 else
686 fw_link_status = BNX2_LINK_STATUS_LINK_DOWN; 698 fw_link_status = BNX2_LINK_STATUS_LINK_DOWN;
687 699
688 REG_WR_IND(bp, bp->shmem_base + BNX2_LINK_STATUS, fw_link_status); 700 bnx2_shmem_wr(bp, BNX2_LINK_STATUS, fw_link_status);
689} 701}
690 702
691static char * 703static char *
@@ -980,6 +992,42 @@ bnx2_copper_linkup(struct bnx2 *bp)
980 return 0; 992 return 0;
981} 993}
982 994
995static void
996bnx2_init_rx_context0(struct bnx2 *bp)
997{
998 u32 val, rx_cid_addr = GET_CID_ADDR(RX_CID);
999
1000 val = BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE;
1001 val |= BNX2_L2CTX_CTX_TYPE_SIZE_L2;
1002 val |= 0x02 << 8;
1003
1004 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
1005 u32 lo_water, hi_water;
1006
1007 if (bp->flow_ctrl & FLOW_CTRL_TX)
1008 lo_water = BNX2_L2CTX_LO_WATER_MARK_DEFAULT;
1009 else
1010 lo_water = BNX2_L2CTX_LO_WATER_MARK_DIS;
1011 if (lo_water >= bp->rx_ring_size)
1012 lo_water = 0;
1013
1014 hi_water = bp->rx_ring_size / 4;
1015
1016 if (hi_water <= lo_water)
1017 lo_water = 0;
1018
1019 hi_water /= BNX2_L2CTX_HI_WATER_MARK_SCALE;
1020 lo_water /= BNX2_L2CTX_LO_WATER_MARK_SCALE;
1021
1022 if (hi_water > 0xf)
1023 hi_water = 0xf;
1024 else if (hi_water == 0)
1025 lo_water = 0;
1026 val |= lo_water | (hi_water << BNX2_L2CTX_HI_WATER_MARK_SHIFT);
1027 }
1028 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_CTX_TYPE, val);
1029}
1030
983static int 1031static int
984bnx2_set_mac_link(struct bnx2 *bp) 1032bnx2_set_mac_link(struct bnx2 *bp)
985{ 1033{
@@ -1044,6 +1092,9 @@ bnx2_set_mac_link(struct bnx2 *bp)
1044 /* Acknowledge the interrupt. */ 1092 /* Acknowledge the interrupt. */
1045 REG_WR(bp, BNX2_EMAC_STATUS, BNX2_EMAC_STATUS_LINK_CHANGE); 1093 REG_WR(bp, BNX2_EMAC_STATUS, BNX2_EMAC_STATUS_LINK_CHANGE);
1046 1094
1095 if (CHIP_NUM(bp) == CHIP_NUM_5709)
1096 bnx2_init_rx_context0(bp);
1097
1047 return 0; 1098 return 0;
1048} 1099}
1049 1100
@@ -1378,14 +1429,14 @@ bnx2_setup_remote_phy(struct bnx2 *bp, u8 port)
1378 1429
1379 if (pause_adv & (ADVERTISE_1000XPAUSE | ADVERTISE_PAUSE_CAP)) 1430 if (pause_adv & (ADVERTISE_1000XPAUSE | ADVERTISE_PAUSE_CAP))
1380 speed_arg |= BNX2_NETLINK_SET_LINK_FC_SYM_PAUSE; 1431 speed_arg |= BNX2_NETLINK_SET_LINK_FC_SYM_PAUSE;
1381 if (pause_adv & (ADVERTISE_1000XPSE_ASYM | ADVERTISE_1000XPSE_ASYM)) 1432 if (pause_adv & (ADVERTISE_1000XPSE_ASYM | ADVERTISE_PAUSE_ASYM))
1382 speed_arg |= BNX2_NETLINK_SET_LINK_FC_ASYM_PAUSE; 1433 speed_arg |= BNX2_NETLINK_SET_LINK_FC_ASYM_PAUSE;
1383 1434
1384 if (port == PORT_TP) 1435 if (port == PORT_TP)
1385 speed_arg |= BNX2_NETLINK_SET_LINK_PHY_APP_REMOTE | 1436 speed_arg |= BNX2_NETLINK_SET_LINK_PHY_APP_REMOTE |
1386 BNX2_NETLINK_SET_LINK_ETH_AT_WIRESPEED; 1437 BNX2_NETLINK_SET_LINK_ETH_AT_WIRESPEED;
1387 1438
1388 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB_ARG0, speed_arg); 1439 bnx2_shmem_wr(bp, BNX2_DRV_MB_ARG0, speed_arg);
1389 1440
1390 spin_unlock_bh(&bp->phy_lock); 1441 spin_unlock_bh(&bp->phy_lock);
1391 bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_CMD_SET_LINK, 0); 1442 bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_CMD_SET_LINK, 0);
@@ -1530,9 +1581,9 @@ bnx2_set_default_remote_link(struct bnx2 *bp)
1530 u32 link; 1581 u32 link;
1531 1582
1532 if (bp->phy_port == PORT_TP) 1583 if (bp->phy_port == PORT_TP)
1533 link = REG_RD_IND(bp, bp->shmem_base + BNX2_RPHY_COPPER_LINK); 1584 link = bnx2_shmem_rd(bp, BNX2_RPHY_COPPER_LINK);
1534 else 1585 else
1535 link = REG_RD_IND(bp, bp->shmem_base + BNX2_RPHY_SERDES_LINK); 1586 link = bnx2_shmem_rd(bp, BNX2_RPHY_SERDES_LINK);
1536 1587
1537 if (link & BNX2_NETLINK_SET_LINK_ENABLE_AUTONEG) { 1588 if (link & BNX2_NETLINK_SET_LINK_ENABLE_AUTONEG) {
1538 bp->req_line_speed = 0; 1589 bp->req_line_speed = 0;
@@ -1584,7 +1635,7 @@ bnx2_set_default_link(struct bnx2 *bp)
1584 1635
1585 bp->advertising = ETHTOOL_ALL_FIBRE_SPEED | ADVERTISED_Autoneg; 1636 bp->advertising = ETHTOOL_ALL_FIBRE_SPEED | ADVERTISED_Autoneg;
1586 1637
1587 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_CONFIG); 1638 reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_CONFIG);
1588 reg &= BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK; 1639 reg &= BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK;
1589 if (reg == BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G) { 1640 if (reg == BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G) {
1590 bp->autoneg = 0; 1641 bp->autoneg = 0;
@@ -1616,7 +1667,7 @@ bnx2_remote_phy_event(struct bnx2 *bp)
1616 u8 link_up = bp->link_up; 1667 u8 link_up = bp->link_up;
1617 u8 old_port; 1668 u8 old_port;
1618 1669
1619 msg = REG_RD_IND(bp, bp->shmem_base + BNX2_LINK_STATUS); 1670 msg = bnx2_shmem_rd(bp, BNX2_LINK_STATUS);
1620 1671
1621 if (msg & BNX2_LINK_STATUS_HEART_BEAT_EXPIRED) 1672 if (msg & BNX2_LINK_STATUS_HEART_BEAT_EXPIRED)
1622 bnx2_send_heart_beat(bp); 1673 bnx2_send_heart_beat(bp);
@@ -1693,7 +1744,7 @@ bnx2_set_remote_link(struct bnx2 *bp)
1693{ 1744{
1694 u32 evt_code; 1745 u32 evt_code;
1695 1746
1696 evt_code = REG_RD_IND(bp, bp->shmem_base + BNX2_FW_EVT_CODE_MB); 1747 evt_code = bnx2_shmem_rd(bp, BNX2_FW_EVT_CODE_MB);
1697 switch (evt_code) { 1748 switch (evt_code) {
1698 case BNX2_FW_EVT_CODE_LINK_EVENT: 1749 case BNX2_FW_EVT_CODE_LINK_EVENT:
1699 bnx2_remote_phy_event(bp); 1750 bnx2_remote_phy_event(bp);
@@ -1905,14 +1956,13 @@ bnx2_init_5708s_phy(struct bnx2 *bp)
1905 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, BCM5708S_BLK_ADDR_DIG); 1956 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, BCM5708S_BLK_ADDR_DIG);
1906 } 1957 }
1907 1958
1908 val = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_CONFIG) & 1959 val = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_CONFIG) &
1909 BNX2_PORT_HW_CFG_CFG_TXCTL3_MASK; 1960 BNX2_PORT_HW_CFG_CFG_TXCTL3_MASK;
1910 1961
1911 if (val) { 1962 if (val) {
1912 u32 is_backplane; 1963 u32 is_backplane;
1913 1964
1914 is_backplane = REG_RD_IND(bp, bp->shmem_base + 1965 is_backplane = bnx2_shmem_rd(bp, BNX2_SHARED_HW_CFG_CONFIG);
1915 BNX2_SHARED_HW_CFG_CONFIG);
1916 if (is_backplane & BNX2_SHARED_HW_CFG_PHY_BACKPLANE) { 1966 if (is_backplane & BNX2_SHARED_HW_CFG_PHY_BACKPLANE) {
1917 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, 1967 bnx2_write_phy(bp, BCM5708S_BLK_ADDR,
1918 BCM5708S_BLK_ADDR_TX_MISC); 1968 BCM5708S_BLK_ADDR_TX_MISC);
@@ -2111,13 +2161,13 @@ bnx2_fw_sync(struct bnx2 *bp, u32 msg_data, int silent)
2111 bp->fw_wr_seq++; 2161 bp->fw_wr_seq++;
2112 msg_data |= bp->fw_wr_seq; 2162 msg_data |= bp->fw_wr_seq;
2113 2163
2114 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB, msg_data); 2164 bnx2_shmem_wr(bp, BNX2_DRV_MB, msg_data);
2115 2165
2116 /* wait for an acknowledgement. */ 2166 /* wait for an acknowledgement. */
2117 for (i = 0; i < (FW_ACK_TIME_OUT_MS / 10); i++) { 2167 for (i = 0; i < (FW_ACK_TIME_OUT_MS / 10); i++) {
2118 msleep(10); 2168 msleep(10);
2119 2169
2120 val = REG_RD_IND(bp, bp->shmem_base + BNX2_FW_MB); 2170 val = bnx2_shmem_rd(bp, BNX2_FW_MB);
2121 2171
2122 if ((val & BNX2_FW_MSG_ACK) == (msg_data & BNX2_DRV_MSG_SEQ)) 2172 if ((val & BNX2_FW_MSG_ACK) == (msg_data & BNX2_DRV_MSG_SEQ))
2123 break; 2173 break;
@@ -2134,7 +2184,7 @@ bnx2_fw_sync(struct bnx2 *bp, u32 msg_data, int silent)
2134 msg_data &= ~BNX2_DRV_MSG_CODE; 2184 msg_data &= ~BNX2_DRV_MSG_CODE;
2135 msg_data |= BNX2_DRV_MSG_CODE_FW_TIMEOUT; 2185 msg_data |= BNX2_DRV_MSG_CODE_FW_TIMEOUT;
2136 2186
2137 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB, msg_data); 2187 bnx2_shmem_wr(bp, BNX2_DRV_MB, msg_data);
2138 2188
2139 return -EBUSY; 2189 return -EBUSY;
2140 } 2190 }
@@ -2226,7 +2276,7 @@ bnx2_init_context(struct bnx2 *bp)
2226 2276
2227 /* Zero out the context. */ 2277 /* Zero out the context. */
2228 for (offset = 0; offset < PHY_CTX_SIZE; offset += 4) 2278 for (offset = 0; offset < PHY_CTX_SIZE; offset += 4)
2229 CTX_WR(bp, vcid_addr, offset, 0); 2279 bnx2_ctx_wr(bp, vcid_addr, offset, 0);
2230 } 2280 }
2231 } 2281 }
2232} 2282}
@@ -2251,11 +2301,12 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
2251 good_mbuf_cnt = 0; 2301 good_mbuf_cnt = 0;
2252 2302
2253 /* Allocate a bunch of mbufs and save the good ones in an array. */ 2303 /* Allocate a bunch of mbufs and save the good ones in an array. */
2254 val = REG_RD_IND(bp, BNX2_RBUF_STATUS1); 2304 val = bnx2_reg_rd_ind(bp, BNX2_RBUF_STATUS1);
2255 while (val & BNX2_RBUF_STATUS1_FREE_COUNT) { 2305 while (val & BNX2_RBUF_STATUS1_FREE_COUNT) {
2256 REG_WR_IND(bp, BNX2_RBUF_COMMAND, BNX2_RBUF_COMMAND_ALLOC_REQ); 2306 bnx2_reg_wr_ind(bp, BNX2_RBUF_COMMAND,
2307 BNX2_RBUF_COMMAND_ALLOC_REQ);
2257 2308
2258 val = REG_RD_IND(bp, BNX2_RBUF_FW_BUF_ALLOC); 2309 val = bnx2_reg_rd_ind(bp, BNX2_RBUF_FW_BUF_ALLOC);
2259 2310
2260 val &= BNX2_RBUF_FW_BUF_ALLOC_VALUE; 2311 val &= BNX2_RBUF_FW_BUF_ALLOC_VALUE;
2261 2312
@@ -2265,7 +2316,7 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
2265 good_mbuf_cnt++; 2316 good_mbuf_cnt++;
2266 } 2317 }
2267 2318
2268 val = REG_RD_IND(bp, BNX2_RBUF_STATUS1); 2319 val = bnx2_reg_rd_ind(bp, BNX2_RBUF_STATUS1);
2269 } 2320 }
2270 2321
2271 /* Free the good ones back to the mbuf pool thus discarding 2322 /* Free the good ones back to the mbuf pool thus discarding
@@ -2276,7 +2327,7 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
2276 val = good_mbuf[good_mbuf_cnt]; 2327 val = good_mbuf[good_mbuf_cnt];
2277 val = (val << 9) | val | 1; 2328 val = (val << 9) | val | 1;
2278 2329
2279 REG_WR_IND(bp, BNX2_RBUF_FW_BUF_FREE, val); 2330 bnx2_reg_wr_ind(bp, BNX2_RBUF_FW_BUF_FREE, val);
2280 } 2331 }
2281 kfree(good_mbuf); 2332 kfree(good_mbuf);
2282 return 0; 2333 return 0;
@@ -3151,10 +3202,10 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3151 int rc; 3202 int rc;
3152 3203
3153 /* Halt the CPU. */ 3204 /* Halt the CPU. */
3154 val = REG_RD_IND(bp, cpu_reg->mode); 3205 val = bnx2_reg_rd_ind(bp, cpu_reg->mode);
3155 val |= cpu_reg->mode_value_halt; 3206 val |= cpu_reg->mode_value_halt;
3156 REG_WR_IND(bp, cpu_reg->mode, val); 3207 bnx2_reg_wr_ind(bp, cpu_reg->mode, val);
3157 REG_WR_IND(bp, cpu_reg->state, cpu_reg->state_value_clear); 3208 bnx2_reg_wr_ind(bp, cpu_reg->state, cpu_reg->state_value_clear);
3158 3209
3159 /* Load the Text area. */ 3210 /* Load the Text area. */
3160 offset = cpu_reg->spad_base + (fw->text_addr - cpu_reg->mips_view_base); 3211 offset = cpu_reg->spad_base + (fw->text_addr - cpu_reg->mips_view_base);
@@ -3167,7 +3218,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3167 return rc; 3218 return rc;
3168 3219
3169 for (j = 0; j < (fw->text_len / 4); j++, offset += 4) { 3220 for (j = 0; j < (fw->text_len / 4); j++, offset += 4) {
3170 REG_WR_IND(bp, offset, le32_to_cpu(fw->text[j])); 3221 bnx2_reg_wr_ind(bp, offset, le32_to_cpu(fw->text[j]));
3171 } 3222 }
3172 } 3223 }
3173 3224
@@ -3177,7 +3228,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3177 int j; 3228 int j;
3178 3229
3179 for (j = 0; j < (fw->data_len / 4); j++, offset += 4) { 3230 for (j = 0; j < (fw->data_len / 4); j++, offset += 4) {
3180 REG_WR_IND(bp, offset, fw->data[j]); 3231 bnx2_reg_wr_ind(bp, offset, fw->data[j]);
3181 } 3232 }
3182 } 3233 }
3183 3234
@@ -3187,7 +3238,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3187 int j; 3238 int j;
3188 3239
3189 for (j = 0; j < (fw->sbss_len / 4); j++, offset += 4) { 3240 for (j = 0; j < (fw->sbss_len / 4); j++, offset += 4) {
3190 REG_WR_IND(bp, offset, 0); 3241 bnx2_reg_wr_ind(bp, offset, 0);
3191 } 3242 }
3192 } 3243 }
3193 3244
@@ -3197,7 +3248,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3197 int j; 3248 int j;
3198 3249
3199 for (j = 0; j < (fw->bss_len/4); j++, offset += 4) { 3250 for (j = 0; j < (fw->bss_len/4); j++, offset += 4) {
3200 REG_WR_IND(bp, offset, 0); 3251 bnx2_reg_wr_ind(bp, offset, 0);
3201 } 3252 }
3202 } 3253 }
3203 3254
@@ -3208,19 +3259,19 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3208 int j; 3259 int j;
3209 3260
3210 for (j = 0; j < (fw->rodata_len / 4); j++, offset += 4) { 3261 for (j = 0; j < (fw->rodata_len / 4); j++, offset += 4) {
3211 REG_WR_IND(bp, offset, fw->rodata[j]); 3262 bnx2_reg_wr_ind(bp, offset, fw->rodata[j]);
3212 } 3263 }
3213 } 3264 }
3214 3265
3215 /* Clear the pre-fetch instruction. */ 3266 /* Clear the pre-fetch instruction. */
3216 REG_WR_IND(bp, cpu_reg->inst, 0); 3267 bnx2_reg_wr_ind(bp, cpu_reg->inst, 0);
3217 REG_WR_IND(bp, cpu_reg->pc, fw->start_addr); 3268 bnx2_reg_wr_ind(bp, cpu_reg->pc, fw->start_addr);
3218 3269
3219 /* Start the CPU. */ 3270 /* Start the CPU. */
3220 val = REG_RD_IND(bp, cpu_reg->mode); 3271 val = bnx2_reg_rd_ind(bp, cpu_reg->mode);
3221 val &= ~cpu_reg->mode_value_halt; 3272 val &= ~cpu_reg->mode_value_halt;
3222 REG_WR_IND(bp, cpu_reg->state, cpu_reg->state_value_clear); 3273 bnx2_reg_wr_ind(bp, cpu_reg->state, cpu_reg->state_value_clear);
3223 REG_WR_IND(bp, cpu_reg->mode, val); 3274 bnx2_reg_wr_ind(bp, cpu_reg->mode, val);
3224 3275
3225 return 0; 3276 return 0;
3226} 3277}
@@ -3833,7 +3884,7 @@ bnx2_init_nvram(struct bnx2 *bp)
3833 } 3884 }
3834 3885
3835get_flash_size: 3886get_flash_size:
3836 val = REG_RD_IND(bp, bp->shmem_base + BNX2_SHARED_HW_CFG_CONFIG2); 3887 val = bnx2_shmem_rd(bp, BNX2_SHARED_HW_CFG_CONFIG2);
3837 val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK; 3888 val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK;
3838 if (val) 3889 if (val)
3839 bp->flash_size = val; 3890 bp->flash_size = val;
@@ -4142,14 +4193,14 @@ bnx2_init_remote_phy(struct bnx2 *bp)
4142 if (!(bp->phy_flags & BNX2_PHY_FLAG_SERDES)) 4193 if (!(bp->phy_flags & BNX2_PHY_FLAG_SERDES))
4143 return; 4194 return;
4144 4195
4145 val = REG_RD_IND(bp, bp->shmem_base + BNX2_FW_CAP_MB); 4196 val = bnx2_shmem_rd(bp, BNX2_FW_CAP_MB);
4146 if ((val & BNX2_FW_CAP_SIGNATURE_MASK) != BNX2_FW_CAP_SIGNATURE) 4197 if ((val & BNX2_FW_CAP_SIGNATURE_MASK) != BNX2_FW_CAP_SIGNATURE)
4147 return; 4198 return;
4148 4199
4149 if (val & BNX2_FW_CAP_REMOTE_PHY_CAPABLE) { 4200 if (val & BNX2_FW_CAP_REMOTE_PHY_CAPABLE) {
4150 bp->phy_flags |= BNX2_PHY_FLAG_REMOTE_PHY_CAP; 4201 bp->phy_flags |= BNX2_PHY_FLAG_REMOTE_PHY_CAP;
4151 4202
4152 val = REG_RD_IND(bp, bp->shmem_base + BNX2_LINK_STATUS); 4203 val = bnx2_shmem_rd(bp, BNX2_LINK_STATUS);
4153 if (val & BNX2_LINK_STATUS_SERDES_LINK) 4204 if (val & BNX2_LINK_STATUS_SERDES_LINK)
4154 bp->phy_port = PORT_FIBRE; 4205 bp->phy_port = PORT_FIBRE;
4155 else 4206 else
@@ -4167,8 +4218,7 @@ bnx2_init_remote_phy(struct bnx2 *bp)
4167 } 4218 }
4168 sig = BNX2_DRV_ACK_CAP_SIGNATURE | 4219 sig = BNX2_DRV_ACK_CAP_SIGNATURE |
4169 BNX2_FW_CAP_REMOTE_PHY_CAPABLE; 4220 BNX2_FW_CAP_REMOTE_PHY_CAPABLE;
4170 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_ACK_CAP_MB, 4221 bnx2_shmem_wr(bp, BNX2_DRV_ACK_CAP_MB, sig);
4171 sig);
4172 } 4222 }
4173 } 4223 }
4174} 4224}
@@ -4204,8 +4254,8 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
4204 4254
4205 /* Deposit a driver reset signature so the firmware knows that 4255 /* Deposit a driver reset signature so the firmware knows that
4206 * this is a soft reset. */ 4256 * this is a soft reset. */
4207 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_RESET_SIGNATURE, 4257 bnx2_shmem_wr(bp, BNX2_DRV_RESET_SIGNATURE,
4208 BNX2_DRV_RESET_SIGNATURE_MAGIC); 4258 BNX2_DRV_RESET_SIGNATURE_MAGIC);
4209 4259
4210 /* Do a dummy read to force the chip to complete all current transaction 4260 /* Do a dummy read to force the chip to complete all current transaction
4211 * before we issue a reset. */ 4261 * before we issue a reset. */
@@ -4438,18 +4488,21 @@ bnx2_init_chip(struct bnx2 *bp)
4438 } 4488 }
4439 4489
4440 if (bp->flags & BNX2_FLAG_USING_MSIX) { 4490 if (bp->flags & BNX2_FLAG_USING_MSIX) {
4491 u32 base = ((BNX2_TX_VEC - 1) * BNX2_HC_SB_CONFIG_SIZE) +
4492 BNX2_HC_SB_CONFIG_1;
4493
4441 REG_WR(bp, BNX2_HC_MSIX_BIT_VECTOR, 4494 REG_WR(bp, BNX2_HC_MSIX_BIT_VECTOR,
4442 BNX2_HC_MSIX_BIT_VECTOR_VAL); 4495 BNX2_HC_MSIX_BIT_VECTOR_VAL);
4443 4496
4444 REG_WR(bp, BNX2_HC_SB_CONFIG_1, 4497 REG_WR(bp, base,
4445 BNX2_HC_SB_CONFIG_1_TX_TMR_MODE | 4498 BNX2_HC_SB_CONFIG_1_TX_TMR_MODE |
4446 BNX2_HC_SB_CONFIG_1_ONE_SHOT); 4499 BNX2_HC_SB_CONFIG_1_ONE_SHOT);
4447 4500
4448 REG_WR(bp, BNX2_HC_TX_QUICK_CONS_TRIP_1, 4501 REG_WR(bp, base + BNX2_HC_TX_QUICK_CONS_TRIP_OFF,
4449 (bp->tx_quick_cons_trip_int << 16) | 4502 (bp->tx_quick_cons_trip_int << 16) |
4450 bp->tx_quick_cons_trip); 4503 bp->tx_quick_cons_trip);
4451 4504
4452 REG_WR(bp, BNX2_HC_TX_TICKS_1, 4505 REG_WR(bp, base + BNX2_HC_TX_TICKS_OFF,
4453 (bp->tx_ticks_int << 16) | bp->tx_ticks); 4506 (bp->tx_ticks_int << 16) | bp->tx_ticks);
4454 4507
4455 val |= BNX2_HC_CONFIG_SB_ADDR_INC_128B; 4508 val |= BNX2_HC_CONFIG_SB_ADDR_INC_128B;
@@ -4509,6 +4562,7 @@ static void
4509bnx2_init_tx_context(struct bnx2 *bp, u32 cid) 4562bnx2_init_tx_context(struct bnx2 *bp, u32 cid)
4510{ 4563{
4511 u32 val, offset0, offset1, offset2, offset3; 4564 u32 val, offset0, offset1, offset2, offset3;
4565 u32 cid_addr = GET_CID_ADDR(cid);
4512 4566
4513 if (CHIP_NUM(bp) == CHIP_NUM_5709) { 4567 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
4514 offset0 = BNX2_L2CTX_TYPE_XI; 4568 offset0 = BNX2_L2CTX_TYPE_XI;
@@ -4522,16 +4576,16 @@ bnx2_init_tx_context(struct bnx2 *bp, u32 cid)
4522 offset3 = BNX2_L2CTX_TBDR_BHADDR_LO; 4576 offset3 = BNX2_L2CTX_TBDR_BHADDR_LO;
4523 } 4577 }
4524 val = BNX2_L2CTX_TYPE_TYPE_L2 | BNX2_L2CTX_TYPE_SIZE_L2; 4578 val = BNX2_L2CTX_TYPE_TYPE_L2 | BNX2_L2CTX_TYPE_SIZE_L2;
4525 CTX_WR(bp, GET_CID_ADDR(cid), offset0, val); 4579 bnx2_ctx_wr(bp, cid_addr, offset0, val);
4526 4580
4527 val = BNX2_L2CTX_CMD_TYPE_TYPE_L2 | (8 << 16); 4581 val = BNX2_L2CTX_CMD_TYPE_TYPE_L2 | (8 << 16);
4528 CTX_WR(bp, GET_CID_ADDR(cid), offset1, val); 4582 bnx2_ctx_wr(bp, cid_addr, offset1, val);
4529 4583
4530 val = (u64) bp->tx_desc_mapping >> 32; 4584 val = (u64) bp->tx_desc_mapping >> 32;
4531 CTX_WR(bp, GET_CID_ADDR(cid), offset2, val); 4585 bnx2_ctx_wr(bp, cid_addr, offset2, val);
4532 4586
4533 val = (u64) bp->tx_desc_mapping & 0xffffffff; 4587 val = (u64) bp->tx_desc_mapping & 0xffffffff;
4534 CTX_WR(bp, GET_CID_ADDR(cid), offset3, val); 4588 bnx2_ctx_wr(bp, cid_addr, offset3, val);
4535} 4589}
4536 4590
4537static void 4591static void
@@ -4601,36 +4655,38 @@ bnx2_init_rx_ring(struct bnx2 *bp)
4601 bnx2_init_rxbd_rings(bp->rx_desc_ring, bp->rx_desc_mapping, 4655 bnx2_init_rxbd_rings(bp->rx_desc_ring, bp->rx_desc_mapping,
4602 bp->rx_buf_use_size, bp->rx_max_ring); 4656 bp->rx_buf_use_size, bp->rx_max_ring);
4603 4657
4604 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, 0); 4658 bnx2_init_rx_context0(bp);
4659
4660 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
4661 val = REG_RD(bp, BNX2_MQ_MAP_L2_5);
4662 REG_WR(bp, BNX2_MQ_MAP_L2_5, val | BNX2_MQ_MAP_L2_5_ARM);
4663 }
4664
4665 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, 0);
4605 if (bp->rx_pg_ring_size) { 4666 if (bp->rx_pg_ring_size) {
4606 bnx2_init_rxbd_rings(bp->rx_pg_desc_ring, 4667 bnx2_init_rxbd_rings(bp->rx_pg_desc_ring,
4607 bp->rx_pg_desc_mapping, 4668 bp->rx_pg_desc_mapping,
4608 PAGE_SIZE, bp->rx_max_pg_ring); 4669 PAGE_SIZE, bp->rx_max_pg_ring);
4609 val = (bp->rx_buf_use_size << 16) | PAGE_SIZE; 4670 val = (bp->rx_buf_use_size << 16) | PAGE_SIZE;
4610 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, val); 4671 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, val);
4611 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_RBDC_KEY, 4672 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_RBDC_KEY,
4612 BNX2_L2CTX_RBDC_JUMBO_KEY); 4673 BNX2_L2CTX_RBDC_JUMBO_KEY);
4613 4674
4614 val = (u64) bp->rx_pg_desc_mapping[0] >> 32; 4675 val = (u64) bp->rx_pg_desc_mapping[0] >> 32;
4615 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_HI, val); 4676 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_HI, val);
4616 4677
4617 val = (u64) bp->rx_pg_desc_mapping[0] & 0xffffffff; 4678 val = (u64) bp->rx_pg_desc_mapping[0] & 0xffffffff;
4618 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_LO, val); 4679 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_LO, val);
4619 4680
4620 if (CHIP_NUM(bp) == CHIP_NUM_5709) 4681 if (CHIP_NUM(bp) == CHIP_NUM_5709)
4621 REG_WR(bp, BNX2_MQ_MAP_L2_3, BNX2_MQ_MAP_L2_3_DEFAULT); 4682 REG_WR(bp, BNX2_MQ_MAP_L2_3, BNX2_MQ_MAP_L2_3_DEFAULT);
4622 } 4683 }
4623 4684
4624 val = BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE;
4625 val |= BNX2_L2CTX_CTX_TYPE_SIZE_L2;
4626 val |= 0x02 << 8;
4627 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_CTX_TYPE, val);
4628
4629 val = (u64) bp->rx_desc_mapping[0] >> 32; 4685 val = (u64) bp->rx_desc_mapping[0] >> 32;
4630 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val); 4686 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val);
4631 4687
4632 val = (u64) bp->rx_desc_mapping[0] & 0xffffffff; 4688 val = (u64) bp->rx_desc_mapping[0] & 0xffffffff;
4633 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val); 4689 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val);
4634 4690
4635 ring_prod = prod = bnapi->rx_pg_prod; 4691 ring_prod = prod = bnapi->rx_pg_prod;
4636 for (i = 0; i < bp->rx_pg_ring_size; i++) { 4692 for (i = 0; i < bp->rx_pg_ring_size; i++) {
@@ -5003,9 +5059,9 @@ bnx2_do_mem_test(struct bnx2 *bp, u32 start, u32 size)
5003 5059
5004 for (offset = 0; offset < size; offset += 4) { 5060 for (offset = 0; offset < size; offset += 4) {
5005 5061
5006 REG_WR_IND(bp, start + offset, test_pattern[i]); 5062 bnx2_reg_wr_ind(bp, start + offset, test_pattern[i]);
5007 5063
5008 if (REG_RD_IND(bp, start + offset) != 5064 if (bnx2_reg_rd_ind(bp, start + offset) !=
5009 test_pattern[i]) { 5065 test_pattern[i]) {
5010 return -ENODEV; 5066 return -ENODEV;
5011 } 5067 }
@@ -5315,7 +5371,7 @@ bnx2_5706_serdes_has_link(struct bnx2 *bp)
5315 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg); 5371 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg);
5316 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg); 5372 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg);
5317 5373
5318 if (an_dbg & MISC_SHDW_AN_DBG_NOSYNC) 5374 if (an_dbg & (MISC_SHDW_AN_DBG_NOSYNC | MISC_SHDW_AN_DBG_RUDI_INVALID))
5319 return 0; 5375 return 0;
5320 5376
5321 bnx2_write_phy(bp, MII_BNX2_DSP_ADDRESS, MII_EXPAND_REG1); 5377 bnx2_write_phy(bp, MII_BNX2_DSP_ADDRESS, MII_EXPAND_REG1);
@@ -5440,7 +5496,8 @@ bnx2_timer(unsigned long data)
5440 5496
5441 bnx2_send_heart_beat(bp); 5497 bnx2_send_heart_beat(bp);
5442 5498
5443 bp->stats_blk->stat_FwRxDrop = REG_RD_IND(bp, BNX2_FW_RX_DROP_COUNT); 5499 bp->stats_blk->stat_FwRxDrop =
5500 bnx2_reg_rd_ind(bp, BNX2_FW_RX_DROP_COUNT);
5444 5501
5445 /* workaround occasional corrupted counters */ 5502 /* workaround occasional corrupted counters */
5446 if (CHIP_NUM(bp) == CHIP_NUM_5708 && bp->stats_ticks) 5503 if (CHIP_NUM(bp) == CHIP_NUM_5708 && bp->stats_ticks)
@@ -7155,20 +7212,20 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7155 7212
7156 bnx2_init_nvram(bp); 7213 bnx2_init_nvram(bp);
7157 7214
7158 reg = REG_RD_IND(bp, BNX2_SHM_HDR_SIGNATURE); 7215 reg = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_SIGNATURE);
7159 7216
7160 if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) == 7217 if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) ==
7161 BNX2_SHM_HDR_SIGNATURE_SIG) { 7218 BNX2_SHM_HDR_SIGNATURE_SIG) {
7162 u32 off = PCI_FUNC(pdev->devfn) << 2; 7219 u32 off = PCI_FUNC(pdev->devfn) << 2;
7163 7220
7164 bp->shmem_base = REG_RD_IND(bp, BNX2_SHM_HDR_ADDR_0 + off); 7221 bp->shmem_base = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_ADDR_0 + off);
7165 } else 7222 } else
7166 bp->shmem_base = HOST_VIEW_SHMEM_BASE; 7223 bp->shmem_base = HOST_VIEW_SHMEM_BASE;
7167 7224
7168 /* Get the permanent MAC address. First we need to make sure the 7225 /* Get the permanent MAC address. First we need to make sure the
7169 * firmware is actually running. 7226 * firmware is actually running.
7170 */ 7227 */
7171 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_DEV_INFO_SIGNATURE); 7228 reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_SIGNATURE);
7172 7229
7173 if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) != 7230 if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) !=
7174 BNX2_DEV_INFO_SIGNATURE_MAGIC) { 7231 BNX2_DEV_INFO_SIGNATURE_MAGIC) {
@@ -7177,7 +7234,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7177 goto err_out_unmap; 7234 goto err_out_unmap;
7178 } 7235 }
7179 7236
7180 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_DEV_INFO_BC_REV); 7237 reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_BC_REV);
7181 for (i = 0, j = 0; i < 3; i++) { 7238 for (i = 0, j = 0; i < 3; i++) {
7182 u8 num, k, skip0; 7239 u8 num, k, skip0;
7183 7240
@@ -7191,7 +7248,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7191 if (i != 2) 7248 if (i != 2)
7192 bp->fw_version[j++] = '.'; 7249 bp->fw_version[j++] = '.';
7193 } 7250 }
7194 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_FEATURE); 7251 reg = bnx2_shmem_rd(bp, BNX2_PORT_FEATURE);
7195 if (reg & BNX2_PORT_FEATURE_WOL_ENABLED) 7252 if (reg & BNX2_PORT_FEATURE_WOL_ENABLED)
7196 bp->wol = 1; 7253 bp->wol = 1;
7197 7254
@@ -7199,34 +7256,33 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7199 bp->flags |= BNX2_FLAG_ASF_ENABLE; 7256 bp->flags |= BNX2_FLAG_ASF_ENABLE;
7200 7257
7201 for (i = 0; i < 30; i++) { 7258 for (i = 0; i < 30; i++) {
7202 reg = REG_RD_IND(bp, bp->shmem_base + 7259 reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION);
7203 BNX2_BC_STATE_CONDITION);
7204 if (reg & BNX2_CONDITION_MFW_RUN_MASK) 7260 if (reg & BNX2_CONDITION_MFW_RUN_MASK)
7205 break; 7261 break;
7206 msleep(10); 7262 msleep(10);
7207 } 7263 }
7208 } 7264 }
7209 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_BC_STATE_CONDITION); 7265 reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION);
7210 reg &= BNX2_CONDITION_MFW_RUN_MASK; 7266 reg &= BNX2_CONDITION_MFW_RUN_MASK;
7211 if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN && 7267 if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN &&
7212 reg != BNX2_CONDITION_MFW_RUN_NONE) { 7268 reg != BNX2_CONDITION_MFW_RUN_NONE) {
7213 int i; 7269 int i;
7214 u32 addr = REG_RD_IND(bp, bp->shmem_base + BNX2_MFW_VER_PTR); 7270 u32 addr = bnx2_shmem_rd(bp, BNX2_MFW_VER_PTR);
7215 7271
7216 bp->fw_version[j++] = ' '; 7272 bp->fw_version[j++] = ' ';
7217 for (i = 0; i < 3; i++) { 7273 for (i = 0; i < 3; i++) {
7218 reg = REG_RD_IND(bp, addr + i * 4); 7274 reg = bnx2_reg_rd_ind(bp, addr + i * 4);
7219 reg = swab32(reg); 7275 reg = swab32(reg);
7220 memcpy(&bp->fw_version[j], &reg, 4); 7276 memcpy(&bp->fw_version[j], &reg, 4);
7221 j += 4; 7277 j += 4;
7222 } 7278 }
7223 } 7279 }
7224 7280
7225 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_MAC_UPPER); 7281 reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_UPPER);
7226 bp->mac_addr[0] = (u8) (reg >> 8); 7282 bp->mac_addr[0] = (u8) (reg >> 8);
7227 bp->mac_addr[1] = (u8) reg; 7283 bp->mac_addr[1] = (u8) reg;
7228 7284
7229 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_MAC_LOWER); 7285 reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_LOWER);
7230 bp->mac_addr[2] = (u8) (reg >> 24); 7286 bp->mac_addr[2] = (u8) (reg >> 24);
7231 bp->mac_addr[3] = (u8) (reg >> 16); 7287 bp->mac_addr[3] = (u8) (reg >> 16);
7232 bp->mac_addr[4] = (u8) (reg >> 8); 7288 bp->mac_addr[4] = (u8) (reg >> 8);
@@ -7265,8 +7321,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7265 bp->phy_port = PORT_TP; 7321 bp->phy_port = PORT_TP;
7266 if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) { 7322 if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) {
7267 bp->phy_port = PORT_FIBRE; 7323 bp->phy_port = PORT_FIBRE;
7268 reg = REG_RD_IND(bp, bp->shmem_base + 7324 reg = bnx2_shmem_rd(bp, BNX2_SHARED_HW_CFG_CONFIG);
7269 BNX2_SHARED_HW_CFG_CONFIG);
7270 if (!(reg & BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX)) { 7325 if (!(reg & BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX)) {
7271 bp->flags |= BNX2_FLAG_NO_WOL; 7326 bp->flags |= BNX2_FLAG_NO_WOL;
7272 bp->wol = 0; 7327 bp->wol = 0;