@@ -180,10 +180,16 @@ void bnx2x_panic_dump(struct bnx2x *bp);
180180#define SHMEM2_WR (bp , field , val ) REG_WR(bp, SHMEM2_ADDR(bp, field), val)
181181#define MF_CFG_ADDR (bp , field ) (bp->common.mf_cfg_base + \
182182 offsetof(struct mf_cfg, field))
183+ #define MF2_CFG_ADDR (bp , field ) (bp->common.mf2_cfg_base + \
184+ offsetof(struct mf2_cfg, field))
183185
184186#define MF_CFG_RD (bp , field ) REG_RD(bp, MF_CFG_ADDR(bp, field))
185187#define MF_CFG_WR (bp , field , val ) REG_WR(bp,\
186188 MF_CFG_ADDR(bp, field), (val))
189+ #define MF2_CFG_RD (bp , field ) REG_RD(bp, MF2_CFG_ADDR(bp, field))
190+ #define SHMEM2_HAS (bp , field ) ((bp)->common.shmem2_base && \
191+ (SHMEM2_RD((bp), size) > \
192+ offsetof(struct shmem2_region, field)))
187193
188194#define EMAC_RD (bp , reg ) REG_RD(bp, emac_base + reg)
189195#define EMAC_WR (bp , reg , val ) REG_WR(bp, emac_base + reg, val)
@@ -296,6 +302,8 @@ union db_prod {
296302union host_hc_status_block {
297303 /* pointer to fp status block e1x */
298304 struct host_hc_status_block_e1x * e1x_sb ;
305+ /* pointer to fp status block e2 */
306+ struct host_hc_status_block_e2 * e2_sb ;
299307};
300308
301309struct bnx2x_fastpath {
@@ -564,12 +572,19 @@ struct bnx2x_common {
564572#define CHIP_NUM_57710 0x164e
565573#define CHIP_NUM_57711 0x164f
566574#define CHIP_NUM_57711E 0x1650
575+ #define CHIP_NUM_57712 0x1662
576+ #define CHIP_NUM_57712E 0x1663
567577#define CHIP_IS_E1 (bp ) (CHIP_NUM(bp) == CHIP_NUM_57710)
568578#define CHIP_IS_57711 (bp ) (CHIP_NUM(bp) == CHIP_NUM_57711)
569579#define CHIP_IS_57711E (bp ) (CHIP_NUM(bp) == CHIP_NUM_57711E)
580+ #define CHIP_IS_57712 (bp ) (CHIP_NUM(bp) == CHIP_NUM_57712)
581+ #define CHIP_IS_57712E (bp ) (CHIP_NUM(bp) == CHIP_NUM_57712E)
570582#define CHIP_IS_E1H (bp ) (CHIP_IS_57711(bp) || \
571583 CHIP_IS_57711E(bp))
572- #define IS_E1H_OFFSET CHIP_IS_E1H(bp)
584+ #define CHIP_IS_E2 (bp ) (CHIP_IS_57712(bp) || \
585+ CHIP_IS_57712E(bp))
586+ #define CHIP_IS_E1x (bp ) (CHIP_IS_E1((bp)) || CHIP_IS_E1H((bp)))
587+ #define IS_E1H_OFFSET (CHIP_IS_E1H(bp) || CHIP_IS_E2(bp))
573588
574589#define CHIP_REV (bp ) (bp->common.chip_id & 0x0000f000)
575590#define CHIP_REV_Ax 0x00000000
@@ -596,17 +611,33 @@ struct bnx2x_common {
596611 u32 shmem_base ;
597612 u32 shmem2_base ;
598613 u32 mf_cfg_base ;
614+ u32 mf2_cfg_base ;
599615
600616 u32 hw_config ;
601617
602618 u32 bc_ver ;
603619
604620 u8 int_block ;
605621#define INT_BLOCK_HC 0
622+ #define INT_BLOCK_IGU 1
623+ #define INT_BLOCK_MODE_NORMAL 0
624+ #define INT_BLOCK_MODE_BW_COMP 2
625+ #define CHIP_INT_MODE_IS_NBC (bp ) \
626+ (CHIP_IS_E2(bp) && \
627+ !((bp)->common.int_block & INT_BLOCK_MODE_BW_COMP))
628+ #define CHIP_INT_MODE_IS_BC (bp ) (!CHIP_INT_MODE_IS_NBC(bp))
629+
606630 u8 chip_port_mode ;
631+ #define CHIP_4_PORT_MODE 0x0
632+ #define CHIP_2_PORT_MODE 0x1
607633#define CHIP_PORT_MODE_NONE 0x2
634+ #define CHIP_MODE (bp ) (bp->common.chip_port_mode)
635+ #define CHIP_MODE_IS_4_PORT (bp ) (CHIP_MODE(bp) == CHIP_4_PORT_MODE)
608636};
609637
638+ /* IGU MSIX STATISTICS on 57712: 64 for VFs; 4 for PFs; 4 for Attentions */
639+ #define BNX2X_IGU_STAS_MSG_VF_CNT 64
640+ #define BNX2X_IGU_STAS_MSG_PF_CNT 4
610641
611642/* end of common */
612643
@@ -670,7 +701,7 @@ enum {
670701 */
671702
672703#define FP_SB_MAX_E1x 16 /* fast-path interrupt contexts E1x */
673- #define MAX_CONTEXT FP_SB_MAX_E1x
704+ #define FP_SB_MAX_E2 16 /* fast-path interrupt contexts E2 */
674705
675706/*
676707 * cid_cnt paramter below refers to the value returned by
@@ -754,7 +785,7 @@ struct bnx2x_slowpath {
754785#define MAX_DYNAMIC_ATTN_GRPS 8
755786
756787struct attn_route {
757- u32 sig [4 ];
788+ u32 sig [5 ];
758789};
759790
760791struct iro {
@@ -896,13 +927,20 @@ struct bnx2x {
896927#define HW_VLAN_RX_FLAG 0x800
897928#define MF_FUNC_DIS 0x1000
898929
899- int func ;
930+ int pf_num ; /* absolute PF number */
931+ int pfid ; /* per-path PF number */
900932 int base_fw_ndsb ;
901-
902- #define BP_PORT (bp ) (bp->func % PORT_MAX)
903- #define BP_FUNC (bp ) (bp->func)
904- #define BP_E1HVN (bp ) (bp->func >> 1)
933+ #define BP_PATH (bp ) (!CHIP_IS_E2(bp) ? \
934+ 0 : (bp->pf_num & 1))
935+ #define BP_PORT (bp ) (bp->pfid & 1)
936+ #define BP_FUNC (bp ) (bp->pfid)
937+ #define BP_ABS_FUNC (bp ) (bp->pf_num)
938+ #define BP_E1HVN (bp ) (bp->pfid >> 1)
939+ #define BP_VN (bp ) (CHIP_MODE_IS_4_PORT(bp) ? \
940+ 0 : BP_E1HVN(bp))
905941#define BP_L_ID (bp ) (BP_E1HVN(bp) << 2)
942+ #define BP_FW_MB_IDX (bp ) (BP_PORT(bp) +\
943+ BP_VN(bp) * (CHIP_IS_E1x(bp) ? 2 : 1))
906944
907945#ifdef BCM_CNIC
908946#define BCM_CNIC_CID_START 16
@@ -932,7 +970,8 @@ struct bnx2x {
932970 struct cmng_struct_per_port cmng ;
933971 u32 vn_weight_sum ;
934972
935- u32 mf_config ;
973+ u32 mf_config [E1HVN_MAX ];
974+ u32 mf2_config [E2_FUNC_MAX ];
936975 u16 mf_ov ;
937976 u8 mf_mode ;
938977#define IS_MF (bp ) (bp->mf_mode != 0)
@@ -1127,11 +1166,11 @@ struct bnx2x {
11271166#define RSS_IPV6_CAP 0x0004
11281167#define RSS_IPV6_TCP_CAP 0x0008
11291168
1130- #define BNX2X_MAX_QUEUES (bp ) (IS_MF(bp) ? (MAX_CONTEXT/E1HVN_MAX) \
1131- : MAX_CONTEXT)
11321169#define BNX2X_NUM_QUEUES (bp ) (bp->num_queues)
11331170#define is_multi (bp ) (BNX2X_NUM_QUEUES(bp) > 1)
11341171
1172+ #define BNX2X_MAX_QUEUES (bp ) (bp->igu_sb_cnt - CNIC_CONTEXT_USE)
1173+ #define is_eth_multi (bp ) (BNX2X_NUM_ETH_QUEUES(bp) > 1)
11351174
11361175#define RSS_IPV4_CAP_MASK \
11371176 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY
@@ -1342,14 +1381,40 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
13421381
13431382
13441383/* DMAE command defines */
1345- #define DMAE_CMD_SRC_PCI 0
1346- #define DMAE_CMD_SRC_GRC DMAE_COMMAND_SRC
1384+ #define DMAE_TIMEOUT -1
1385+ #define DMAE_PCI_ERROR -2 /* E2 and onward */
1386+ #define DMAE_NOT_RDY -3
1387+ #define DMAE_PCI_ERR_FLAG 0x80000000
1388+
1389+ #define DMAE_SRC_PCI 0
1390+ #define DMAE_SRC_GRC 1
1391+
1392+ #define DMAE_DST_NONE 0
1393+ #define DMAE_DST_PCI 1
1394+ #define DMAE_DST_GRC 2
1395+
1396+ #define DMAE_COMP_PCI 0
1397+ #define DMAE_COMP_GRC 1
1398+
1399+ /* E2 and onward - PCI error handling in the completion */
1400+
1401+ #define DMAE_COMP_REGULAR 0
1402+ #define DMAE_COM_SET_ERR 1
13471403
1348- #define DMAE_CMD_DST_PCI (1 << DMAE_COMMAND_DST_SHIFT)
1349- #define DMAE_CMD_DST_GRC (2 << DMAE_COMMAND_DST_SHIFT)
1404+ #define DMAE_CMD_SRC_PCI (DMAE_SRC_PCI << \
1405+ DMAE_COMMAND_SRC_SHIFT)
1406+ #define DMAE_CMD_SRC_GRC (DMAE_SRC_GRC << \
1407+ DMAE_COMMAND_SRC_SHIFT)
13501408
1351- #define DMAE_CMD_C_DST_PCI 0
1352- #define DMAE_CMD_C_DST_GRC (1 << DMAE_COMMAND_C_DST_SHIFT)
1409+ #define DMAE_CMD_DST_PCI (DMAE_DST_PCI << \
1410+ DMAE_COMMAND_DST_SHIFT)
1411+ #define DMAE_CMD_DST_GRC (DMAE_DST_GRC << \
1412+ DMAE_COMMAND_DST_SHIFT)
1413+
1414+ #define DMAE_CMD_C_DST_PCI (DMAE_COMP_PCI << \
1415+ DMAE_COMMAND_C_DST_SHIFT)
1416+ #define DMAE_CMD_C_DST_GRC (DMAE_COMP_GRC << \
1417+ DMAE_COMMAND_C_DST_SHIFT)
13531418
13541419#define DMAE_CMD_C_ENABLE DMAE_COMMAND_C_TYPE_ENABLE
13551420
@@ -1365,10 +1430,20 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
13651430#define DMAE_CMD_DST_RESET DMAE_COMMAND_DST_RESET
13661431#define DMAE_CMD_E1HVN_SHIFT DMAE_COMMAND_E1HVN_SHIFT
13671432
1433+ #define DMAE_SRC_PF 0
1434+ #define DMAE_SRC_VF 1
1435+
1436+ #define DMAE_DST_PF 0
1437+ #define DMAE_DST_VF 1
1438+
1439+ #define DMAE_C_SRC 0
1440+ #define DMAE_C_DST 1
1441+
13681442#define DMAE_LEN32_RD_MAX 0x80
13691443#define DMAE_LEN32_WR_MAX (bp ) (CHIP_IS_E1(bp) ? 0x400 : 0x2000)
13701444
1371- #define DMAE_COMP_VAL 0xe0d0d0ae
1445+ #define DMAE_COMP_VAL 0x60d0d0ae /* E2 and on - upper bit
1446+ indicates eror */
13721447
13731448#define MAX_DMAE_C_PER_PORT 8
13741449#define INIT_DMAE_C (bp ) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \
@@ -1534,6 +1609,9 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
15341609#define GET_FLAG (value , mask ) \
15351610 (((value) &= (mask)) >> (mask##_SHIFT))
15361611
1612+ #define GET_FIELD (value , fname ) \
1613+ (((value) & (fname##_MASK)) >> (fname##_SHIFT))
1614+
15371615#define CAM_IS_INVALID (x ) \
15381616 (GET_FLAG(x.flags, \
15391617 MAC_CONFIGURATION_ENTRY_ACTION_TYPE) == \
@@ -1553,6 +1631,9 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
15531631#define PXP2_REG_PXP2_INT_STS PXP2_REG_PXP2_INT_STS_0
15541632#endif
15551633
1634+ #ifndef ETH_MAX_RX_CLIENTS_E2
1635+ #define ETH_MAX_RX_CLIENTS_E2 ETH_MAX_RX_CLIENTS_E1H
1636+ #endif
15561637#define BNX2X_VPD_LEN 128
15571638#define VENDOR_ID_LEN 4
15581639
@@ -1570,13 +1651,18 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
15701651#define BNX2X_EXTERN extern
15711652#endif
15721653
1573- BNX2X_EXTERN int load_count [3 ]; /* 0-common, 1-port0, 2-port1 */
1654+ BNX2X_EXTERN int load_count [2 ][ 3 ]; /* per path: 0-common, 1-port0, 2-port1 */
15741655
15751656/* MISC_REG_RESET_REG - this is here for the hsi to work don't touch */
15761657
15771658extern void bnx2x_set_ethtool_ops (struct net_device * netdev );
15781659
15791660void bnx2x_post_dmae (struct bnx2x * bp , struct dmae_command * dmae , int idx );
1661+ u32 bnx2x_dmae_opcode_add_comp (u32 opcode , u8 comp_type );
1662+ u32 bnx2x_dmae_opcode_clr_src_reset (u32 opcode );
1663+ u32 bnx2x_dmae_opcode (struct bnx2x * bp , u8 src_type , u8 dst_type ,
1664+ bool with_comp , u8 comp_type );
1665+
15801666
15811667#define WAIT_RAMROD_POLL 0x01
15821668#define WAIT_RAMROD_COMMON 0x02
0 commit comments