4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_NXGE_NXGE_ZCP_HW_H
27 #define _SYS_NXGE_NXGE_ZCP_HW_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
35 #include <nxge_defs.h>
38 * Neptune Zerocopy Hardware definitions
39 * Updated to reflect PRM-0.8.
42 #define ZCP_CONFIG_REG (FZC_ZCP + 0x00000)
43 #define ZCP_INT_STAT_REG (FZC_ZCP + 0x00008)
44 #define ZCP_INT_STAT_TEST_REG (FZC_ZCP + 0x00108)
45 #define ZCP_INT_MASK_REG (FZC_ZCP + 0x00010)
47 #define ZCP_BAM4_RE_CTL_REG (FZC_ZCP + 0x00018)
48 #define ZCP_BAM8_RE_CTL_REG (FZC_ZCP + 0x00020)
49 #define ZCP_BAM16_RE_CTL_REG (FZC_ZCP + 0x00028)
50 #define ZCP_BAM32_RE_CTL_REG (FZC_ZCP + 0x00030)
52 #define ZCP_DST4_RE_CTL_REG (FZC_ZCP + 0x00038)
53 #define ZCP_DST8_RE_CTL_REG (FZC_ZCP + 0x00040)
54 #define ZCP_DST16_RE_CTL_REG (FZC_ZCP + 0x00048)
55 #define ZCP_DST32_RE_CTL_REG (FZC_ZCP + 0x00050)
57 #define ZCP_RAM_DATA_REG (FZC_ZCP + 0x00058)
58 #define ZCP_RAM_DATA0_REG (FZC_ZCP + 0x00058)
59 #define ZCP_RAM_DATA1_REG (FZC_ZCP + 0x00060)
60 #define ZCP_RAM_DATA2_REG (FZC_ZCP + 0x00068)
61 #define ZCP_RAM_DATA3_REG (FZC_ZCP + 0x00070)
62 #define ZCP_RAM_DATA4_REG (FZC_ZCP + 0x00078)
63 #define ZCP_RAM_BE_REG (FZC_ZCP + 0x00080)
64 #define ZCP_RAM_ACC_REG (FZC_ZCP + 0x00088)
66 #define ZCP_TRAINING_VECTOR_REG (FZC_ZCP + 0x000C0)
67 #define ZCP_STATE_MACHINE_REG (FZC_ZCP + 0x000C8)
68 #define ZCP_CHK_BIT_DATA_REG (FZC_ZCP + 0x00090)
69 #define ZCP_RESET_CFIFO_REG (FZC_ZCP + 0x00098)
70 #define ZCP_RESET_CFIFO_MASK 0x0F
72 #define ZCP_CFIFIO_RESET_WAIT 10
73 #define ZCP_P0_P1_CFIFO_DEPTH 2048
74 #define ZCP_P2_P3_CFIFO_DEPTH 1024
75 #define ZCP_NIU_CFIFO_DEPTH 1024
77 typedef union _zcp_reset_cfifo
{
80 #if defined(_BIG_ENDIAN)
84 #if defined(_BIT_FIELDS_HTOL)
86 uint32_t reset_cfifo3
:1;
87 uint32_t reset_cfifo2
:1;
88 uint32_t reset_cfifo1
:1;
89 uint32_t reset_cfifo0
:1;
90 #elif defined(_BIT_FIELDS_LTOH)
91 uint32_t reset_cfifo0
:1;
92 uint32_t reset_cfifo1
:1;
93 uint32_t reset_cfifo2
:1;
94 uint32_t reset_cfifo3
:1;
98 #if !defined(_BIG_ENDIAN)
102 } zcp_reset_cfifo_t
, *p_zcp_reset_cfifo_t
;
104 #define ZCP_CFIFO_ECC_PORT0_REG (FZC_ZCP + 0x000A0)
105 #define ZCP_CFIFO_ECC_PORT1_REG (FZC_ZCP + 0x000A8)
106 #define ZCP_CFIFO_ECC_PORT2_REG (FZC_ZCP + 0x000B0)
107 #define ZCP_CFIFO_ECC_PORT3_REG (FZC_ZCP + 0x000B8)
109 /* NOTE: Same as RX_LOG_PAGE_HDL */
110 #define ZCP_PAGE_HDL_REG (FZC_DMC + 0x20038)
112 /* Data Structures */
114 typedef union zcp_config_reg_u
{
117 #if defined(_BIG_ENDIAN)
121 #if defined(_BIT_FIELDS_HTOL)
123 uint32_t mode_32_bit
:1;
124 uint32_t debug_sel
:8;
126 uint32_t ecc_chk_dis
:1;
127 uint32_t par_chk_dis
:1;
128 uint32_t dis_buf_rn
:1;
129 uint32_t dis_buf_rq_if
:1;
130 uint32_t zc_enable
:1;
131 #elif defined(_BIT_FIELDS_LTOH)
132 uint32_t zc_enable
:1;
133 uint32_t dis_buf_rq_if
:1;
134 uint32_t dis_buf_rn
:1;
135 uint32_t par_chk_dis
:1;
136 uint32_t ecc_chk_dis
:1;
138 uint32_t debug_sel
:8;
139 uint32_t mode_32_bit
:1;
143 #if !defined(_BIG_ENDIAN)
147 } zcp_config_reg_t
, *zcp_config_reg_pt
;
149 #define ZCP_DEBUG_SEL_BITS 0xFF
150 #define ZCP_DEBUG_SEL_SHIFT 16
151 #define ZCP_DEBUG_SEL_MASK (ZCP_DEBUG_SEL_BITS << ZCP_DEBUG_SEL_SHIFT)
152 #define RDMA_TH_BITS 0x7FF
153 #define RDMA_TH_SHIFT 5
154 #define RDMA_TH_MASK (RDMA_TH_BITS << RDMA_TH_SHIFT)
155 #define ECC_CHK_DIS (1 << 4)
156 #define PAR_CHK_DIS (1 << 3)
157 #define DIS_BUFF_RN (1 << 2)
158 #define DIS_BUFF_RQ_IF (1 << 1)
159 #define ZC_ENABLE (1 << 0)
161 typedef union zcp_int_stat_reg_u
{
164 #if defined(_BIG_ENDIAN)
168 #if defined(_BIT_FIELDS_HTOL)
170 uint32_t rrfifo_urun
:1;
171 uint32_t rrfifo_orun
:1;
173 uint32_t rspfifo_uc_err
:1;
174 uint32_t buf_overflow
:1;
175 uint32_t stat_tbl_perr
:1;
176 uint32_t dyn_tbl_perr
:1;
177 uint32_t buf_tbl_perr
:1;
178 uint32_t tt_tbl_perr
:1;
179 uint32_t rsp_tt_index_err
:1;
180 uint32_t slv_tt_index_err
:1;
181 uint32_t zcp_tt_index_err
:1;
182 uint32_t cfifo_ecc3
:1;
183 uint32_t cfifo_ecc2
:1;
184 uint32_t cfifo_ecc1
:1;
185 uint32_t cfifo_ecc0
:1;
186 #elif defined(_BIT_FIELDS_LTOH)
187 uint32_t cfifo_ecc0
:1;
188 uint32_t cfifo_ecc1
:1;
189 uint32_t cfifo_ecc2
:1;
190 uint32_t cfifo_ecc3
:1;
191 uint32_t zcp_tt_index_err
:1;
192 uint32_t slv_tt_index_err
:1;
193 uint32_t rsp_tt_index_err
:1;
194 uint32_t tt_tbl_perr
:1;
195 uint32_t buf_tbl_perr
:1;
196 uint32_t dyn_tbl_perr
:1;
197 uint32_t stat_tbl_perr
:1;
198 uint32_t buf_overflow
:1;
199 uint32_t rspfifo_uc_err
:1;
201 uint32_t rrfifo_orun
:1;
202 uint32_t rrfifo_urun
:1;
206 #if !defined(_BIG_ENDIAN)
210 } zcp_int_stat_reg_t
, *zcp_int_stat_reg_pt
, zcp_int_mask_reg_t
,
211 *zcp_int_mask_reg_pt
;
213 #define RRFIFO_UNDERRUN (1 << 15)
214 #define RRFIFO_OVERRUN (1 << 14)
215 #define RSPFIFO_UNCORR_ERR (1 << 12)
216 #define BUFFER_OVERFLOW (1 << 11)
217 #define STAT_TBL_PERR (1 << 10)
218 #define BUF_DYN_TBL_PERR (1 << 9)
219 #define BUF_TBL_PERR (1 << 8)
220 #define TT_PROGRAM_ERR (1 << 7)
221 #define RSP_TT_INDEX_ERR (1 << 6)
222 #define SLV_TT_INDEX_ERR (1 << 5)
223 #define ZCP_TT_INDEX_ERR (1 << 4)
224 #define CFIFO_ECC3 (1 << 3)
225 #define CFIFO_ECC0 (1 << 0)
226 #define CFIFO_ECC2 (1 << 2)
227 #define CFIFO_ECC1 (1 << 1)
229 typedef union zcp_bam_region_reg_u
{
232 #if defined(_BIG_ENDIAN)
236 #if defined(_BIT_FIELDS_HTOL)
238 uint32_t range_chk_en
:1;
239 uint32_t last_zcfid
:10;
240 uint32_t first_zcfid
:10;
242 #elif defined(_BIT_FIELDS_LTOH)
244 uint32_t first_zcfid
:10;
245 uint32_t last_zcfid
:10;
246 uint32_t range_chk_en
:1;
250 #if !defined(_BIG_ENDIAN)
254 } zcp_bam_region_reg_t
, *zcp_bam_region_reg_pt
;
256 typedef union zcp_dst_region_reg_u
{
259 #if defined(_BIG_ENDIAN)
263 #if defined(_BIT_FIELDS_HTOL)
265 uint32_t ds_offset
:10;
266 #elif defined(_BIT_FIELDS_LTOH)
268 uint32_t ds_offset
:10;
271 #if !defined(_BIG_ENDIAN)
275 } zcp_dst_region_reg_t
, *zcp_dst_region_reg_pt
;
277 typedef enum tbuf_size_e
{
292 typedef enum tbuf_num_e
{
299 typedef enum tmode_e
{
301 TMODE_AUTO_UNMAP
= 1,
305 typedef struct tte_sflow_attr_s
{
309 #if defined(_BIG_ENDIAN)
313 #if defined(_BIT_FIELDS_HTOL)
317 uint32_t rdc_tbl_offset
:8;
318 #elif defined(_BIT_FIELDS_LTOH)
319 uint32_t rdc_tbl_offset
:8;
325 #if !defined(_BIG_ENDIAN)
334 #if defined(_BIG_ENDIAN)
338 #if defined(_BIT_FIELDS_HTOL)
339 uint32_t ring_base
:12;
343 uint32_t unmap_all_en
:1;
344 uint32_t ulp_end_en
:1;
346 #elif defined(_BIT_FIELDS_LTOH)
348 uint32_t ulp_end_en
:1;
349 uint32_t unmap_all_en
:1;
353 uint32_t ring_base
:12;
356 #if !defined(_BIG_ENDIAN)
365 #if defined(_BIG_ENDIAN)
369 #if defined(_BIT_FIELDS_HTOL)
371 uint32_t ring_size
:4;
372 uint32_t ring_base
:27;
373 #elif defined(_BIT_FIELDS_LTOH)
374 uint32_t ring_base
:27;
375 uint32_t ring_size
:4;
379 #if !defined(_BIG_ENDIAN)
388 #if defined(_BIG_ENDIAN)
392 #if defined(_BIT_FIELDS_HTOL)
395 #elif defined(_BIT_FIELDS_LTOH)
400 #if !defined(_BIG_ENDIAN)
409 #if defined(_BIG_ENDIAN)
413 #if defined(_BIT_FIELDS_HTOL)
416 #elif defined(_BIT_FIELDS_LTOH)
421 #if !defined(_BIG_ENDIAN)
427 } tte_sflow_attr_t
, *tte_sflow_attr_pt
;
429 #define TTE_RDC_TBL_SFLOW_BITS_EN 0x0001
430 #define TTE_BUF_SIZE_BITS_EN 0x0002
431 #define TTE_NUM_BUF_BITS_EN 0x0002
432 #define TTE_ULP_END_BITS_EN 0x003E
433 #define TTE_ULP_END_EN_BITS_EN 0x0020
434 #define TTE_UNMAP_ALL_BITS_EN 0x0020
435 #define TTE_TMODE_BITS_EN 0x0040
436 #define TTE_SKIP_BITS_EN 0x0040
437 #define TTE_RING_BASE_ADDR_BITS_EN 0x0FC0
438 #define TTE_RING_SIZE_BITS_EN 0x0800
439 #define TTE_BUSY_BITS_EN 0x0800
440 #define TTE_TOQ_BITS_EN 0x3000
442 #define TTE_MAPPED_IN_BITS_EN 0x0000F
443 #define TTE_ANCHOR_SEQ_BITS_EN 0x000F0
444 #define TTE_ANCHOR_OFFSET_BITS_EN 0x00700
445 #define TTE_ANCHOR_BUFFER_BITS_EN 0x00800
446 #define TTE_ANCHOR_BUF_FLAG_BITS_EN 0x00800
447 #define TTE_UNMAP_ON_LEFT_BITS_EN 0x00800
448 #define TTE_ULP_END_REACHED_BITS_EN 0x00800
449 #define TTE_ERR_STAT_BITS_EN 0x01000
450 #define TTE_WR_PTR_BITS_EN 0x01000
451 #define TTE_HOQ_BITS_EN 0x0E000
452 #define TTE_PREFETCH_ON_BITS_EN 0x08000
454 typedef enum tring_size_e
{
470 typedef struct tte_dflow_attr_s
{
474 #if defined(_BIG_ENDIAN)
478 #if defined(_BIT_FIELDS_HTOL)
480 #elif defined(_BIT_FIELDS_LTOH)
484 #if !defined(_BIG_ENDIAN)
493 #if defined(_BIG_ENDIAN)
497 #if defined(_BIT_FIELDS_HTOL)
499 #elif defined(_BIT_FIELDS_LTOH)
503 #if !defined(_BIG_ENDIAN)
512 #if defined(_BIG_ENDIAN)
516 #if defined(_BIT_FIELDS_HTOL)
517 uint32_t ulp_end_reached
;
518 uint32_t unmap_on_left
;
519 uint32_t anchor_buf_flag
;
520 uint32_t anchor_buf
:5;
521 uint32_t anchor_offset
:24;
522 #elif defined(_BIT_FIELDS_LTOH)
523 uint32_t anchor_offset
:24;
524 uint32_t anchor_buf
:5;
525 uint32_t anchor_buf_flag
;
526 uint32_t unmap_on_left
;
527 uint32_t ulp_end_reached
;
530 #if !defined(_BIG_ENDIAN)
539 #if defined(_BIG_ENDIAN)
543 #if defined(_BIT_FIELDS_HTOL)
545 uint32_t prefetch_on
:1;
550 #elif defined(_BIT_FIELDS_LTOH)
555 uint32_t prefetch_on
:1;
559 #if !defined(_BIG_ENDIAN)
568 #if defined(_BIG_ENDIAN)
572 #if defined(_BIT_FIELDS_HTOL)
575 #elif defined(_BIT_FIELDS_LTOH)
580 #if !defined(_BIG_ENDIAN)
586 } tte_dflow_attr_t
, *tte_dflow_attr_pt
;
588 #define MAX_BAM_BANKS 8
590 typedef struct zcp_ram_unit_s
{
598 typedef enum dmaw_type_e
{
599 DMAW_NO_CROSS_BUF
= 0,
605 typedef union zcp_ram_data_u
{
606 tte_sflow_attr_t sentry
;
607 tte_dflow_attr_t dentry
;
608 } zcp_ram_data_t
, *zcp_ram_data_pt
;
610 typedef union zcp_ram_access_u
{
613 #if defined(_BIG_ENDIAN)
617 #if defined(_BIT_FIELDS_HTOL)
624 #elif defined(_BIT_FIELDS_LTOH)
633 #if !defined(_BIG_ENDIAN)
637 } zcp_ram_access_t
, *zcp_ram_access_pt
;
641 #define ZCP_RAM_SEL_BAM0 0
642 #define ZCP_RAM_SEL_BAM1 0x1
643 #define ZCP_RAM_SEL_BAM2 0x2
644 #define ZCP_RAM_SEL_BAM3 0x3
645 #define ZCP_RAM_SEL_BAM4 0x4
646 #define ZCP_RAM_SEL_BAM5 0x5
647 #define ZCP_RAM_SEL_BAM6 0x6
648 #define ZCP_RAM_SEL_BAM7 0x7
649 #define ZCP_RAM_SEL_TT_STATIC 0x8
650 #define ZCP_RAM_SEL_TT_DYNAMIC 0x9
651 #define ZCP_RAM_SEL_CFIFO0 0x10
652 #define ZCP_RAM_SEL_CFIFO1 0x11
653 #define ZCP_RAM_SEL_CFIFO2 0x12
654 #define ZCP_RAM_SEL_CFIFO3 0x13
656 typedef union zcp_ram_benable_u
{
659 #if defined(_BIG_ENDIAN)
663 #if defined(_BIT_FIELDS_HTOL)
666 #elif defined(_BIT_FIELDS_LTOH)
671 #if !defined(_BIG_ENDIAN)
675 } zcp_ram_benable_t
, *zcp_ram_benable_pt
;
677 typedef union zcp_training_vector_u
{
680 #if defined(_BIG_ENDIAN)
684 #if defined(_BIT_FIELDS_HTOL)
686 #elif defined(_BIT_FIELDS_LTOH)
690 #if !defined(_BIG_ENDIAN)
694 } zcp_training_vector_t
, *zcp_training_vector_pt
;
696 typedef union zcp_state_machine_u
{
699 #if defined(_BIG_ENDIAN)
703 #if defined(_BIT_FIELDS_HTOL)
705 #elif defined(_BIT_FIELDS_LTOH)
709 #if !defined(_BIG_ENDIAN)
713 } zcp_state_machine_t
, *zcp_state_machine_pt
;
715 typedef struct zcp_hdr_s
{
717 uint16_t tcp_hdr_len
;
718 uint16_t tcp_payld_len
;
719 uint16_t head_of_que
;
720 uint32_t first_b_offset
;
721 boolean_t reach_buf_end
;
722 dmaw_type_t dmaw_type
;
723 uint8_t win_buf_offset
;
726 typedef union _zcp_ecc_ctrl
{
730 #if defined(_BIG_ENDIAN)
734 #if defined(_BIT_FIELDS_HTOL)
735 uint32_t dis_dbl
: 1;
737 uint32_t cor_dbl
: 1;
738 uint32_t cor_sng
: 1;
740 uint32_t cor_all
: 1;
742 uint32_t cor_lst
: 1;
743 uint32_t cor_snd
: 1;
744 uint32_t cor_fst
: 1;
745 #elif defined(_BIT_FIELDS_LTOH)
746 uint32_t cor_fst
: 1;
747 uint32_t cor_snd
: 1;
748 uint32_t cor_lst
: 1;
750 uint32_t cor_all
: 1;
752 uint32_t cor_sng
: 1;
753 uint32_t cor_dbl
: 1;
755 uint32_t dis_dbl
: 1;
757 #error one of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
761 #if !defined(_BIG_ENDIAN)
771 #endif /* _SYS_NXGE_NXGE_ZCP_HW_H */