xref: /onnv-gate/usr/src/uts/common/sys/fibre-channel/impl/fc_linkapp.h (revision 7836:4e95154b5b7a)
1*7836SJohn.Forte@Sun.COM /*
2*7836SJohn.Forte@Sun.COM  * CDDL HEADER START
3*7836SJohn.Forte@Sun.COM  *
4*7836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM  *
8*7836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM  * and limitations under the License.
12*7836SJohn.Forte@Sun.COM  *
13*7836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM  *
19*7836SJohn.Forte@Sun.COM  * CDDL HEADER END
20*7836SJohn.Forte@Sun.COM  */
21*7836SJohn.Forte@Sun.COM /*
22*7836SJohn.Forte@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*7836SJohn.Forte@Sun.COM  * Use is subject to license terms.
24*7836SJohn.Forte@Sun.COM  */
25*7836SJohn.Forte@Sun.COM 
26*7836SJohn.Forte@Sun.COM #ifndef	_SYS_FIBRE_CHANNEL_IMPL_FC_LINKAPP_H
27*7836SJohn.Forte@Sun.COM #define	_SYS_FIBRE_CHANNEL_IMPL_FC_LINKAPP_H
28*7836SJohn.Forte@Sun.COM 
29*7836SJohn.Forte@Sun.COM 
30*7836SJohn.Forte@Sun.COM 
31*7836SJohn.Forte@Sun.COM #include <sys/note.h>
32*7836SJohn.Forte@Sun.COM 
33*7836SJohn.Forte@Sun.COM #ifdef	__cplusplus
34*7836SJohn.Forte@Sun.COM extern "C" {
35*7836SJohn.Forte@Sun.COM #endif
36*7836SJohn.Forte@Sun.COM 
37*7836SJohn.Forte@Sun.COM #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL)
38*7836SJohn.Forte@Sun.COM #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
39*7836SJohn.Forte@Sun.COM #endif	/* _BIT_FIELDS_LTOH */
40*7836SJohn.Forte@Sun.COM 
41*7836SJohn.Forte@Sun.COM /*
42*7836SJohn.Forte@Sun.COM  * Link Application Opcodes.
43*7836SJohn.Forte@Sun.COM  */
44*7836SJohn.Forte@Sun.COM #define	LA_ELS_RJT		0x01
45*7836SJohn.Forte@Sun.COM #define	LA_ELS_ACC		0x02
46*7836SJohn.Forte@Sun.COM #define	LA_ELS_PLOGI		0x03
47*7836SJohn.Forte@Sun.COM #define	LA_ELS_FLOGI		0x04
48*7836SJohn.Forte@Sun.COM #define	LA_ELS_LOGO		0x05
49*7836SJohn.Forte@Sun.COM #define	LA_ELS_ABTX		0x06
50*7836SJohn.Forte@Sun.COM #define	LA_ELS_RCS		0x07
51*7836SJohn.Forte@Sun.COM #define	LA_ELS_RES		0x08
52*7836SJohn.Forte@Sun.COM #define	LA_ELS_RSS		0x09
53*7836SJohn.Forte@Sun.COM #define	LA_ELS_RSI		0x0a
54*7836SJohn.Forte@Sun.COM #define	LA_ELS_ESTS		0x0b
55*7836SJohn.Forte@Sun.COM #define	LA_ELS_ESTC		0x0c
56*7836SJohn.Forte@Sun.COM #define	LA_ELS_ADVC		0x0d
57*7836SJohn.Forte@Sun.COM #define	LA_ELS_RTV		0x0e
58*7836SJohn.Forte@Sun.COM #define	LA_ELS_RLS		0x0f
59*7836SJohn.Forte@Sun.COM #define	LA_ELS_ECHO		0x10
60*7836SJohn.Forte@Sun.COM #define	LA_ELS_RRQ		0x12
61*7836SJohn.Forte@Sun.COM #define	LA_ELS_PRLI		0x20
62*7836SJohn.Forte@Sun.COM #define	LA_ELS_PRLO		0x21
63*7836SJohn.Forte@Sun.COM #define	LA_ELS_SCN		0x22
64*7836SJohn.Forte@Sun.COM #define	LA_ELS_TPLS		0x23
65*7836SJohn.Forte@Sun.COM #define	LA_ELS_GPRLO		0x24
66*7836SJohn.Forte@Sun.COM #define	LA_ELS_GAID		0x30
67*7836SJohn.Forte@Sun.COM #define	LA_ELS_FACT		0x31
68*7836SJohn.Forte@Sun.COM #define	LA_ELS_FDACT		0x32
69*7836SJohn.Forte@Sun.COM #define	LA_ELS_NACT		0x33
70*7836SJohn.Forte@Sun.COM #define	LA_ELS_NDACT		0x34
71*7836SJohn.Forte@Sun.COM #define	LA_ELS_QoSR		0x40
72*7836SJohn.Forte@Sun.COM #define	LA_ELS_RVCS		0x41
73*7836SJohn.Forte@Sun.COM #define	LA_ELS_PDISC		0x50
74*7836SJohn.Forte@Sun.COM #define	LA_ELS_FDISC		0x51
75*7836SJohn.Forte@Sun.COM #define	LA_ELS_ADISC		0x52
76*7836SJohn.Forte@Sun.COM #define	LA_ELS_RSCN		0x61
77*7836SJohn.Forte@Sun.COM #define	LA_ELS_SCR		0x62
78*7836SJohn.Forte@Sun.COM #define	LA_ELS_LINIT		0x70
79*7836SJohn.Forte@Sun.COM #define	LA_ELS_RNID		0x78
80*7836SJohn.Forte@Sun.COM 
81*7836SJohn.Forte@Sun.COM /*
82*7836SJohn.Forte@Sun.COM  * LINIT status codes in the ACC
83*7836SJohn.Forte@Sun.COM  */
84*7836SJohn.Forte@Sun.COM #define	FC_LINIT_SUCCESS	0x01
85*7836SJohn.Forte@Sun.COM #define	FC_LINIT_FAILURE	0x02
86*7836SJohn.Forte@Sun.COM 
87*7836SJohn.Forte@Sun.COM /* Basic Accept Payload. */
88*7836SJohn.Forte@Sun.COM typedef struct la_ba_acc {
89*7836SJohn.Forte@Sun.COM 
90*7836SJohn.Forte@Sun.COM #if defined(_BIT_FIELDS_LTOH)
91*7836SJohn.Forte@Sun.COM 	uint32_t	org_sid : 24,
92*7836SJohn.Forte@Sun.COM 			seq_id : 8;
93*7836SJohn.Forte@Sun.COM 
94*7836SJohn.Forte@Sun.COM #else
95*7836SJohn.Forte@Sun.COM 	uint32_t	seq_id : 8,
96*7836SJohn.Forte@Sun.COM 			org_sid : 24;
97*7836SJohn.Forte@Sun.COM 
98*7836SJohn.Forte@Sun.COM #endif	/* _BIT_FIELDS_LTOH */
99*7836SJohn.Forte@Sun.COM 
100*7836SJohn.Forte@Sun.COM 	uint16_t	ox_id;
101*7836SJohn.Forte@Sun.COM 	uint16_t	rx_id;
102*7836SJohn.Forte@Sun.COM } la_ba_acc_t;
103*7836SJohn.Forte@Sun.COM 
104*7836SJohn.Forte@Sun.COM 
105*7836SJohn.Forte@Sun.COM /* Basic Reject. */
106*7836SJohn.Forte@Sun.COM typedef struct la_ba_rjt {
107*7836SJohn.Forte@Sun.COM 	uchar_t		reserved;
108*7836SJohn.Forte@Sun.COM 	uchar_t		reason_code;
109*7836SJohn.Forte@Sun.COM 	uchar_t		explanation;
110*7836SJohn.Forte@Sun.COM 	uchar_t		vendor;
111*7836SJohn.Forte@Sun.COM } la_ba_rjt_t;
112*7836SJohn.Forte@Sun.COM 
113*7836SJohn.Forte@Sun.COM 
114*7836SJohn.Forte@Sun.COM /* Logout payload. */
115*7836SJohn.Forte@Sun.COM typedef struct la_els_logo {
116*7836SJohn.Forte@Sun.COM 	ls_code_t	ls_code;
117*7836SJohn.Forte@Sun.COM 	fc_portid_t	nport_id;
118*7836SJohn.Forte@Sun.COM 	la_wwn_t	nport_ww_name;
119*7836SJohn.Forte@Sun.COM } la_els_logo_t;
120*7836SJohn.Forte@Sun.COM 
121*7836SJohn.Forte@Sun.COM /* Address discovery */
122*7836SJohn.Forte@Sun.COM typedef	struct la_els_adisc {
123*7836SJohn.Forte@Sun.COM 	ls_code_t	ls_code;
124*7836SJohn.Forte@Sun.COM 	fc_hardaddr_t	hard_addr;
125*7836SJohn.Forte@Sun.COM 	la_wwn_t	port_wwn;
126*7836SJohn.Forte@Sun.COM 	la_wwn_t	node_wwn;
127*7836SJohn.Forte@Sun.COM 	fc_portid_t	nport_id;
128*7836SJohn.Forte@Sun.COM } la_els_adisc_t;
129*7836SJohn.Forte@Sun.COM 
130*7836SJohn.Forte@Sun.COM 
131*7836SJohn.Forte@Sun.COM /* Link Application Reject */
132*7836SJohn.Forte@Sun.COM typedef struct la_els_rjt {
133*7836SJohn.Forte@Sun.COM 	ls_code_t	ls_code;
134*7836SJohn.Forte@Sun.COM 	uchar_t		action;
135*7836SJohn.Forte@Sun.COM 	uchar_t		reason;
136*7836SJohn.Forte@Sun.COM 	uchar_t		reserved;
137*7836SJohn.Forte@Sun.COM 	uchar_t		vu;
138*7836SJohn.Forte@Sun.COM } la_els_rjt_t;
139*7836SJohn.Forte@Sun.COM 
140*7836SJohn.Forte@Sun.COM /* Process Login/Logout Service Parameter Page */
141*7836SJohn.Forte@Sun.COM #define	SP_OPA_VALID			0x8000
142*7836SJohn.Forte@Sun.COM #define	SP_RPA_VALID			0x4000
143*7836SJohn.Forte@Sun.COM #define	SP_ESTABLISH_IMAGE_PAIR		0x2000
144*7836SJohn.Forte@Sun.COM #define	SP_RESP_CODE_MASK		0x0F00
145*7836SJohn.Forte@Sun.COM #define	SP_RESP_CODE_REQ_EXECUTED	0x0100
146*7836SJohn.Forte@Sun.COM 
147*7836SJohn.Forte@Sun.COM typedef struct service_parameter_page {
148*7836SJohn.Forte@Sun.COM 	uint8_t		type_code;
149*7836SJohn.Forte@Sun.COM 	uint8_t		type_code_ext;
150*7836SJohn.Forte@Sun.COM 	uint16_t	flags;
151*7836SJohn.Forte@Sun.COM 	uint32_t	opa;
152*7836SJohn.Forte@Sun.COM 	uint32_t	rpa;
153*7836SJohn.Forte@Sun.COM 	uint32_t	sp;
154*7836SJohn.Forte@Sun.COM } service_parameter_page_t;
155*7836SJohn.Forte@Sun.COM 
156*7836SJohn.Forte@Sun.COM /* Process login */
157*7836SJohn.Forte@Sun.COM typedef struct la_els_prli {
158*7836SJohn.Forte@Sun.COM #if defined(_BIT_FIELDS_LTOH)
159*7836SJohn.Forte@Sun.COM 	uint32_t	payload_length : 16,
160*7836SJohn.Forte@Sun.COM 			page_length : 8,
161*7836SJohn.Forte@Sun.COM 			ls_code : 8;
162*7836SJohn.Forte@Sun.COM 
163*7836SJohn.Forte@Sun.COM #elif	defined(_BIT_FIELDS_HTOL)
164*7836SJohn.Forte@Sun.COM 	uint32_t	ls_code : 8,
165*7836SJohn.Forte@Sun.COM 			page_length : 8,
166*7836SJohn.Forte@Sun.COM 			payload_length : 16;
167*7836SJohn.Forte@Sun.COM 
168*7836SJohn.Forte@Sun.COM #endif	/* _BIT_FIELDS_LTOH */
169*7836SJohn.Forte@Sun.COM 	uchar_t		service_params[16];
170*7836SJohn.Forte@Sun.COM } la_els_prli_t;
171*7836SJohn.Forte@Sun.COM 
172*7836SJohn.Forte@Sun.COM /* Process Logout */
173*7836SJohn.Forte@Sun.COM typedef struct la_els_prlo {
174*7836SJohn.Forte@Sun.COM 	uint8_t		ls_code;
175*7836SJohn.Forte@Sun.COM 	uint8_t		page_length;
176*7836SJohn.Forte@Sun.COM 	uint16_t	payload_length;
177*7836SJohn.Forte@Sun.COM 	uint8_t		type_code;
178*7836SJohn.Forte@Sun.COM 	uint8_t		type_code_extension;
179*7836SJohn.Forte@Sun.COM 	uint16_t	flags;
180*7836SJohn.Forte@Sun.COM 	uint32_t	opa;
181*7836SJohn.Forte@Sun.COM 	uint32_t	rpa;
182*7836SJohn.Forte@Sun.COM 	uint32_t	reserved;
183*7836SJohn.Forte@Sun.COM } la_els_prlo_t;
184*7836SJohn.Forte@Sun.COM 
185*7836SJohn.Forte@Sun.COM #if	!defined(__lint)
186*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_ba_rjt))
187*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_logo))
188*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_adisc))
189*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rjt))
190*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_prli_t))
191*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_ba_acc))
192*7836SJohn.Forte@Sun.COM #endif /* __lint */
193*7836SJohn.Forte@Sun.COM 
194*7836SJohn.Forte@Sun.COM 
195*7836SJohn.Forte@Sun.COM #ifdef	__cplusplus
196*7836SJohn.Forte@Sun.COM }
197*7836SJohn.Forte@Sun.COM #endif
198*7836SJohn.Forte@Sun.COM 
199*7836SJohn.Forte@Sun.COM #endif	/* _SYS_FIBRE_CHANNEL_IMPL_FC_LINKAPP_H */
200