diff options
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r-- | drivers/net/bnx2x_main.c | 343 |
1 files changed, 281 insertions, 62 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index ad5ef25add3e..cdc80e0820cd 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -53,12 +53,19 @@ | |||
53 | 53 | ||
54 | #include "bnx2x.h" | 54 | #include "bnx2x.h" |
55 | #include "bnx2x_init.h" | 55 | #include "bnx2x_init.h" |
56 | #include "bnx2x_init_ops.h" | ||
56 | #include "bnx2x_dump.h" | 57 | #include "bnx2x_dump.h" |
57 | 58 | ||
58 | #define DRV_MODULE_VERSION "1.48.105" | 59 | #define DRV_MODULE_VERSION "1.48.105" |
59 | #define DRV_MODULE_RELDATE "2009/03/02" | 60 | #define DRV_MODULE_RELDATE "2009/03/02" |
60 | #define BNX2X_BC_VER 0x040200 | 61 | #define BNX2X_BC_VER 0x040200 |
61 | 62 | ||
63 | #include <linux/firmware.h> | ||
64 | #include "bnx2x_fw_file_hdr.h" | ||
65 | /* FW files */ | ||
66 | #define FW_FILE_PREFIX_E1 "bnx2x-e1-" | ||
67 | #define FW_FILE_PREFIX_E1H "bnx2x-e1h-" | ||
68 | |||
62 | /* Time in jiffies before concluding the transmitter is hung */ | 69 | /* Time in jiffies before concluding the transmitter is hung */ |
63 | #define TX_TIMEOUT (5*HZ) | 70 | #define TX_TIMEOUT (5*HZ) |
64 | 71 | ||
@@ -5232,13 +5239,15 @@ static void bnx2x_gunzip_end(struct bnx2x *bp) | |||
5232 | } | 5239 | } |
5233 | } | 5240 | } |
5234 | 5241 | ||
5235 | static int bnx2x_gunzip(struct bnx2x *bp, u8 *zbuf, int len) | 5242 | static int bnx2x_gunzip(struct bnx2x *bp, const u8 *zbuf, int len) |
5236 | { | 5243 | { |
5237 | int n, rc; | 5244 | int n, rc; |
5238 | 5245 | ||
5239 | /* check gzip header */ | 5246 | /* check gzip header */ |
5240 | if ((zbuf[0] != 0x1f) || (zbuf[1] != 0x8b) || (zbuf[2] != Z_DEFLATED)) | 5247 | if ((zbuf[0] != 0x1f) || (zbuf[1] != 0x8b) || (zbuf[2] != Z_DEFLATED)) { |
5248 | BNX2X_ERR("Bad gzip header\n"); | ||
5241 | return -EINVAL; | 5249 | return -EINVAL; |
5250 | } | ||
5242 | 5251 | ||
5243 | n = 10; | 5252 | n = 10; |
5244 | 5253 | ||
@@ -5247,7 +5256,7 @@ static int bnx2x_gunzip(struct bnx2x *bp, u8 *zbuf, int len) | |||
5247 | if (zbuf[3] & FNAME) | 5256 | if (zbuf[3] & FNAME) |
5248 | while ((zbuf[n++] != 0) && (n < len)); | 5257 | while ((zbuf[n++] != 0) && (n < len)); |
5249 | 5258 | ||
5250 | bp->strm->next_in = zbuf + n; | 5259 | bp->strm->next_in = (typeof(bp->strm->next_in))zbuf + n; |
5251 | bp->strm->avail_in = len - n; | 5260 | bp->strm->avail_in = len - n; |
5252 | bp->strm->next_out = bp->gunzip_buf; | 5261 | bp->strm->next_out = bp->gunzip_buf; |
5253 | bp->strm->avail_out = FW_BUF_SIZE; | 5262 | bp->strm->avail_out = FW_BUF_SIZE; |
@@ -5369,8 +5378,8 @@ static int bnx2x_int_mem_test(struct bnx2x *bp) | |||
5369 | msleep(50); | 5378 | msleep(50); |
5370 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0x03); | 5379 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0x03); |
5371 | msleep(50); | 5380 | msleep(50); |
5372 | bnx2x_init_block(bp, BRB1_COMMON_START, BRB1_COMMON_END); | 5381 | bnx2x_init_block(bp, BRB1_BLOCK, COMMON_STAGE); |
5373 | bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END); | 5382 | bnx2x_init_block(bp, PRS_BLOCK, COMMON_STAGE); |
5374 | 5383 | ||
5375 | DP(NETIF_MSG_HW, "part2\n"); | 5384 | DP(NETIF_MSG_HW, "part2\n"); |
5376 | 5385 | ||
@@ -5434,8 +5443,8 @@ static int bnx2x_int_mem_test(struct bnx2x *bp) | |||
5434 | msleep(50); | 5443 | msleep(50); |
5435 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0x03); | 5444 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0x03); |
5436 | msleep(50); | 5445 | msleep(50); |
5437 | bnx2x_init_block(bp, BRB1_COMMON_START, BRB1_COMMON_END); | 5446 | bnx2x_init_block(bp, BRB1_BLOCK, COMMON_STAGE); |
5438 | bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END); | 5447 | bnx2x_init_block(bp, PRS_BLOCK, COMMON_STAGE); |
5439 | #ifndef BCM_ISCSI | 5448 | #ifndef BCM_ISCSI |
5440 | /* set NIC mode */ | 5449 | /* set NIC mode */ |
5441 | REG_WR(bp, PRS_REG_NIC_MODE, 1); | 5450 | REG_WR(bp, PRS_REG_NIC_MODE, 1); |
@@ -5510,7 +5519,7 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5510 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff); | 5519 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff); |
5511 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, 0xfffc); | 5520 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, 0xfffc); |
5512 | 5521 | ||
5513 | bnx2x_init_block(bp, MISC_COMMON_START, MISC_COMMON_END); | 5522 | bnx2x_init_block(bp, MISC_BLOCK, COMMON_STAGE); |
5514 | if (CHIP_IS_E1H(bp)) | 5523 | if (CHIP_IS_E1H(bp)) |
5515 | REG_WR(bp, MISC_REG_E1HMF_MODE, IS_E1HMF(bp)); | 5524 | REG_WR(bp, MISC_REG_E1HMF_MODE, IS_E1HMF(bp)); |
5516 | 5525 | ||
@@ -5518,14 +5527,14 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5518 | msleep(30); | 5527 | msleep(30); |
5519 | REG_WR(bp, MISC_REG_LCPLL_CTRL_REG_2, 0x0); | 5528 | REG_WR(bp, MISC_REG_LCPLL_CTRL_REG_2, 0x0); |
5520 | 5529 | ||
5521 | bnx2x_init_block(bp, PXP_COMMON_START, PXP_COMMON_END); | 5530 | bnx2x_init_block(bp, PXP_BLOCK, COMMON_STAGE); |
5522 | if (CHIP_IS_E1(bp)) { | 5531 | if (CHIP_IS_E1(bp)) { |
5523 | /* enable HW interrupt from PXP on USDM overflow | 5532 | /* enable HW interrupt from PXP on USDM overflow |
5524 | bit 16 on INT_MASK_0 */ | 5533 | bit 16 on INT_MASK_0 */ |
5525 | REG_WR(bp, PXP_REG_PXP_INT_MASK_0, 0); | 5534 | REG_WR(bp, PXP_REG_PXP_INT_MASK_0, 0); |
5526 | } | 5535 | } |
5527 | 5536 | ||
5528 | bnx2x_init_block(bp, PXP2_COMMON_START, PXP2_COMMON_END); | 5537 | bnx2x_init_block(bp, PXP2_BLOCK, COMMON_STAGE); |
5529 | bnx2x_init_pxp(bp); | 5538 | bnx2x_init_pxp(bp); |
5530 | 5539 | ||
5531 | #ifdef __BIG_ENDIAN | 5540 | #ifdef __BIG_ENDIAN |
@@ -5571,60 +5580,60 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5571 | REG_WR(bp, PXP2_REG_RQ_DISABLE_INPUTS, 0); | 5580 | REG_WR(bp, PXP2_REG_RQ_DISABLE_INPUTS, 0); |
5572 | REG_WR(bp, PXP2_REG_RD_DISABLE_INPUTS, 0); | 5581 | REG_WR(bp, PXP2_REG_RD_DISABLE_INPUTS, 0); |
5573 | 5582 | ||
5574 | bnx2x_init_block(bp, DMAE_COMMON_START, DMAE_COMMON_END); | 5583 | bnx2x_init_block(bp, DMAE_BLOCK, COMMON_STAGE); |
5575 | 5584 | ||
5576 | /* clean the DMAE memory */ | 5585 | /* clean the DMAE memory */ |
5577 | bp->dmae_ready = 1; | 5586 | bp->dmae_ready = 1; |
5578 | bnx2x_init_fill(bp, TSEM_REG_PRAM, 0, 8); | 5587 | bnx2x_init_fill(bp, TSEM_REG_PRAM, 0, 8); |
5579 | 5588 | ||
5580 | bnx2x_init_block(bp, TCM_COMMON_START, TCM_COMMON_END); | 5589 | bnx2x_init_block(bp, TCM_BLOCK, COMMON_STAGE); |
5581 | bnx2x_init_block(bp, UCM_COMMON_START, UCM_COMMON_END); | 5590 | bnx2x_init_block(bp, UCM_BLOCK, COMMON_STAGE); |
5582 | bnx2x_init_block(bp, CCM_COMMON_START, CCM_COMMON_END); | 5591 | bnx2x_init_block(bp, CCM_BLOCK, COMMON_STAGE); |
5583 | bnx2x_init_block(bp, XCM_COMMON_START, XCM_COMMON_END); | 5592 | bnx2x_init_block(bp, XCM_BLOCK, COMMON_STAGE); |
5584 | 5593 | ||
5585 | bnx2x_read_dmae(bp, XSEM_REG_PASSIVE_BUFFER, 3); | 5594 | bnx2x_read_dmae(bp, XSEM_REG_PASSIVE_BUFFER, 3); |
5586 | bnx2x_read_dmae(bp, CSEM_REG_PASSIVE_BUFFER, 3); | 5595 | bnx2x_read_dmae(bp, CSEM_REG_PASSIVE_BUFFER, 3); |
5587 | bnx2x_read_dmae(bp, TSEM_REG_PASSIVE_BUFFER, 3); | 5596 | bnx2x_read_dmae(bp, TSEM_REG_PASSIVE_BUFFER, 3); |
5588 | bnx2x_read_dmae(bp, USEM_REG_PASSIVE_BUFFER, 3); | 5597 | bnx2x_read_dmae(bp, USEM_REG_PASSIVE_BUFFER, 3); |
5589 | 5598 | ||
5590 | bnx2x_init_block(bp, QM_COMMON_START, QM_COMMON_END); | 5599 | bnx2x_init_block(bp, QM_BLOCK, COMMON_STAGE); |
5591 | /* soft reset pulse */ | 5600 | /* soft reset pulse */ |
5592 | REG_WR(bp, QM_REG_SOFT_RESET, 1); | 5601 | REG_WR(bp, QM_REG_SOFT_RESET, 1); |
5593 | REG_WR(bp, QM_REG_SOFT_RESET, 0); | 5602 | REG_WR(bp, QM_REG_SOFT_RESET, 0); |
5594 | 5603 | ||
5595 | #ifdef BCM_ISCSI | 5604 | #ifdef BCM_ISCSI |
5596 | bnx2x_init_block(bp, TIMERS_COMMON_START, TIMERS_COMMON_END); | 5605 | bnx2x_init_block(bp, TIMERS_BLOCK, COMMON_STAGE); |
5597 | #endif | 5606 | #endif |
5598 | 5607 | ||
5599 | bnx2x_init_block(bp, DQ_COMMON_START, DQ_COMMON_END); | 5608 | bnx2x_init_block(bp, DQ_BLOCK, COMMON_STAGE); |
5600 | REG_WR(bp, DORQ_REG_DPM_CID_OFST, BCM_PAGE_SHIFT); | 5609 | REG_WR(bp, DORQ_REG_DPM_CID_OFST, BCM_PAGE_SHIFT); |
5601 | if (!CHIP_REV_IS_SLOW(bp)) { | 5610 | if (!CHIP_REV_IS_SLOW(bp)) { |
5602 | /* enable hw interrupt from doorbell Q */ | 5611 | /* enable hw interrupt from doorbell Q */ |
5603 | REG_WR(bp, DORQ_REG_DORQ_INT_MASK, 0); | 5612 | REG_WR(bp, DORQ_REG_DORQ_INT_MASK, 0); |
5604 | } | 5613 | } |
5605 | 5614 | ||
5606 | bnx2x_init_block(bp, BRB1_COMMON_START, BRB1_COMMON_END); | 5615 | bnx2x_init_block(bp, BRB1_BLOCK, COMMON_STAGE); |
5607 | bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END); | 5616 | bnx2x_init_block(bp, PRS_BLOCK, COMMON_STAGE); |
5608 | REG_WR(bp, PRS_REG_A_PRSU_20, 0xf); | 5617 | REG_WR(bp, PRS_REG_A_PRSU_20, 0xf); |
5609 | /* set NIC mode */ | 5618 | /* set NIC mode */ |
5610 | REG_WR(bp, PRS_REG_NIC_MODE, 1); | 5619 | REG_WR(bp, PRS_REG_NIC_MODE, 1); |
5611 | if (CHIP_IS_E1H(bp)) | 5620 | if (CHIP_IS_E1H(bp)) |
5612 | REG_WR(bp, PRS_REG_E1HOV_MODE, IS_E1HMF(bp)); | 5621 | REG_WR(bp, PRS_REG_E1HOV_MODE, IS_E1HMF(bp)); |
5613 | 5622 | ||
5614 | bnx2x_init_block(bp, TSDM_COMMON_START, TSDM_COMMON_END); | 5623 | bnx2x_init_block(bp, TSDM_BLOCK, COMMON_STAGE); |
5615 | bnx2x_init_block(bp, CSDM_COMMON_START, CSDM_COMMON_END); | 5624 | bnx2x_init_block(bp, CSDM_BLOCK, COMMON_STAGE); |
5616 | bnx2x_init_block(bp, USDM_COMMON_START, USDM_COMMON_END); | 5625 | bnx2x_init_block(bp, USDM_BLOCK, COMMON_STAGE); |
5617 | bnx2x_init_block(bp, XSDM_COMMON_START, XSDM_COMMON_END); | 5626 | bnx2x_init_block(bp, XSDM_BLOCK, COMMON_STAGE); |
5618 | 5627 | ||
5619 | bnx2x_init_fill(bp, TSTORM_INTMEM_ADDR, 0, STORM_INTMEM_SIZE(bp)); | 5628 | bnx2x_init_fill(bp, TSTORM_INTMEM_ADDR, 0, STORM_INTMEM_SIZE(bp)); |
5620 | bnx2x_init_fill(bp, USTORM_INTMEM_ADDR, 0, STORM_INTMEM_SIZE(bp)); | 5629 | bnx2x_init_fill(bp, USTORM_INTMEM_ADDR, 0, STORM_INTMEM_SIZE(bp)); |
5621 | bnx2x_init_fill(bp, CSTORM_INTMEM_ADDR, 0, STORM_INTMEM_SIZE(bp)); | 5630 | bnx2x_init_fill(bp, CSTORM_INTMEM_ADDR, 0, STORM_INTMEM_SIZE(bp)); |
5622 | bnx2x_init_fill(bp, XSTORM_INTMEM_ADDR, 0, STORM_INTMEM_SIZE(bp)); | 5631 | bnx2x_init_fill(bp, XSTORM_INTMEM_ADDR, 0, STORM_INTMEM_SIZE(bp)); |
5623 | 5632 | ||
5624 | bnx2x_init_block(bp, TSEM_COMMON_START, TSEM_COMMON_END); | 5633 | bnx2x_init_block(bp, TSEM_BLOCK, COMMON_STAGE); |
5625 | bnx2x_init_block(bp, USEM_COMMON_START, USEM_COMMON_END); | 5634 | bnx2x_init_block(bp, USEM_BLOCK, COMMON_STAGE); |
5626 | bnx2x_init_block(bp, CSEM_COMMON_START, CSEM_COMMON_END); | 5635 | bnx2x_init_block(bp, CSEM_BLOCK, COMMON_STAGE); |
5627 | bnx2x_init_block(bp, XSEM_COMMON_START, XSEM_COMMON_END); | 5636 | bnx2x_init_block(bp, XSEM_BLOCK, COMMON_STAGE); |
5628 | 5637 | ||
5629 | /* sync semi rtc */ | 5638 | /* sync semi rtc */ |
5630 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR, | 5639 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR, |
@@ -5632,16 +5641,16 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5632 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, | 5641 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, |
5633 | 0x80000000); | 5642 | 0x80000000); |
5634 | 5643 | ||
5635 | bnx2x_init_block(bp, UPB_COMMON_START, UPB_COMMON_END); | 5644 | bnx2x_init_block(bp, UPB_BLOCK, COMMON_STAGE); |
5636 | bnx2x_init_block(bp, XPB_COMMON_START, XPB_COMMON_END); | 5645 | bnx2x_init_block(bp, XPB_BLOCK, COMMON_STAGE); |
5637 | bnx2x_init_block(bp, PBF_COMMON_START, PBF_COMMON_END); | 5646 | bnx2x_init_block(bp, PBF_BLOCK, COMMON_STAGE); |
5638 | 5647 | ||
5639 | REG_WR(bp, SRC_REG_SOFT_RST, 1); | 5648 | REG_WR(bp, SRC_REG_SOFT_RST, 1); |
5640 | for (i = SRC_REG_KEYRSS0_0; i <= SRC_REG_KEYRSS1_9; i += 4) { | 5649 | for (i = SRC_REG_KEYRSS0_0; i <= SRC_REG_KEYRSS1_9; i += 4) { |
5641 | REG_WR(bp, i, 0xc0cac01a); | 5650 | REG_WR(bp, i, 0xc0cac01a); |
5642 | /* TODO: replace with something meaningful */ | 5651 | /* TODO: replace with something meaningful */ |
5643 | } | 5652 | } |
5644 | bnx2x_init_block(bp, SRCH_COMMON_START, SRCH_COMMON_END); | 5653 | bnx2x_init_block(bp, SRCH_BLOCK, COMMON_STAGE); |
5645 | REG_WR(bp, SRC_REG_SOFT_RST, 0); | 5654 | REG_WR(bp, SRC_REG_SOFT_RST, 0); |
5646 | 5655 | ||
5647 | if (sizeof(union cdu_context) != 1024) | 5656 | if (sizeof(union cdu_context) != 1024) |
@@ -5649,7 +5658,7 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5649 | printk(KERN_ALERT PFX "please adjust the size of" | 5658 | printk(KERN_ALERT PFX "please adjust the size of" |
5650 | " cdu_context(%ld)\n", (long)sizeof(union cdu_context)); | 5659 | " cdu_context(%ld)\n", (long)sizeof(union cdu_context)); |
5651 | 5660 | ||
5652 | bnx2x_init_block(bp, CDU_COMMON_START, CDU_COMMON_END); | 5661 | bnx2x_init_block(bp, CDU_BLOCK, COMMON_STAGE); |
5653 | val = (4 << 24) + (0 << 12) + 1024; | 5662 | val = (4 << 24) + (0 << 12) + 1024; |
5654 | REG_WR(bp, CDU_REG_CDU_GLOBAL_PARAMS, val); | 5663 | REG_WR(bp, CDU_REG_CDU_GLOBAL_PARAMS, val); |
5655 | if (CHIP_IS_E1(bp)) { | 5664 | if (CHIP_IS_E1(bp)) { |
@@ -5658,7 +5667,7 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5658 | REG_WR(bp, CDU_REG_CDU_DEBUG, 0); | 5667 | REG_WR(bp, CDU_REG_CDU_DEBUG, 0); |
5659 | } | 5668 | } |
5660 | 5669 | ||
5661 | bnx2x_init_block(bp, CFC_COMMON_START, CFC_COMMON_END); | 5670 | bnx2x_init_block(bp, CFC_BLOCK, COMMON_STAGE); |
5662 | REG_WR(bp, CFC_REG_INIT_REG, 0x7FF); | 5671 | REG_WR(bp, CFC_REG_INIT_REG, 0x7FF); |
5663 | /* enable context validation interrupt from CFC */ | 5672 | /* enable context validation interrupt from CFC */ |
5664 | REG_WR(bp, CFC_REG_CFC_INT_MASK, 0); | 5673 | REG_WR(bp, CFC_REG_CFC_INT_MASK, 0); |
@@ -5666,20 +5675,25 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5666 | /* set the thresholds to prevent CFC/CDU race */ | 5675 | /* set the thresholds to prevent CFC/CDU race */ |
5667 | REG_WR(bp, CFC_REG_DEBUG0, 0x20020000); | 5676 | REG_WR(bp, CFC_REG_DEBUG0, 0x20020000); |
5668 | 5677 | ||
5669 | bnx2x_init_block(bp, HC_COMMON_START, HC_COMMON_END); | 5678 | bnx2x_init_block(bp, HC_BLOCK, COMMON_STAGE); |
5670 | bnx2x_init_block(bp, MISC_AEU_COMMON_START, MISC_AEU_COMMON_END); | 5679 | bnx2x_init_block(bp, MISC_AEU_BLOCK, COMMON_STAGE); |
5671 | 5680 | ||
5672 | /* PXPCS COMMON comes here */ | 5681 | /* PXPCS COMMON comes here */ |
5682 | bnx2x_init_block(bp, PXPCS_BLOCK, COMMON_STAGE); | ||
5673 | /* Reset PCIE errors for debug */ | 5683 | /* Reset PCIE errors for debug */ |
5674 | REG_WR(bp, 0x2814, 0xffffffff); | 5684 | REG_WR(bp, 0x2814, 0xffffffff); |
5675 | REG_WR(bp, 0x3820, 0xffffffff); | 5685 | REG_WR(bp, 0x3820, 0xffffffff); |
5676 | 5686 | ||
5677 | /* EMAC0 COMMON comes here */ | 5687 | /* EMAC0 COMMON comes here */ |
5688 | bnx2x_init_block(bp, EMAC0_BLOCK, COMMON_STAGE); | ||
5678 | /* EMAC1 COMMON comes here */ | 5689 | /* EMAC1 COMMON comes here */ |
5690 | bnx2x_init_block(bp, EMAC1_BLOCK, COMMON_STAGE); | ||
5679 | /* DBU COMMON comes here */ | 5691 | /* DBU COMMON comes here */ |
5692 | bnx2x_init_block(bp, DBU_BLOCK, COMMON_STAGE); | ||
5680 | /* DBG COMMON comes here */ | 5693 | /* DBG COMMON comes here */ |
5694 | bnx2x_init_block(bp, DBG_BLOCK, COMMON_STAGE); | ||
5681 | 5695 | ||
5682 | bnx2x_init_block(bp, NIG_COMMON_START, NIG_COMMON_END); | 5696 | bnx2x_init_block(bp, NIG_BLOCK, COMMON_STAGE); |
5683 | if (CHIP_IS_E1H(bp)) { | 5697 | if (CHIP_IS_E1H(bp)) { |
5684 | REG_WR(bp, NIG_REG_LLH_MF_MODE, IS_E1HMF(bp)); | 5698 | REG_WR(bp, NIG_REG_LLH_MF_MODE, IS_E1HMF(bp)); |
5685 | REG_WR(bp, NIG_REG_LLH_E1HOV_MODE, IS_E1HMF(bp)); | 5699 | REG_WR(bp, NIG_REG_LLH_E1HOV_MODE, IS_E1HMF(bp)); |
@@ -5763,6 +5777,7 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5763 | static int bnx2x_init_port(struct bnx2x *bp) | 5777 | static int bnx2x_init_port(struct bnx2x *bp) |
5764 | { | 5778 | { |
5765 | int port = BP_PORT(bp); | 5779 | int port = BP_PORT(bp); |
5780 | int init_stage = port ? PORT1_STAGE : PORT0_STAGE; | ||
5766 | u32 low, high; | 5781 | u32 low, high; |
5767 | u32 val; | 5782 | u32 val; |
5768 | 5783 | ||
@@ -5771,7 +5786,9 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
5771 | REG_WR(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 0); | 5786 | REG_WR(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 0); |
5772 | 5787 | ||
5773 | /* Port PXP comes here */ | 5788 | /* Port PXP comes here */ |
5789 | bnx2x_init_block(bp, PXP_BLOCK, init_stage); | ||
5774 | /* Port PXP2 comes here */ | 5790 | /* Port PXP2 comes here */ |
5791 | bnx2x_init_block(bp, PXP2_BLOCK, init_stage); | ||
5775 | #ifdef BCM_ISCSI | 5792 | #ifdef BCM_ISCSI |
5776 | /* Port0 1 | 5793 | /* Port0 1 |
5777 | * Port1 385 */ | 5794 | * Port1 385 */ |
@@ -5798,21 +5815,19 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
5798 | REG_WR(bp, PXP2_REG_PSWRQ_SRC0_L2P + func*4, PXP_ONE_ILT(i)); | 5815 | REG_WR(bp, PXP2_REG_PSWRQ_SRC0_L2P + func*4, PXP_ONE_ILT(i)); |
5799 | #endif | 5816 | #endif |
5800 | /* Port CMs come here */ | 5817 | /* Port CMs come here */ |
5801 | bnx2x_init_block(bp, (port ? XCM_PORT1_START : XCM_PORT0_START), | 5818 | bnx2x_init_block(bp, XCM_BLOCK, init_stage); |
5802 | (port ? XCM_PORT1_END : XCM_PORT0_END)); | ||
5803 | 5819 | ||
5804 | /* Port QM comes here */ | 5820 | /* Port QM comes here */ |
5805 | #ifdef BCM_ISCSI | 5821 | #ifdef BCM_ISCSI |
5806 | REG_WR(bp, TM_REG_LIN0_SCAN_TIME + func*4, 1024/64*20); | 5822 | REG_WR(bp, TM_REG_LIN0_SCAN_TIME + func*4, 1024/64*20); |
5807 | REG_WR(bp, TM_REG_LIN0_MAX_ACTIVE_CID + func*4, 31); | 5823 | REG_WR(bp, TM_REG_LIN0_MAX_ACTIVE_CID + func*4, 31); |
5808 | 5824 | ||
5809 | bnx2x_init_block(bp, func ? TIMERS_PORT1_START : TIMERS_PORT0_START, | 5825 | bnx2x_init_block(bp, TIMERS_BLOCK, init_stage); |
5810 | func ? TIMERS_PORT1_END : TIMERS_PORT0_END); | ||
5811 | #endif | 5826 | #endif |
5812 | /* Port DQ comes here */ | 5827 | /* Port DQ comes here */ |
5828 | bnx2x_init_block(bp, DQ_BLOCK, init_stage); | ||
5813 | 5829 | ||
5814 | bnx2x_init_block(bp, (port ? BRB1_PORT1_START : BRB1_PORT0_START), | 5830 | bnx2x_init_block(bp, BRB1_BLOCK, init_stage); |
5815 | (port ? BRB1_PORT1_END : BRB1_PORT0_END)); | ||
5816 | if (CHIP_REV_IS_SLOW(bp) && !CHIP_IS_E1H(bp)) { | 5831 | if (CHIP_REV_IS_SLOW(bp) && !CHIP_IS_E1H(bp)) { |
5817 | /* no pause for emulation and FPGA */ | 5832 | /* no pause for emulation and FPGA */ |
5818 | low = 0; | 5833 | low = 0; |
@@ -5837,25 +5852,27 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
5837 | 5852 | ||
5838 | 5853 | ||
5839 | /* Port PRS comes here */ | 5854 | /* Port PRS comes here */ |
5855 | bnx2x_init_block(bp, PRS_BLOCK, init_stage); | ||
5840 | /* Port TSDM comes here */ | 5856 | /* Port TSDM comes here */ |
5857 | bnx2x_init_block(bp, TSDM_BLOCK, init_stage); | ||
5841 | /* Port CSDM comes here */ | 5858 | /* Port CSDM comes here */ |
5859 | bnx2x_init_block(bp, CSDM_BLOCK, init_stage); | ||
5842 | /* Port USDM comes here */ | 5860 | /* Port USDM comes here */ |
5861 | bnx2x_init_block(bp, USDM_BLOCK, init_stage); | ||
5843 | /* Port XSDM comes here */ | 5862 | /* Port XSDM comes here */ |
5863 | bnx2x_init_block(bp, XSDM_BLOCK, init_stage); | ||
5844 | 5864 | ||
5845 | bnx2x_init_block(bp, port ? TSEM_PORT1_START : TSEM_PORT0_START, | 5865 | bnx2x_init_block(bp, TSEM_BLOCK, init_stage); |
5846 | port ? TSEM_PORT1_END : TSEM_PORT0_END); | 5866 | bnx2x_init_block(bp, USEM_BLOCK, init_stage); |
5847 | bnx2x_init_block(bp, port ? USEM_PORT1_START : USEM_PORT0_START, | 5867 | bnx2x_init_block(bp, CSEM_BLOCK, init_stage); |
5848 | port ? USEM_PORT1_END : USEM_PORT0_END); | 5868 | bnx2x_init_block(bp, XSEM_BLOCK, init_stage); |
5849 | bnx2x_init_block(bp, port ? CSEM_PORT1_START : CSEM_PORT0_START, | ||
5850 | port ? CSEM_PORT1_END : CSEM_PORT0_END); | ||
5851 | bnx2x_init_block(bp, port ? XSEM_PORT1_START : XSEM_PORT0_START, | ||
5852 | port ? XSEM_PORT1_END : XSEM_PORT0_END); | ||
5853 | 5869 | ||
5854 | /* Port UPB comes here */ | 5870 | /* Port UPB comes here */ |
5871 | bnx2x_init_block(bp, UPB_BLOCK, init_stage); | ||
5855 | /* Port XPB comes here */ | 5872 | /* Port XPB comes here */ |
5873 | bnx2x_init_block(bp, XPB_BLOCK, init_stage); | ||
5856 | 5874 | ||
5857 | bnx2x_init_block(bp, port ? PBF_PORT1_START : PBF_PORT0_START, | 5875 | bnx2x_init_block(bp, PBF_BLOCK, init_stage); |
5858 | port ? PBF_PORT1_END : PBF_PORT0_END); | ||
5859 | 5876 | ||
5860 | /* configure PBF to work without PAUSE mtu 9000 */ | 5877 | /* configure PBF to work without PAUSE mtu 9000 */ |
5861 | REG_WR(bp, PBF_REG_P0_PAUSE_ENABLE + port*4, 0); | 5878 | REG_WR(bp, PBF_REG_P0_PAUSE_ENABLE + port*4, 0); |
@@ -5885,18 +5902,17 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
5885 | /* Port SRCH comes here */ | 5902 | /* Port SRCH comes here */ |
5886 | #endif | 5903 | #endif |
5887 | /* Port CDU comes here */ | 5904 | /* Port CDU comes here */ |
5905 | bnx2x_init_block(bp, CDU_BLOCK, init_stage); | ||
5888 | /* Port CFC comes here */ | 5906 | /* Port CFC comes here */ |
5907 | bnx2x_init_block(bp, CFC_BLOCK, init_stage); | ||
5889 | 5908 | ||
5890 | if (CHIP_IS_E1(bp)) { | 5909 | if (CHIP_IS_E1(bp)) { |
5891 | REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, 0); | 5910 | REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, 0); |
5892 | REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, 0); | 5911 | REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, 0); |
5893 | } | 5912 | } |
5894 | bnx2x_init_block(bp, port ? HC_PORT1_START : HC_PORT0_START, | 5913 | bnx2x_init_block(bp, HC_BLOCK, init_stage); |
5895 | port ? HC_PORT1_END : HC_PORT0_END); | ||
5896 | 5914 | ||
5897 | bnx2x_init_block(bp, port ? MISC_AEU_PORT1_START : | 5915 | bnx2x_init_block(bp, MISC_AEU_BLOCK, init_stage); |
5898 | MISC_AEU_PORT0_START, | ||
5899 | port ? MISC_AEU_PORT1_END : MISC_AEU_PORT0_END); | ||
5900 | /* init aeu_mask_attn_func_0/1: | 5916 | /* init aeu_mask_attn_func_0/1: |
5901 | * - SF mode: bits 3-7 are masked. only bits 0-2 are in use | 5917 | * - SF mode: bits 3-7 are masked. only bits 0-2 are in use |
5902 | * - MF mode: bit 3 is masked. bits 0-2 are in use as in SF | 5918 | * - MF mode: bit 3 is masked. bits 0-2 are in use as in SF |
@@ -5905,13 +5921,17 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
5905 | (IS_E1HMF(bp) ? 0xF7 : 0x7)); | 5921 | (IS_E1HMF(bp) ? 0xF7 : 0x7)); |
5906 | 5922 | ||
5907 | /* Port PXPCS comes here */ | 5923 | /* Port PXPCS comes here */ |
5924 | bnx2x_init_block(bp, PXPCS_BLOCK, init_stage); | ||
5908 | /* Port EMAC0 comes here */ | 5925 | /* Port EMAC0 comes here */ |
5926 | bnx2x_init_block(bp, EMAC0_BLOCK, init_stage); | ||
5909 | /* Port EMAC1 comes here */ | 5927 | /* Port EMAC1 comes here */ |
5928 | bnx2x_init_block(bp, EMAC1_BLOCK, init_stage); | ||
5910 | /* Port DBU comes here */ | 5929 | /* Port DBU comes here */ |
5930 | bnx2x_init_block(bp, DBU_BLOCK, init_stage); | ||
5911 | /* Port DBG comes here */ | 5931 | /* Port DBG comes here */ |
5932 | bnx2x_init_block(bp, DBG_BLOCK, init_stage); | ||
5912 | 5933 | ||
5913 | bnx2x_init_block(bp, port ? NIG_PORT1_START : NIG_PORT0_START, | 5934 | bnx2x_init_block(bp, NIG_BLOCK, init_stage); |
5914 | port ? NIG_PORT1_END : NIG_PORT0_END); | ||
5915 | 5935 | ||
5916 | REG_WR(bp, NIG_REG_XGXS_SERDES0_MODE_SEL + port*4, 1); | 5936 | REG_WR(bp, NIG_REG_XGXS_SERDES0_MODE_SEL + port*4, 1); |
5917 | 5937 | ||
@@ -5931,7 +5951,9 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
5931 | } | 5951 | } |
5932 | 5952 | ||
5933 | /* Port MCP comes here */ | 5953 | /* Port MCP comes here */ |
5954 | bnx2x_init_block(bp, MCP_BLOCK, init_stage); | ||
5934 | /* Port DMAE comes here */ | 5955 | /* Port DMAE comes here */ |
5956 | bnx2x_init_block(bp, DMAE_BLOCK, init_stage); | ||
5935 | 5957 | ||
5936 | switch (XGXS_EXT_PHY_TYPE(bp->link_params.ext_phy_config)) { | 5958 | switch (XGXS_EXT_PHY_TYPE(bp->link_params.ext_phy_config)) { |
5937 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: | 5959 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: |
@@ -6036,7 +6058,7 @@ static int bnx2x_init_func(struct bnx2x *bp) | |||
6036 | if (CHIP_IS_E1H(bp)) { | 6058 | if (CHIP_IS_E1H(bp)) { |
6037 | for (i = 0; i < 9; i++) | 6059 | for (i = 0; i < 9; i++) |
6038 | bnx2x_init_block(bp, | 6060 | bnx2x_init_block(bp, |
6039 | cm_start[func][i], cm_end[func][i]); | 6061 | cm_blocks[i], FUNC0_STAGE + func); |
6040 | 6062 | ||
6041 | REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 1); | 6063 | REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 1); |
6042 | REG_WR(bp, NIG_REG_LLH0_FUNC_VLAN_ID + port*8, bp->e1hov); | 6064 | REG_WR(bp, NIG_REG_LLH0_FUNC_VLAN_ID + port*8, bp->e1hov); |
@@ -6049,7 +6071,7 @@ static int bnx2x_init_func(struct bnx2x *bp) | |||
6049 | REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, 0); | 6071 | REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, 0); |
6050 | REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, 0); | 6072 | REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, 0); |
6051 | } | 6073 | } |
6052 | bnx2x_init_block(bp, hc_limits[func][0], hc_limits[func][1]); | 6074 | bnx2x_init_block(bp, HC_BLOCK, FUNC0_STAGE + func); |
6053 | 6075 | ||
6054 | /* Reset PCIE errors for debug */ | 6076 | /* Reset PCIE errors for debug */ |
6055 | REG_WR(bp, 0x2114, 0xffffffff); | 6077 | REG_WR(bp, 0x2114, 0xffffffff); |
@@ -11082,6 +11104,190 @@ static int __devinit bnx2x_get_pcie_speed(struct bnx2x *bp) | |||
11082 | val = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT; | 11104 | val = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT; |
11083 | return val; | 11105 | return val; |
11084 | } | 11106 | } |
11107 | static int __devinit bnx2x_check_firmware(struct bnx2x *bp) | ||
11108 | { | ||
11109 | struct bnx2x_fw_file_hdr *fw_hdr; | ||
11110 | struct bnx2x_fw_file_section *sections; | ||
11111 | u16 *ops_offsets; | ||
11112 | u32 offset, len, num_ops; | ||
11113 | int i; | ||
11114 | const struct firmware *firmware = bp->firmware; | ||
11115 | const u8 * fw_ver; | ||
11116 | |||
11117 | if (firmware->size < sizeof(struct bnx2x_fw_file_hdr)) | ||
11118 | return -EINVAL; | ||
11119 | |||
11120 | fw_hdr = (struct bnx2x_fw_file_hdr *)firmware->data; | ||
11121 | sections = (struct bnx2x_fw_file_section *)fw_hdr; | ||
11122 | |||
11123 | /* Make sure none of the offsets and sizes make us read beyond | ||
11124 | * the end of the firmware data */ | ||
11125 | for (i = 0; i < sizeof(*fw_hdr) / sizeof(*sections); i++) { | ||
11126 | offset = be32_to_cpu(sections[i].offset); | ||
11127 | len = be32_to_cpu(sections[i].len); | ||
11128 | if (offset + len > firmware->size) { | ||
11129 | printk(KERN_ERR PFX "Section %d length is out of bounds\n", i); | ||
11130 | return -EINVAL; | ||
11131 | } | ||
11132 | } | ||
11133 | |||
11134 | /* Likewise for the init_ops offsets */ | ||
11135 | offset = be32_to_cpu(fw_hdr->init_ops_offsets.offset); | ||
11136 | ops_offsets = (u16 *)(firmware->data + offset); | ||
11137 | num_ops = be32_to_cpu(fw_hdr->init_ops.len) / sizeof(struct raw_op); | ||
11138 | |||
11139 | for (i = 0; i < be32_to_cpu(fw_hdr->init_ops_offsets.len) / 2; i++) { | ||
11140 | if (be16_to_cpu(ops_offsets[i]) > num_ops) { | ||
11141 | printk(KERN_ERR PFX "Section offset %d is out of bounds\n", i); | ||
11142 | return -EINVAL; | ||
11143 | } | ||
11144 | } | ||
11145 | |||
11146 | /* Check FW version */ | ||
11147 | offset = be32_to_cpu(fw_hdr->fw_version.offset); | ||
11148 | fw_ver = firmware->data + offset; | ||
11149 | if ((fw_ver[0] != BCM_5710_FW_MAJOR_VERSION) || | ||
11150 | (fw_ver[1] != BCM_5710_FW_MINOR_VERSION) || | ||
11151 | (fw_ver[2] != BCM_5710_FW_REVISION_VERSION) || | ||
11152 | (fw_ver[3] != BCM_5710_FW_ENGINEERING_VERSION)) { | ||
11153 | printk(KERN_ERR PFX "Bad FW version:%d.%d.%d.%d." | ||
11154 | " Should be %d.%d.%d.%d\n", | ||
11155 | fw_ver[0], fw_ver[1], fw_ver[2], | ||
11156 | fw_ver[3], BCM_5710_FW_MAJOR_VERSION, | ||
11157 | BCM_5710_FW_MINOR_VERSION, | ||
11158 | BCM_5710_FW_REVISION_VERSION, | ||
11159 | BCM_5710_FW_ENGINEERING_VERSION); | ||
11160 | return -EINVAL; | ||
11161 | } | ||
11162 | |||
11163 | return 0; | ||
11164 | } | ||
11165 | |||
11166 | static void inline be32_to_cpu_n(const u8 *_source, u8 *_target, u32 n) | ||
11167 | { | ||
11168 | u32 i; | ||
11169 | const __be32 *source = (const __be32*)_source; | ||
11170 | u32 *target = (u32*)_target; | ||
11171 | |||
11172 | for (i = 0; i < n/4; i++) | ||
11173 | target[i] = be32_to_cpu(source[i]); | ||
11174 | } | ||
11175 | |||
11176 | /* | ||
11177 | Ops array is stored in the following format: | ||
11178 | {op(8bit), offset(24bit, big endian), data(32bit, big endian)} | ||
11179 | */ | ||
11180 | static void inline bnx2x_prep_ops(const u8 *_source, u8 *_target, u32 n) | ||
11181 | { | ||
11182 | u32 i, j, tmp; | ||
11183 | const __be32 *source = (const __be32*)_source; | ||
11184 | struct raw_op *target = (struct raw_op*)_target; | ||
11185 | |||
11186 | for (i = 0, j = 0; i < n/8; i++, j+=2) { | ||
11187 | tmp = be32_to_cpu(source[j]); | ||
11188 | target[i].op = (tmp >> 24) & 0xff; | ||
11189 | target[i].offset = tmp & 0xffffff; | ||
11190 | target[i].raw_data = be32_to_cpu(source[j+1]); | ||
11191 | } | ||
11192 | } | ||
11193 | static void inline be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n) | ||
11194 | { | ||
11195 | u32 i; | ||
11196 | u16 *target = (u16*)_target; | ||
11197 | const __be16 *source = (const __be16*)_source; | ||
11198 | |||
11199 | for (i = 0; i < n/2; i++) | ||
11200 | target[i] = be16_to_cpu(source[i]); | ||
11201 | } | ||
11202 | |||
11203 | #define BNX2X_ALLOC_AND_SET(arr, lbl, func) \ | ||
11204 | do { \ | ||
11205 | u32 len = be32_to_cpu(fw_hdr->arr.len); \ | ||
11206 | bp->arr = kmalloc(len, GFP_KERNEL); \ | ||
11207 | if (!bp->arr) { \ | ||
11208 | printk(KERN_ERR PFX "Failed to allocate %d bytes for "#arr"\n", len); \ | ||
11209 | goto lbl; \ | ||
11210 | } \ | ||
11211 | func(bp->firmware->data + \ | ||
11212 | be32_to_cpu(fw_hdr->arr.offset), \ | ||
11213 | (u8*)bp->arr, len); \ | ||
11214 | } while (0) | ||
11215 | |||
11216 | |||
11217 | static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev) | ||
11218 | { | ||
11219 | char fw_file_name[40] = {0}; | ||
11220 | int rc, offset; | ||
11221 | struct bnx2x_fw_file_hdr *fw_hdr; | ||
11222 | |||
11223 | /* Create a FW file name */ | ||
11224 | if (CHIP_IS_E1(bp)) | ||
11225 | offset = sprintf(fw_file_name, FW_FILE_PREFIX_E1); | ||
11226 | else | ||
11227 | offset = sprintf(fw_file_name, FW_FILE_PREFIX_E1H); | ||
11228 | |||
11229 | sprintf(fw_file_name + offset, "%d.%d.%d.%d.fw", | ||
11230 | BCM_5710_FW_MAJOR_VERSION, | ||
11231 | BCM_5710_FW_MINOR_VERSION, | ||
11232 | BCM_5710_FW_REVISION_VERSION, | ||
11233 | BCM_5710_FW_ENGINEERING_VERSION); | ||
11234 | |||
11235 | printk(KERN_INFO PFX "Loading %s\n", fw_file_name); | ||
11236 | |||
11237 | rc = request_firmware(&bp->firmware, fw_file_name, dev); | ||
11238 | if (rc) { | ||
11239 | printk(KERN_ERR PFX "Can't load firmware file %s\n", fw_file_name); | ||
11240 | goto request_firmware_exit; | ||
11241 | } | ||
11242 | |||
11243 | rc = bnx2x_check_firmware(bp); | ||
11244 | if (rc) { | ||
11245 | printk(KERN_ERR PFX "Corrupt firmware file %s\n", fw_file_name); | ||
11246 | goto request_firmware_exit; | ||
11247 | } | ||
11248 | |||
11249 | fw_hdr = (struct bnx2x_fw_file_hdr *)bp->firmware->data; | ||
11250 | |||
11251 | /* Initialize the pointers to the init arrays */ | ||
11252 | /* Blob */ | ||
11253 | BNX2X_ALLOC_AND_SET(init_data, request_firmware_exit, be32_to_cpu_n); | ||
11254 | |||
11255 | /* Opcodes */ | ||
11256 | BNX2X_ALLOC_AND_SET(init_ops, init_ops_alloc_err, bnx2x_prep_ops); | ||
11257 | |||
11258 | /* Offsets */ | ||
11259 | BNX2X_ALLOC_AND_SET(init_ops_offsets, init_offsets_alloc_err, be16_to_cpu_n); | ||
11260 | |||
11261 | /* STORMs firmware */ | ||
11262 | bp->tsem_int_table_data = bp->firmware->data + | ||
11263 | be32_to_cpu(fw_hdr->tsem_int_table_data.offset); | ||
11264 | bp->tsem_pram_data = bp->firmware->data + | ||
11265 | be32_to_cpu(fw_hdr->tsem_pram_data.offset); | ||
11266 | bp->usem_int_table_data = bp->firmware->data + | ||
11267 | be32_to_cpu(fw_hdr->usem_int_table_data.offset); | ||
11268 | bp->usem_pram_data = bp->firmware->data + | ||
11269 | be32_to_cpu(fw_hdr->usem_pram_data.offset); | ||
11270 | bp->xsem_int_table_data = bp->firmware->data + | ||
11271 | be32_to_cpu(fw_hdr->xsem_int_table_data.offset); | ||
11272 | bp->xsem_pram_data = bp->firmware->data + | ||
11273 | be32_to_cpu(fw_hdr->xsem_pram_data.offset); | ||
11274 | bp->csem_int_table_data = bp->firmware->data + | ||
11275 | be32_to_cpu(fw_hdr->csem_int_table_data.offset); | ||
11276 | bp->csem_pram_data = bp->firmware->data + | ||
11277 | be32_to_cpu(fw_hdr->csem_pram_data.offset); | ||
11278 | |||
11279 | return 0; | ||
11280 | init_offsets_alloc_err: | ||
11281 | kfree(bp->init_ops); | ||
11282 | init_ops_alloc_err: | ||
11283 | kfree(bp->init_data); | ||
11284 | request_firmware_exit: | ||
11285 | release_firmware(bp->firmware); | ||
11286 | |||
11287 | return rc; | ||
11288 | } | ||
11289 | |||
11290 | |||
11085 | 11291 | ||
11086 | static int __devinit bnx2x_init_one(struct pci_dev *pdev, | 11292 | static int __devinit bnx2x_init_one(struct pci_dev *pdev, |
11087 | const struct pci_device_id *ent) | 11293 | const struct pci_device_id *ent) |
@@ -11116,6 +11322,13 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
11116 | if (rc) | 11322 | if (rc) |
11117 | goto init_one_exit; | 11323 | goto init_one_exit; |
11118 | 11324 | ||
11325 | /* Set init arrays */ | ||
11326 | rc = bnx2x_init_firmware(bp, &pdev->dev); | ||
11327 | if (rc) { | ||
11328 | printk(KERN_ERR PFX "Error loading firmware\n"); | ||
11329 | goto init_one_exit; | ||
11330 | } | ||
11331 | |||
11119 | rc = register_netdev(dev); | 11332 | rc = register_netdev(dev); |
11120 | if (rc) { | 11333 | if (rc) { |
11121 | dev_err(&pdev->dev, "Cannot register net device\n"); | 11334 | dev_err(&pdev->dev, "Cannot register net device\n"); |
@@ -11163,6 +11376,11 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev) | |||
11163 | 11376 | ||
11164 | unregister_netdev(dev); | 11377 | unregister_netdev(dev); |
11165 | 11378 | ||
11379 | kfree(bp->init_ops_offsets); | ||
11380 | kfree(bp->init_ops); | ||
11381 | kfree(bp->init_data); | ||
11382 | release_firmware(bp->firmware); | ||
11383 | |||
11166 | if (bp->regview) | 11384 | if (bp->regview) |
11167 | iounmap(bp->regview); | 11385 | iounmap(bp->regview); |
11168 | 11386 | ||
@@ -11431,3 +11649,4 @@ static void __exit bnx2x_cleanup(void) | |||
11431 | module_init(bnx2x_init); | 11649 | module_init(bnx2x_init); |
11432 | module_exit(bnx2x_cleanup); | 11650 | module_exit(bnx2x_cleanup); |
11433 | 11651 | ||
11652 | |||