summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/nxge/nxge_ipp_hw.h
blob: 890ac7824d8885191b03bb912f9372f1ca2e82b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef _SYS_NXGE_NXGE_IPP_HW_H
#define	_SYS_NXGE_NXGE_IPP_HW_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

#include <nxge_defs.h>

/* IPP Registers */
#define	IPP_CONFIG_REG				0x000
#define	IPP_DISCARD_PKT_CNT_REG			0x020
#define	IPP_BAD_CKSUM_ERR_CNT_REG		0x028
#define	IPP_ECC_ERR_COUNTER_REG			0x030
#define	IPP_INT_STATUS_REG			0x040
#define	IPP_INT_MASK_REG			0x048

#define	IPP_PFIFO_RD_DATA0_REG			0x060
#define	IPP_PFIFO_RD_DATA1_REG			0x068
#define	IPP_PFIFO_RD_DATA2_REG			0x070
#define	IPP_PFIFO_RD_DATA3_REG			0x078
#define	IPP_PFIFO_RD_DATA4_REG			0x080
#define	IPP_PFIFO_WR_DATA0_REG			0x088
#define	IPP_PFIFO_WR_DATA1_REG			0x090
#define	IPP_PFIFO_WR_DATA2_REG			0x098
#define	IPP_PFIFO_WR_DATA3_REG			0x0a0
#define	IPP_PFIFO_WR_DATA4_REG			0x0a8
#define	IPP_PFIFO_RD_PTR_REG			0x0b0
#define	IPP_PFIFO_WR_PTR_REG			0x0b8
#define	IPP_DFIFO_RD_DATA0_REG			0x0c0
#define	IPP_DFIFO_RD_DATA1_REG			0x0c8
#define	IPP_DFIFO_RD_DATA2_REG			0x0d0
#define	IPP_DFIFO_RD_DATA3_REG			0x0d8
#define	IPP_DFIFO_RD_DATA4_REG			0x0e0
#define	IPP_DFIFO_WR_DATA0_REG			0x0e8
#define	IPP_DFIFO_WR_DATA1_REG			0x0f0
#define	IPP_DFIFO_WR_DATA2_REG			0x0f8
#define	IPP_DFIFO_WR_DATA3_REG			0x100
#define	IPP_DFIFO_WR_DATA4_REG			0x108
#define	IPP_DFIFO_RD_PTR_REG			0x110
#define	IPP_DFIFO_WR_PTR_REG			0x118
#define	IPP_STATE_MACHINE_REG			0x120
#define	IPP_CKSUM_STATUS_REG			0x128
#define	IPP_FFLP_CKSUM_INFO_REG			0x130
#define	IPP_DEBUG_SELECT_REG			0x138
#define	IPP_DFIFO_ECC_SYNDROME_REG		0x140
#define	IPP_DFIFO_EOPM_RD_PTR_REG		0x148
#define	IPP_ECC_CTRL_REG			0x150

#define	IPP_PORT_OFFSET				0x4000
#define	IPP_PORT0_OFFSET			0
#define	IPP_PORT1_OFFSET			0x8000
#define	IPP_PORT2_OFFSET			0x4000
#define	IPP_PORT3_OFFSET			0xc000
#define	IPP_REG_ADDR(port_num, reg)\
	((port_num == 0) ? FZC_IPP + reg : \
	FZC_IPP + reg + (((port_num % 2) * IPP_PORT_OFFSET) + \
	((port_num / 3) * IPP_PORT_OFFSET) + IPP_PORT_OFFSET))
#define	IPP_PORT_ADDR(port_num)\
	((port_num == 0) ? FZC_IPP: \
	FZC_IPP + (((port_num % 2) * IPP_PORT_OFFSET) + \
	((port_num / 3) * IPP_PORT_OFFSET) + IPP_PORT_OFFSET))

/* IPP Configuration Register */

#define	IPP_SOFT_RESET				(1ULL << 31)
#define	IPP_IP_MAX_PKT_BYTES_SHIFT		8
#define	IPP_IP_MAX_PKT_BYTES_MASK		0x1FFFF
#define	IPP_FFLP_CKSUM_INFO_PIO_WR_EN		(1 << 7)
#define	IPP_PRE_FIFO_PIO_WR_EN			(1 << 6)
#define	IPP_DFIFO_PIO_WR_EN			(1 << 5)
#define	IPP_TCP_UDP_CKSUM_EN			(1 << 4)
#define	IPP_DROP_BAD_CRC_EN			(1 << 3)
#define	IPP_DFIFO_ECC_CORRECT_EN		(1 << 2)
#define	IPP_EN					(1 << 0)

/* IPP Interrupt Status Registers */

#define	IPP_DFIFO_MISSED_SOP			(1ULL << 31)
#define	IPP_DFIFO_MISSED_EOP			(1 << 30)
#define	IPP_DFIFO_ECC_UNCORR_ERR_MASK		0x3
#define	IPP_DFIFO_ECC_UNCORR_ERR_SHIFT		28
#define	IPP_DFIFO_ECC_CORR_ERR_MASK		0x3
#define	IPP_DFIFO_ECC_CORR_ERR_SHIFT		26
#define	IPP_DFIFO_ECC_ERR_MASK			0x3
#define	IPP_DFIFO_ECC_ERR_SHIFT			24
#define	IPP_DFIFO_NO_ECC_ERR			(1 << 23)
#define	IPP_DFIFO_ECC_ERR_ENTRY_INDEX_MASK	0x7FF
#define	IPP_DFIFO_ECC_ERR_ENTRY_INDEX_SHIFT	12
#define	IPP_PRE_FIFO_PERR			(1 << 11)
#define	IPP_ECC_ERR_CNT_MAX			(1 << 10)
#define	IPP_PRE_FIFO_PERR_ENTRY_INDEX_MASK	0x3F
#define	IPP_PRE_FIFO_PERR_ENTRY_INDEX_SHIFT	4
#define	IPP_PRE_FIFO_OVERRUN			(1 << 3)
#define	IPP_PRE_FIFO_UNDERRUN			(1 << 2)
#define	IPP_BAD_TCPIP_CHKSUM_CNT_MAX		(1 << 1)
#define	IPP_PKT_DISCARD_CNT_MAX			(1 << 0)

#define	IPP_P0_P1_DFIFO_ENTRIES			2048
#define	IPP_P2_P3_DFIFO_ENTRIES			1024
#define	IPP_NIU_DFIFO_ENTRIES			1024

typedef	union _ipp_status {
	uint64_t value;

	struct {
#if defined(_BIG_ENDIAN)
		uint32_t	w1;
#endif
		struct {
#if defined(_BIT_FIELDS_HTOL)
		uint32_t dfifo_missed_sop	: 1;
		uint32_t dfifo_missed_eop	: 1;
		uint32_t dfifo_uncorr_ecc_err	: 2;
		uint32_t dfifo_corr_ecc_err	: 2;
		uint32_t dfifo_ecc_err		: 2;
		uint32_t dfifo_no_ecc_err	: 1;
		uint32_t dfifo_ecc_err_idx	: 11;
		uint32_t pre_fifo_perr		: 1;
		uint32_t ecc_err_cnt_ovfl	: 1;
		uint32_t pre_fifo_perr_idx	: 6;
		uint32_t pre_fifo_overrun	: 1;
		uint32_t pre_fifo_underrun	: 1;
		uint32_t bad_cksum_cnt_ovfl	: 1;
		uint32_t pkt_discard_cnt_ovfl	: 1;
#elif defined(_BIT_FIELDS_LTOH)
		uint32_t pkt_discard_cnt_ovfl	: 1;
		uint32_t bad_cksum_cnt_ovfl	: 1;
		uint32_t pre_fifo_underrun	: 1;
		uint32_t pre_fifo_overrun	: 1;
		uint32_t pre_fifo_perr_idx	: 6;
		uint32_t ecc_err_cnt_ovfl	: 1;
		uint32_t pre_fifo_perr		: 1;
		uint32_t dfifo_ecc_err_idx	: 11;
		uint32_t dfifo_no_ecc_err	: 1;
		uint32_t dfifo_ecc_err		: 2;
		uint32_t dfifo_corr_ecc_err	: 2;
		uint32_t dfifo_uncorr_ecc_err	: 2;
		uint32_t dfifo_missed_eop	: 1;
		uint32_t dfifo_missed_sop	: 1;
#else
#error	one of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
#endif
	} w0;

#if !defined(_BIG_ENDIAN)
		uint32_t	w1;
#endif
	} bits;
} ipp_status_t;

typedef	union _ipp_ecc_ctrl {
	uint64_t value;

	struct {
#if defined(_BIG_ENDIAN)
		uint32_t	w1;
#endif
		struct {
#if defined(_BIT_FIELDS_HTOL)
		uint32_t dis_dbl	: 1;
		uint32_t res3		: 13;
		uint32_t cor_dbl	: 1;
		uint32_t cor_sng	: 1;
		uint32_t rsvd		: 5;
		uint32_t cor_all	: 1;
		uint32_t res2		: 1;
		uint32_t cor_1		: 1;
		uint32_t res1		: 5;
		uint32_t cor_lst	: 1;
		uint32_t cor_snd	: 1;
		uint32_t cor_fst	: 1;
#elif defined(_BIT_FIELDS_LTOH)
		uint32_t cor_fst	: 1;
		uint32_t cor_snd	: 1;
		uint32_t cor_lst	: 1;
		uint32_t res1		: 5;
		uint32_t cor_1		: 1;
		uint32_t res2		: 1;
		uint32_t cor_all	: 1;
		uint32_t rsvd		: 5;
		uint32_t cor_sng	: 1;
		uint32_t cor_dbl	: 1;
		uint32_t res3		: 13;
		uint32_t dis_dbl	: 1;
#else
#error	one of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
#endif
	} w0;

#if !defined(_BIG_ENDIAN)
		uint32_t	w1;
#endif
	} bits;
} ipp_ecc_ctrl_t;


/* IPP Interrupt Mask Registers */

#define	IPP_ECC_ERR_CNT_MAX_INTR_DIS		(1 << 7)
#define	IPP_DFIFO_MISSING_EOP_SOP_INTR_DIS	(1 << 6)
#define	IPP_DFIFO_ECC_UNCORR_ERR_INTR_DIS	(1 << 5)
#define	IPP_PRE_FIFO_PERR_INTR_DIS		(1 << 4)
#define	IPP_PRE_FIFO_OVERRUN_INTR_DIS		(1 << 3)
#define	IPP_PRE_FIFO_UNDERRUN_INTR_DIS		(1 << 2)
#define	IPP_BAD_TCPIP_CKSUM_CNT_INTR_DIS	(1 << 1)
#define	IPP_PKT_DISCARD_CNT_INTR_DIS		(1 << 0)

#define	IPP_RESET_WAIT				10

/* DFIFO RD/WR pointers mask */

#define	IPP_XMAC_DFIFO_PTR_MASK			0x7FF
#define	IPP_BMAC_DFIFO_PTR_MASK			0x3FF

#define	IPP_ECC_CNT_MASK			0xFF
#define	IPP_BAD_CS_CNT_MASK			0x3FFF
#define	IPP_PKT_DIS_CNT_MASK			0x3FFF

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_NXGE_NXGE_IPP_HW_H */