xref: /onnv-gate/usr/src/uts/common/sys/nxge/nxge_zcp_hw.h (revision 3859:19804e7fd496)
1*3859Sml29623 /*
2*3859Sml29623  * CDDL HEADER START
3*3859Sml29623  *
4*3859Sml29623  * The contents of this file are subject to the terms of the
5*3859Sml29623  * Common Development and Distribution License (the "License").
6*3859Sml29623  * You may not use this file except in compliance with the License.
7*3859Sml29623  *
8*3859Sml29623  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3859Sml29623  * or http://www.opensolaris.org/os/licensing.
10*3859Sml29623  * See the License for the specific language governing permissions
11*3859Sml29623  * and limitations under the License.
12*3859Sml29623  *
13*3859Sml29623  * When distributing Covered Code, include this CDDL HEADER in each
14*3859Sml29623  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3859Sml29623  * If applicable, add the following below this CDDL HEADER, with the
16*3859Sml29623  * fields enclosed by brackets "[]" replaced with your own identifying
17*3859Sml29623  * information: Portions Copyright [yyyy] [name of copyright owner]
18*3859Sml29623  *
19*3859Sml29623  * CDDL HEADER END
20*3859Sml29623  */
21*3859Sml29623 /*
22*3859Sml29623  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*3859Sml29623  * Use is subject to license terms.
24*3859Sml29623  */
25*3859Sml29623 
26*3859Sml29623 #ifndef	_SYS_NXGE_NXGE_ZCP_HW_H
27*3859Sml29623 #define	_SYS_NXGE_NXGE_ZCP_HW_H
28*3859Sml29623 
29*3859Sml29623 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*3859Sml29623 
31*3859Sml29623 #ifdef	__cplusplus
32*3859Sml29623 extern "C" {
33*3859Sml29623 #endif
34*3859Sml29623 
35*3859Sml29623 #include <nxge_defs.h>
36*3859Sml29623 
37*3859Sml29623 /*
38*3859Sml29623  * Neptune Zerocopy Hardware definitions
39*3859Sml29623  * Updated to reflect PRM-0.8.
40*3859Sml29623  */
41*3859Sml29623 
42*3859Sml29623 #define	ZCP_CONFIG_REG		(FZC_ZCP + 0x00000)
43*3859Sml29623 #define	ZCP_INT_STAT_REG	(FZC_ZCP + 0x00008)
44*3859Sml29623 #define	ZCP_INT_STAT_TEST_REG	(FZC_ZCP + 0x00108)
45*3859Sml29623 #define	ZCP_INT_MASK_REG	(FZC_ZCP + 0x00010)
46*3859Sml29623 
47*3859Sml29623 #define	ZCP_BAM4_RE_CTL_REG 	(FZC_ZCP + 0x00018)
48*3859Sml29623 #define	ZCP_BAM8_RE_CTL_REG 	(FZC_ZCP + 0x00020)
49*3859Sml29623 #define	ZCP_BAM16_RE_CTL_REG 	(FZC_ZCP + 0x00028)
50*3859Sml29623 #define	ZCP_BAM32_RE_CTL_REG 	(FZC_ZCP + 0x00030)
51*3859Sml29623 
52*3859Sml29623 #define	ZCP_DST4_RE_CTL_REG 	(FZC_ZCP + 0x00038)
53*3859Sml29623 #define	ZCP_DST8_RE_CTL_REG 	(FZC_ZCP + 0x00040)
54*3859Sml29623 #define	ZCP_DST16_RE_CTL_REG 	(FZC_ZCP + 0x00048)
55*3859Sml29623 #define	ZCP_DST32_RE_CTL_REG 	(FZC_ZCP + 0x00050)
56*3859Sml29623 
57*3859Sml29623 #define	ZCP_RAM_DATA_REG	(FZC_ZCP + 0x00058)
58*3859Sml29623 #define	ZCP_RAM_DATA0_REG	(FZC_ZCP + 0x00058)
59*3859Sml29623 #define	ZCP_RAM_DATA1_REG	(FZC_ZCP + 0x00060)
60*3859Sml29623 #define	ZCP_RAM_DATA2_REG	(FZC_ZCP + 0x00068)
61*3859Sml29623 #define	ZCP_RAM_DATA3_REG	(FZC_ZCP + 0x00070)
62*3859Sml29623 #define	ZCP_RAM_DATA4_REG	(FZC_ZCP + 0x00078)
63*3859Sml29623 #define	ZCP_RAM_BE_REG		(FZC_ZCP + 0x00080)
64*3859Sml29623 #define	ZCP_RAM_ACC_REG		(FZC_ZCP + 0x00088)
65*3859Sml29623 
66*3859Sml29623 #define	ZCP_TRAINING_VECTOR_REG	(FZC_ZCP + 0x000C0)
67*3859Sml29623 #define	ZCP_STATE_MACHINE_REG	(FZC_ZCP + 0x000C8)
68*3859Sml29623 #define	ZCP_CHK_BIT_DATA_REG	(FZC_ZCP + 0x00090)
69*3859Sml29623 #define	ZCP_RESET_CFIFO_REG	(FZC_ZCP + 0x00098)
70*3859Sml29623 #define	ZCP_RESET_CFIFO_MASK	0x0F
71*3859Sml29623 
72*3859Sml29623 #define	ZCP_CFIFIO_RESET_WAIT		10
73*3859Sml29623 #define	ZCP_P0_P1_CFIFO_DEPTH		2048
74*3859Sml29623 #define	ZCP_P2_P3_CFIFO_DEPTH		1024
75*3859Sml29623 #define	ZCP_NIU_CFIFO_DEPTH		1024
76*3859Sml29623 
77*3859Sml29623 typedef union _zcp_reset_cfifo {
78*3859Sml29623 	uint64_t value;
79*3859Sml29623 	struct {
80*3859Sml29623 #if defined(_BIG_ENDIAN)
81*3859Sml29623 		uint32_t hdw;
82*3859Sml29623 #endif
83*3859Sml29623 		struct {
84*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
85*3859Sml29623 			uint32_t rsrvd:28;
86*3859Sml29623 			uint32_t reset_cfifo3:1;
87*3859Sml29623 			uint32_t reset_cfifo2:1;
88*3859Sml29623 			uint32_t reset_cfifo1:1;
89*3859Sml29623 			uint32_t reset_cfifo0:1;
90*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
91*3859Sml29623 			uint32_t reset_cfifo0:1;
92*3859Sml29623 			uint32_t reset_cfifo1:1;
93*3859Sml29623 			uint32_t reset_cfifo2:1;
94*3859Sml29623 			uint32_t reset_cfifo3:1;
95*3859Sml29623 			uint32_t rsrvd:28;
96*3859Sml29623 #endif
97*3859Sml29623 		} ldw;
98*3859Sml29623 #if !defined(_BIG_ENDIAN)
99*3859Sml29623 		uint32_t hdw;
100*3859Sml29623 #endif
101*3859Sml29623 	} bits;
102*3859Sml29623 } zcp_reset_cfifo_t, *p_zcp_reset_cfifo_t;
103*3859Sml29623 
104*3859Sml29623 #define	ZCP_CFIFO_ECC_PORT0_REG	(FZC_ZCP + 0x000A0)
105*3859Sml29623 #define	ZCP_CFIFO_ECC_PORT1_REG	(FZC_ZCP + 0x000A8)
106*3859Sml29623 #define	ZCP_CFIFO_ECC_PORT2_REG	(FZC_ZCP + 0x000B0)
107*3859Sml29623 #define	ZCP_CFIFO_ECC_PORT3_REG	(FZC_ZCP + 0x000B8)
108*3859Sml29623 
109*3859Sml29623 /* NOTE: Same as RX_LOG_PAGE_HDL */
110*3859Sml29623 #define	ZCP_PAGE_HDL_REG	(FZC_DMC + 0x20038)
111*3859Sml29623 
112*3859Sml29623 /* Data Structures */
113*3859Sml29623 
114*3859Sml29623 typedef union zcp_config_reg_u {
115*3859Sml29623 	uint64_t value;
116*3859Sml29623 	struct {
117*3859Sml29623 #if defined(_BIG_ENDIAN)
118*3859Sml29623 		uint32_t hdw;
119*3859Sml29623 #endif
120*3859Sml29623 		struct {
121*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
122*3859Sml29623 			uint32_t rsvd:7;
123*3859Sml29623 			uint32_t mode_32_bit:1;
124*3859Sml29623 			uint32_t debug_sel:8;
125*3859Sml29623 			uint32_t rdma_th:11;
126*3859Sml29623 			uint32_t ecc_chk_dis:1;
127*3859Sml29623 			uint32_t par_chk_dis:1;
128*3859Sml29623 			uint32_t dis_buf_rn:1;
129*3859Sml29623 			uint32_t dis_buf_rq_if:1;
130*3859Sml29623 			uint32_t zc_enable:1;
131*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
132*3859Sml29623 			uint32_t zc_enable:1;
133*3859Sml29623 			uint32_t dis_buf_rq_if:1;
134*3859Sml29623 			uint32_t dis_buf_rn:1;
135*3859Sml29623 			uint32_t par_chk_dis:1;
136*3859Sml29623 			uint32_t ecc_chk_dis:1;
137*3859Sml29623 			uint32_t rdma_th:11;
138*3859Sml29623 			uint32_t debug_sel:8;
139*3859Sml29623 			uint32_t mode_32_bit:1;
140*3859Sml29623 			uint32_t rsvd:7;
141*3859Sml29623 #endif
142*3859Sml29623 		} ldw;
143*3859Sml29623 #if !defined(_BIG_ENDIAN)
144*3859Sml29623 		uint32_t hdw;
145*3859Sml29623 #endif
146*3859Sml29623 	} bits;
147*3859Sml29623 } zcp_config_reg_t, *zcp_config_reg_pt;
148*3859Sml29623 
149*3859Sml29623 #define	ZCP_DEBUG_SEL_BITS	0xFF
150*3859Sml29623 #define	ZCP_DEBUG_SEL_SHIFT	16
151*3859Sml29623 #define	ZCP_DEBUG_SEL_MASK	(ZCP_DEBUG_SEL_BITS << ZCP_DEBUG_SEL_SHIFT)
152*3859Sml29623 #define	RDMA_TH_BITS		0x7FF
153*3859Sml29623 #define	RDMA_TH_SHIFT		5
154*3859Sml29623 #define	RDMA_TH_MASK		(RDMA_TH_BITS << RDMA_TH_SHIFT)
155*3859Sml29623 #define	ECC_CHK_DIS		(1 << 4)
156*3859Sml29623 #define	PAR_CHK_DIS		(1 << 3)
157*3859Sml29623 #define	DIS_BUFF_RN		(1 << 2)
158*3859Sml29623 #define	DIS_BUFF_RQ_IF		(1 << 1)
159*3859Sml29623 #define	ZC_ENABLE		(1 << 0)
160*3859Sml29623 
161*3859Sml29623 typedef union zcp_int_stat_reg_u {
162*3859Sml29623 	uint64_t value;
163*3859Sml29623 	struct {
164*3859Sml29623 #if defined(_BIG_ENDIAN)
165*3859Sml29623 		uint32_t hdw;
166*3859Sml29623 #endif
167*3859Sml29623 		struct {
168*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
169*3859Sml29623 			uint32_t rsvd:16;
170*3859Sml29623 			uint32_t rrfifo_urun:1;
171*3859Sml29623 			uint32_t rrfifo_orun:1;
172*3859Sml29623 			uint32_t rsvd1:1;
173*3859Sml29623 			uint32_t rspfifo_uc_err:1;
174*3859Sml29623 			uint32_t buf_overflow:1;
175*3859Sml29623 			uint32_t stat_tbl_perr:1;
176*3859Sml29623 			uint32_t dyn_tbl_perr:1;
177*3859Sml29623 			uint32_t buf_tbl_perr:1;
178*3859Sml29623 			uint32_t tt_tbl_perr:1;
179*3859Sml29623 			uint32_t rsp_tt_index_err:1;
180*3859Sml29623 			uint32_t slv_tt_index_err:1;
181*3859Sml29623 			uint32_t zcp_tt_index_err:1;
182*3859Sml29623 			uint32_t cfifo_ecc3:1;
183*3859Sml29623 			uint32_t cfifo_ecc2:1;
184*3859Sml29623 			uint32_t cfifo_ecc1:1;
185*3859Sml29623 			uint32_t cfifo_ecc0:1;
186*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
187*3859Sml29623 			uint32_t cfifo_ecc0:1;
188*3859Sml29623 			uint32_t cfifo_ecc1:1;
189*3859Sml29623 			uint32_t cfifo_ecc2:1;
190*3859Sml29623 			uint32_t cfifo_ecc3:1;
191*3859Sml29623 			uint32_t zcp_tt_index_err:1;
192*3859Sml29623 			uint32_t slv_tt_index_err:1;
193*3859Sml29623 			uint32_t rsp_tt_index_err:1;
194*3859Sml29623 			uint32_t tt_tbl_perr:1;
195*3859Sml29623 			uint32_t buf_tbl_perr:1;
196*3859Sml29623 			uint32_t dyn_tbl_perr:1;
197*3859Sml29623 			uint32_t stat_tbl_perr:1;
198*3859Sml29623 			uint32_t buf_overflow:1;
199*3859Sml29623 			uint32_t rspfifo_uc_err:1;
200*3859Sml29623 			uint32_t rsvd1:1;
201*3859Sml29623 			uint32_t rrfifo_orun:1;
202*3859Sml29623 			uint32_t rrfifo_urun:1;
203*3859Sml29623 			uint32_t rsvd:16;
204*3859Sml29623 #endif
205*3859Sml29623 		} ldw;
206*3859Sml29623 #if !defined(_BIG_ENDIAN)
207*3859Sml29623 		uint32_t hdw;
208*3859Sml29623 #endif
209*3859Sml29623 	} bits;
210*3859Sml29623 } zcp_int_stat_reg_t, *zcp_int_stat_reg_pt, zcp_int_mask_reg_t,
211*3859Sml29623 	*zcp_int_mask_reg_pt;
212*3859Sml29623 
213*3859Sml29623 #define	RRFIFO_UNDERRUN		(1 << 15)
214*3859Sml29623 #define	RRFIFO_OVERRUN		(1 << 14)
215*3859Sml29623 #define	RSPFIFO_UNCORR_ERR	(1 << 12)
216*3859Sml29623 #define	BUFFER_OVERFLOW		(1 << 11)
217*3859Sml29623 #define	STAT_TBL_PERR		(1 << 10)
218*3859Sml29623 #define	BUF_DYN_TBL_PERR	(1 << 9)
219*3859Sml29623 #define	BUF_TBL_PERR		(1 << 8)
220*3859Sml29623 #define	TT_PROGRAM_ERR		(1 << 7)
221*3859Sml29623 #define	RSP_TT_INDEX_ERR	(1 << 6)
222*3859Sml29623 #define	SLV_TT_INDEX_ERR	(1 << 5)
223*3859Sml29623 #define	ZCP_TT_INDEX_ERR	(1 << 4)
224*3859Sml29623 #define	CFIFO_ECC3		(1 << 3)
225*3859Sml29623 #define	CFIFO_ECC0		(1 << 0)
226*3859Sml29623 #define	CFIFO_ECC2		(1 << 2)
227*3859Sml29623 #define	CFIFO_ECC1		(1 << 1)
228*3859Sml29623 
229*3859Sml29623 typedef union zcp_bam_region_reg_u {
230*3859Sml29623 	uint64_t value;
231*3859Sml29623 	struct {
232*3859Sml29623 #if defined(_BIG_ENDIAN)
233*3859Sml29623 		uint32_t hdw;
234*3859Sml29623 #endif
235*3859Sml29623 		struct {
236*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
237*3859Sml29623 			uint32_t loj:1;
238*3859Sml29623 			uint32_t range_chk_en:1;
239*3859Sml29623 			uint32_t last_zcfid:10;
240*3859Sml29623 			uint32_t first_zcfid:10;
241*3859Sml29623 			uint32_t offset:10;
242*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
243*3859Sml29623 			uint32_t offset:10;
244*3859Sml29623 			uint32_t first_zcfid:10;
245*3859Sml29623 			uint32_t last_zcfid:10;
246*3859Sml29623 			uint32_t range_chk_en:1;
247*3859Sml29623 			uint32_t loj:1;
248*3859Sml29623 #endif
249*3859Sml29623 		} ldw;
250*3859Sml29623 #if !defined(_BIG_ENDIAN)
251*3859Sml29623 		uint32_t hdw;
252*3859Sml29623 #endif
253*3859Sml29623 	} bits;
254*3859Sml29623 } zcp_bam_region_reg_t, *zcp_bam_region_reg_pt;
255*3859Sml29623 
256*3859Sml29623 typedef union zcp_dst_region_reg_u {
257*3859Sml29623 	uint64_t value;
258*3859Sml29623 	struct {
259*3859Sml29623 #if defined(_BIG_ENDIAN)
260*3859Sml29623 		uint32_t hdw;
261*3859Sml29623 #endif
262*3859Sml29623 		struct {
263*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
264*3859Sml29623 			uint32_t rsvd:22;
265*3859Sml29623 			uint32_t ds_offset:10;
266*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
267*3859Sml29623 			uint32_t rsvd:22;
268*3859Sml29623 			uint32_t ds_offset:10;
269*3859Sml29623 #endif
270*3859Sml29623 		} ldw;
271*3859Sml29623 #if !defined(_BIG_ENDIAN)
272*3859Sml29623 		uint32_t hdw;
273*3859Sml29623 #endif
274*3859Sml29623 	} bits;
275*3859Sml29623 } zcp_dst_region_reg_t, *zcp_dst_region_reg_pt;
276*3859Sml29623 
277*3859Sml29623 typedef	enum tbuf_size_e {
278*3859Sml29623 	TBUF_4K		= 0,
279*3859Sml29623 	TBUF_8K,
280*3859Sml29623 	TBUF_16K,
281*3859Sml29623 	TBUF_32K,
282*3859Sml29623 	TBUF_64K,
283*3859Sml29623 	TBUF_128K,
284*3859Sml29623 	TBUF_256K,
285*3859Sml29623 	TBUF_512K,
286*3859Sml29623 	TBUF_1M,
287*3859Sml29623 	TBUF_2M,
288*3859Sml29623 	TBUF_4M,
289*3859Sml29623 	TBUF_8M
290*3859Sml29623 } tbuf_size_t;
291*3859Sml29623 
292*3859Sml29623 typedef	enum tbuf_num_e {
293*3859Sml29623 	TBUF_NUM_4	= 0,
294*3859Sml29623 	TBUF_NUM_8,
295*3859Sml29623 	TBUF_NUM_16,
296*3859Sml29623 	TBUF_NUM_32
297*3859Sml29623 } tbuf_num_t;
298*3859Sml29623 
299*3859Sml29623 typedef	enum tmode_e {
300*3859Sml29623 	TMODE_BASIC		= 0,
301*3859Sml29623 	TMODE_AUTO_UNMAP	= 1,
302*3859Sml29623 	TMODE_AUTO_ADV		= 3
303*3859Sml29623 } tmode_t;
304*3859Sml29623 
305*3859Sml29623 typedef	struct tte_sflow_attr_s {
306*3859Sml29623 	union {
307*3859Sml29623 		uint64_t value;
308*3859Sml29623 		struct {
309*3859Sml29623 #if defined(_BIG_ENDIAN)
310*3859Sml29623 			uint32_t hdw;
311*3859Sml29623 #endif
312*3859Sml29623 			struct {
313*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
314*3859Sml29623 				uint32_t ulp_end:18;
315*3859Sml29623 				uint32_t num_buf:2;
316*3859Sml29623 				uint32_t buf_size:4;
317*3859Sml29623 				uint32_t rdc_tbl_offset:8;
318*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
319*3859Sml29623 				uint32_t rdc_tbl_offset:8;
320*3859Sml29623 				uint32_t buf_size:4;
321*3859Sml29623 				uint32_t num_buf:2;
322*3859Sml29623 				uint32_t ulp_end:18;
323*3859Sml29623 #endif
324*3859Sml29623 			} ldw;
325*3859Sml29623 #if !defined(_BIG_ENDIAN)
326*3859Sml29623 			uint32_t hdw;
327*3859Sml29623 #endif
328*3859Sml29623 		} bits;
329*3859Sml29623 	} qw0;
330*3859Sml29623 
331*3859Sml29623 	union {
332*3859Sml29623 		uint64_t value;
333*3859Sml29623 		struct {
334*3859Sml29623 #if defined(_BIG_ENDIAN)
335*3859Sml29623 			uint32_t hdw;
336*3859Sml29623 #endif
337*3859Sml29623 			struct {
338*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
339*3859Sml29623 				uint32_t ring_base:12;
340*3859Sml29623 				uint32_t skip:1;
341*3859Sml29623 				uint32_t rsvd:1;
342*3859Sml29623 				uint32_t tmode:2;
343*3859Sml29623 				uint32_t unmap_all_en:1;
344*3859Sml29623 				uint32_t ulp_end_en:1;
345*3859Sml29623 				uint32_t ulp_end:14;
346*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
347*3859Sml29623 				uint32_t ulp_end:14;
348*3859Sml29623 				uint32_t ulp_end_en:1;
349*3859Sml29623 				uint32_t unmap_all_en:1;
350*3859Sml29623 				uint32_t tmode:2;
351*3859Sml29623 				uint32_t rsvd:1;
352*3859Sml29623 				uint32_t skip:1;
353*3859Sml29623 				uint32_t ring_base:12;
354*3859Sml29623 #endif
355*3859Sml29623 			} ldw;
356*3859Sml29623 #if !defined(_BIG_ENDIAN)
357*3859Sml29623 		uint32_t hdw;
358*3859Sml29623 #endif
359*3859Sml29623 		} bits;
360*3859Sml29623 	} qw1;
361*3859Sml29623 
362*3859Sml29623 	union {
363*3859Sml29623 		uint64_t value;
364*3859Sml29623 		struct {
365*3859Sml29623 #if defined(_BIG_ENDIAN)
366*3859Sml29623 			uint32_t hdw;
367*3859Sml29623 #endif
368*3859Sml29623 			struct {
369*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
370*3859Sml29623 				uint32_t busy:1;
371*3859Sml29623 				uint32_t ring_size:4;
372*3859Sml29623 				uint32_t ring_base:27;
373*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
374*3859Sml29623 				uint32_t ring_base:27;
375*3859Sml29623 				uint32_t ring_size:4;
376*3859Sml29623 				uint32_t busy:1;
377*3859Sml29623 #endif
378*3859Sml29623 			} ldw;
379*3859Sml29623 #if !defined(_BIG_ENDIAN)
380*3859Sml29623 			uint32_t hdw;
381*3859Sml29623 #endif
382*3859Sml29623 		} bits;
383*3859Sml29623 	} qw2;
384*3859Sml29623 
385*3859Sml29623 	union {
386*3859Sml29623 		uint64_t value;
387*3859Sml29623 		struct {
388*3859Sml29623 #if defined(_BIG_ENDIAN)
389*3859Sml29623 			uint32_t hdw;
390*3859Sml29623 #endif
391*3859Sml29623 			struct {
392*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
393*3859Sml29623 				uint32_t rsvd:16;
394*3859Sml29623 				uint32_t toq:16;
395*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
396*3859Sml29623 				uint32_t toq:16;
397*3859Sml29623 				uint32_t rsvd:16;
398*3859Sml29623 #endif
399*3859Sml29623 			} ldw;
400*3859Sml29623 #if !defined(_BIG_ENDIAN)
401*3859Sml29623 			uint32_t hdw;
402*3859Sml29623 #endif
403*3859Sml29623 		} bits;
404*3859Sml29623 	} qw3;
405*3859Sml29623 
406*3859Sml29623 	union {
407*3859Sml29623 		uint64_t value;
408*3859Sml29623 		struct {
409*3859Sml29623 #if defined(_BIG_ENDIAN)
410*3859Sml29623 			uint32_t hdw;
411*3859Sml29623 #endif
412*3859Sml29623 			struct {
413*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
414*3859Sml29623 				uint32_t rsvd:28;
415*3859Sml29623 				uint32_t dat4:4;
416*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
417*3859Sml29623 				uint32_t dat4:4;
418*3859Sml29623 				uint32_t rsvd:28;
419*3859Sml29623 #endif
420*3859Sml29623 			} ldw;
421*3859Sml29623 #if !defined(_BIG_ENDIAN)
422*3859Sml29623 			uint32_t hdw;
423*3859Sml29623 #endif
424*3859Sml29623 		} bits;
425*3859Sml29623 	} qw4;
426*3859Sml29623 
427*3859Sml29623 } tte_sflow_attr_t, *tte_sflow_attr_pt;
428*3859Sml29623 
429*3859Sml29623 #define	TTE_RDC_TBL_SFLOW_BITS_EN	0x0001
430*3859Sml29623 #define	TTE_BUF_SIZE_BITS_EN		0x0002
431*3859Sml29623 #define	TTE_NUM_BUF_BITS_EN		0x0002
432*3859Sml29623 #define	TTE_ULP_END_BITS_EN		0x003E
433*3859Sml29623 #define	TTE_ULP_END_EN_BITS_EN		0x0020
434*3859Sml29623 #define	TTE_UNMAP_ALL_BITS_EN		0x0020
435*3859Sml29623 #define	TTE_TMODE_BITS_EN		0x0040
436*3859Sml29623 #define	TTE_SKIP_BITS_EN		0x0040
437*3859Sml29623 #define	TTE_RING_BASE_ADDR_BITS_EN	0x0FC0
438*3859Sml29623 #define	TTE_RING_SIZE_BITS_EN		0x0800
439*3859Sml29623 #define	TTE_BUSY_BITS_EN		0x0800
440*3859Sml29623 #define	TTE_TOQ_BITS_EN			0x3000
441*3859Sml29623 
442*3859Sml29623 #define	TTE_MAPPED_IN_BITS_EN		0x0000F
443*3859Sml29623 #define	TTE_ANCHOR_SEQ_BITS_EN		0x000F0
444*3859Sml29623 #define	TTE_ANCHOR_OFFSET_BITS_EN	0x00700
445*3859Sml29623 #define	TTE_ANCHOR_BUFFER_BITS_EN	0x00800
446*3859Sml29623 #define	TTE_ANCHOR_BUF_FLAG_BITS_EN	0x00800
447*3859Sml29623 #define	TTE_UNMAP_ON_LEFT_BITS_EN	0x00800
448*3859Sml29623 #define	TTE_ULP_END_REACHED_BITS_EN	0x00800
449*3859Sml29623 #define	TTE_ERR_STAT_BITS_EN		0x01000
450*3859Sml29623 #define	TTE_WR_PTR_BITS_EN		0x01000
451*3859Sml29623 #define	TTE_HOQ_BITS_EN			0x0E000
452*3859Sml29623 #define	TTE_PREFETCH_ON_BITS_EN		0x08000
453*3859Sml29623 
454*3859Sml29623 typedef	enum tring_size_e {
455*3859Sml29623 	TRING_SIZE_8		= 0,
456*3859Sml29623 	TRING_SIZE_16,
457*3859Sml29623 	TRING_SIZE_32,
458*3859Sml29623 	TRING_SIZE_64,
459*3859Sml29623 	TRING_SIZE_128,
460*3859Sml29623 	TRING_SIZE_256,
461*3859Sml29623 	TRING_SIZE_512,
462*3859Sml29623 	TRING_SIZE_1K,
463*3859Sml29623 	TRING_SIZE_2K,
464*3859Sml29623 	TRING_SIZE_4K,
465*3859Sml29623 	TRING_SIZE_8K,
466*3859Sml29623 	TRING_SIZE_16K,
467*3859Sml29623 	TRING_SIZE_32K
468*3859Sml29623 } tring_size_t;
469*3859Sml29623 
470*3859Sml29623 typedef struct tte_dflow_attr_s {
471*3859Sml29623 	union {
472*3859Sml29623 		uint64_t value;
473*3859Sml29623 		struct {
474*3859Sml29623 #if defined(_BIG_ENDIAN)
475*3859Sml29623 			uint32_t hdw;
476*3859Sml29623 #endif
477*3859Sml29623 			struct {
478*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
479*3859Sml29623 				uint32_t mapped_in;
480*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
481*3859Sml29623 				uint32_t mapped_in;
482*3859Sml29623 #endif
483*3859Sml29623 			} ldw;
484*3859Sml29623 #if !defined(_BIG_ENDIAN)
485*3859Sml29623 			uint32_t hdw;
486*3859Sml29623 #endif
487*3859Sml29623 		} bits;
488*3859Sml29623 	} qw0;
489*3859Sml29623 
490*3859Sml29623 	union {
491*3859Sml29623 		uint64_t value;
492*3859Sml29623 		struct {
493*3859Sml29623 #if defined(_BIG_ENDIAN)
494*3859Sml29623 			uint32_t hdw;
495*3859Sml29623 #endif
496*3859Sml29623 			struct {
497*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
498*3859Sml29623 				uint32_t anchor_seq;
499*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
500*3859Sml29623 				uint32_t anchor_seq;
501*3859Sml29623 #endif
502*3859Sml29623 			} ldw;
503*3859Sml29623 #if !defined(_BIG_ENDIAN)
504*3859Sml29623 			uint32_t hdw;
505*3859Sml29623 #endif
506*3859Sml29623 		} bits;
507*3859Sml29623 	} qw1;
508*3859Sml29623 
509*3859Sml29623 	union {
510*3859Sml29623 		uint64_t value;
511*3859Sml29623 		struct {
512*3859Sml29623 #if defined(_BIG_ENDIAN)
513*3859Sml29623 			uint32_t hdw;
514*3859Sml29623 #endif
515*3859Sml29623 			struct {
516*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
517*3859Sml29623 				uint32_t ulp_end_reached;
518*3859Sml29623 				uint32_t unmap_on_left;
519*3859Sml29623 				uint32_t anchor_buf_flag;
520*3859Sml29623 				uint32_t anchor_buf:5;
521*3859Sml29623 				uint32_t anchor_offset:24;
522*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
523*3859Sml29623 				uint32_t anchor_offset:24;
524*3859Sml29623 				uint32_t anchor_buf:5;
525*3859Sml29623 				uint32_t anchor_buf_flag;
526*3859Sml29623 				uint32_t unmap_on_left;
527*3859Sml29623 				uint32_t ulp_end_reached;
528*3859Sml29623 #endif
529*3859Sml29623 			} ldw;
530*3859Sml29623 #if !defined(_BIG_ENDIAN)
531*3859Sml29623 		uint32_t hdw;
532*3859Sml29623 #endif
533*3859Sml29623 		} bits;
534*3859Sml29623 	} qw2;
535*3859Sml29623 
536*3859Sml29623 	union {
537*3859Sml29623 		uint64_t value;
538*3859Sml29623 		struct {
539*3859Sml29623 #if defined(_BIG_ENDIAN)
540*3859Sml29623 			uint32_t hdw;
541*3859Sml29623 #endif
542*3859Sml29623 			struct {
543*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
544*3859Sml29623 				uint32_t rsvd1:1;
545*3859Sml29623 				uint32_t prefetch_on:1;
546*3859Sml29623 				uint32_t hoq:16;
547*3859Sml29623 				uint32_t rsvd:6;
548*3859Sml29623 				uint32_t wr_ptr:6;
549*3859Sml29623 				uint32_t err_stat:2;
550*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
551*3859Sml29623 				uint32_t err_stat:2;
552*3859Sml29623 				uint32_t wr_ptr:6;
553*3859Sml29623 				uint32_t rsvd:6;
554*3859Sml29623 				uint32_t hoq:16;
555*3859Sml29623 				uint32_t prefetch_on:1;
556*3859Sml29623 				uint32_t rsvd1:1;
557*3859Sml29623 #endif
558*3859Sml29623 			} ldw;
559*3859Sml29623 #if !defined(_BIG_ENDIAN)
560*3859Sml29623 			uint32_t hdw;
561*3859Sml29623 #endif
562*3859Sml29623 		} bits;
563*3859Sml29623 	} qw3;
564*3859Sml29623 
565*3859Sml29623 	union {
566*3859Sml29623 		uint64_t value;
567*3859Sml29623 		struct {
568*3859Sml29623 #if defined(_BIG_ENDIAN)
569*3859Sml29623 			uint32_t hdw;
570*3859Sml29623 #endif
571*3859Sml29623 			struct {
572*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
573*3859Sml29623 				uint32_t rsvd:28;
574*3859Sml29623 				uint32_t dat4:4;
575*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
576*3859Sml29623 				uint32_t dat4:4;
577*3859Sml29623 				uint32_t rsvd:28;
578*3859Sml29623 #endif
579*3859Sml29623 			} ldw;
580*3859Sml29623 #if !defined(_BIG_ENDIAN)
581*3859Sml29623 			uint32_t hdw;
582*3859Sml29623 #endif
583*3859Sml29623 		} bits;
584*3859Sml29623 	} qw4;
585*3859Sml29623 
586*3859Sml29623 } tte_dflow_attr_t, *tte_dflow_attr_pt;
587*3859Sml29623 
588*3859Sml29623 #define	MAX_BAM_BANKS	8
589*3859Sml29623 
590*3859Sml29623 typedef	struct zcp_ram_unit_s {
591*3859Sml29623 	uint32_t	w0;
592*3859Sml29623 	uint32_t	w1;
593*3859Sml29623 	uint32_t	w2;
594*3859Sml29623 	uint32_t	w3;
595*3859Sml29623 	uint32_t	w4;
596*3859Sml29623 } zcp_ram_unit_t;
597*3859Sml29623 
598*3859Sml29623 typedef	enum dmaw_type_e {
599*3859Sml29623 	DMAW_NO_CROSS_BUF	= 0,
600*3859Sml29623 	DMAW_IP_CROSS_BUF_2,
601*3859Sml29623 	DMAW_IP_CROSS_BUF_3,
602*3859Sml29623 	DMAW_IP_CROSS_BUF_4
603*3859Sml29623 } dmaw_type_t;
604*3859Sml29623 
605*3859Sml29623 typedef union zcp_ram_data_u {
606*3859Sml29623 	tte_sflow_attr_t sentry;
607*3859Sml29623 	tte_dflow_attr_t dentry;
608*3859Sml29623 } zcp_ram_data_t, *zcp_ram_data_pt;
609*3859Sml29623 
610*3859Sml29623 typedef union zcp_ram_access_u {
611*3859Sml29623 	uint64_t value;
612*3859Sml29623 	struct {
613*3859Sml29623 #if defined(_BIG_ENDIAN)
614*3859Sml29623 		uint32_t hdw;
615*3859Sml29623 #endif
616*3859Sml29623 		struct {
617*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
618*3859Sml29623 			uint32_t busy:1;
619*3859Sml29623 			uint32_t rdwr:1;
620*3859Sml29623 			uint32_t rsvd:1;
621*3859Sml29623 			uint32_t zcfid:12;
622*3859Sml29623 			uint32_t ram_sel:5;
623*3859Sml29623 			uint32_t cfifo:12;
624*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
625*3859Sml29623 			uint32_t cfifo:12;
626*3859Sml29623 			uint32_t ram_sel:5;
627*3859Sml29623 			uint32_t zcfid:12;
628*3859Sml29623 			uint32_t rsvd:1;
629*3859Sml29623 			uint32_t rdwr:1;
630*3859Sml29623 			uint32_t busy:1;
631*3859Sml29623 #endif
632*3859Sml29623 		} ldw;
633*3859Sml29623 #if !defined(_BIG_ENDIAN)
634*3859Sml29623 		uint32_t hdw;
635*3859Sml29623 #endif
636*3859Sml29623 	} bits;
637*3859Sml29623 } zcp_ram_access_t, *zcp_ram_access_pt;
638*3859Sml29623 
639*3859Sml29623 #define	ZCP_RAM_WR		0
640*3859Sml29623 #define	ZCP_RAM_RD		1
641*3859Sml29623 #define	ZCP_RAM_SEL_BAM0	0
642*3859Sml29623 #define	ZCP_RAM_SEL_BAM1	0x1
643*3859Sml29623 #define	ZCP_RAM_SEL_BAM2	0x2
644*3859Sml29623 #define	ZCP_RAM_SEL_BAM3	0x3
645*3859Sml29623 #define	ZCP_RAM_SEL_BAM4	0x4
646*3859Sml29623 #define	ZCP_RAM_SEL_BAM5	0x5
647*3859Sml29623 #define	ZCP_RAM_SEL_BAM6	0x6
648*3859Sml29623 #define	ZCP_RAM_SEL_BAM7	0x7
649*3859Sml29623 #define	ZCP_RAM_SEL_TT_STATIC	0x8
650*3859Sml29623 #define	ZCP_RAM_SEL_TT_DYNAMIC	0x9
651*3859Sml29623 #define	ZCP_RAM_SEL_CFIFO0	0x10
652*3859Sml29623 #define	ZCP_RAM_SEL_CFIFO1	0x11
653*3859Sml29623 #define	ZCP_RAM_SEL_CFIFO2	0x12
654*3859Sml29623 #define	ZCP_RAM_SEL_CFIFO3	0x13
655*3859Sml29623 
656*3859Sml29623 typedef union zcp_ram_benable_u {
657*3859Sml29623 	uint64_t value;
658*3859Sml29623 	struct {
659*3859Sml29623 #if defined(_BIG_ENDIAN)
660*3859Sml29623 		uint32_t hdw;
661*3859Sml29623 #endif
662*3859Sml29623 		struct {
663*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
664*3859Sml29623 			uint32_t rsvd:15;
665*3859Sml29623 			uint32_t be:17;
666*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
667*3859Sml29623 			uint32_t be:17;
668*3859Sml29623 			uint32_t rsvd:15;
669*3859Sml29623 #endif
670*3859Sml29623 		} ldw;
671*3859Sml29623 #if !defined(_BIG_ENDIAN)
672*3859Sml29623 		uint32_t hdw;
673*3859Sml29623 #endif
674*3859Sml29623 	} bits;
675*3859Sml29623 } zcp_ram_benable_t, *zcp_ram_benable_pt;
676*3859Sml29623 
677*3859Sml29623 typedef union zcp_training_vector_u {
678*3859Sml29623 	uint64_t value;
679*3859Sml29623 	struct {
680*3859Sml29623 #if defined(_BIG_ENDIAN)
681*3859Sml29623 		uint32_t hdw;
682*3859Sml29623 #endif
683*3859Sml29623 		struct {
684*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
685*3859Sml29623 			uint32_t train_vec;
686*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
687*3859Sml29623 			uint32_t train_vec;
688*3859Sml29623 #endif
689*3859Sml29623 		} ldw;
690*3859Sml29623 #if !defined(_BIG_ENDIAN)
691*3859Sml29623 		uint32_t hdw;
692*3859Sml29623 #endif
693*3859Sml29623 	} bits;
694*3859Sml29623 } zcp_training_vector_t, *zcp_training_vector_pt;
695*3859Sml29623 
696*3859Sml29623 typedef union zcp_state_machine_u {
697*3859Sml29623 	uint64_t value;
698*3859Sml29623 	struct {
699*3859Sml29623 #if defined(_BIG_ENDIAN)
700*3859Sml29623 		uint32_t hdw;
701*3859Sml29623 #endif
702*3859Sml29623 		struct {
703*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
704*3859Sml29623 			uint32_t state;
705*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
706*3859Sml29623 			uint32_t state;
707*3859Sml29623 #endif
708*3859Sml29623 		} ldw;
709*3859Sml29623 #if !defined(_BIG_ENDIAN)
710*3859Sml29623 		uint32_t hdw;
711*3859Sml29623 #endif
712*3859Sml29623 	} bits;
713*3859Sml29623 } zcp_state_machine_t, *zcp_state_machine_pt;
714*3859Sml29623 
715*3859Sml29623 typedef	struct zcp_hdr_s {
716*3859Sml29623 	uint16_t	zflowid;
717*3859Sml29623 	uint16_t	tcp_hdr_len;
718*3859Sml29623 	uint16_t	tcp_payld_len;
719*3859Sml29623 	uint16_t	head_of_que;
720*3859Sml29623 	uint32_t	first_b_offset;
721*3859Sml29623 	boolean_t	reach_buf_end;
722*3859Sml29623 	dmaw_type_t	dmaw_type;
723*3859Sml29623 	uint8_t		win_buf_offset;
724*3859Sml29623 } zcp_hdr_t;
725*3859Sml29623 
726*3859Sml29623 typedef	union _zcp_ecc_ctrl {
727*3859Sml29623 	uint64_t value;
728*3859Sml29623 
729*3859Sml29623 	struct {
730*3859Sml29623 #if defined(_BIG_ENDIAN)
731*3859Sml29623 		uint32_t	w1;
732*3859Sml29623 #endif
733*3859Sml29623 		struct {
734*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
735*3859Sml29623 		uint32_t dis_dbl	: 1;
736*3859Sml29623 		uint32_t res3		: 13;
737*3859Sml29623 		uint32_t cor_dbl	: 1;
738*3859Sml29623 		uint32_t cor_sng	: 1;
739*3859Sml29623 		uint32_t res2		: 5;
740*3859Sml29623 		uint32_t cor_all	: 1;
741*3859Sml29623 		uint32_t res1		: 7;
742*3859Sml29623 		uint32_t cor_lst	: 1;
743*3859Sml29623 		uint32_t cor_snd	: 1;
744*3859Sml29623 		uint32_t cor_fst	: 1;
745*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
746*3859Sml29623 		uint32_t cor_fst	: 1;
747*3859Sml29623 		uint32_t cor_snd	: 1;
748*3859Sml29623 		uint32_t cor_lst	: 1;
749*3859Sml29623 		uint32_t res1		: 7;
750*3859Sml29623 		uint32_t cor_all	: 1;
751*3859Sml29623 		uint32_t res2		: 5;
752*3859Sml29623 		uint32_t cor_sng	: 1;
753*3859Sml29623 		uint32_t cor_dbl	: 1;
754*3859Sml29623 		uint32_t res3		: 13;
755*3859Sml29623 		uint32_t dis_dbl	: 1;
756*3859Sml29623 #else
757*3859Sml29623 #error	one of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
758*3859Sml29623 #endif
759*3859Sml29623 	} w0;
760*3859Sml29623 
761*3859Sml29623 #if !defined(_BIG_ENDIAN)
762*3859Sml29623 		uint32_t	w1;
763*3859Sml29623 #endif
764*3859Sml29623 	} bits;
765*3859Sml29623 } zcp_ecc_ctrl_t;
766*3859Sml29623 
767*3859Sml29623 #ifdef	__cplusplus
768*3859Sml29623 }
769*3859Sml29623 #endif
770*3859Sml29623 
771*3859Sml29623 #endif	/* _SYS_NXGE_NXGE_ZCP_HW_H */
772