xref: /onnv-gate/usr/src/uts/common/sys/nxge/nxge_espc.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_ESPC_H
27*3859Sml29623 #define	_SYS_NXGE_NXGE_ESPC_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_espc_hw.h>
36*3859Sml29623 
37*3859Sml29623 #define	ESPC_MAC_ADDR_0		ESPC_NCR_REGN(0)
38*3859Sml29623 #define	ESPC_MAC_ADDR_1		ESPC_NCR_REGN(1)
39*3859Sml29623 #define	ESPC_NUM_PORTS_MACS	ESPC_NCR_REGN(2)
40*3859Sml29623 #define	ESPC_MOD_STR_LEN	ESPC_NCR_REGN(4)
41*3859Sml29623 #define	ESPC_MOD_STR_1		ESPC_NCR_REGN(5)
42*3859Sml29623 #define	ESPC_MOD_STR_2		ESPC_NCR_REGN(6)
43*3859Sml29623 #define	ESPC_MOD_STR_3		ESPC_NCR_REGN(7)
44*3859Sml29623 #define	ESPC_MOD_STR_4		ESPC_NCR_REGN(8)
45*3859Sml29623 #define	ESPC_MOD_STR_5		ESPC_NCR_REGN(9)
46*3859Sml29623 #define	ESPC_MOD_STR_6		ESPC_NCR_REGN(10)
47*3859Sml29623 #define	ESPC_MOD_STR_7		ESPC_NCR_REGN(11)
48*3859Sml29623 #define	ESPC_MOD_STR_8		ESPC_NCR_REGN(12)
49*3859Sml29623 #define	ESPC_BD_MOD_STR_LEN	ESPC_NCR_REGN(13)
50*3859Sml29623 #define	ESPC_BD_MOD_STR_1	ESPC_NCR_REGN(14)
51*3859Sml29623 #define	ESPC_BD_MOD_STR_2	ESPC_NCR_REGN(15)
52*3859Sml29623 #define	ESPC_BD_MOD_STR_3	ESPC_NCR_REGN(16)
53*3859Sml29623 #define	ESPC_BD_MOD_STR_4	ESPC_NCR_REGN(17)
54*3859Sml29623 #define	ESPC_PHY_TYPE		ESPC_NCR_REGN(18)
55*3859Sml29623 #define	ESPC_MAX_FM_SZ		ESPC_NCR_REGN(19)
56*3859Sml29623 #define	ESPC_INTR_NUM		ESPC_NCR_REGN(20)
57*3859Sml29623 #define	ESPC_VER_IMGSZ		ESPC_NCR_REGN(21)
58*3859Sml29623 #define	ESPC_CHKSUM		ESPC_NCR_REGN(22)
59*3859Sml29623 
60*3859Sml29623 #define	NUM_PORTS_MASK		0xff
61*3859Sml29623 #define	NUM_MAC_ADDRS_MASK	0xff0000
62*3859Sml29623 #define	NUM_MAC_ADDRS_SHIFT	16
63*3859Sml29623 #define	MOD_STR_LEN_MASK	0xffff
64*3859Sml29623 #define	BD_MOD_STR_LEN_MASK	0xffff
65*3859Sml29623 #define	MAX_FM_SZ_MASK		0xffff
66*3859Sml29623 #define	VER_NUM_MASK		0xffff
67*3859Sml29623 #define	IMG_SZ_MASK		0xffff0000
68*3859Sml29623 #define	IMG_SZ_SHIFT		16
69*3859Sml29623 #define	CHKSUM_MASK		0xff
70*3859Sml29623 
71*3859Sml29623 /* 0 <= n < 8 */
72*3859Sml29623 #define	ESPC_MOD_STR(n)		(ESPC_MOD_STR_1 + n*8)
73*3859Sml29623 #define	MAX_MOD_STR_LEN		32
74*3859Sml29623 
75*3859Sml29623 /* 0 <= n < 4 */
76*3859Sml29623 #define	ESPC_BD_MOD_STR(n)	(ESPC_BD_MOD_STR_1 + n*8)
77*3859Sml29623 #define	MAX_BD_MOD_STR_LEN	16
78*3859Sml29623 
79*3859Sml29623 #define	ESC_PHY_10G_FIBER	0x0
80*3859Sml29623 #define	ESC_PHY_10G_COPPER	0x1
81*3859Sml29623 #define	ESC_PHY_1G_FIBER	0x2
82*3859Sml29623 #define	ESC_PHY_1G_COPPER	0x3
83*3859Sml29623 #define	ESC_PHY_NONE		0xf
84*3859Sml29623 
85*3859Sml29623 #define	ESC_IMG_CHKSUM_VAL	0xab
86*3859Sml29623 
87*3859Sml29623 typedef union _mac_addr_0_t {
88*3859Sml29623 	uint64_t value;
89*3859Sml29623 
90*3859Sml29623 	struct {
91*3859Sml29623 #if defined(_BIG_ENDIAN)
92*3859Sml29623 		uint32_t msw;	/* Most significant word */
93*3859Sml29623 		uint32_t lsw;	/* Least significant word */
94*3859Sml29623 #elif defined(_LITTLE_ENDIAN)
95*3859Sml29623 		uint32_t lsw;	/* Least significant word */
96*3859Sml29623 		uint32_t msw;	/* Most significant word */
97*3859Sml29623 #endif
98*3859Sml29623 	} val;
99*3859Sml29623 	struct {
100*3859Sml29623 #if defined(_BIG_ENDIAN)
101*3859Sml29623 		uint32_t	w1;
102*3859Sml29623 #endif
103*3859Sml29623 		struct {
104*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
105*3859Sml29623 		uint32_t byte3		: 8;
106*3859Sml29623 		uint32_t byte2		: 8;
107*3859Sml29623 		uint32_t byte1		: 8;
108*3859Sml29623 		uint32_t byte0		: 8;
109*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
110*3859Sml29623 		uint32_t byte0		: 8;
111*3859Sml29623 		uint32_t byte1		: 8;
112*3859Sml29623 		uint32_t byte2		: 8;
113*3859Sml29623 		uint32_t byte3		: 8;
114*3859Sml29623 #endif
115*3859Sml29623 		} w0;
116*3859Sml29623 
117*3859Sml29623 #if defined(_LITTLE_ENDIAN)
118*3859Sml29623 		uint32_t	w1;
119*3859Sml29623 #endif
120*3859Sml29623 	} bits;
121*3859Sml29623 } mac_addr_0_t;
122*3859Sml29623 
123*3859Sml29623 typedef union _mac_addr_1_t {
124*3859Sml29623 	uint64_t value;
125*3859Sml29623 
126*3859Sml29623 	struct {
127*3859Sml29623 #if defined(_BIG_ENDIAN)
128*3859Sml29623 		uint32_t msw;	/* Most significant word */
129*3859Sml29623 		uint32_t lsw;	/* Least significant word */
130*3859Sml29623 #elif defined(_LITTLE_ENDIAN)
131*3859Sml29623 		uint32_t lsw;	/* Least significant word */
132*3859Sml29623 		uint32_t msw;	/* Most significant word */
133*3859Sml29623 #endif
134*3859Sml29623 	} val;
135*3859Sml29623 	struct {
136*3859Sml29623 #if defined(_BIG_ENDIAN)
137*3859Sml29623 		uint32_t	w1;
138*3859Sml29623 #endif
139*3859Sml29623 		struct {
140*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
141*3859Sml29623 		uint32_t res		: 16;
142*3859Sml29623 		uint32_t byte5		: 8;
143*3859Sml29623 		uint32_t byte4		: 8;
144*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
145*3859Sml29623 		uint32_t byte4		: 8;
146*3859Sml29623 		uint32_t byte5		: 8;
147*3859Sml29623 		uint32_t res		: 16;
148*3859Sml29623 #endif
149*3859Sml29623 		} w0;
150*3859Sml29623 
151*3859Sml29623 #if defined(_LITTLE_ENDIAN)
152*3859Sml29623 		uint32_t	w1;
153*3859Sml29623 #endif
154*3859Sml29623 	} bits;
155*3859Sml29623 } mac_addr_1_t;
156*3859Sml29623 
157*3859Sml29623 
158*3859Sml29623 typedef union _phy_type_t {
159*3859Sml29623 	uint64_t value;
160*3859Sml29623 
161*3859Sml29623 	struct {
162*3859Sml29623 #if defined(_BIG_ENDIAN)
163*3859Sml29623 		uint32_t msw;	/* Most significant word */
164*3859Sml29623 		uint32_t lsw;	/* Least significant word */
165*3859Sml29623 #elif defined(_LITTLE_ENDIAN)
166*3859Sml29623 		uint32_t lsw;	/* Least significant word */
167*3859Sml29623 		uint32_t msw;	/* Most significant word */
168*3859Sml29623 #endif
169*3859Sml29623 	} val;
170*3859Sml29623 	struct {
171*3859Sml29623 #if defined(_BIG_ENDIAN)
172*3859Sml29623 		uint32_t	w1;
173*3859Sml29623 #endif
174*3859Sml29623 		struct {
175*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
176*3859Sml29623 		uint32_t pt0_phy_type	: 8;
177*3859Sml29623 		uint32_t pt1_phy_type	: 8;
178*3859Sml29623 		uint32_t pt2_phy_type	: 8;
179*3859Sml29623 		uint32_t pt3_phy_type	: 8;
180*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
181*3859Sml29623 		uint32_t pt3_phy_type	: 8;
182*3859Sml29623 		uint32_t pt2_phy_type	: 8;
183*3859Sml29623 		uint32_t pt1_phy_type	: 8;
184*3859Sml29623 		uint32_t pt0_phy_type	: 8;
185*3859Sml29623 #endif
186*3859Sml29623 		} w0;
187*3859Sml29623 
188*3859Sml29623 #if defined(_LITTLE_ENDIAN)
189*3859Sml29623 		uint32_t	w1;
190*3859Sml29623 #endif
191*3859Sml29623 	} bits;
192*3859Sml29623 } phy_type_t;
193*3859Sml29623 
194*3859Sml29623 
195*3859Sml29623 typedef union _intr_num_t {
196*3859Sml29623 	uint64_t value;
197*3859Sml29623 
198*3859Sml29623 	struct {
199*3859Sml29623 #if defined(_BIG_ENDIAN)
200*3859Sml29623 		uint32_t msw;	/* Most significant word */
201*3859Sml29623 		uint32_t lsw;	/* Least significant word */
202*3859Sml29623 #elif defined(_LITTLE_ENDIAN)
203*3859Sml29623 		uint32_t lsw;	/* Least significant word */
204*3859Sml29623 		uint32_t msw;	/* Most significant word */
205*3859Sml29623 #endif
206*3859Sml29623 	} val;
207*3859Sml29623 	struct {
208*3859Sml29623 #if defined(_BIG_ENDIAN)
209*3859Sml29623 		uint32_t	w1;
210*3859Sml29623 #endif
211*3859Sml29623 		struct {
212*3859Sml29623 #if defined(_BIT_FIELDS_HTOL)
213*3859Sml29623 		uint32_t pt0_intr_num	: 8;
214*3859Sml29623 		uint32_t pt1_intr_num	: 8;
215*3859Sml29623 		uint32_t pt2_intr_num	: 8;
216*3859Sml29623 		uint32_t pt3_intr_num	: 8;
217*3859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
218*3859Sml29623 		uint32_t pt3_intr_num	: 8;
219*3859Sml29623 		uint32_t pt2_intr_num	: 8;
220*3859Sml29623 		uint32_t pt1_intr_num	: 8;
221*3859Sml29623 		uint32_t pt0_intr_num	: 8;
222*3859Sml29623 #endif
223*3859Sml29623 		} w0;
224*3859Sml29623 
225*3859Sml29623 #if defined(_LITTLE_ENDIAN)
226*3859Sml29623 		uint32_t	w1;
227*3859Sml29623 #endif
228*3859Sml29623 	} bits;
229*3859Sml29623 } intr_num_t;
230*3859Sml29623 
231*3859Sml29623 
232*3859Sml29623 #ifdef __cplusplus
233*3859Sml29623 }
234*3859Sml29623 #endif
235*3859Sml29623 
236*3859Sml29623 #endif	/* _SYS_NXGE_NXGE_ESPC_H */
237