diff options
author | Michael Chan <mchan@broadcom.com> | 2009-10-10 09:46:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-12 02:30:13 -0400 |
commit | 37b091bacba7bd329eced9a56998b6247da414c4 (patch) | |
tree | 4611c86c1dfd6dff1de9270e579b1cf5562f6792 /drivers/net | |
parent | e665bfda5b8fea586ddd028b26a6e2ed9e987c6b (diff) |
bnx2x: Add hw init code to support iSCSI.
Add code to initialize hardware blocks used for iSCSI.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Shmulik Ravid - Rabinovitz <shmulikr@broadcom.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bnx2x.h | 59 | ||||
-rw-r--r-- | drivers/net/bnx2x_main.c | 210 |
2 files changed, 200 insertions, 69 deletions
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h index 1f0706328a3f..e94ce8370253 100644 --- a/drivers/net/bnx2x.h +++ b/drivers/net/bnx2x.h | |||
@@ -762,7 +762,11 @@ struct bnx2x_eth_stats { | |||
762 | (offsetof(struct bnx2x_eth_stats, stat_name) / 4) | 762 | (offsetof(struct bnx2x_eth_stats, stat_name) / 4) |
763 | 763 | ||
764 | 764 | ||
765 | #ifdef BCM_CNIC | ||
766 | #define MAX_CONTEXT 15 | ||
767 | #else | ||
765 | #define MAX_CONTEXT 16 | 768 | #define MAX_CONTEXT 16 |
769 | #endif | ||
766 | 770 | ||
767 | union cdu_context { | 771 | union cdu_context { |
768 | struct eth_context eth; | 772 | struct eth_context eth; |
@@ -811,13 +815,21 @@ struct bnx2x { | |||
811 | struct bnx2x_fastpath fp[MAX_CONTEXT]; | 815 | struct bnx2x_fastpath fp[MAX_CONTEXT]; |
812 | void __iomem *regview; | 816 | void __iomem *regview; |
813 | void __iomem *doorbells; | 817 | void __iomem *doorbells; |
818 | #ifdef BCM_CNIC | ||
819 | #define BNX2X_DB_SIZE (18*BCM_PAGE_SIZE) | ||
820 | #else | ||
814 | #define BNX2X_DB_SIZE (16*BCM_PAGE_SIZE) | 821 | #define BNX2X_DB_SIZE (16*BCM_PAGE_SIZE) |
822 | #endif | ||
815 | 823 | ||
816 | struct net_device *dev; | 824 | struct net_device *dev; |
817 | struct pci_dev *pdev; | 825 | struct pci_dev *pdev; |
818 | 826 | ||
819 | atomic_t intr_sem; | 827 | atomic_t intr_sem; |
828 | #ifdef BCM_CNIC | ||
829 | struct msix_entry msix_table[MAX_CONTEXT+2]; | ||
830 | #else | ||
820 | struct msix_entry msix_table[MAX_CONTEXT+1]; | 831 | struct msix_entry msix_table[MAX_CONTEXT+1]; |
832 | #endif | ||
821 | #define INT_MODE_INTx 1 | 833 | #define INT_MODE_INTx 1 |
822 | #define INT_MODE_MSI 2 | 834 | #define INT_MODE_MSI 2 |
823 | #define INT_MODE_MSIX 3 | 835 | #define INT_MODE_MSIX 3 |
@@ -891,6 +903,11 @@ struct bnx2x { | |||
891 | #define BP_E1HVN(bp) (bp->func >> 1) | 903 | #define BP_E1HVN(bp) (bp->func >> 1) |
892 | #define BP_L_ID(bp) (BP_E1HVN(bp) << 2) | 904 | #define BP_L_ID(bp) (BP_E1HVN(bp) << 2) |
893 | 905 | ||
906 | #ifdef BCM_CNIC | ||
907 | #define BCM_CNIC_CID_START 16 | ||
908 | #define BCM_ISCSI_ETH_CL_ID 17 | ||
909 | #endif | ||
910 | |||
894 | int pm_cap; | 911 | int pm_cap; |
895 | int pcie_cap; | 912 | int pcie_cap; |
896 | int mrrs; | 913 | int mrrs; |
@@ -960,24 +977,44 @@ struct bnx2x { | |||
960 | #define BNX2X_MAX_MULTICAST 64 | 977 | #define BNX2X_MAX_MULTICAST 64 |
961 | #define BNX2X_MAX_EMUL_MULTI 16 | 978 | #define BNX2X_MAX_EMUL_MULTI 16 |
962 | 979 | ||
980 | u32 rx_mode_cl_mask; | ||
981 | |||
963 | dma_addr_t def_status_blk_mapping; | 982 | dma_addr_t def_status_blk_mapping; |
964 | 983 | ||
965 | struct bnx2x_slowpath *slowpath; | 984 | struct bnx2x_slowpath *slowpath; |
966 | dma_addr_t slowpath_mapping; | 985 | dma_addr_t slowpath_mapping; |
967 | 986 | ||
968 | #ifdef BCM_ISCSI | ||
969 | void *t1; | ||
970 | dma_addr_t t1_mapping; | ||
971 | void *t2; | ||
972 | dma_addr_t t2_mapping; | ||
973 | void *timers; | ||
974 | dma_addr_t timers_mapping; | ||
975 | void *qm; | ||
976 | dma_addr_t qm_mapping; | ||
977 | #endif | ||
978 | |||
979 | int dropless_fc; | 987 | int dropless_fc; |
980 | 988 | ||
989 | #ifdef BCM_CNIC | ||
990 | u32 cnic_flags; | ||
991 | #define BNX2X_CNIC_FLAG_MAC_SET 1 | ||
992 | |||
993 | void *t1; | ||
994 | dma_addr_t t1_mapping; | ||
995 | void *t2; | ||
996 | dma_addr_t t2_mapping; | ||
997 | void *timers; | ||
998 | dma_addr_t timers_mapping; | ||
999 | void *qm; | ||
1000 | dma_addr_t qm_mapping; | ||
1001 | struct cnic_ops *cnic_ops; | ||
1002 | void *cnic_data; | ||
1003 | u32 cnic_tag; | ||
1004 | struct cnic_eth_dev cnic_eth_dev; | ||
1005 | struct host_status_block *cnic_sb; | ||
1006 | dma_addr_t cnic_sb_mapping; | ||
1007 | #define CNIC_SB_ID(bp) BP_L_ID(bp) | ||
1008 | struct eth_spe *cnic_kwq; | ||
1009 | struct eth_spe *cnic_kwq_prod; | ||
1010 | struct eth_spe *cnic_kwq_cons; | ||
1011 | struct eth_spe *cnic_kwq_last; | ||
1012 | u16 cnic_kwq_pending; | ||
1013 | u16 cnic_spq_pending; | ||
1014 | struct mutex cnic_mutex; | ||
1015 | u8 iscsi_mac[6]; | ||
1016 | #endif | ||
1017 | |||
981 | int dmae_ready; | 1018 | int dmae_ready; |
982 | /* used to synchronize dmae accesses */ | 1019 | /* used to synchronize dmae accesses */ |
983 | struct mutex dmae_mutex; | 1020 | struct mutex dmae_mutex; |
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 02ce3b31050c..f7b71100e95c 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -742,6 +742,9 @@ static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw) | |||
742 | if (msix) { | 742 | if (msix) { |
743 | synchronize_irq(bp->msix_table[0].vector); | 743 | synchronize_irq(bp->msix_table[0].vector); |
744 | offset = 1; | 744 | offset = 1; |
745 | #ifdef BCM_CNIC | ||
746 | offset++; | ||
747 | #endif | ||
745 | for_each_queue(bp, i) | 748 | for_each_queue(bp, i) |
746 | synchronize_irq(bp->msix_table[i + offset].vector); | 749 | synchronize_irq(bp->msix_table[i + offset].vector); |
747 | } else | 750 | } else |
@@ -5252,7 +5255,7 @@ static void bnx2x_set_storm_rx_mode(struct bnx2x *bp) | |||
5252 | { | 5255 | { |
5253 | struct tstorm_eth_mac_filter_config tstorm_mac_filter = {0}; | 5256 | struct tstorm_eth_mac_filter_config tstorm_mac_filter = {0}; |
5254 | int mode = bp->rx_mode; | 5257 | int mode = bp->rx_mode; |
5255 | int mask = (1 << BP_L_ID(bp)); | 5258 | int mask = bp->rx_mode_cl_mask; |
5256 | int func = BP_FUNC(bp); | 5259 | int func = BP_FUNC(bp); |
5257 | int port = BP_PORT(bp); | 5260 | int port = BP_PORT(bp); |
5258 | int i; | 5261 | int i; |
@@ -5365,6 +5368,7 @@ static void bnx2x_init_internal_func(struct bnx2x *bp) | |||
5365 | (*(u32 *)&tstorm_config)); | 5368 | (*(u32 *)&tstorm_config)); |
5366 | 5369 | ||
5367 | bp->rx_mode = BNX2X_RX_MODE_NONE; /* no rx until link is up */ | 5370 | bp->rx_mode = BNX2X_RX_MODE_NONE; /* no rx until link is up */ |
5371 | bp->rx_mode_cl_mask = (1 << BP_L_ID(bp)); | ||
5368 | bnx2x_set_storm_rx_mode(bp); | 5372 | bnx2x_set_storm_rx_mode(bp); |
5369 | 5373 | ||
5370 | for_each_queue(bp, i) { | 5374 | for_each_queue(bp, i) { |
@@ -5582,7 +5586,11 @@ static void bnx2x_nic_init(struct bnx2x *bp, u32 load_code) | |||
5582 | fp->state = BNX2X_FP_STATE_CLOSED; | 5586 | fp->state = BNX2X_FP_STATE_CLOSED; |
5583 | fp->index = i; | 5587 | fp->index = i; |
5584 | fp->cl_id = BP_L_ID(bp) + i; | 5588 | fp->cl_id = BP_L_ID(bp) + i; |
5589 | #ifdef BCM_CNIC | ||
5590 | fp->sb_id = fp->cl_id + 1; | ||
5591 | #else | ||
5585 | fp->sb_id = fp->cl_id; | 5592 | fp->sb_id = fp->cl_id; |
5593 | #endif | ||
5586 | /* Suitable Rx and Tx SBs are served by the same client */ | 5594 | /* Suitable Rx and Tx SBs are served by the same client */ |
5587 | if (i >= bp->num_rx_queues) | 5595 | if (i >= bp->num_rx_queues) |
5588 | fp->cl_id -= bp->num_rx_queues; | 5596 | fp->cl_id -= bp->num_rx_queues; |
@@ -5884,7 +5892,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp) | |||
5884 | msleep(50); | 5892 | msleep(50); |
5885 | bnx2x_init_block(bp, BRB1_BLOCK, COMMON_STAGE); | 5893 | bnx2x_init_block(bp, BRB1_BLOCK, COMMON_STAGE); |
5886 | bnx2x_init_block(bp, PRS_BLOCK, COMMON_STAGE); | 5894 | bnx2x_init_block(bp, PRS_BLOCK, COMMON_STAGE); |
5887 | #ifndef BCM_ISCSI | 5895 | #ifndef BCM_CNIC |
5888 | /* set NIC mode */ | 5896 | /* set NIC mode */ |
5889 | REG_WR(bp, PRS_REG_NIC_MODE, 1); | 5897 | REG_WR(bp, PRS_REG_NIC_MODE, 1); |
5890 | #endif | 5898 | #endif |
@@ -6023,6 +6031,9 @@ static void bnx2x_setup_fan_failure_detection(struct bnx2x *bp) | |||
6023 | static int bnx2x_init_common(struct bnx2x *bp) | 6031 | static int bnx2x_init_common(struct bnx2x *bp) |
6024 | { | 6032 | { |
6025 | u32 val, i; | 6033 | u32 val, i; |
6034 | #ifdef BCM_CNIC | ||
6035 | u32 wb_write[2]; | ||
6036 | #endif | ||
6026 | 6037 | ||
6027 | DP(BNX2X_MSG_MCP, "starting common init func %d\n", BP_FUNC(bp)); | 6038 | DP(BNX2X_MSG_MCP, "starting common init func %d\n", BP_FUNC(bp)); |
6028 | 6039 | ||
@@ -6065,7 +6076,7 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
6065 | #endif | 6076 | #endif |
6066 | 6077 | ||
6067 | REG_WR(bp, PXP2_REG_RQ_CDU_P_SIZE, 2); | 6078 | REG_WR(bp, PXP2_REG_RQ_CDU_P_SIZE, 2); |
6068 | #ifdef BCM_ISCSI | 6079 | #ifdef BCM_CNIC |
6069 | REG_WR(bp, PXP2_REG_RQ_TM_P_SIZE, 5); | 6080 | REG_WR(bp, PXP2_REG_RQ_TM_P_SIZE, 5); |
6070 | REG_WR(bp, PXP2_REG_RQ_QM_P_SIZE, 5); | 6081 | REG_WR(bp, PXP2_REG_RQ_QM_P_SIZE, 5); |
6071 | REG_WR(bp, PXP2_REG_RQ_SRC_P_SIZE, 5); | 6082 | REG_WR(bp, PXP2_REG_RQ_SRC_P_SIZE, 5); |
@@ -6108,11 +6119,26 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
6108 | bnx2x_read_dmae(bp, USEM_REG_PASSIVE_BUFFER, 3); | 6119 | bnx2x_read_dmae(bp, USEM_REG_PASSIVE_BUFFER, 3); |
6109 | 6120 | ||
6110 | bnx2x_init_block(bp, QM_BLOCK, COMMON_STAGE); | 6121 | bnx2x_init_block(bp, QM_BLOCK, COMMON_STAGE); |
6122 | |||
6123 | #ifdef BCM_CNIC | ||
6124 | wb_write[0] = 0; | ||
6125 | wb_write[1] = 0; | ||
6126 | for (i = 0; i < 64; i++) { | ||
6127 | REG_WR(bp, QM_REG_BASEADDR + i*4, 1024 * 4 * (i%16)); | ||
6128 | bnx2x_init_ind_wr(bp, QM_REG_PTRTBL + i*8, wb_write, 2); | ||
6129 | |||
6130 | if (CHIP_IS_E1H(bp)) { | ||
6131 | REG_WR(bp, QM_REG_BASEADDR_EXT_A + i*4, 1024*4*(i%16)); | ||
6132 | bnx2x_init_ind_wr(bp, QM_REG_PTRTBL_EXT_A + i*8, | ||
6133 | wb_write, 2); | ||
6134 | } | ||
6135 | } | ||
6136 | #endif | ||
6111 | /* soft reset pulse */ | 6137 | /* soft reset pulse */ |
6112 | REG_WR(bp, QM_REG_SOFT_RESET, 1); | 6138 | REG_WR(bp, QM_REG_SOFT_RESET, 1); |
6113 | REG_WR(bp, QM_REG_SOFT_RESET, 0); | 6139 | REG_WR(bp, QM_REG_SOFT_RESET, 0); |
6114 | 6140 | ||
6115 | #ifdef BCM_ISCSI | 6141 | #ifdef BCM_CNIC |
6116 | bnx2x_init_block(bp, TIMERS_BLOCK, COMMON_STAGE); | 6142 | bnx2x_init_block(bp, TIMERS_BLOCK, COMMON_STAGE); |
6117 | #endif | 6143 | #endif |
6118 | 6144 | ||
@@ -6126,8 +6152,10 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
6126 | bnx2x_init_block(bp, BRB1_BLOCK, COMMON_STAGE); | 6152 | bnx2x_init_block(bp, BRB1_BLOCK, COMMON_STAGE); |
6127 | bnx2x_init_block(bp, PRS_BLOCK, COMMON_STAGE); | 6153 | bnx2x_init_block(bp, PRS_BLOCK, COMMON_STAGE); |
6128 | REG_WR(bp, PRS_REG_A_PRSU_20, 0xf); | 6154 | REG_WR(bp, PRS_REG_A_PRSU_20, 0xf); |
6155 | #ifndef BCM_CNIC | ||
6129 | /* set NIC mode */ | 6156 | /* set NIC mode */ |
6130 | REG_WR(bp, PRS_REG_NIC_MODE, 1); | 6157 | REG_WR(bp, PRS_REG_NIC_MODE, 1); |
6158 | #endif | ||
6131 | if (CHIP_IS_E1H(bp)) | 6159 | if (CHIP_IS_E1H(bp)) |
6132 | REG_WR(bp, PRS_REG_E1HOV_MODE, IS_E1HMF(bp)); | 6160 | REG_WR(bp, PRS_REG_E1HOV_MODE, IS_E1HMF(bp)); |
6133 | 6161 | ||
@@ -6162,6 +6190,18 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
6162 | /* TODO: replace with something meaningful */ | 6190 | /* TODO: replace with something meaningful */ |
6163 | } | 6191 | } |
6164 | bnx2x_init_block(bp, SRCH_BLOCK, COMMON_STAGE); | 6192 | bnx2x_init_block(bp, SRCH_BLOCK, COMMON_STAGE); |
6193 | #ifdef BCM_CNIC | ||
6194 | REG_WR(bp, SRC_REG_KEYSEARCH_0, 0x63285672); | ||
6195 | REG_WR(bp, SRC_REG_KEYSEARCH_1, 0x24b8f2cc); | ||
6196 | REG_WR(bp, SRC_REG_KEYSEARCH_2, 0x223aef9b); | ||
6197 | REG_WR(bp, SRC_REG_KEYSEARCH_3, 0x26001e3a); | ||
6198 | REG_WR(bp, SRC_REG_KEYSEARCH_4, 0x7ae91116); | ||
6199 | REG_WR(bp, SRC_REG_KEYSEARCH_5, 0x5ce5230b); | ||
6200 | REG_WR(bp, SRC_REG_KEYSEARCH_6, 0x298d8adf); | ||
6201 | REG_WR(bp, SRC_REG_KEYSEARCH_7, 0x6eb0ff09); | ||
6202 | REG_WR(bp, SRC_REG_KEYSEARCH_8, 0x1830f82f); | ||
6203 | REG_WR(bp, SRC_REG_KEYSEARCH_9, 0x01e46be7); | ||
6204 | #endif | ||
6165 | REG_WR(bp, SRC_REG_SOFT_RST, 0); | 6205 | REG_WR(bp, SRC_REG_SOFT_RST, 0); |
6166 | 6206 | ||
6167 | if (sizeof(union cdu_context) != 1024) | 6207 | if (sizeof(union cdu_context) != 1024) |
@@ -6278,38 +6318,14 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
6278 | bnx2x_init_block(bp, TCM_BLOCK, init_stage); | 6318 | bnx2x_init_block(bp, TCM_BLOCK, init_stage); |
6279 | bnx2x_init_block(bp, UCM_BLOCK, init_stage); | 6319 | bnx2x_init_block(bp, UCM_BLOCK, init_stage); |
6280 | bnx2x_init_block(bp, CCM_BLOCK, init_stage); | 6320 | bnx2x_init_block(bp, CCM_BLOCK, init_stage); |
6281 | #ifdef BCM_ISCSI | ||
6282 | /* Port0 1 | ||
6283 | * Port1 385 */ | ||
6284 | i++; | ||
6285 | wb_write[0] = ONCHIP_ADDR1(bp->timers_mapping); | ||
6286 | wb_write[1] = ONCHIP_ADDR2(bp->timers_mapping); | ||
6287 | REG_WR_DMAE(bp, PXP2_REG_RQ_ONCHIP_AT + i*8, wb_write, 2); | ||
6288 | REG_WR(bp, PXP2_REG_PSWRQ_TM0_L2P + func*4, PXP_ONE_ILT(i)); | ||
6289 | |||
6290 | /* Port0 2 | ||
6291 | * Port1 386 */ | ||
6292 | i++; | ||
6293 | wb_write[0] = ONCHIP_ADDR1(bp->qm_mapping); | ||
6294 | wb_write[1] = ONCHIP_ADDR2(bp->qm_mapping); | ||
6295 | REG_WR_DMAE(bp, PXP2_REG_RQ_ONCHIP_AT + i*8, wb_write, 2); | ||
6296 | REG_WR(bp, PXP2_REG_PSWRQ_QM0_L2P + func*4, PXP_ONE_ILT(i)); | ||
6297 | |||
6298 | /* Port0 3 | ||
6299 | * Port1 387 */ | ||
6300 | i++; | ||
6301 | wb_write[0] = ONCHIP_ADDR1(bp->t1_mapping); | ||
6302 | wb_write[1] = ONCHIP_ADDR2(bp->t1_mapping); | ||
6303 | REG_WR_DMAE(bp, PXP2_REG_RQ_ONCHIP_AT + i*8, wb_write, 2); | ||
6304 | REG_WR(bp, PXP2_REG_PSWRQ_SRC0_L2P + func*4, PXP_ONE_ILT(i)); | ||
6305 | #endif | ||
6306 | bnx2x_init_block(bp, XCM_BLOCK, init_stage); | 6321 | bnx2x_init_block(bp, XCM_BLOCK, init_stage); |
6307 | 6322 | ||
6308 | #ifdef BCM_ISCSI | 6323 | #ifdef BCM_CNIC |
6309 | REG_WR(bp, TM_REG_LIN0_SCAN_TIME + func*4, 1024/64*20); | 6324 | REG_WR(bp, QM_REG_CONNNUM_0 + port*4, 1024/16 - 1); |
6310 | REG_WR(bp, TM_REG_LIN0_MAX_ACTIVE_CID + func*4, 31); | ||
6311 | 6325 | ||
6312 | bnx2x_init_block(bp, TIMERS_BLOCK, init_stage); | 6326 | bnx2x_init_block(bp, TIMERS_BLOCK, init_stage); |
6327 | REG_WR(bp, TM_REG_LIN0_SCAN_TIME + port*4, 20); | ||
6328 | REG_WR(bp, TM_REG_LIN0_MAX_ACTIVE_CID + port*4, 31); | ||
6313 | #endif | 6329 | #endif |
6314 | bnx2x_init_block(bp, DQ_BLOCK, init_stage); | 6330 | bnx2x_init_block(bp, DQ_BLOCK, init_stage); |
6315 | 6331 | ||
@@ -6367,18 +6383,8 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
6367 | msleep(5); | 6383 | msleep(5); |
6368 | REG_WR(bp, PBF_REG_INIT_P0 + port*4, 0); | 6384 | REG_WR(bp, PBF_REG_INIT_P0 + port*4, 0); |
6369 | 6385 | ||
6370 | #ifdef BCM_ISCSI | 6386 | #ifdef BCM_CNIC |
6371 | /* tell the searcher where the T2 table is */ | 6387 | bnx2x_init_block(bp, SRCH_BLOCK, init_stage); |
6372 | REG_WR(bp, SRC_REG_COUNTFREE0 + func*4, 16*1024/64); | ||
6373 | |||
6374 | wb_write[0] = U64_LO(bp->t2_mapping); | ||
6375 | wb_write[1] = U64_HI(bp->t2_mapping); | ||
6376 | REG_WR_DMAE(bp, SRC_REG_FIRSTFREE0 + func*4, wb_write, 2); | ||
6377 | wb_write[0] = U64_LO((u64)bp->t2_mapping + 16*1024 - 64); | ||
6378 | wb_write[1] = U64_HI((u64)bp->t2_mapping + 16*1024 - 64); | ||
6379 | REG_WR_DMAE(bp, SRC_REG_LASTFREE0 + func*4, wb_write, 2); | ||
6380 | |||
6381 | REG_WR(bp, SRC_REG_NUMBER_HASH_BITS0 + func*4, 10); | ||
6382 | #endif | 6388 | #endif |
6383 | bnx2x_init_block(bp, CDU_BLOCK, init_stage); | 6389 | bnx2x_init_block(bp, CDU_BLOCK, init_stage); |
6384 | bnx2x_init_block(bp, CFC_BLOCK, init_stage); | 6390 | bnx2x_init_block(bp, CFC_BLOCK, init_stage); |
@@ -6487,7 +6493,12 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
6487 | #define PXP_ONE_ILT(x) (((x) << 10) | x) | 6493 | #define PXP_ONE_ILT(x) (((x) << 10) | x) |
6488 | #define PXP_ILT_RANGE(f, l) (((l) << 10) | f) | 6494 | #define PXP_ILT_RANGE(f, l) (((l) << 10) | f) |
6489 | 6495 | ||
6496 | #ifdef BCM_CNIC | ||
6497 | #define CNIC_ILT_LINES 127 | ||
6498 | #define CNIC_CTX_PER_ILT 16 | ||
6499 | #else | ||
6490 | #define CNIC_ILT_LINES 0 | 6500 | #define CNIC_ILT_LINES 0 |
6501 | #endif | ||
6491 | 6502 | ||
6492 | static void bnx2x_ilt_wr(struct bnx2x *bp, u32 index, dma_addr_t addr) | 6503 | static void bnx2x_ilt_wr(struct bnx2x *bp, u32 index, dma_addr_t addr) |
6493 | { | 6504 | { |
@@ -6526,6 +6537,46 @@ static int bnx2x_init_func(struct bnx2x *bp) | |||
6526 | REG_WR(bp, PXP2_REG_PSWRQ_CDU0_L2P + func*4, | 6537 | REG_WR(bp, PXP2_REG_PSWRQ_CDU0_L2P + func*4, |
6527 | PXP_ILT_RANGE(i, i + CNIC_ILT_LINES)); | 6538 | PXP_ILT_RANGE(i, i + CNIC_ILT_LINES)); |
6528 | 6539 | ||
6540 | #ifdef BCM_CNIC | ||
6541 | i += 1 + CNIC_ILT_LINES; | ||
6542 | bnx2x_ilt_wr(bp, i, bp->timers_mapping); | ||
6543 | if (CHIP_IS_E1(bp)) | ||
6544 | REG_WR(bp, PXP2_REG_PSWRQ_TM0_L2P + func*4, PXP_ONE_ILT(i)); | ||
6545 | else { | ||
6546 | REG_WR(bp, PXP2_REG_RQ_TM_FIRST_ILT, i); | ||
6547 | REG_WR(bp, PXP2_REG_RQ_TM_LAST_ILT, i); | ||
6548 | } | ||
6549 | |||
6550 | i++; | ||
6551 | bnx2x_ilt_wr(bp, i, bp->qm_mapping); | ||
6552 | if (CHIP_IS_E1(bp)) | ||
6553 | REG_WR(bp, PXP2_REG_PSWRQ_QM0_L2P + func*4, PXP_ONE_ILT(i)); | ||
6554 | else { | ||
6555 | REG_WR(bp, PXP2_REG_RQ_QM_FIRST_ILT, i); | ||
6556 | REG_WR(bp, PXP2_REG_RQ_QM_LAST_ILT, i); | ||
6557 | } | ||
6558 | |||
6559 | i++; | ||
6560 | bnx2x_ilt_wr(bp, i, bp->t1_mapping); | ||
6561 | if (CHIP_IS_E1(bp)) | ||
6562 | REG_WR(bp, PXP2_REG_PSWRQ_SRC0_L2P + func*4, PXP_ONE_ILT(i)); | ||
6563 | else { | ||
6564 | REG_WR(bp, PXP2_REG_RQ_SRC_FIRST_ILT, i); | ||
6565 | REG_WR(bp, PXP2_REG_RQ_SRC_LAST_ILT, i); | ||
6566 | } | ||
6567 | |||
6568 | /* tell the searcher where the T2 table is */ | ||
6569 | REG_WR(bp, SRC_REG_COUNTFREE0 + port*4, 16*1024/64); | ||
6570 | |||
6571 | bnx2x_wb_wr(bp, SRC_REG_FIRSTFREE0 + port*16, | ||
6572 | U64_LO(bp->t2_mapping), U64_HI(bp->t2_mapping)); | ||
6573 | |||
6574 | bnx2x_wb_wr(bp, SRC_REG_LASTFREE0 + port*16, | ||
6575 | U64_LO((u64)bp->t2_mapping + 16*1024 - 64), | ||
6576 | U64_HI((u64)bp->t2_mapping + 16*1024 - 64)); | ||
6577 | |||
6578 | REG_WR(bp, SRC_REG_NUMBER_HASH_BITS0 + port*4, 10); | ||
6579 | #endif | ||
6529 | 6580 | ||
6530 | if (CHIP_IS_E1H(bp)) { | 6581 | if (CHIP_IS_E1H(bp)) { |
6531 | bnx2x_init_block(bp, MISC_BLOCK, FUNC0_STAGE + func); | 6582 | bnx2x_init_block(bp, MISC_BLOCK, FUNC0_STAGE + func); |
@@ -6610,6 +6661,9 @@ static int bnx2x_init_hw(struct bnx2x *bp, u32 load_code) | |||
6610 | bnx2x_zero_def_sb(bp); | 6661 | bnx2x_zero_def_sb(bp); |
6611 | for_each_queue(bp, i) | 6662 | for_each_queue(bp, i) |
6612 | bnx2x_zero_sb(bp, BP_L_ID(bp) + i); | 6663 | bnx2x_zero_sb(bp, BP_L_ID(bp) + i); |
6664 | #ifdef BCM_CNIC | ||
6665 | bnx2x_zero_sb(bp, BP_L_ID(bp) + i); | ||
6666 | #endif | ||
6613 | 6667 | ||
6614 | init_hw_err: | 6668 | init_hw_err: |
6615 | bnx2x_gunzip_end(bp); | 6669 | bnx2x_gunzip_end(bp); |
@@ -6685,11 +6739,13 @@ static void bnx2x_free_mem(struct bnx2x *bp) | |||
6685 | BNX2X_PCI_FREE(bp->slowpath, bp->slowpath_mapping, | 6739 | BNX2X_PCI_FREE(bp->slowpath, bp->slowpath_mapping, |
6686 | sizeof(struct bnx2x_slowpath)); | 6740 | sizeof(struct bnx2x_slowpath)); |
6687 | 6741 | ||
6688 | #ifdef BCM_ISCSI | 6742 | #ifdef BCM_CNIC |
6689 | BNX2X_PCI_FREE(bp->t1, bp->t1_mapping, 64*1024); | 6743 | BNX2X_PCI_FREE(bp->t1, bp->t1_mapping, 64*1024); |
6690 | BNX2X_PCI_FREE(bp->t2, bp->t2_mapping, 16*1024); | 6744 | BNX2X_PCI_FREE(bp->t2, bp->t2_mapping, 16*1024); |
6691 | BNX2X_PCI_FREE(bp->timers, bp->timers_mapping, 8*1024); | 6745 | BNX2X_PCI_FREE(bp->timers, bp->timers_mapping, 8*1024); |
6692 | BNX2X_PCI_FREE(bp->qm, bp->qm_mapping, 128*1024); | 6746 | BNX2X_PCI_FREE(bp->qm, bp->qm_mapping, 128*1024); |
6747 | BNX2X_PCI_FREE(bp->cnic_sb, bp->cnic_sb_mapping, | ||
6748 | sizeof(struct host_status_block)); | ||
6693 | #endif | 6749 | #endif |
6694 | BNX2X_PCI_FREE(bp->spq, bp->spq_mapping, BCM_PAGE_SIZE); | 6750 | BNX2X_PCI_FREE(bp->spq, bp->spq_mapping, BCM_PAGE_SIZE); |
6695 | 6751 | ||
@@ -6768,32 +6824,26 @@ static int bnx2x_alloc_mem(struct bnx2x *bp) | |||
6768 | BNX2X_PCI_ALLOC(bp->slowpath, &bp->slowpath_mapping, | 6824 | BNX2X_PCI_ALLOC(bp->slowpath, &bp->slowpath_mapping, |
6769 | sizeof(struct bnx2x_slowpath)); | 6825 | sizeof(struct bnx2x_slowpath)); |
6770 | 6826 | ||
6771 | #ifdef BCM_ISCSI | 6827 | #ifdef BCM_CNIC |
6772 | BNX2X_PCI_ALLOC(bp->t1, &bp->t1_mapping, 64*1024); | 6828 | BNX2X_PCI_ALLOC(bp->t1, &bp->t1_mapping, 64*1024); |
6773 | 6829 | ||
6774 | /* Initialize T1 */ | ||
6775 | for (i = 0; i < 64*1024; i += 64) { | ||
6776 | *(u64 *)((char *)bp->t1 + i + 56) = 0x0UL; | ||
6777 | *(u64 *)((char *)bp->t1 + i + 3) = 0x0UL; | ||
6778 | } | ||
6779 | |||
6780 | /* allocate searcher T2 table | 6830 | /* allocate searcher T2 table |
6781 | we allocate 1/4 of alloc num for T2 | 6831 | we allocate 1/4 of alloc num for T2 |
6782 | (which is not entered into the ILT) */ | 6832 | (which is not entered into the ILT) */ |
6783 | BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, 16*1024); | 6833 | BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, 16*1024); |
6784 | 6834 | ||
6785 | /* Initialize T2 */ | 6835 | /* Initialize T2 (for 1024 connections) */ |
6786 | for (i = 0; i < 16*1024; i += 64) | 6836 | for (i = 0; i < 16*1024; i += 64) |
6787 | * (u64 *)((char *)bp->t2 + i + 56) = bp->t2_mapping + i + 64; | 6837 | *(u64 *)((char *)bp->t2 + i + 56) = bp->t2_mapping + i + 64; |
6788 | |||
6789 | /* now fixup the last line in the block to point to the next block */ | ||
6790 | *(u64 *)((char *)bp->t2 + 1024*16-8) = bp->t2_mapping; | ||
6791 | 6838 | ||
6792 | /* Timer block array (MAX_CONN*8) phys uncached for now 1024 conns */ | 6839 | /* Timer block array (8*MAX_CONN) phys uncached for now 1024 conns */ |
6793 | BNX2X_PCI_ALLOC(bp->timers, &bp->timers_mapping, 8*1024); | 6840 | BNX2X_PCI_ALLOC(bp->timers, &bp->timers_mapping, 8*1024); |
6794 | 6841 | ||
6795 | /* QM queues (128*MAX_CONN) */ | 6842 | /* QM queues (128*MAX_CONN) */ |
6796 | BNX2X_PCI_ALLOC(bp->qm, &bp->qm_mapping, 128*1024); | 6843 | BNX2X_PCI_ALLOC(bp->qm, &bp->qm_mapping, 128*1024); |
6844 | |||
6845 | BNX2X_PCI_ALLOC(bp->cnic_sb, &bp->cnic_sb_mapping, | ||
6846 | sizeof(struct host_status_block)); | ||
6797 | #endif | 6847 | #endif |
6798 | 6848 | ||
6799 | /* Slow path ring */ | 6849 | /* Slow path ring */ |
@@ -6869,6 +6919,9 @@ static void bnx2x_free_msix_irqs(struct bnx2x *bp) | |||
6869 | DP(NETIF_MSG_IFDOWN, "released sp irq (%d)\n", | 6919 | DP(NETIF_MSG_IFDOWN, "released sp irq (%d)\n", |
6870 | bp->msix_table[0].vector); | 6920 | bp->msix_table[0].vector); |
6871 | 6921 | ||
6922 | #ifdef BCM_CNIC | ||
6923 | offset++; | ||
6924 | #endif | ||
6872 | for_each_queue(bp, i) { | 6925 | for_each_queue(bp, i) { |
6873 | DP(NETIF_MSG_IFDOWN, "about to release fp #%d->%d irq " | 6926 | DP(NETIF_MSG_IFDOWN, "about to release fp #%d->%d irq " |
6874 | "state %x\n", i, bp->msix_table[i + offset].vector, | 6927 | "state %x\n", i, bp->msix_table[i + offset].vector, |
@@ -6902,6 +6955,12 @@ static int bnx2x_enable_msix(struct bnx2x *bp) | |||
6902 | bp->msix_table[0].entry = igu_vec; | 6955 | bp->msix_table[0].entry = igu_vec; |
6903 | DP(NETIF_MSG_IFUP, "msix_table[0].entry = %d (slowpath)\n", igu_vec); | 6956 | DP(NETIF_MSG_IFUP, "msix_table[0].entry = %d (slowpath)\n", igu_vec); |
6904 | 6957 | ||
6958 | #ifdef BCM_CNIC | ||
6959 | igu_vec = BP_L_ID(bp) + offset; | ||
6960 | bp->msix_table[1].entry = igu_vec; | ||
6961 | DP(NETIF_MSG_IFUP, "msix_table[1].entry = %d (CNIC)\n", igu_vec); | ||
6962 | offset++; | ||
6963 | #endif | ||
6905 | for_each_queue(bp, i) { | 6964 | for_each_queue(bp, i) { |
6906 | igu_vec = BP_L_ID(bp) + offset + i; | 6965 | igu_vec = BP_L_ID(bp) + offset + i; |
6907 | bp->msix_table[i + offset].entry = igu_vec; | 6966 | bp->msix_table[i + offset].entry = igu_vec; |
@@ -6932,6 +6991,9 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp) | |||
6932 | return -EBUSY; | 6991 | return -EBUSY; |
6933 | } | 6992 | } |
6934 | 6993 | ||
6994 | #ifdef BCM_CNIC | ||
6995 | offset++; | ||
6996 | #endif | ||
6935 | for_each_queue(bp, i) { | 6997 | for_each_queue(bp, i) { |
6936 | struct bnx2x_fastpath *fp = &bp->fp[i]; | 6998 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
6937 | 6999 | ||
@@ -7496,10 +7558,18 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
7496 | } | 7558 | } |
7497 | 7559 | ||
7498 | if (bp->state == BNX2X_STATE_OPEN) { | 7560 | if (bp->state == BNX2X_STATE_OPEN) { |
7561 | #ifdef BCM_CNIC | ||
7562 | /* Enable Timer scan */ | ||
7563 | REG_WR(bp, TM_REG_EN_LINEAR0_TIMER + BP_PORT(bp)*4, 1); | ||
7564 | #endif | ||
7499 | for_each_nondefault_queue(bp, i) { | 7565 | for_each_nondefault_queue(bp, i) { |
7500 | rc = bnx2x_setup_multi(bp, i); | 7566 | rc = bnx2x_setup_multi(bp, i); |
7501 | if (rc) | 7567 | if (rc) |
7568 | #ifdef BCM_CNIC | ||
7569 | goto load_error4; | ||
7570 | #else | ||
7502 | goto load_error3; | 7571 | goto load_error3; |
7572 | #endif | ||
7503 | } | 7573 | } |
7504 | 7574 | ||
7505 | if (CHIP_IS_E1(bp)) | 7575 | if (CHIP_IS_E1(bp)) |
@@ -7549,6 +7619,11 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
7549 | 7619 | ||
7550 | return 0; | 7620 | return 0; |
7551 | 7621 | ||
7622 | #ifdef BCM_CNIC | ||
7623 | load_error4: | ||
7624 | /* Disable Timer scan */ | ||
7625 | REG_WR(bp, TM_REG_EN_LINEAR0_TIMER + BP_PORT(bp)*4, 0); | ||
7626 | #endif | ||
7552 | load_error3: | 7627 | load_error3: |
7553 | bnx2x_int_disable_sync(bp, 1); | 7628 | bnx2x_int_disable_sync(bp, 1); |
7554 | if (!BP_NOMCP(bp)) { | 7629 | if (!BP_NOMCP(bp)) { |
@@ -7656,6 +7731,19 @@ static void bnx2x_reset_func(struct bnx2x *bp) | |||
7656 | REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, 0); | 7731 | REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, 0); |
7657 | REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, 0); | 7732 | REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, 0); |
7658 | 7733 | ||
7734 | #ifdef BCM_CNIC | ||
7735 | /* Disable Timer scan */ | ||
7736 | REG_WR(bp, TM_REG_EN_LINEAR0_TIMER + port*4, 0); | ||
7737 | /* | ||
7738 | * Wait for at least 10ms and up to 2 second for the timers scan to | ||
7739 | * complete | ||
7740 | */ | ||
7741 | for (i = 0; i < 200; i++) { | ||
7742 | msleep(10); | ||
7743 | if (!REG_RD(bp, TM_REG_LIN0_SCAN_ON + port*4)) | ||
7744 | break; | ||
7745 | } | ||
7746 | #endif | ||
7659 | /* Clear ILT */ | 7747 | /* Clear ILT */ |
7660 | base = FUNC_ILT_BASE(func); | 7748 | base = FUNC_ILT_BASE(func); |
7661 | for (i = base; i < base + ILT_PER_FUNC; i++) | 7749 | for (i = base; i < base + ILT_PER_FUNC; i++) |
@@ -8666,6 +8754,12 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp) | |||
8666 | bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2); | 8754 | bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2); |
8667 | memcpy(bp->link_params.mac_addr, bp->dev->dev_addr, ETH_ALEN); | 8755 | memcpy(bp->link_params.mac_addr, bp->dev->dev_addr, ETH_ALEN); |
8668 | memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN); | 8756 | memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN); |
8757 | |||
8758 | #ifdef BCM_CNIC | ||
8759 | val2 = SHMEM_RD(bp, dev_info.port_hw_config[port].iscsi_mac_upper); | ||
8760 | val = SHMEM_RD(bp, dev_info.port_hw_config[port].iscsi_mac_lower); | ||
8761 | bnx2x_set_mac_buf(bp->iscsi_mac, val, val2); | ||
8762 | #endif | ||
8669 | } | 8763 | } |
8670 | 8764 | ||
8671 | static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) | 8765 | static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) |