xref: /titanic_44/usr/src/uts/common/sys/fc4/fcal_linkapp.h (revision e1c679fa4b0ab8c4bcaa6263974ca0c46e5b027f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _SYS_FC4_FCAL_LINKAPP_H
28 #define	_SYS_FC4_FCAL_LINKAPP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * linkapp.h
38  *
39  *	This file contains the definitions for structures and macros
40  *	for fiber channel link application payloads and data.
41  */
42 
43 /*
44  * Well Known Fiber Chaneel Addresses to reach the fabric for
45  * various services.
46  */
47 
48 #define	MAX_FCODE_SIZE		0x2000
49 #define	FS_GENERAL_MULTICAST	0xfffff7
50 #define	FS_WELL_KNOWN_MULTICAST	0xfffff8
51 #define	FS_HUNT_GROUP		0xfffff9
52 #define	FS_MANAGEMENT_SERVER	0xfffffa
53 #define	FS_TIME_SERVER		0xfffffb
54 #define	FS_NAME_SERVER		0xfffffc
55 #define	FS_FABRIC_CONTROLLER	0xfffffd
56 #define	FS_FABRIC_F_PORT	0xfffffe
57 #define	FS_BROADCAST		0xffffff
58 
59 /*
60  * Link Application Opcodes.
61  */
62 
63 #define	LA_ELS_RJT		0x01
64 #define	LA_ELS_ACC		0x02
65 #define	LA_ELS_PLOGI		0x03
66 #define	LA_ELS_FLOGI		0x04
67 #define	LA_ELS_LOGO		0x05
68 #define	LA_ELS_ABTX		0x06
69 #define	LA_ELS_RCS		0x07
70 #define	LA_ELS_RES		0x08
71 #define	LA_ELS_RSS		0x09
72 #define	LA_ELS_RSI		0x0a
73 #define	LA_ELS_ESTS		0x0b
74 #define	LA_ELS_ESTC		0x0c
75 #define	LA_ELS_ADVC		0x0d
76 #define	LA_ELS_RTV		0x0e
77 #define	LA_ELS_RLS		0x0f
78 #define	LA_ELS_ECHO		0x10
79 #define	LA_ELS_RRQ		0x12
80 #define	LA_ELS_PRLI		0x20
81 #define	LA_ELS_PRLO		0x21
82 #define	LA_ELS_SCN		0x22
83 #define	LA_ELS_TPLS		0x23
84 #define	LA_ELS_GPRLO		0x24
85 #define	LA_ELS_GAID		0x30
86 #define	LA_ELS_FACT		0x31
87 #define	LA_ELS_FDACT		0x32
88 #define	LA_ELS_NACT		0x33
89 #define	LA_ELS_NDACT		0x34
90 #define	LA_ELS_QoSR		0x40
91 #define	LA_ELS_RVCS		0x41
92 #define	LA_ELS_PDISC		0x50
93 #define	LA_ELS_FDISC		0x51
94 #define	LA_ELS_ADISC		0x52
95 #define	LA_ELS_NEW_IDENT	0xf0	/* SMCC specific */
96 #define	LA_ELS_DISPLAY		0xf1	/* SMCC specific */
97 #define	LA_ELS_IDENT		0x20	/* SMCC specifi, SSA compat. */
98 
99 /*
100  * Events supported by soc+ HBA driver
101  */
102 #define	FCAL_INSERT_EVENT	"SUNW,sf:DEVICE-INSERTION.1"
103 #define	FCAL_REMOVE_EVENT	"SUNW,sf:DEVICE-REMOVAL.1"
104 
105 /* Basic Accept Payload. */
106 typedef struct la_ba_acc {
107 	uchar_t		seq_id:8;
108 	uchar_t		org_s_id[3];
109 	ushort_t	ox_id;
110 	ushort_t	rx_id;
111 } la_ba_acc_t;
112 
113 /* Basic Reject. */
114 typedef struct la_ba_rjt {
115 	uchar_t		reserved;
116 	uchar_t		reason_code;
117 	uchar_t		explanation;
118 	uchar_t		vendor;
119 } la_ba_rjt_t;
120 
121 /*
122  * Basic Reject Reason Codes.
123  */
124 #define	RJT_INVALID_CMD		0x01
125 #define	RJT_LOGICAL_ERR		0x03
126 #define	RJT_LOGICAL_BUSY	0x05
127 #define	RJT_PROTOCOL_ERR	0x07
128 #define	RJT_UNABLE		0x09
129 #define	RJT_UNSUPPORTED		0x0B
130 #define	RJT_VENDOR		0xFF
131 
132 /*
133  * Basic Reject Explanation Codes
134  */
135 #define	RJT_NOEXPLANATION	0x00
136 #define	RJT_INVALID_OSID	0x01
137 #define	RJT_INVALID_OXID_RXID	0x03
138 #define	RJT_INVALID_SEQID	0x05
139 #define	RJT_ABORT_INACTIVE_SEQ	0x07
140 #define	RJT_UNABLE_TO_SUPPLY	0x09
141 
142 /*
143  * Service parameters.
144  */
145 typedef struct common_service {
146 	uint_t		fcph;
147 	uint_t		btob_crdt;
148 	uint_t		cmn_features;
149 	uint_t		reserved;
150 } common_svc_t;
151 
152 typedef struct service_param {
153 	uchar_t		data[16];
154 } svc_param_t;
155 
156 /* World Wide Name formats */
157 typedef union la_wwn {
158 	uchar_t		raw_wwn[8];
159 	struct {
160 	    uint_t	naa_id : 4;
161 	    uint_t	nport_id : 12;
162 	    uint_t	wwn_hi : 16;
163 	    uint_t	wwn_lo;
164 	} w;
165 } la_wwn_t;
166 
167 #define	FC_WWN_SIZE	8
168 
169 /*
170  * Values for naa_id
171  */
172 #define	NAA_ID_IEEE		1
173 #define	NAA_ID_IEEE_EXTENDED	2
174 
175 /* Login Payload. */
176 typedef struct la_els_logi {
177 	uchar_t		ls_code;
178 	uchar_t		mbz[3];
179 	common_svc_t	common_service;
180 
181 	la_wwn_t	nport_ww_name;
182 	la_wwn_t	node_ww_name;
183 
184 	svc_param_t	class_1;
185 	svc_param_t	class_2;
186 	svc_param_t	class_3;
187 	uchar_t		reserved[16];
188 	uchar_t		vendor_version_level[16];
189 } la_els_logi_t;
190 
191 typedef	la_els_logi_t	la_els_logi_reply_t;
192 #define	la_logi_t	la_els_logi_t
193 
194 #define	SP_F_PORT_LOGIN	0x10
195 
196 /* Read Link Error Status */
197 typedef struct la_els_rls {
198 	uchar_t		ls_code;
199 	uchar_t		mbz[3];
200 	uchar_t		reserved;
201 	uchar_t		nport_id[3];
202 } la_els_rls_t;
203 
204 /* Read Link Error Status Reply */
205 typedef struct la_els_rls_reply {
206 	uchar_t		ls_code;
207 	uchar_t		mbz[3];
208 	uint_t	link_failure;
209 	uint_t	loss_of_sync;
210 	uint_t	loss_of_signal;
211 	uint_t	primitive;
212 	uint_t	invalid_transmission;
213 	uint_t	invalid_crc;
214 } la_els_rls_reply_t;
215 
216 /* Logout payload. */
217 typedef struct la_els_logo {
218 	uchar_t		ls_code;
219 	uchar_t		mbz[3];
220 	uchar_t		reserved;
221 	uchar_t		nport_id[3];
222 	la_wwn_t	nport_ww_name;
223 } la_els_logo_t;
224 
225 /* Logout reply payload. */
226 typedef la_els_logo_t la_els_logo_reply_t;
227 
228 /* Reinstate recovery qualifier */
229 typedef	struct la_els_rrq {
230 	uchar_t		ls_code;
231 	uchar_t		mbz[3];
232 	uchar_t		reserved;
233 	uchar_t		source_id[3];
234 	ushort_t	ox_id;
235 	ushort_t	rx_id;
236 	uchar_t		assoc_header[32];
237 } la_els_rrq_t;
238 
239 /* Reinstate recovery qualifier reply */
240 typedef la_els_logo_t la_els_rrq_reply_t;
241 
242 /* Process login */
243 typedef struct la_els_prli {
244 	uchar_t		ls_code;
245 	uchar_t		page_length;
246 	ushort_t	payload_length;
247 	uchar_t		service_params[16];
248 } la_els_prli_t;
249 
250 /* Process login reply */
251 typedef	la_els_prli_t la_els_prli_reply_t;
252 
253 /* Process logout */
254 typedef la_els_prli_t la_els_prlo_t;
255 
256 /* process logout reply */
257 typedef	la_els_prli_t la_els_prlo_reply_t;
258 
259 /* Port discovery */
260 typedef la_els_logi_t la_els_pdisc_t;
261 
262 /* Port discovery reply */
263 typedef la_els_logi_reply_t la_els_pdisc_reply_t;
264 
265 /* Address discovery */
266 typedef	struct la_els_adisc {
267 	uchar_t	ls_code;
268 	uchar_t	mbz[3];
269 	uint_t	hard_address;
270 	uchar_t	port_wwn[8];
271 	uchar_t	node_wwn[8];
272 	uint_t	nport_id;
273 } la_els_adisc_t;
274 
275 /* Address discovery reply */
276 typedef	la_els_adisc_t la_els_adisc_reply_t;
277 
278 /* Identify */
279 typedef	struct la_els_identify {
280 	uint_t	ls_code;
281 	uint_t	byte_count;
282 } la_els_identify_t;
283 
284 /* Identify reply */
285 typedef	struct la_els_identify_reply {
286 	uint_t	ls_code;
287 	uchar_t	fcode[MAX_FCODE_SIZE];
288 } la_els_identify_reply;
289 
290 /* Link Application Reject */
291 typedef struct la_els_rjt {
292 	uchar_t	ls_code;
293 	uchar_t	mbz[3];
294 	uchar_t	reserved;
295 	uchar_t	reason_code;
296 	uchar_t	explanation;
297 	uchar_t	vendor;
298 } la_els_rjt_t;
299 
300 /*
301  * LA_RJT Reason Codes.
302  */
303 #define	LA_RJT_INVALID			0x01
304 #define	LA_RJT_LOGICAL_ERR		0x03
305 #define	LA_RJT_LOGICAL_BUSY		0x05
306 #define	LA_RJT_PROTOCOL_ERR		0x07
307 #define	LA_RJT_UNABLE_TO_PERFORM	0x09
308 #define	LA_RJT_NOT_SUPPORTED		0x0b
309 #define	LA_RJT_VENDOR			0xff
310 
311 /*
312  * LA_RJT explanations
313  */
314 #define	LA_RJT_NOEXPLANATION	0x00
315 #define	LA_RJT_OPTIONS		0x01
316 #define	LA_RJT_INITIATOR	0x03
317 #define	LA_RJT_RECIPIENT	0x05
318 #define	LA_RJT_DATA_FIELD_SIZE	0x07
319 #define	LA_RJT_CONCURRENT	0x09
320 #define	LA_RJT_CREDIT		0x0b
321 
322 #define	LA_RJT_INVALID_PORT_WWNAME	0x0d
323 #define	LA_RJT_INVALID_NODE_WWNAME	0x0e
324 #define	LA_RJT_INVALID_COMMON_SVC	0x0f
325 
326 #define	LA_RJT_INVALID_ASSOC_HEADER	0x11
327 #define	LA_RJT_ASSOC_HDR_REQD		0x13
328 #define	LA_RJT_INVALID_ORIG_SID		0x15
329 #define	LA_RJT_INVALID_FQXID		0x17
330 #define	LA_RJT_REQUEST_IN_PROGRESS	0x19
331 #define	LA_RJT_INVALID_NPORT_ID		0x1f
332 
333 #define	LA_RJT_ INVALID_SEQ_ID		0x21
334 #define	LA_RJT_ABT_INVALID_XID		0x23
335 #define	LA_RJT_ABT_INACTIVE_XID		0x25
336 #define	LA_RJT_RRQ_REQUIRED		0x27
337 #define	LA_RJT_INSUFFICENT		0x29
338 
339 #define	LA_RJT_REQUESTED_DATA		0x2a
340 #define	LA_RJT_REQUEST_NOT_SUPPORTED	0x2c
341 
342 #ifdef	__cplusplus
343 }
344 #endif
345 
346 #endif	/* !_SYS_FC4_FCAL_LINKAPP_H */
347