162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * This software is available to you under a choice of one of two
562306a36Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
662306a36Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
762306a36Sopenharmony_ci * COPYING in the main directory of this source tree, or the
862306a36Sopenharmony_ci * OpenIB.org BSD license below:
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci *     Redistribution and use in source and binary forms, with or
1162306a36Sopenharmony_ci *     without modification, are permitted provided that the following
1262306a36Sopenharmony_ci *     conditions are met:
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci *      - Redistributions of source code must retain the above
1562306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
1662306a36Sopenharmony_ci *        disclaimer.
1762306a36Sopenharmony_ci *      - Redistributions in binary form must reproduce the above
1862306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
1962306a36Sopenharmony_ci *        disclaimer in the documentation and/or other materials
2062306a36Sopenharmony_ci *        provided with the distribution.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2362306a36Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2462306a36Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2562306a36Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2662306a36Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2762306a36Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2862306a36Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2962306a36Sopenharmony_ci * SOFTWARE.
3062306a36Sopenharmony_ci */
3162306a36Sopenharmony_ci#ifndef _T4FW_RI_API_H_
3262306a36Sopenharmony_ci#define _T4FW_RI_API_H_
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#include "t4fw_api.h"
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_cienum fw_ri_wr_opcode {
3762306a36Sopenharmony_ci	FW_RI_RDMA_WRITE		= 0x0,	/* IETF RDMAP v1.0 ... */
3862306a36Sopenharmony_ci	FW_RI_READ_REQ			= 0x1,
3962306a36Sopenharmony_ci	FW_RI_READ_RESP			= 0x2,
4062306a36Sopenharmony_ci	FW_RI_SEND			= 0x3,
4162306a36Sopenharmony_ci	FW_RI_SEND_WITH_INV		= 0x4,
4262306a36Sopenharmony_ci	FW_RI_SEND_WITH_SE		= 0x5,
4362306a36Sopenharmony_ci	FW_RI_SEND_WITH_SE_INV		= 0x6,
4462306a36Sopenharmony_ci	FW_RI_TERMINATE			= 0x7,
4562306a36Sopenharmony_ci	FW_RI_RDMA_INIT			= 0x8,	/* CHELSIO RI specific ... */
4662306a36Sopenharmony_ci	FW_RI_BIND_MW			= 0x9,
4762306a36Sopenharmony_ci	FW_RI_FAST_REGISTER		= 0xa,
4862306a36Sopenharmony_ci	FW_RI_LOCAL_INV			= 0xb,
4962306a36Sopenharmony_ci	FW_RI_QP_MODIFY			= 0xc,
5062306a36Sopenharmony_ci	FW_RI_BYPASS			= 0xd,
5162306a36Sopenharmony_ci	FW_RI_RECEIVE			= 0xe,
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci	FW_RI_SGE_EC_CR_RETURN		= 0xf,
5462306a36Sopenharmony_ci	FW_RI_WRITE_IMMEDIATE           = FW_RI_RDMA_INIT
5562306a36Sopenharmony_ci};
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_cienum fw_ri_wr_flags {
5862306a36Sopenharmony_ci	FW_RI_COMPLETION_FLAG		= 0x01,
5962306a36Sopenharmony_ci	FW_RI_NOTIFICATION_FLAG		= 0x02,
6062306a36Sopenharmony_ci	FW_RI_SOLICITED_EVENT_FLAG	= 0x04,
6162306a36Sopenharmony_ci	FW_RI_READ_FENCE_FLAG		= 0x08,
6262306a36Sopenharmony_ci	FW_RI_LOCAL_FENCE_FLAG		= 0x10,
6362306a36Sopenharmony_ci	FW_RI_RDMA_READ_INVALIDATE	= 0x20,
6462306a36Sopenharmony_ci	FW_RI_RDMA_WRITE_WITH_IMMEDIATE = 0x40
6562306a36Sopenharmony_ci};
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_cienum fw_ri_mpa_attrs {
6862306a36Sopenharmony_ci	FW_RI_MPA_RX_MARKER_ENABLE	= 0x01,
6962306a36Sopenharmony_ci	FW_RI_MPA_TX_MARKER_ENABLE	= 0x02,
7062306a36Sopenharmony_ci	FW_RI_MPA_CRC_ENABLE		= 0x04,
7162306a36Sopenharmony_ci	FW_RI_MPA_IETF_ENABLE		= 0x08
7262306a36Sopenharmony_ci};
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cienum fw_ri_qp_caps {
7562306a36Sopenharmony_ci	FW_RI_QP_RDMA_READ_ENABLE	= 0x01,
7662306a36Sopenharmony_ci	FW_RI_QP_RDMA_WRITE_ENABLE	= 0x02,
7762306a36Sopenharmony_ci	FW_RI_QP_BIND_ENABLE		= 0x04,
7862306a36Sopenharmony_ci	FW_RI_QP_FAST_REGISTER_ENABLE	= 0x08,
7962306a36Sopenharmony_ci	FW_RI_QP_STAG0_ENABLE		= 0x10
8062306a36Sopenharmony_ci};
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_cienum fw_ri_addr_type {
8362306a36Sopenharmony_ci	FW_RI_ZERO_BASED_TO		= 0x00,
8462306a36Sopenharmony_ci	FW_RI_VA_BASED_TO		= 0x01
8562306a36Sopenharmony_ci};
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_cienum fw_ri_mem_perms {
8862306a36Sopenharmony_ci	FW_RI_MEM_ACCESS_REM_WRITE	= 0x01,
8962306a36Sopenharmony_ci	FW_RI_MEM_ACCESS_REM_READ	= 0x02,
9062306a36Sopenharmony_ci	FW_RI_MEM_ACCESS_REM		= 0x03,
9162306a36Sopenharmony_ci	FW_RI_MEM_ACCESS_LOCAL_WRITE	= 0x04,
9262306a36Sopenharmony_ci	FW_RI_MEM_ACCESS_LOCAL_READ	= 0x08,
9362306a36Sopenharmony_ci	FW_RI_MEM_ACCESS_LOCAL		= 0x0C
9462306a36Sopenharmony_ci};
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_cienum fw_ri_stag_type {
9762306a36Sopenharmony_ci	FW_RI_STAG_NSMR			= 0x00,
9862306a36Sopenharmony_ci	FW_RI_STAG_SMR			= 0x01,
9962306a36Sopenharmony_ci	FW_RI_STAG_MW			= 0x02,
10062306a36Sopenharmony_ci	FW_RI_STAG_MW_RELAXED		= 0x03
10162306a36Sopenharmony_ci};
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_cienum fw_ri_data_op {
10462306a36Sopenharmony_ci	FW_RI_DATA_IMMD			= 0x81,
10562306a36Sopenharmony_ci	FW_RI_DATA_DSGL			= 0x82,
10662306a36Sopenharmony_ci	FW_RI_DATA_ISGL			= 0x83
10762306a36Sopenharmony_ci};
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_cienum fw_ri_sgl_depth {
11062306a36Sopenharmony_ci	FW_RI_SGL_DEPTH_MAX_SQ		= 16,
11162306a36Sopenharmony_ci	FW_RI_SGL_DEPTH_MAX_RQ		= 4
11262306a36Sopenharmony_ci};
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_cistruct fw_ri_dsge_pair {
11562306a36Sopenharmony_ci	__be32	len[2];
11662306a36Sopenharmony_ci	__be64	addr[2];
11762306a36Sopenharmony_ci};
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_cistruct fw_ri_dsgl {
12062306a36Sopenharmony_ci	__u8	op;
12162306a36Sopenharmony_ci	__u8	r1;
12262306a36Sopenharmony_ci	__be16	nsge;
12362306a36Sopenharmony_ci	__be32	len0;
12462306a36Sopenharmony_ci	__be64	addr0;
12562306a36Sopenharmony_ci	struct fw_ri_dsge_pair sge[];
12662306a36Sopenharmony_ci};
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_cistruct fw_ri_sge {
12962306a36Sopenharmony_ci	__be32 stag;
13062306a36Sopenharmony_ci	__be32 len;
13162306a36Sopenharmony_ci	__be64 to;
13262306a36Sopenharmony_ci};
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_cistruct fw_ri_isgl {
13562306a36Sopenharmony_ci	__u8	op;
13662306a36Sopenharmony_ci	__u8	r1;
13762306a36Sopenharmony_ci	__be16	nsge;
13862306a36Sopenharmony_ci	__be32	r2;
13962306a36Sopenharmony_ci	struct fw_ri_sge sge[];
14062306a36Sopenharmony_ci};
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_cistruct fw_ri_immd {
14362306a36Sopenharmony_ci	__u8	op;
14462306a36Sopenharmony_ci	__u8	r1;
14562306a36Sopenharmony_ci	__be16	r2;
14662306a36Sopenharmony_ci	__be32	immdlen;
14762306a36Sopenharmony_ci	__u8	data[];
14862306a36Sopenharmony_ci};
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_cistruct fw_ri_tpte {
15162306a36Sopenharmony_ci	__be32 valid_to_pdid;
15262306a36Sopenharmony_ci	__be32 locread_to_qpid;
15362306a36Sopenharmony_ci	__be32 nosnoop_pbladdr;
15462306a36Sopenharmony_ci	__be32 len_lo;
15562306a36Sopenharmony_ci	__be32 va_hi;
15662306a36Sopenharmony_ci	__be32 va_lo_fbo;
15762306a36Sopenharmony_ci	__be32 dca_mwbcnt_pstag;
15862306a36Sopenharmony_ci	__be32 len_hi;
15962306a36Sopenharmony_ci};
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci#define FW_RI_TPTE_VALID_S		31
16262306a36Sopenharmony_ci#define FW_RI_TPTE_VALID_M		0x1
16362306a36Sopenharmony_ci#define FW_RI_TPTE_VALID_V(x)		((x) << FW_RI_TPTE_VALID_S)
16462306a36Sopenharmony_ci#define FW_RI_TPTE_VALID_G(x)		\
16562306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_VALID_S) & FW_RI_TPTE_VALID_M)
16662306a36Sopenharmony_ci#define FW_RI_TPTE_VALID_F		FW_RI_TPTE_VALID_V(1U)
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci#define FW_RI_TPTE_STAGKEY_S		23
16962306a36Sopenharmony_ci#define FW_RI_TPTE_STAGKEY_M		0xff
17062306a36Sopenharmony_ci#define FW_RI_TPTE_STAGKEY_V(x)		((x) << FW_RI_TPTE_STAGKEY_S)
17162306a36Sopenharmony_ci#define FW_RI_TPTE_STAGKEY_G(x)		\
17262306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_STAGKEY_S) & FW_RI_TPTE_STAGKEY_M)
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci#define FW_RI_TPTE_STAGSTATE_S		22
17562306a36Sopenharmony_ci#define FW_RI_TPTE_STAGSTATE_M		0x1
17662306a36Sopenharmony_ci#define FW_RI_TPTE_STAGSTATE_V(x)	((x) << FW_RI_TPTE_STAGSTATE_S)
17762306a36Sopenharmony_ci#define FW_RI_TPTE_STAGSTATE_G(x)	\
17862306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_STAGSTATE_S) & FW_RI_TPTE_STAGSTATE_M)
17962306a36Sopenharmony_ci#define FW_RI_TPTE_STAGSTATE_F		FW_RI_TPTE_STAGSTATE_V(1U)
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci#define FW_RI_TPTE_STAGTYPE_S		20
18262306a36Sopenharmony_ci#define FW_RI_TPTE_STAGTYPE_M		0x3
18362306a36Sopenharmony_ci#define FW_RI_TPTE_STAGTYPE_V(x)	((x) << FW_RI_TPTE_STAGTYPE_S)
18462306a36Sopenharmony_ci#define FW_RI_TPTE_STAGTYPE_G(x)	\
18562306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_STAGTYPE_S) & FW_RI_TPTE_STAGTYPE_M)
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci#define FW_RI_TPTE_PDID_S		0
18862306a36Sopenharmony_ci#define FW_RI_TPTE_PDID_M		0xfffff
18962306a36Sopenharmony_ci#define FW_RI_TPTE_PDID_V(x)		((x) << FW_RI_TPTE_PDID_S)
19062306a36Sopenharmony_ci#define FW_RI_TPTE_PDID_G(x)		\
19162306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_PDID_S) & FW_RI_TPTE_PDID_M)
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci#define FW_RI_TPTE_PERM_S		28
19462306a36Sopenharmony_ci#define FW_RI_TPTE_PERM_M		0xf
19562306a36Sopenharmony_ci#define FW_RI_TPTE_PERM_V(x)		((x) << FW_RI_TPTE_PERM_S)
19662306a36Sopenharmony_ci#define FW_RI_TPTE_PERM_G(x)		\
19762306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_PERM_S) & FW_RI_TPTE_PERM_M)
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci#define FW_RI_TPTE_REMINVDIS_S		27
20062306a36Sopenharmony_ci#define FW_RI_TPTE_REMINVDIS_M		0x1
20162306a36Sopenharmony_ci#define FW_RI_TPTE_REMINVDIS_V(x)	((x) << FW_RI_TPTE_REMINVDIS_S)
20262306a36Sopenharmony_ci#define FW_RI_TPTE_REMINVDIS_G(x)	\
20362306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_REMINVDIS_S) & FW_RI_TPTE_REMINVDIS_M)
20462306a36Sopenharmony_ci#define FW_RI_TPTE_REMINVDIS_F		FW_RI_TPTE_REMINVDIS_V(1U)
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci#define FW_RI_TPTE_ADDRTYPE_S		26
20762306a36Sopenharmony_ci#define FW_RI_TPTE_ADDRTYPE_M		1
20862306a36Sopenharmony_ci#define FW_RI_TPTE_ADDRTYPE_V(x)	((x) << FW_RI_TPTE_ADDRTYPE_S)
20962306a36Sopenharmony_ci#define FW_RI_TPTE_ADDRTYPE_G(x)	\
21062306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_ADDRTYPE_S) & FW_RI_TPTE_ADDRTYPE_M)
21162306a36Sopenharmony_ci#define FW_RI_TPTE_ADDRTYPE_F		FW_RI_TPTE_ADDRTYPE_V(1U)
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci#define FW_RI_TPTE_MWBINDEN_S		25
21462306a36Sopenharmony_ci#define FW_RI_TPTE_MWBINDEN_M		0x1
21562306a36Sopenharmony_ci#define FW_RI_TPTE_MWBINDEN_V(x)	((x) << FW_RI_TPTE_MWBINDEN_S)
21662306a36Sopenharmony_ci#define FW_RI_TPTE_MWBINDEN_G(x)	\
21762306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_MWBINDEN_S) & FW_RI_TPTE_MWBINDEN_M)
21862306a36Sopenharmony_ci#define FW_RI_TPTE_MWBINDEN_F		FW_RI_TPTE_MWBINDEN_V(1U)
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci#define FW_RI_TPTE_PS_S			20
22162306a36Sopenharmony_ci#define FW_RI_TPTE_PS_M			0x1f
22262306a36Sopenharmony_ci#define FW_RI_TPTE_PS_V(x)		((x) << FW_RI_TPTE_PS_S)
22362306a36Sopenharmony_ci#define FW_RI_TPTE_PS_G(x)		\
22462306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_PS_S) & FW_RI_TPTE_PS_M)
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci#define FW_RI_TPTE_QPID_S		0
22762306a36Sopenharmony_ci#define FW_RI_TPTE_QPID_M		0xfffff
22862306a36Sopenharmony_ci#define FW_RI_TPTE_QPID_V(x)		((x) << FW_RI_TPTE_QPID_S)
22962306a36Sopenharmony_ci#define FW_RI_TPTE_QPID_G(x)		\
23062306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_QPID_S) & FW_RI_TPTE_QPID_M)
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci#define FW_RI_TPTE_NOSNOOP_S		30
23362306a36Sopenharmony_ci#define FW_RI_TPTE_NOSNOOP_M		0x1
23462306a36Sopenharmony_ci#define FW_RI_TPTE_NOSNOOP_V(x)		((x) << FW_RI_TPTE_NOSNOOP_S)
23562306a36Sopenharmony_ci#define FW_RI_TPTE_NOSNOOP_G(x)		\
23662306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_NOSNOOP_S) & FW_RI_TPTE_NOSNOOP_M)
23762306a36Sopenharmony_ci#define FW_RI_TPTE_NOSNOOP_F		FW_RI_TPTE_NOSNOOP_V(1U)
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci#define FW_RI_TPTE_PBLADDR_S		0
24062306a36Sopenharmony_ci#define FW_RI_TPTE_PBLADDR_M		0x1fffffff
24162306a36Sopenharmony_ci#define FW_RI_TPTE_PBLADDR_V(x)		((x) << FW_RI_TPTE_PBLADDR_S)
24262306a36Sopenharmony_ci#define FW_RI_TPTE_PBLADDR_G(x)		\
24362306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_PBLADDR_S) & FW_RI_TPTE_PBLADDR_M)
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci#define FW_RI_TPTE_DCA_S		24
24662306a36Sopenharmony_ci#define FW_RI_TPTE_DCA_M		0x1f
24762306a36Sopenharmony_ci#define FW_RI_TPTE_DCA_V(x)		((x) << FW_RI_TPTE_DCA_S)
24862306a36Sopenharmony_ci#define FW_RI_TPTE_DCA_G(x)		\
24962306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_DCA_S) & FW_RI_TPTE_DCA_M)
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci#define FW_RI_TPTE_MWBCNT_PSTAG_S	0
25262306a36Sopenharmony_ci#define FW_RI_TPTE_MWBCNT_PSTAG_M	0xffffff
25362306a36Sopenharmony_ci#define FW_RI_TPTE_MWBCNT_PSTAT_V(x)	\
25462306a36Sopenharmony_ci	((x) << FW_RI_TPTE_MWBCNT_PSTAG_S)
25562306a36Sopenharmony_ci#define FW_RI_TPTE_MWBCNT_PSTAG_G(x)	\
25662306a36Sopenharmony_ci	(((x) >> FW_RI_TPTE_MWBCNT_PSTAG_S) & FW_RI_TPTE_MWBCNT_PSTAG_M)
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_cienum fw_ri_res_type {
25962306a36Sopenharmony_ci	FW_RI_RES_TYPE_SQ,
26062306a36Sopenharmony_ci	FW_RI_RES_TYPE_RQ,
26162306a36Sopenharmony_ci	FW_RI_RES_TYPE_CQ,
26262306a36Sopenharmony_ci	FW_RI_RES_TYPE_SRQ,
26362306a36Sopenharmony_ci};
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_cienum fw_ri_res_op {
26662306a36Sopenharmony_ci	FW_RI_RES_OP_WRITE,
26762306a36Sopenharmony_ci	FW_RI_RES_OP_RESET,
26862306a36Sopenharmony_ci};
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_cistruct fw_ri_res {
27162306a36Sopenharmony_ci	union fw_ri_restype {
27262306a36Sopenharmony_ci		struct fw_ri_res_sqrq {
27362306a36Sopenharmony_ci			__u8   restype;
27462306a36Sopenharmony_ci			__u8   op;
27562306a36Sopenharmony_ci			__be16 r3;
27662306a36Sopenharmony_ci			__be32 eqid;
27762306a36Sopenharmony_ci			__be32 r4[2];
27862306a36Sopenharmony_ci			__be32 fetchszm_to_iqid;
27962306a36Sopenharmony_ci			__be32 dcaen_to_eqsize;
28062306a36Sopenharmony_ci			__be64 eqaddr;
28162306a36Sopenharmony_ci		} sqrq;
28262306a36Sopenharmony_ci		struct fw_ri_res_cq {
28362306a36Sopenharmony_ci			__u8   restype;
28462306a36Sopenharmony_ci			__u8   op;
28562306a36Sopenharmony_ci			__be16 r3;
28662306a36Sopenharmony_ci			__be32 iqid;
28762306a36Sopenharmony_ci			__be32 r4[2];
28862306a36Sopenharmony_ci			__be32 iqandst_to_iqandstindex;
28962306a36Sopenharmony_ci			__be16 iqdroprss_to_iqesize;
29062306a36Sopenharmony_ci			__be16 iqsize;
29162306a36Sopenharmony_ci			__be64 iqaddr;
29262306a36Sopenharmony_ci			__be32 iqns_iqro;
29362306a36Sopenharmony_ci			__be32 r6_lo;
29462306a36Sopenharmony_ci			__be64 r7;
29562306a36Sopenharmony_ci		} cq;
29662306a36Sopenharmony_ci		struct fw_ri_res_srq {
29762306a36Sopenharmony_ci			__u8   restype;
29862306a36Sopenharmony_ci			__u8   op;
29962306a36Sopenharmony_ci			__be16 r3;
30062306a36Sopenharmony_ci			__be32 eqid;
30162306a36Sopenharmony_ci			__be32 r4[2];
30262306a36Sopenharmony_ci			__be32 fetchszm_to_iqid;
30362306a36Sopenharmony_ci			__be32 dcaen_to_eqsize;
30462306a36Sopenharmony_ci			__be64 eqaddr;
30562306a36Sopenharmony_ci			__be32 srqid;
30662306a36Sopenharmony_ci			__be32 pdid;
30762306a36Sopenharmony_ci			__be32 hwsrqsize;
30862306a36Sopenharmony_ci			__be32 hwsrqaddr;
30962306a36Sopenharmony_ci		} srq;
31062306a36Sopenharmony_ci	} u;
31162306a36Sopenharmony_ci};
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_cistruct fw_ri_res_wr {
31462306a36Sopenharmony_ci	__be32 op_nres;
31562306a36Sopenharmony_ci	__be32 len16_pkd;
31662306a36Sopenharmony_ci	__u64  cookie;
31762306a36Sopenharmony_ci	struct fw_ri_res res[];
31862306a36Sopenharmony_ci};
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci#define FW_RI_RES_WR_NRES_S	0
32162306a36Sopenharmony_ci#define FW_RI_RES_WR_NRES_M	0xff
32262306a36Sopenharmony_ci#define FW_RI_RES_WR_NRES_V(x)	((x) << FW_RI_RES_WR_NRES_S)
32362306a36Sopenharmony_ci#define FW_RI_RES_WR_NRES_G(x)	\
32462306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_NRES_S) & FW_RI_RES_WR_NRES_M)
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHSZM_S		26
32762306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHSZM_M		0x1
32862306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHSZM_V(x)	((x) << FW_RI_RES_WR_FETCHSZM_S)
32962306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHSZM_G(x)	\
33062306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_FETCHSZM_S) & FW_RI_RES_WR_FETCHSZM_M)
33162306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHSZM_F	FW_RI_RES_WR_FETCHSZM_V(1U)
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGNS_S	25
33462306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGNS_M	0x1
33562306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGNS_V(x)	((x) << FW_RI_RES_WR_STATUSPGNS_S)
33662306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGNS_G(x)	\
33762306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_STATUSPGNS_S) & FW_RI_RES_WR_STATUSPGNS_M)
33862306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGNS_F	FW_RI_RES_WR_STATUSPGNS_V(1U)
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGRO_S	24
34162306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGRO_M	0x1
34262306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGRO_V(x)	((x) << FW_RI_RES_WR_STATUSPGRO_S)
34362306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGRO_G(x)	\
34462306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_STATUSPGRO_S) & FW_RI_RES_WR_STATUSPGRO_M)
34562306a36Sopenharmony_ci#define FW_RI_RES_WR_STATUSPGRO_F	FW_RI_RES_WR_STATUSPGRO_V(1U)
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHNS_S		23
34862306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHNS_M		0x1
34962306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHNS_V(x)	((x) << FW_RI_RES_WR_FETCHNS_S)
35062306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHNS_G(x)	\
35162306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_FETCHNS_S) & FW_RI_RES_WR_FETCHNS_M)
35262306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHNS_F	FW_RI_RES_WR_FETCHNS_V(1U)
35362306a36Sopenharmony_ci
35462306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHRO_S		22
35562306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHRO_M		0x1
35662306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHRO_V(x)	((x) << FW_RI_RES_WR_FETCHRO_S)
35762306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHRO_G(x)	\
35862306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_FETCHRO_S) & FW_RI_RES_WR_FETCHRO_M)
35962306a36Sopenharmony_ci#define FW_RI_RES_WR_FETCHRO_F	FW_RI_RES_WR_FETCHRO_V(1U)
36062306a36Sopenharmony_ci
36162306a36Sopenharmony_ci#define FW_RI_RES_WR_HOSTFCMODE_S	20
36262306a36Sopenharmony_ci#define FW_RI_RES_WR_HOSTFCMODE_M	0x3
36362306a36Sopenharmony_ci#define FW_RI_RES_WR_HOSTFCMODE_V(x)	((x) << FW_RI_RES_WR_HOSTFCMODE_S)
36462306a36Sopenharmony_ci#define FW_RI_RES_WR_HOSTFCMODE_G(x)	\
36562306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_HOSTFCMODE_S) & FW_RI_RES_WR_HOSTFCMODE_M)
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ci#define FW_RI_RES_WR_CPRIO_S	19
36862306a36Sopenharmony_ci#define FW_RI_RES_WR_CPRIO_M	0x1
36962306a36Sopenharmony_ci#define FW_RI_RES_WR_CPRIO_V(x)	((x) << FW_RI_RES_WR_CPRIO_S)
37062306a36Sopenharmony_ci#define FW_RI_RES_WR_CPRIO_G(x)	\
37162306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_CPRIO_S) & FW_RI_RES_WR_CPRIO_M)
37262306a36Sopenharmony_ci#define FW_RI_RES_WR_CPRIO_F	FW_RI_RES_WR_CPRIO_V(1U)
37362306a36Sopenharmony_ci
37462306a36Sopenharmony_ci#define FW_RI_RES_WR_ONCHIP_S		18
37562306a36Sopenharmony_ci#define FW_RI_RES_WR_ONCHIP_M		0x1
37662306a36Sopenharmony_ci#define FW_RI_RES_WR_ONCHIP_V(x)	((x) << FW_RI_RES_WR_ONCHIP_S)
37762306a36Sopenharmony_ci#define FW_RI_RES_WR_ONCHIP_G(x)	\
37862306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_ONCHIP_S) & FW_RI_RES_WR_ONCHIP_M)
37962306a36Sopenharmony_ci#define FW_RI_RES_WR_ONCHIP_F	FW_RI_RES_WR_ONCHIP_V(1U)
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci#define FW_RI_RES_WR_PCIECHN_S		16
38262306a36Sopenharmony_ci#define FW_RI_RES_WR_PCIECHN_M		0x3
38362306a36Sopenharmony_ci#define FW_RI_RES_WR_PCIECHN_V(x)	((x) << FW_RI_RES_WR_PCIECHN_S)
38462306a36Sopenharmony_ci#define FW_RI_RES_WR_PCIECHN_G(x)	\
38562306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_PCIECHN_S) & FW_RI_RES_WR_PCIECHN_M)
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_ci#define FW_RI_RES_WR_IQID_S	0
38862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQID_M	0xffff
38962306a36Sopenharmony_ci#define FW_RI_RES_WR_IQID_V(x)	((x) << FW_RI_RES_WR_IQID_S)
39062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQID_G(x)	\
39162306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQID_S) & FW_RI_RES_WR_IQID_M)
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci#define FW_RI_RES_WR_DCAEN_S	31
39462306a36Sopenharmony_ci#define FW_RI_RES_WR_DCAEN_M	0x1
39562306a36Sopenharmony_ci#define FW_RI_RES_WR_DCAEN_V(x)	((x) << FW_RI_RES_WR_DCAEN_S)
39662306a36Sopenharmony_ci#define FW_RI_RES_WR_DCAEN_G(x)	\
39762306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_DCAEN_S) & FW_RI_RES_WR_DCAEN_M)
39862306a36Sopenharmony_ci#define FW_RI_RES_WR_DCAEN_F	FW_RI_RES_WR_DCAEN_V(1U)
39962306a36Sopenharmony_ci
40062306a36Sopenharmony_ci#define FW_RI_RES_WR_DCACPU_S		26
40162306a36Sopenharmony_ci#define FW_RI_RES_WR_DCACPU_M		0x1f
40262306a36Sopenharmony_ci#define FW_RI_RES_WR_DCACPU_V(x)	((x) << FW_RI_RES_WR_DCACPU_S)
40362306a36Sopenharmony_ci#define FW_RI_RES_WR_DCACPU_G(x)	\
40462306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_DCACPU_S) & FW_RI_RES_WR_DCACPU_M)
40562306a36Sopenharmony_ci
40662306a36Sopenharmony_ci#define FW_RI_RES_WR_FBMIN_S	23
40762306a36Sopenharmony_ci#define FW_RI_RES_WR_FBMIN_M	0x7
40862306a36Sopenharmony_ci#define FW_RI_RES_WR_FBMIN_V(x)	((x) << FW_RI_RES_WR_FBMIN_S)
40962306a36Sopenharmony_ci#define FW_RI_RES_WR_FBMIN_G(x)	\
41062306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_FBMIN_S) & FW_RI_RES_WR_FBMIN_M)
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_ci#define FW_RI_RES_WR_FBMAX_S	20
41362306a36Sopenharmony_ci#define FW_RI_RES_WR_FBMAX_M	0x7
41462306a36Sopenharmony_ci#define FW_RI_RES_WR_FBMAX_V(x)	((x) << FW_RI_RES_WR_FBMAX_S)
41562306a36Sopenharmony_ci#define FW_RI_RES_WR_FBMAX_G(x)	\
41662306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_FBMAX_S) & FW_RI_RES_WR_FBMAX_M)
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_ci#define FW_RI_RES_WR_CIDXFTHRESHO_S	19
41962306a36Sopenharmony_ci#define FW_RI_RES_WR_CIDXFTHRESHO_M	0x1
42062306a36Sopenharmony_ci#define FW_RI_RES_WR_CIDXFTHRESHO_V(x)	((x) << FW_RI_RES_WR_CIDXFTHRESHO_S)
42162306a36Sopenharmony_ci#define FW_RI_RES_WR_CIDXFTHRESHO_G(x)	\
42262306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_CIDXFTHRESHO_S) & FW_RI_RES_WR_CIDXFTHRESHO_M)
42362306a36Sopenharmony_ci#define FW_RI_RES_WR_CIDXFTHRESHO_F	FW_RI_RES_WR_CIDXFTHRESHO_V(1U)
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci#define FW_RI_RES_WR_CIDXFTHRESH_S	16
42662306a36Sopenharmony_ci#define FW_RI_RES_WR_CIDXFTHRESH_M	0x7
42762306a36Sopenharmony_ci#define FW_RI_RES_WR_CIDXFTHRESH_V(x)	((x) << FW_RI_RES_WR_CIDXFTHRESH_S)
42862306a36Sopenharmony_ci#define FW_RI_RES_WR_CIDXFTHRESH_G(x)	\
42962306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_CIDXFTHRESH_S) & FW_RI_RES_WR_CIDXFTHRESH_M)
43062306a36Sopenharmony_ci
43162306a36Sopenharmony_ci#define FW_RI_RES_WR_EQSIZE_S		0
43262306a36Sopenharmony_ci#define FW_RI_RES_WR_EQSIZE_M		0xffff
43362306a36Sopenharmony_ci#define FW_RI_RES_WR_EQSIZE_V(x)	((x) << FW_RI_RES_WR_EQSIZE_S)
43462306a36Sopenharmony_ci#define FW_RI_RES_WR_EQSIZE_G(x)	\
43562306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_EQSIZE_S) & FW_RI_RES_WR_EQSIZE_M)
43662306a36Sopenharmony_ci
43762306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANDST_S		15
43862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANDST_M		0x1
43962306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANDST_V(x)	((x) << FW_RI_RES_WR_IQANDST_S)
44062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANDST_G(x)	\
44162306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQANDST_S) & FW_RI_RES_WR_IQANDST_M)
44262306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANDST_F	FW_RI_RES_WR_IQANDST_V(1U)
44362306a36Sopenharmony_ci
44462306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANUS_S		14
44562306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANUS_M		0x1
44662306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANUS_V(x)	((x) << FW_RI_RES_WR_IQANUS_S)
44762306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANUS_G(x)	\
44862306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQANUS_S) & FW_RI_RES_WR_IQANUS_M)
44962306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANUS_F	FW_RI_RES_WR_IQANUS_V(1U)
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANUD_S		12
45262306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANUD_M		0x3
45362306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANUD_V(x)	((x) << FW_RI_RES_WR_IQANUD_S)
45462306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANUD_G(x)	\
45562306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQANUD_S) & FW_RI_RES_WR_IQANUD_M)
45662306a36Sopenharmony_ci
45762306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANDSTINDEX_S	0
45862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANDSTINDEX_M	0xfff
45962306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANDSTINDEX_V(x)	((x) << FW_RI_RES_WR_IQANDSTINDEX_S)
46062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQANDSTINDEX_G(x)	\
46162306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQANDSTINDEX_S) & FW_RI_RES_WR_IQANDSTINDEX_M)
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDROPRSS_S	15
46462306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDROPRSS_M	0x1
46562306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDROPRSS_V(x)	((x) << FW_RI_RES_WR_IQDROPRSS_S)
46662306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDROPRSS_G(x)	\
46762306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQDROPRSS_S) & FW_RI_RES_WR_IQDROPRSS_M)
46862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDROPRSS_F	FW_RI_RES_WR_IQDROPRSS_V(1U)
46962306a36Sopenharmony_ci
47062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQGTSMODE_S	14
47162306a36Sopenharmony_ci#define FW_RI_RES_WR_IQGTSMODE_M	0x1
47262306a36Sopenharmony_ci#define FW_RI_RES_WR_IQGTSMODE_V(x)	((x) << FW_RI_RES_WR_IQGTSMODE_S)
47362306a36Sopenharmony_ci#define FW_RI_RES_WR_IQGTSMODE_G(x)	\
47462306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQGTSMODE_S) & FW_RI_RES_WR_IQGTSMODE_M)
47562306a36Sopenharmony_ci#define FW_RI_RES_WR_IQGTSMODE_F	FW_RI_RES_WR_IQGTSMODE_V(1U)
47662306a36Sopenharmony_ci
47762306a36Sopenharmony_ci#define FW_RI_RES_WR_IQPCIECH_S		12
47862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQPCIECH_M		0x3
47962306a36Sopenharmony_ci#define FW_RI_RES_WR_IQPCIECH_V(x)	((x) << FW_RI_RES_WR_IQPCIECH_S)
48062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQPCIECH_G(x)	\
48162306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQPCIECH_S) & FW_RI_RES_WR_IQPCIECH_M)
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDCAEN_S		11
48462306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDCAEN_M		0x1
48562306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDCAEN_V(x)	((x) << FW_RI_RES_WR_IQDCAEN_S)
48662306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDCAEN_G(x)	\
48762306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQDCAEN_S) & FW_RI_RES_WR_IQDCAEN_M)
48862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDCAEN_F	FW_RI_RES_WR_IQDCAEN_V(1U)
48962306a36Sopenharmony_ci
49062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDCACPU_S		6
49162306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDCACPU_M		0x1f
49262306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDCACPU_V(x)	((x) << FW_RI_RES_WR_IQDCACPU_S)
49362306a36Sopenharmony_ci#define FW_RI_RES_WR_IQDCACPU_G(x)	\
49462306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQDCACPU_S) & FW_RI_RES_WR_IQDCACPU_M)
49562306a36Sopenharmony_ci
49662306a36Sopenharmony_ci#define FW_RI_RES_WR_IQINTCNTTHRESH_S		4
49762306a36Sopenharmony_ci#define FW_RI_RES_WR_IQINTCNTTHRESH_M		0x3
49862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQINTCNTTHRESH_V(x)	\
49962306a36Sopenharmony_ci	((x) << FW_RI_RES_WR_IQINTCNTTHRESH_S)
50062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQINTCNTTHRESH_G(x)	\
50162306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQINTCNTTHRESH_S) & FW_RI_RES_WR_IQINTCNTTHRESH_M)
50262306a36Sopenharmony_ci
50362306a36Sopenharmony_ci#define FW_RI_RES_WR_IQO_S	3
50462306a36Sopenharmony_ci#define FW_RI_RES_WR_IQO_M	0x1
50562306a36Sopenharmony_ci#define FW_RI_RES_WR_IQO_V(x)	((x) << FW_RI_RES_WR_IQO_S)
50662306a36Sopenharmony_ci#define FW_RI_RES_WR_IQO_G(x)	\
50762306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQO_S) & FW_RI_RES_WR_IQO_M)
50862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQO_F	FW_RI_RES_WR_IQO_V(1U)
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQCPRIO_S		2
51162306a36Sopenharmony_ci#define FW_RI_RES_WR_IQCPRIO_M		0x1
51262306a36Sopenharmony_ci#define FW_RI_RES_WR_IQCPRIO_V(x)	((x) << FW_RI_RES_WR_IQCPRIO_S)
51362306a36Sopenharmony_ci#define FW_RI_RES_WR_IQCPRIO_G(x)	\
51462306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQCPRIO_S) & FW_RI_RES_WR_IQCPRIO_M)
51562306a36Sopenharmony_ci#define FW_RI_RES_WR_IQCPRIO_F	FW_RI_RES_WR_IQCPRIO_V(1U)
51662306a36Sopenharmony_ci
51762306a36Sopenharmony_ci#define FW_RI_RES_WR_IQESIZE_S		0
51862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQESIZE_M		0x3
51962306a36Sopenharmony_ci#define FW_RI_RES_WR_IQESIZE_V(x)	((x) << FW_RI_RES_WR_IQESIZE_S)
52062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQESIZE_G(x)	\
52162306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQESIZE_S) & FW_RI_RES_WR_IQESIZE_M)
52262306a36Sopenharmony_ci
52362306a36Sopenharmony_ci#define FW_RI_RES_WR_IQNS_S	31
52462306a36Sopenharmony_ci#define FW_RI_RES_WR_IQNS_M	0x1
52562306a36Sopenharmony_ci#define FW_RI_RES_WR_IQNS_V(x)	((x) << FW_RI_RES_WR_IQNS_S)
52662306a36Sopenharmony_ci#define FW_RI_RES_WR_IQNS_G(x)	\
52762306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQNS_S) & FW_RI_RES_WR_IQNS_M)
52862306a36Sopenharmony_ci#define FW_RI_RES_WR_IQNS_F	FW_RI_RES_WR_IQNS_V(1U)
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_ci#define FW_RI_RES_WR_IQRO_S	30
53162306a36Sopenharmony_ci#define FW_RI_RES_WR_IQRO_M	0x1
53262306a36Sopenharmony_ci#define FW_RI_RES_WR_IQRO_V(x)	((x) << FW_RI_RES_WR_IQRO_S)
53362306a36Sopenharmony_ci#define FW_RI_RES_WR_IQRO_G(x)	\
53462306a36Sopenharmony_ci	(((x) >> FW_RI_RES_WR_IQRO_S) & FW_RI_RES_WR_IQRO_M)
53562306a36Sopenharmony_ci#define FW_RI_RES_WR_IQRO_F	FW_RI_RES_WR_IQRO_V(1U)
53662306a36Sopenharmony_ci
53762306a36Sopenharmony_cistruct fw_ri_rdma_write_wr {
53862306a36Sopenharmony_ci	__u8   opcode;
53962306a36Sopenharmony_ci	__u8   flags;
54062306a36Sopenharmony_ci	__u16  wrid;
54162306a36Sopenharmony_ci	__u8   r1[3];
54262306a36Sopenharmony_ci	__u8   len16;
54362306a36Sopenharmony_ci	/*
54462306a36Sopenharmony_ci	 * Use union for immediate data to be consistent with stack's 32 bit
54562306a36Sopenharmony_ci	 * data and iWARP spec's 64 bit data.
54662306a36Sopenharmony_ci	 */
54762306a36Sopenharmony_ci	union {
54862306a36Sopenharmony_ci		struct {
54962306a36Sopenharmony_ci			__be32 imm_data32;
55062306a36Sopenharmony_ci			u32 reserved;
55162306a36Sopenharmony_ci		} ib_imm_data;
55262306a36Sopenharmony_ci		__be64 imm_data64;
55362306a36Sopenharmony_ci	} iw_imm_data;
55462306a36Sopenharmony_ci	__be32 plen;
55562306a36Sopenharmony_ci	__be32 stag_sink;
55662306a36Sopenharmony_ci	__be64 to_sink;
55762306a36Sopenharmony_ci	union {
55862306a36Sopenharmony_ci		DECLARE_FLEX_ARRAY(struct fw_ri_immd, immd_src);
55962306a36Sopenharmony_ci		DECLARE_FLEX_ARRAY(struct fw_ri_isgl, isgl_src);
56062306a36Sopenharmony_ci	} u;
56162306a36Sopenharmony_ci};
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_cistruct fw_ri_send_wr {
56462306a36Sopenharmony_ci	__u8   opcode;
56562306a36Sopenharmony_ci	__u8   flags;
56662306a36Sopenharmony_ci	__u16  wrid;
56762306a36Sopenharmony_ci	__u8   r1[3];
56862306a36Sopenharmony_ci	__u8   len16;
56962306a36Sopenharmony_ci	__be32 sendop_pkd;
57062306a36Sopenharmony_ci	__be32 stag_inv;
57162306a36Sopenharmony_ci	__be32 plen;
57262306a36Sopenharmony_ci	__be32 r3;
57362306a36Sopenharmony_ci	__be64 r4;
57462306a36Sopenharmony_ci	union {
57562306a36Sopenharmony_ci		DECLARE_FLEX_ARRAY(struct fw_ri_immd, immd_src);
57662306a36Sopenharmony_ci		DECLARE_FLEX_ARRAY(struct fw_ri_isgl, isgl_src);
57762306a36Sopenharmony_ci	} u;
57862306a36Sopenharmony_ci};
57962306a36Sopenharmony_ci
58062306a36Sopenharmony_ci#define FW_RI_SEND_WR_SENDOP_S		0
58162306a36Sopenharmony_ci#define FW_RI_SEND_WR_SENDOP_M		0xf
58262306a36Sopenharmony_ci#define FW_RI_SEND_WR_SENDOP_V(x)	((x) << FW_RI_SEND_WR_SENDOP_S)
58362306a36Sopenharmony_ci#define FW_RI_SEND_WR_SENDOP_G(x)	\
58462306a36Sopenharmony_ci	(((x) >> FW_RI_SEND_WR_SENDOP_S) & FW_RI_SEND_WR_SENDOP_M)
58562306a36Sopenharmony_ci
58662306a36Sopenharmony_cistruct fw_ri_rdma_write_cmpl_wr {
58762306a36Sopenharmony_ci	__u8   opcode;
58862306a36Sopenharmony_ci	__u8   flags;
58962306a36Sopenharmony_ci	__u16  wrid;
59062306a36Sopenharmony_ci	__u8   r1[3];
59162306a36Sopenharmony_ci	__u8   len16;
59262306a36Sopenharmony_ci	__u8   r2;
59362306a36Sopenharmony_ci	__u8   flags_send;
59462306a36Sopenharmony_ci	__u16  wrid_send;
59562306a36Sopenharmony_ci	__be32 stag_inv;
59662306a36Sopenharmony_ci	__be32 plen;
59762306a36Sopenharmony_ci	__be32 stag_sink;
59862306a36Sopenharmony_ci	__be64 to_sink;
59962306a36Sopenharmony_ci	union fw_ri_cmpl {
60062306a36Sopenharmony_ci		struct fw_ri_immd_cmpl {
60162306a36Sopenharmony_ci			__u8   op;
60262306a36Sopenharmony_ci			__u8   r1[6];
60362306a36Sopenharmony_ci			__u8   immdlen;
60462306a36Sopenharmony_ci			__u8   data[16];
60562306a36Sopenharmony_ci		} immd_src;
60662306a36Sopenharmony_ci		struct fw_ri_isgl isgl_src;
60762306a36Sopenharmony_ci	} u_cmpl;
60862306a36Sopenharmony_ci	__be64 r3;
60962306a36Sopenharmony_ci	union fw_ri_write {
61062306a36Sopenharmony_ci		DECLARE_FLEX_ARRAY(struct fw_ri_immd, immd_src);
61162306a36Sopenharmony_ci		DECLARE_FLEX_ARRAY(struct fw_ri_isgl, isgl_src);
61262306a36Sopenharmony_ci	} u;
61362306a36Sopenharmony_ci};
61462306a36Sopenharmony_ci
61562306a36Sopenharmony_cistruct fw_ri_rdma_read_wr {
61662306a36Sopenharmony_ci	__u8   opcode;
61762306a36Sopenharmony_ci	__u8   flags;
61862306a36Sopenharmony_ci	__u16  wrid;
61962306a36Sopenharmony_ci	__u8   r1[3];
62062306a36Sopenharmony_ci	__u8   len16;
62162306a36Sopenharmony_ci	__be64 r2;
62262306a36Sopenharmony_ci	__be32 stag_sink;
62362306a36Sopenharmony_ci	__be32 to_sink_hi;
62462306a36Sopenharmony_ci	__be32 to_sink_lo;
62562306a36Sopenharmony_ci	__be32 plen;
62662306a36Sopenharmony_ci	__be32 stag_src;
62762306a36Sopenharmony_ci	__be32 to_src_hi;
62862306a36Sopenharmony_ci	__be32 to_src_lo;
62962306a36Sopenharmony_ci	__be32 r5;
63062306a36Sopenharmony_ci};
63162306a36Sopenharmony_ci
63262306a36Sopenharmony_cistruct fw_ri_recv_wr {
63362306a36Sopenharmony_ci	__u8   opcode;
63462306a36Sopenharmony_ci	__u8   r1;
63562306a36Sopenharmony_ci	__u16  wrid;
63662306a36Sopenharmony_ci	__u8   r2[3];
63762306a36Sopenharmony_ci	__u8   len16;
63862306a36Sopenharmony_ci	struct fw_ri_isgl isgl;
63962306a36Sopenharmony_ci};
64062306a36Sopenharmony_ci
64162306a36Sopenharmony_cistruct fw_ri_bind_mw_wr {
64262306a36Sopenharmony_ci	__u8   opcode;
64362306a36Sopenharmony_ci	__u8   flags;
64462306a36Sopenharmony_ci	__u16  wrid;
64562306a36Sopenharmony_ci	__u8   r1[3];
64662306a36Sopenharmony_ci	__u8   len16;
64762306a36Sopenharmony_ci	__u8   qpbinde_to_dcacpu;
64862306a36Sopenharmony_ci	__u8   pgsz_shift;
64962306a36Sopenharmony_ci	__u8   addr_type;
65062306a36Sopenharmony_ci	__u8   mem_perms;
65162306a36Sopenharmony_ci	__be32 stag_mr;
65262306a36Sopenharmony_ci	__be32 stag_mw;
65362306a36Sopenharmony_ci	__be32 r3;
65462306a36Sopenharmony_ci	__be64 len_mw;
65562306a36Sopenharmony_ci	__be64 va_fbo;
65662306a36Sopenharmony_ci	__be64 r4;
65762306a36Sopenharmony_ci};
65862306a36Sopenharmony_ci
65962306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_QPBINDE_S	6
66062306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_QPBINDE_M	0x1
66162306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_QPBINDE_V(x)	((x) << FW_RI_BIND_MW_WR_QPBINDE_S)
66262306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_QPBINDE_G(x)	\
66362306a36Sopenharmony_ci	(((x) >> FW_RI_BIND_MW_WR_QPBINDE_S) & FW_RI_BIND_MW_WR_QPBINDE_M)
66462306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_QPBINDE_F	FW_RI_BIND_MW_WR_QPBINDE_V(1U)
66562306a36Sopenharmony_ci
66662306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_NS_S		5
66762306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_NS_M		0x1
66862306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_NS_V(x)	((x) << FW_RI_BIND_MW_WR_NS_S)
66962306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_NS_G(x)	\
67062306a36Sopenharmony_ci	(((x) >> FW_RI_BIND_MW_WR_NS_S) & FW_RI_BIND_MW_WR_NS_M)
67162306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_NS_F	FW_RI_BIND_MW_WR_NS_V(1U)
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_DCACPU_S	0
67462306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_DCACPU_M	0x1f
67562306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_DCACPU_V(x)	((x) << FW_RI_BIND_MW_WR_DCACPU_S)
67662306a36Sopenharmony_ci#define FW_RI_BIND_MW_WR_DCACPU_G(x)	\
67762306a36Sopenharmony_ci	(((x) >> FW_RI_BIND_MW_WR_DCACPU_S) & FW_RI_BIND_MW_WR_DCACPU_M)
67862306a36Sopenharmony_ci
67962306a36Sopenharmony_cistruct fw_ri_fr_nsmr_wr {
68062306a36Sopenharmony_ci	__u8   opcode;
68162306a36Sopenharmony_ci	__u8   flags;
68262306a36Sopenharmony_ci	__u16  wrid;
68362306a36Sopenharmony_ci	__u8   r1[3];
68462306a36Sopenharmony_ci	__u8   len16;
68562306a36Sopenharmony_ci	__u8   qpbinde_to_dcacpu;
68662306a36Sopenharmony_ci	__u8   pgsz_shift;
68762306a36Sopenharmony_ci	__u8   addr_type;
68862306a36Sopenharmony_ci	__u8   mem_perms;
68962306a36Sopenharmony_ci	__be32 stag;
69062306a36Sopenharmony_ci	__be32 len_hi;
69162306a36Sopenharmony_ci	__be32 len_lo;
69262306a36Sopenharmony_ci	__be32 va_hi;
69362306a36Sopenharmony_ci	__be32 va_lo_fbo;
69462306a36Sopenharmony_ci};
69562306a36Sopenharmony_ci
69662306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_QPBINDE_S	6
69762306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_QPBINDE_M	0x1
69862306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_QPBINDE_V(x)	((x) << FW_RI_FR_NSMR_WR_QPBINDE_S)
69962306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_QPBINDE_G(x)	\
70062306a36Sopenharmony_ci	(((x) >> FW_RI_FR_NSMR_WR_QPBINDE_S) & FW_RI_FR_NSMR_WR_QPBINDE_M)
70162306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_QPBINDE_F	FW_RI_FR_NSMR_WR_QPBINDE_V(1U)
70262306a36Sopenharmony_ci
70362306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_NS_S		5
70462306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_NS_M		0x1
70562306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_NS_V(x)	((x) << FW_RI_FR_NSMR_WR_NS_S)
70662306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_NS_G(x)	\
70762306a36Sopenharmony_ci	(((x) >> FW_RI_FR_NSMR_WR_NS_S) & FW_RI_FR_NSMR_WR_NS_M)
70862306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_NS_F	FW_RI_FR_NSMR_WR_NS_V(1U)
70962306a36Sopenharmony_ci
71062306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_DCACPU_S	0
71162306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_DCACPU_M	0x1f
71262306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_DCACPU_V(x)	((x) << FW_RI_FR_NSMR_WR_DCACPU_S)
71362306a36Sopenharmony_ci#define FW_RI_FR_NSMR_WR_DCACPU_G(x)	\
71462306a36Sopenharmony_ci	(((x) >> FW_RI_FR_NSMR_WR_DCACPU_S) & FW_RI_FR_NSMR_WR_DCACPU_M)
71562306a36Sopenharmony_ci
71662306a36Sopenharmony_cistruct fw_ri_fr_nsmr_tpte_wr {
71762306a36Sopenharmony_ci	__u8	opcode;
71862306a36Sopenharmony_ci	__u8   flags;
71962306a36Sopenharmony_ci	__u16  wrid;
72062306a36Sopenharmony_ci	__u8   r1[3];
72162306a36Sopenharmony_ci	__u8   len16;
72262306a36Sopenharmony_ci	__be32  r2;
72362306a36Sopenharmony_ci	__be32  stag;
72462306a36Sopenharmony_ci	struct fw_ri_tpte tpte;
72562306a36Sopenharmony_ci	__u64  pbl[2];
72662306a36Sopenharmony_ci};
72762306a36Sopenharmony_ci
72862306a36Sopenharmony_cistruct fw_ri_inv_lstag_wr {
72962306a36Sopenharmony_ci	__u8   opcode;
73062306a36Sopenharmony_ci	__u8   flags;
73162306a36Sopenharmony_ci	__u16  wrid;
73262306a36Sopenharmony_ci	__u8   r1[3];
73362306a36Sopenharmony_ci	__u8   len16;
73462306a36Sopenharmony_ci	__be32 r2;
73562306a36Sopenharmony_ci	__be32 stag_inv;
73662306a36Sopenharmony_ci};
73762306a36Sopenharmony_ci
73862306a36Sopenharmony_cienum fw_ri_type {
73962306a36Sopenharmony_ci	FW_RI_TYPE_INIT,
74062306a36Sopenharmony_ci	FW_RI_TYPE_FINI,
74162306a36Sopenharmony_ci	FW_RI_TYPE_TERMINATE
74262306a36Sopenharmony_ci};
74362306a36Sopenharmony_ci
74462306a36Sopenharmony_cienum fw_ri_init_p2ptype {
74562306a36Sopenharmony_ci	FW_RI_INIT_P2PTYPE_RDMA_WRITE		= FW_RI_RDMA_WRITE,
74662306a36Sopenharmony_ci	FW_RI_INIT_P2PTYPE_READ_REQ		= FW_RI_READ_REQ,
74762306a36Sopenharmony_ci	FW_RI_INIT_P2PTYPE_SEND			= FW_RI_SEND,
74862306a36Sopenharmony_ci	FW_RI_INIT_P2PTYPE_SEND_WITH_INV	= FW_RI_SEND_WITH_INV,
74962306a36Sopenharmony_ci	FW_RI_INIT_P2PTYPE_SEND_WITH_SE		= FW_RI_SEND_WITH_SE,
75062306a36Sopenharmony_ci	FW_RI_INIT_P2PTYPE_SEND_WITH_SE_INV	= FW_RI_SEND_WITH_SE_INV,
75162306a36Sopenharmony_ci	FW_RI_INIT_P2PTYPE_DISABLED		= 0xf,
75262306a36Sopenharmony_ci};
75362306a36Sopenharmony_ci
75462306a36Sopenharmony_cienum fw_ri_init_rqeqid_srq {
75562306a36Sopenharmony_ci	FW_RI_INIT_RQEQID_SRQ			= 1 << 31,
75662306a36Sopenharmony_ci};
75762306a36Sopenharmony_ci
75862306a36Sopenharmony_cistruct fw_ri_wr {
75962306a36Sopenharmony_ci	__be32 op_compl;
76062306a36Sopenharmony_ci	__be32 flowid_len16;
76162306a36Sopenharmony_ci	__u64  cookie;
76262306a36Sopenharmony_ci	union fw_ri {
76362306a36Sopenharmony_ci		struct fw_ri_init {
76462306a36Sopenharmony_ci			__u8   type;
76562306a36Sopenharmony_ci			__u8   mpareqbit_p2ptype;
76662306a36Sopenharmony_ci			__u8   r4[2];
76762306a36Sopenharmony_ci			__u8   mpa_attrs;
76862306a36Sopenharmony_ci			__u8   qp_caps;
76962306a36Sopenharmony_ci			__be16 nrqe;
77062306a36Sopenharmony_ci			__be32 pdid;
77162306a36Sopenharmony_ci			__be32 qpid;
77262306a36Sopenharmony_ci			__be32 sq_eqid;
77362306a36Sopenharmony_ci			__be32 rq_eqid;
77462306a36Sopenharmony_ci			__be32 scqid;
77562306a36Sopenharmony_ci			__be32 rcqid;
77662306a36Sopenharmony_ci			__be32 ord_max;
77762306a36Sopenharmony_ci			__be32 ird_max;
77862306a36Sopenharmony_ci			__be32 iss;
77962306a36Sopenharmony_ci			__be32 irs;
78062306a36Sopenharmony_ci			__be32 hwrqsize;
78162306a36Sopenharmony_ci			__be32 hwrqaddr;
78262306a36Sopenharmony_ci			__be64 r5;
78362306a36Sopenharmony_ci			union fw_ri_init_p2p {
78462306a36Sopenharmony_ci				struct fw_ri_rdma_write_wr write;
78562306a36Sopenharmony_ci				struct fw_ri_rdma_read_wr read;
78662306a36Sopenharmony_ci				struct fw_ri_send_wr send;
78762306a36Sopenharmony_ci			} u;
78862306a36Sopenharmony_ci		} init;
78962306a36Sopenharmony_ci		struct fw_ri_fini {
79062306a36Sopenharmony_ci			__u8   type;
79162306a36Sopenharmony_ci			__u8   r3[7];
79262306a36Sopenharmony_ci			__be64 r4;
79362306a36Sopenharmony_ci		} fini;
79462306a36Sopenharmony_ci		struct fw_ri_terminate {
79562306a36Sopenharmony_ci			__u8   type;
79662306a36Sopenharmony_ci			__u8   r3[3];
79762306a36Sopenharmony_ci			__be32 immdlen;
79862306a36Sopenharmony_ci			__u8   termmsg[40];
79962306a36Sopenharmony_ci		} terminate;
80062306a36Sopenharmony_ci	} u;
80162306a36Sopenharmony_ci};
80262306a36Sopenharmony_ci
80362306a36Sopenharmony_ci#define FW_RI_WR_MPAREQBIT_S	7
80462306a36Sopenharmony_ci#define FW_RI_WR_MPAREQBIT_M	0x1
80562306a36Sopenharmony_ci#define FW_RI_WR_MPAREQBIT_V(x)	((x) << FW_RI_WR_MPAREQBIT_S)
80662306a36Sopenharmony_ci#define FW_RI_WR_MPAREQBIT_G(x)	\
80762306a36Sopenharmony_ci	(((x) >> FW_RI_WR_MPAREQBIT_S) & FW_RI_WR_MPAREQBIT_M)
80862306a36Sopenharmony_ci#define FW_RI_WR_MPAREQBIT_F	FW_RI_WR_MPAREQBIT_V(1U)
80962306a36Sopenharmony_ci
81062306a36Sopenharmony_ci#define FW_RI_WR_P2PTYPE_S	0
81162306a36Sopenharmony_ci#define FW_RI_WR_P2PTYPE_M	0xf
81262306a36Sopenharmony_ci#define FW_RI_WR_P2PTYPE_V(x)	((x) << FW_RI_WR_P2PTYPE_S)
81362306a36Sopenharmony_ci#define FW_RI_WR_P2PTYPE_G(x)	\
81462306a36Sopenharmony_ci	(((x) >> FW_RI_WR_P2PTYPE_S) & FW_RI_WR_P2PTYPE_M)
81562306a36Sopenharmony_ci
81662306a36Sopenharmony_ci#endif /* _T4FW_RI_API_H_ */
817