xref: /titanic_41/usr/src/uts/common/sys/nxge/nxge_espc.h (revision 6f45ec7b0b964c3be967c4880e8867ac1e7763a5)
1*6f45ec7bSml29623 /*
2*6f45ec7bSml29623  * CDDL HEADER START
3*6f45ec7bSml29623  *
4*6f45ec7bSml29623  * The contents of this file are subject to the terms of the
5*6f45ec7bSml29623  * Common Development and Distribution License (the "License").
6*6f45ec7bSml29623  * You may not use this file except in compliance with the License.
7*6f45ec7bSml29623  *
8*6f45ec7bSml29623  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*6f45ec7bSml29623  * or http://www.opensolaris.org/os/licensing.
10*6f45ec7bSml29623  * See the License for the specific language governing permissions
11*6f45ec7bSml29623  * and limitations under the License.
12*6f45ec7bSml29623  *
13*6f45ec7bSml29623  * When distributing Covered Code, include this CDDL HEADER in each
14*6f45ec7bSml29623  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*6f45ec7bSml29623  * If applicable, add the following below this CDDL HEADER, with the
16*6f45ec7bSml29623  * fields enclosed by brackets "[]" replaced with your own identifying
17*6f45ec7bSml29623  * information: Portions Copyright [yyyy] [name of copyright owner]
18*6f45ec7bSml29623  *
19*6f45ec7bSml29623  * CDDL HEADER END
20*6f45ec7bSml29623  */
21*6f45ec7bSml29623 /*
22*6f45ec7bSml29623  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*6f45ec7bSml29623  * Use is subject to license terms.
24*6f45ec7bSml29623  */
25*6f45ec7bSml29623 
26*6f45ec7bSml29623 #ifndef	_SYS_NXGE_NXGE_ESPC_H
27*6f45ec7bSml29623 #define	_SYS_NXGE_NXGE_ESPC_H
28*6f45ec7bSml29623 
29*6f45ec7bSml29623 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*6f45ec7bSml29623 
31*6f45ec7bSml29623 #ifdef	__cplusplus
32*6f45ec7bSml29623 extern "C" {
33*6f45ec7bSml29623 #endif
34*6f45ec7bSml29623 
35*6f45ec7bSml29623 #include <nxge_espc_hw.h>
36*6f45ec7bSml29623 
37*6f45ec7bSml29623 #define	ESPC_MAC_ADDR_0		ESPC_NCR_REGN(0)
38*6f45ec7bSml29623 #define	ESPC_MAC_ADDR_1		ESPC_NCR_REGN(1)
39*6f45ec7bSml29623 #define	ESPC_NUM_PORTS_MACS	ESPC_NCR_REGN(2)
40*6f45ec7bSml29623 #define	ESPC_MOD_STR_LEN	ESPC_NCR_REGN(4)
41*6f45ec7bSml29623 #define	ESPC_MOD_STR_1		ESPC_NCR_REGN(5)
42*6f45ec7bSml29623 #define	ESPC_MOD_STR_2		ESPC_NCR_REGN(6)
43*6f45ec7bSml29623 #define	ESPC_MOD_STR_3		ESPC_NCR_REGN(7)
44*6f45ec7bSml29623 #define	ESPC_MOD_STR_4		ESPC_NCR_REGN(8)
45*6f45ec7bSml29623 #define	ESPC_MOD_STR_5		ESPC_NCR_REGN(9)
46*6f45ec7bSml29623 #define	ESPC_MOD_STR_6		ESPC_NCR_REGN(10)
47*6f45ec7bSml29623 #define	ESPC_MOD_STR_7		ESPC_NCR_REGN(11)
48*6f45ec7bSml29623 #define	ESPC_MOD_STR_8		ESPC_NCR_REGN(12)
49*6f45ec7bSml29623 #define	ESPC_BD_MOD_STR_LEN	ESPC_NCR_REGN(13)
50*6f45ec7bSml29623 #define	ESPC_BD_MOD_STR_1	ESPC_NCR_REGN(14)
51*6f45ec7bSml29623 #define	ESPC_BD_MOD_STR_2	ESPC_NCR_REGN(15)
52*6f45ec7bSml29623 #define	ESPC_BD_MOD_STR_3	ESPC_NCR_REGN(16)
53*6f45ec7bSml29623 #define	ESPC_BD_MOD_STR_4	ESPC_NCR_REGN(17)
54*6f45ec7bSml29623 #define	ESPC_PHY_TYPE		ESPC_NCR_REGN(18)
55*6f45ec7bSml29623 #define	ESPC_MAX_FM_SZ		ESPC_NCR_REGN(19)
56*6f45ec7bSml29623 #define	ESPC_INTR_NUM		ESPC_NCR_REGN(20)
57*6f45ec7bSml29623 #define	ESPC_VER_IMGSZ		ESPC_NCR_REGN(21)
58*6f45ec7bSml29623 #define	ESPC_CHKSUM		ESPC_NCR_REGN(22)
59*6f45ec7bSml29623 
60*6f45ec7bSml29623 #define	NUM_PORTS_MASK		0xff
61*6f45ec7bSml29623 #define	NUM_MAC_ADDRS_MASK	0xff0000
62*6f45ec7bSml29623 #define	NUM_MAC_ADDRS_SHIFT	16
63*6f45ec7bSml29623 #define	MOD_STR_LEN_MASK	0xffff
64*6f45ec7bSml29623 #define	BD_MOD_STR_LEN_MASK	0xffff
65*6f45ec7bSml29623 #define	MAX_FM_SZ_MASK		0xffff
66*6f45ec7bSml29623 #define	VER_NUM_MASK		0xffff
67*6f45ec7bSml29623 #define	IMG_SZ_MASK		0xffff0000
68*6f45ec7bSml29623 #define	IMG_SZ_SHIFT		16
69*6f45ec7bSml29623 #define	CHKSUM_MASK		0xff
70*6f45ec7bSml29623 
71*6f45ec7bSml29623 /* 0 <= n < 8 */
72*6f45ec7bSml29623 #define	ESPC_MOD_STR(n)		(ESPC_MOD_STR_1 + n*8)
73*6f45ec7bSml29623 #define	MAX_MOD_STR_LEN		32
74*6f45ec7bSml29623 
75*6f45ec7bSml29623 /* 0 <= n < 4 */
76*6f45ec7bSml29623 #define	ESPC_BD_MOD_STR(n)	(ESPC_BD_MOD_STR_1 + n*8)
77*6f45ec7bSml29623 #define	MAX_BD_MOD_STR_LEN	16
78*6f45ec7bSml29623 
79*6f45ec7bSml29623 #define	ESC_PHY_10G_FIBER	0x0
80*6f45ec7bSml29623 #define	ESC_PHY_10G_COPPER	0x1
81*6f45ec7bSml29623 #define	ESC_PHY_1G_FIBER	0x2
82*6f45ec7bSml29623 #define	ESC_PHY_1G_COPPER	0x3
83*6f45ec7bSml29623 #define	ESC_PHY_NONE		0xf
84*6f45ec7bSml29623 
85*6f45ec7bSml29623 #define	ESC_IMG_CHKSUM_VAL	0xab
86*6f45ec7bSml29623 
87*6f45ec7bSml29623 typedef union _mac_addr_0_t {
88*6f45ec7bSml29623 	uint64_t value;
89*6f45ec7bSml29623 
90*6f45ec7bSml29623 	struct {
91*6f45ec7bSml29623 #if defined(_BIG_ENDIAN)
92*6f45ec7bSml29623 		uint32_t msw;	/* Most significant word */
93*6f45ec7bSml29623 		uint32_t lsw;	/* Least significant word */
94*6f45ec7bSml29623 #elif defined(_LITTLE_ENDIAN)
95*6f45ec7bSml29623 		uint32_t lsw;	/* Least significant word */
96*6f45ec7bSml29623 		uint32_t msw;	/* Most significant word */
97*6f45ec7bSml29623 #endif
98*6f45ec7bSml29623 	} val;
99*6f45ec7bSml29623 	struct {
100*6f45ec7bSml29623 #if defined(_BIG_ENDIAN)
101*6f45ec7bSml29623 		uint32_t	w1;
102*6f45ec7bSml29623 #endif
103*6f45ec7bSml29623 		struct {
104*6f45ec7bSml29623 #if defined(_BIT_FIELDS_HTOL)
105*6f45ec7bSml29623 		uint32_t byte3		: 8;
106*6f45ec7bSml29623 		uint32_t byte2		: 8;
107*6f45ec7bSml29623 		uint32_t byte1		: 8;
108*6f45ec7bSml29623 		uint32_t byte0		: 8;
109*6f45ec7bSml29623 #elif defined(_BIT_FIELDS_LTOH)
110*6f45ec7bSml29623 		uint32_t byte0		: 8;
111*6f45ec7bSml29623 		uint32_t byte1		: 8;
112*6f45ec7bSml29623 		uint32_t byte2		: 8;
113*6f45ec7bSml29623 		uint32_t byte3		: 8;
114*6f45ec7bSml29623 #endif
115*6f45ec7bSml29623 		} w0;
116*6f45ec7bSml29623 
117*6f45ec7bSml29623 #if defined(_LITTLE_ENDIAN)
118*6f45ec7bSml29623 		uint32_t	w1;
119*6f45ec7bSml29623 #endif
120*6f45ec7bSml29623 	} bits;
121*6f45ec7bSml29623 } mac_addr_0_t;
122*6f45ec7bSml29623 
123*6f45ec7bSml29623 typedef union _mac_addr_1_t {
124*6f45ec7bSml29623 	uint64_t value;
125*6f45ec7bSml29623 
126*6f45ec7bSml29623 	struct {
127*6f45ec7bSml29623 #if defined(_BIG_ENDIAN)
128*6f45ec7bSml29623 		uint32_t msw;	/* Most significant word */
129*6f45ec7bSml29623 		uint32_t lsw;	/* Least significant word */
130*6f45ec7bSml29623 #elif defined(_LITTLE_ENDIAN)
131*6f45ec7bSml29623 		uint32_t lsw;	/* Least significant word */
132*6f45ec7bSml29623 		uint32_t msw;	/* Most significant word */
133*6f45ec7bSml29623 #endif
134*6f45ec7bSml29623 	} val;
135*6f45ec7bSml29623 	struct {
136*6f45ec7bSml29623 #if defined(_BIG_ENDIAN)
137*6f45ec7bSml29623 		uint32_t	w1;
138*6f45ec7bSml29623 #endif
139*6f45ec7bSml29623 		struct {
140*6f45ec7bSml29623 #if defined(_BIT_FIELDS_HTOL)
141*6f45ec7bSml29623 		uint32_t res		: 16;
142*6f45ec7bSml29623 		uint32_t byte5		: 8;
143*6f45ec7bSml29623 		uint32_t byte4		: 8;
144*6f45ec7bSml29623 #elif defined(_BIT_FIELDS_LTOH)
145*6f45ec7bSml29623 		uint32_t byte4		: 8;
146*6f45ec7bSml29623 		uint32_t byte5		: 8;
147*6f45ec7bSml29623 		uint32_t res		: 16;
148*6f45ec7bSml29623 #endif
149*6f45ec7bSml29623 		} w0;
150*6f45ec7bSml29623 
151*6f45ec7bSml29623 #if defined(_LITTLE_ENDIAN)
152*6f45ec7bSml29623 		uint32_t	w1;
153*6f45ec7bSml29623 #endif
154*6f45ec7bSml29623 	} bits;
155*6f45ec7bSml29623 } mac_addr_1_t;
156*6f45ec7bSml29623 
157*6f45ec7bSml29623 
158*6f45ec7bSml29623 typedef union _phy_type_t {
159*6f45ec7bSml29623 	uint64_t value;
160*6f45ec7bSml29623 
161*6f45ec7bSml29623 	struct {
162*6f45ec7bSml29623 #if defined(_BIG_ENDIAN)
163*6f45ec7bSml29623 		uint32_t msw;	/* Most significant word */
164*6f45ec7bSml29623 		uint32_t lsw;	/* Least significant word */
165*6f45ec7bSml29623 #elif defined(_LITTLE_ENDIAN)
166*6f45ec7bSml29623 		uint32_t lsw;	/* Least significant word */
167*6f45ec7bSml29623 		uint32_t msw;	/* Most significant word */
168*6f45ec7bSml29623 #endif
169*6f45ec7bSml29623 	} val;
170*6f45ec7bSml29623 	struct {
171*6f45ec7bSml29623 #if defined(_BIG_ENDIAN)
172*6f45ec7bSml29623 		uint32_t	w1;
173*6f45ec7bSml29623 #endif
174*6f45ec7bSml29623 		struct {
175*6f45ec7bSml29623 #if defined(_BIT_FIELDS_HTOL)
176*6f45ec7bSml29623 		uint32_t pt0_phy_type	: 8;
177*6f45ec7bSml29623 		uint32_t pt1_phy_type	: 8;
178*6f45ec7bSml29623 		uint32_t pt2_phy_type	: 8;
179*6f45ec7bSml29623 		uint32_t pt3_phy_type	: 8;
180*6f45ec7bSml29623 #elif defined(_BIT_FIELDS_LTOH)
181*6f45ec7bSml29623 		uint32_t pt3_phy_type	: 8;
182*6f45ec7bSml29623 		uint32_t pt2_phy_type	: 8;
183*6f45ec7bSml29623 		uint32_t pt1_phy_type	: 8;
184*6f45ec7bSml29623 		uint32_t pt0_phy_type	: 8;
185*6f45ec7bSml29623 #endif
186*6f45ec7bSml29623 		} w0;
187*6f45ec7bSml29623 
188*6f45ec7bSml29623 #if defined(_LITTLE_ENDIAN)
189*6f45ec7bSml29623 		uint32_t	w1;
190*6f45ec7bSml29623 #endif
191*6f45ec7bSml29623 	} bits;
192*6f45ec7bSml29623 } phy_type_t;
193*6f45ec7bSml29623 
194*6f45ec7bSml29623 
195*6f45ec7bSml29623 typedef union _intr_num_t {
196*6f45ec7bSml29623 	uint64_t value;
197*6f45ec7bSml29623 
198*6f45ec7bSml29623 	struct {
199*6f45ec7bSml29623 #if defined(_BIG_ENDIAN)
200*6f45ec7bSml29623 		uint32_t msw;	/* Most significant word */
201*6f45ec7bSml29623 		uint32_t lsw;	/* Least significant word */
202*6f45ec7bSml29623 #elif defined(_LITTLE_ENDIAN)
203*6f45ec7bSml29623 		uint32_t lsw;	/* Least significant word */
204*6f45ec7bSml29623 		uint32_t msw;	/* Most significant word */
205*6f45ec7bSml29623 #endif
206*6f45ec7bSml29623 	} val;
207*6f45ec7bSml29623 	struct {
208*6f45ec7bSml29623 #if defined(_BIG_ENDIAN)
209*6f45ec7bSml29623 		uint32_t	w1;
210*6f45ec7bSml29623 #endif
211*6f45ec7bSml29623 		struct {
212*6f45ec7bSml29623 #if defined(_BIT_FIELDS_HTOL)
213*6f45ec7bSml29623 		uint32_t pt0_intr_num	: 8;
214*6f45ec7bSml29623 		uint32_t pt1_intr_num	: 8;
215*6f45ec7bSml29623 		uint32_t pt2_intr_num	: 8;
216*6f45ec7bSml29623 		uint32_t pt3_intr_num	: 8;
217*6f45ec7bSml29623 #elif defined(_BIT_FIELDS_LTOH)
218*6f45ec7bSml29623 		uint32_t pt3_intr_num	: 8;
219*6f45ec7bSml29623 		uint32_t pt2_intr_num	: 8;
220*6f45ec7bSml29623 		uint32_t pt1_intr_num	: 8;
221*6f45ec7bSml29623 		uint32_t pt0_intr_num	: 8;
222*6f45ec7bSml29623 #endif
223*6f45ec7bSml29623 		} w0;
224*6f45ec7bSml29623 
225*6f45ec7bSml29623 #if defined(_LITTLE_ENDIAN)
226*6f45ec7bSml29623 		uint32_t	w1;
227*6f45ec7bSml29623 #endif
228*6f45ec7bSml29623 	} bits;
229*6f45ec7bSml29623 } intr_num_t;
230*6f45ec7bSml29623 
231*6f45ec7bSml29623 
232*6f45ec7bSml29623 #ifdef __cplusplus
233*6f45ec7bSml29623 }
234*6f45ec7bSml29623 #endif
235*6f45ec7bSml29623 
236*6f45ec7bSml29623 #endif	/* _SYS_NXGE_NXGE_ESPC_H */
237