xref: /linux/drivers/infiniband/hw/irdma/i40iw_hw.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1*3ec648c6SKrzysztof Kozlowski /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
244d9e529SMustafa Ismail /* Copyright (c) 2015 - 2021 Intel Corporation */
344d9e529SMustafa Ismail #ifndef I40IW_HW_H
444d9e529SMustafa Ismail #define I40IW_HW_H
544d9e529SMustafa Ismail #define I40E_VFPE_CQPTAIL1            0x0000A000 /* Reset: VFR */
644d9e529SMustafa Ismail #define I40E_VFPE_CQPDB1              0x0000BC00 /* Reset: VFR */
744d9e529SMustafa Ismail #define I40E_VFPE_CCQPSTATUS1         0x0000B800 /* Reset: VFR */
844d9e529SMustafa Ismail #define I40E_VFPE_CCQPHIGH1           0x00009800 /* Reset: VFR */
944d9e529SMustafa Ismail #define I40E_VFPE_CCQPLOW1            0x0000AC00 /* Reset: VFR */
1044d9e529SMustafa Ismail #define I40E_VFPE_CQARM1              0x0000B400 /* Reset: VFR */
1144d9e529SMustafa Ismail #define I40E_VFPE_CQACK1              0x0000B000 /* Reset: VFR */
1244d9e529SMustafa Ismail #define I40E_VFPE_AEQALLOC1           0x0000A400 /* Reset: VFR */
1344d9e529SMustafa Ismail #define I40E_VFPE_CQPERRCODES1        0x00009C00 /* Reset: VFR */
1444d9e529SMustafa Ismail #define I40E_VFPE_WQEALLOC1           0x0000C000 /* Reset: VFR */
1544d9e529SMustafa Ismail #define I40E_VFINT_DYN_CTLN(_INTVF)   (0x00024800 + ((_INTVF) * 4)) /* _i=0...511 */ /* Reset: VFR */
1644d9e529SMustafa Ismail 
1744d9e529SMustafa Ismail #define I40E_PFPE_CQPTAIL             0x00008080 /* Reset: PFR */
1844d9e529SMustafa Ismail 
1944d9e529SMustafa Ismail #define I40E_PFPE_CQPDB               0x00008000 /* Reset: PFR */
2044d9e529SMustafa Ismail #define I40E_PFPE_CCQPSTATUS          0x00008100 /* Reset: PFR */
2144d9e529SMustafa Ismail #define I40E_PFPE_CCQPHIGH            0x00008200 /* Reset: PFR */
2244d9e529SMustafa Ismail #define I40E_PFPE_CCQPLOW             0x00008180 /* Reset: PFR */
2344d9e529SMustafa Ismail #define I40E_PFPE_CQARM               0x00131080 /* Reset: PFR */
2444d9e529SMustafa Ismail #define I40E_PFPE_CQACK               0x00131100 /* Reset: PFR */
2544d9e529SMustafa Ismail #define I40E_PFPE_AEQALLOC            0x00131180 /* Reset: PFR */
2644d9e529SMustafa Ismail #define I40E_PFPE_CQPERRCODES         0x00008880 /* Reset: PFR */
2744d9e529SMustafa Ismail #define I40E_PFPE_WQEALLOC            0x00138C00 /* Reset: PFR */
2844d9e529SMustafa Ismail #define I40E_GLPCI_LBARCTRL           0x000BE484 /* Reset: POR */
2944d9e529SMustafa Ismail #define I40E_GLPE_CPUSTATUS0          0x0000D040 /* Reset: PE_CORER */
3044d9e529SMustafa Ismail #define I40E_GLPE_CPUSTATUS1          0x0000D044 /* Reset: PE_CORER */
3144d9e529SMustafa Ismail #define I40E_GLPE_CPUSTATUS2          0x0000D048 /* Reset: PE_CORER */
3244d9e529SMustafa Ismail #define I40E_GLPE_CRITERR             0x000B4000 /* Reset: PE_CORER */
3344d9e529SMustafa Ismail #define I40E_PFHMC_PDINV              0x000C0300 /* Reset: PFR */
3444d9e529SMustafa Ismail #define I40E_GLHMC_VFPDINV(_i)        (0x000C8300 + ((_i) * 4)) /* _i=0...31 */ /* Reset: CORER */
3544d9e529SMustafa Ismail #define I40E_PFINT_DYN_CTLN(_INTPF)   (0x00034800 + ((_INTPF) * 4)) /* _i=0...511 */	/* Reset: PFR */
3644d9e529SMustafa Ismail #define I40E_PFINT_AEQCTL             0x00038700 /* Reset: CORER */
3744d9e529SMustafa Ismail 
3844d9e529SMustafa Ismail #define I40E_GLPES_PFIP4RXDISCARD(_i)            (0x00010600 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
3944d9e529SMustafa Ismail #define I40E_GLPES_PFIP4RXTRUNC(_i)              (0x00010700 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
4044d9e529SMustafa Ismail #define I40E_GLPES_PFIP4TXNOROUTE(_i)            (0x00012E00 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
4144d9e529SMustafa Ismail #define I40E_GLPES_PFIP6RXDISCARD(_i)            (0x00011200 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
4244d9e529SMustafa Ismail #define I40E_GLPES_PFIP6RXTRUNC(_i)              (0x00011300 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
4344d9e529SMustafa Ismail 
4444d9e529SMustafa Ismail #define I40E_GLPES_PFRDMAVBNDLO(_i)              (0x00014800 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
4544d9e529SMustafa Ismail #define I40E_GLPES_PFIP4TXMCOCTSLO(_i)           (0x00012000 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
4644d9e529SMustafa Ismail #define I40E_GLPES_PFIP6RXMCOCTSLO(_i)           (0x00011600 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
4744d9e529SMustafa Ismail #define I40E_GLPES_PFIP6TXMCOCTSLO(_i)           (0x00012A00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
4844d9e529SMustafa Ismail #define I40E_GLPES_PFUDPRXPKTSLO(_i)             (0x00013800 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
4944d9e529SMustafa Ismail #define I40E_GLPES_PFUDPTXPKTSLO(_i)             (0x00013A00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
5044d9e529SMustafa Ismail 
5144d9e529SMustafa Ismail #define I40E_GLPES_PFIP6TXNOROUTE(_i)            (0x00012F00 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
5244d9e529SMustafa Ismail #define I40E_GLPES_PFTCPRTXSEG(_i)               (0x00013600 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
5344d9e529SMustafa Ismail #define I40E_GLPES_PFTCPRXOPTERR(_i)             (0x00013200 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
5444d9e529SMustafa Ismail #define I40E_GLPES_PFTCPRXPROTOERR(_i)           (0x00013300 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
5544d9e529SMustafa Ismail #define I40E_GLPES_PFRXVLANERR(_i)               (0x00010000 + ((_i) * 4)) /* _i=0...15 */ /* Reset: PE_CORER */
5644d9e529SMustafa Ismail #define I40E_GLPES_PFIP4RXOCTSLO(_i)             (0x00010200 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
5744d9e529SMustafa Ismail #define I40E_GLPES_PFIP4RXPKTSLO(_i)             (0x00010400 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
5844d9e529SMustafa Ismail #define I40E_GLPES_PFIP4RXFRAGSLO(_i)            (0x00010800 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
5944d9e529SMustafa Ismail #define I40E_GLPES_PFIP4RXMCPKTSLO(_i)           (0x00010C00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6044d9e529SMustafa Ismail #define I40E_GLPES_PFIP4TXOCTSLO(_i)             (0x00011A00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6144d9e529SMustafa Ismail #define I40E_GLPES_PFIP4TXPKTSLO(_i)             (0x00011C00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6244d9e529SMustafa Ismail #define I40E_GLPES_PFIP4TXFRAGSLO(_i)            (0x00011E00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6344d9e529SMustafa Ismail #define I40E_GLPES_PFIP4TXMCPKTSLO(_i)           (0x00012200 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6444d9e529SMustafa Ismail #define I40E_GLPES_PFIP6RXOCTSLO(_i)             (0x00010E00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6544d9e529SMustafa Ismail #define I40E_GLPES_PFIP6RXPKTSLO(_i)             (0x00011000 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6644d9e529SMustafa Ismail #define I40E_GLPES_PFIP6RXFRAGSLO(_i)            (0x00011400 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6744d9e529SMustafa Ismail #define I40E_GLPES_PFIP6TXOCTSLO(_i)             (0x00012400 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6844d9e529SMustafa Ismail #define I40E_GLPES_PFIP6TXPKTSLO(_i)             (0x00012600 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
6944d9e529SMustafa Ismail #define I40E_GLPES_PFIP6TXFRAGSLO(_i)            (0x00012800 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7044d9e529SMustafa Ismail #define I40E_GLPES_PFIP6TXMCPKTSLO(_i)           (0x00012C00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7144d9e529SMustafa Ismail #define I40E_GLPES_PFTCPTXSEGLO(_i)              (0x00013400 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7244d9e529SMustafa Ismail #define I40E_GLPES_PFRDMARXRDSLO(_i)             (0x00013E00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7344d9e529SMustafa Ismail #define I40E_GLPES_PFRDMARXSNDSLO(_i)            (0x00014000 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7444d9e529SMustafa Ismail #define I40E_GLPES_PFRDMARXWRSLO(_i)             (0x00013C00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7544d9e529SMustafa Ismail #define I40E_GLPES_PFRDMATXRDSLO(_i)             (0x00014400 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7644d9e529SMustafa Ismail #define I40E_GLPES_PFRDMATXSNDSLO(_i)            (0x00014600 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7744d9e529SMustafa Ismail #define I40E_GLPES_PFRDMATXWRSLO(_i)             (0x00014200 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7844d9e529SMustafa Ismail #define I40E_GLPES_PFIP4RXMCOCTSLO(_i)           (0x00010A00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
7944d9e529SMustafa Ismail #define I40E_GLPES_PFIP6RXMCPKTSLO(_i)           (0x00011800 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
8044d9e529SMustafa Ismail #define I40E_GLPES_PFTCPRXSEGSLO(_i)             (0x00013000 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
8144d9e529SMustafa Ismail #define I40E_GLPES_PFRDMAVINVLO(_i)              (0x00014A00 + ((_i) * 8)) /* _i=0...15 */ /* Reset: PE_CORER */
8244d9e529SMustafa Ismail 
8344d9e529SMustafa Ismail #define I40IW_DB_ADDR_OFFSET    (4 * 1024 * 1024 - 64 * 1024)
8444d9e529SMustafa Ismail 
8544d9e529SMustafa Ismail #define I40IW_VF_DB_ADDR_OFFSET (64 * 1024)
8644d9e529SMustafa Ismail 
8744d9e529SMustafa Ismail #define I40E_PFINT_LNKLSTN(_INTPF)           (0x00035000 + ((_INTPF) * 4)) /* _i=0...511 */ /* Reset: PFR */
8844d9e529SMustafa Ismail #define I40E_PFINT_LNKLSTN_MAX_INDEX         511
8944d9e529SMustafa Ismail #define I40E_PFINT_LNKLSTN_FIRSTQ_INDX GENMASK(10, 0)
9044d9e529SMustafa Ismail #define I40E_PFINT_LNKLSTN_FIRSTQ_TYPE GENMASK(12, 11)
9144d9e529SMustafa Ismail 
9244d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL(_INTPF)          (0x00036800 + ((_INTPF) * 4)) /* _i=0...511 */ /* Reset: CORER */
9344d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_MAX_INDEX        511
9444d9e529SMustafa Ismail 
9544d9e529SMustafa Ismail /* shifts/masks for FLD_[LS/RS]_64 macros used in device table */
9644d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_MSIX_INDX_S 0
9744d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_MSIX_INDX GENMASK(7, 0)
9844d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_ITR_INDX_S 11
9944d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_ITR_INDX GENMASK(12, 11)
10044d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_MSIX0_INDX_S 13
10144d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_MSIX0_INDX GENMASK(15, 13)
10244d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_NEXTQ_INDX_S 16
10344d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_NEXTQ_INDX GENMASK(26, 16)
10444d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_NEXTQ_TYPE_S 27
10544d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_NEXTQ_TYPE GENMASK(28, 27)
10644d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_CAUSE_ENA_S 30
10744d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_CAUSE_ENA BIT(30)
10844d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_INTEVENT_S 31
10944d9e529SMustafa Ismail #define I40E_PFINT_CEQCTL_INTEVENT BIT(31)
11044d9e529SMustafa Ismail #define I40E_CQPSQ_STAG_PDID_S 48
11144d9e529SMustafa Ismail #define I40E_CQPSQ_STAG_PDID GENMASK_ULL(62, 48)
11244d9e529SMustafa Ismail #define I40E_PFPE_CCQPSTATUS_CCQP_DONE_S 0
11344d9e529SMustafa Ismail #define I40E_PFPE_CCQPSTATUS_CCQP_DONE BIT_ULL(0)
11444d9e529SMustafa Ismail #define I40E_PFPE_CCQPSTATUS_CCQP_ERR_S 31
11544d9e529SMustafa Ismail #define I40E_PFPE_CCQPSTATUS_CCQP_ERR BIT_ULL(31)
11644d9e529SMustafa Ismail #define I40E_PFINT_DYN_CTLN_ITR_INDX_S 3
11744d9e529SMustafa Ismail #define I40E_PFINT_DYN_CTLN_ITR_INDX GENMASK(4, 3)
11844d9e529SMustafa Ismail #define I40E_PFINT_DYN_CTLN_INTENA_S 0
11944d9e529SMustafa Ismail #define I40E_PFINT_DYN_CTLN_INTENA BIT(0)
12044d9e529SMustafa Ismail #define I40E_CQPSQ_CQ_CEQID_S 24
12144d9e529SMustafa Ismail #define I40E_CQPSQ_CQ_CEQID GENMASK(30, 24)
12244d9e529SMustafa Ismail #define I40E_CQPSQ_CQ_CQID_S 0
12344d9e529SMustafa Ismail #define I40E_CQPSQ_CQ_CQID GENMASK_ULL(15, 0)
12444d9e529SMustafa Ismail #define I40E_COMMIT_FPM_CQCNT_S 0
12544d9e529SMustafa Ismail #define I40E_COMMIT_FPM_CQCNT GENMASK_ULL(17, 0)
12644d9e529SMustafa Ismail 
12744d9e529SMustafa Ismail #define I40E_VSIQF_CTL(_VSI)             (0x0020D800 + ((_VSI) * 4))
12844d9e529SMustafa Ismail 
12944d9e529SMustafa Ismail enum i40iw_device_caps_const {
13044d9e529SMustafa Ismail 	I40IW_MAX_WQ_FRAGMENT_COUNT		= 3,
13144d9e529SMustafa Ismail 	I40IW_MAX_SGE_RD			= 1,
13244d9e529SMustafa Ismail 	I40IW_MAX_PUSH_PAGE_COUNT		= 0,
13344d9e529SMustafa Ismail 	I40IW_MAX_INLINE_DATA_SIZE		= 48,
13444d9e529SMustafa Ismail 	I40IW_MAX_IRD_SIZE			= 63,
13544d9e529SMustafa Ismail 	I40IW_MAX_ORD_SIZE			= 127,
13644d9e529SMustafa Ismail 	I40IW_MAX_WQ_ENTRIES			= 2048,
13744d9e529SMustafa Ismail 	I40IW_MAX_WQE_SIZE_RQ			= 128,
13844d9e529SMustafa Ismail 	I40IW_MAX_PDS				= 32768,
13944d9e529SMustafa Ismail 	I40IW_MAX_STATS_COUNT			= 16,
14044d9e529SMustafa Ismail 	I40IW_MAX_CQ_SIZE			= 1048575,
14144d9e529SMustafa Ismail 	I40IW_MAX_OUTBOUND_MSG_SIZE		= 2147483647,
14244d9e529SMustafa Ismail 	I40IW_MAX_INBOUND_MSG_SIZE		= 2147483647,
14372d422c2SSindhu Devale 	I40IW_MIN_WQ_SIZE                       = 4 /* WQEs */,
14444d9e529SMustafa Ismail };
14544d9e529SMustafa Ismail 
14644d9e529SMustafa Ismail #define I40IW_QP_WQE_MIN_SIZE   32
14744d9e529SMustafa Ismail #define I40IW_QP_WQE_MAX_SIZE   128
14844d9e529SMustafa Ismail #define I40IW_MAX_RQ_WQE_SHIFT  2
14944d9e529SMustafa Ismail #define I40IW_MAX_QUANTA_PER_WR 2
15044d9e529SMustafa Ismail 
15144d9e529SMustafa Ismail #define I40IW_QP_SW_MAX_SQ_QUANTA 2048
15244d9e529SMustafa Ismail #define I40IW_QP_SW_MAX_RQ_QUANTA 16384
15344d9e529SMustafa Ismail #define I40IW_QP_SW_MAX_WQ_QUANTA 2048
15444d9e529SMustafa Ismail #define I40IW_MAX_QP_WRS ((I40IW_QP_SW_MAX_SQ_QUANTA - IRDMA_SQ_RSVD) / I40IW_MAX_QUANTA_PER_WR)
15544d9e529SMustafa Ismail #define I40IW_FIRST_VF_FPM_ID 16
15644d9e529SMustafa Ismail #define QUEUE_TYPE_CEQ        2
15744d9e529SMustafa Ismail #define NULL_QUEUE_INDEX      0x7FF
15844d9e529SMustafa Ismail 
15944d9e529SMustafa Ismail void i40iw_init_hw(struct irdma_sc_dev *dev);
16044d9e529SMustafa Ismail #endif /* I40IW_HW_H */
161