xref: /illumos-gate/usr/src/uts/common/sys/fc4/linkapp.h (revision afab0816ecb604f0099a09ad8ee398f0d7b77b1c)
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) 1995,1997-1998 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _SYS_FC4_LINKAPP_H
28 #define	_SYS_FC4_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	FS_GENERAL_MULTICAST	0xfffff7
49 #define	FS_WELL_KNOWN_MULTICAST	0xfffff8
50 #define	FS_HUNT_GROUP		0xfffff9
51 #define	FS_MANAGEMENT_SERVER	0xfffffa
52 #define	FS_TIME_SERVER		0xfffffb
53 #define	FS_NAME_SERVER		0xfffffc
54 #define	FS_FABRIC_CONTROLLER	0xfffffd
55 #define	FS_FABRIC_F_PORT	0xfffffe
56 #define	FS_BROADCAST		0xffffff
57 
58 /*
59  * Link Application Opcodes.
60  */
61 
62 #define	LA_RJT		0x01000000
63 #define	LA_ACC		0x02000000
64 #define	LA_LOGI		0x03000000
65 #define	LA_LOGO		0x04000000
66 #define	LA_RLS		0x0d000000
67 #define	LA_IDENT	0x20000000
68 
69 /* Basic Accept Payload. */
70 typedef struct ba_acc {
71 	uchar_t		seq_id:8;
72 	uchar_t		org_s_id[3];
73 	ushort_t	ox_id;
74 	ushort_t	rx_id;
75 } ba_acc_t;
76 
77 /* Basic Reject. */
78 typedef struct ba_rjt {
79 	uchar_t		reseved;
80 	uchar_t		reason_code;
81 	uchar_t		explanation;
82 	uchar_t		vendor;
83 } ba_rjt_t;
84 
85 /*
86  * Basic Reject Reason Codes.
87  */
88 #define	RJT_INVALID_CMD		0x01
89 #define	RJT_LOGICAL_ERR		0x03
90 #define	RJT_LOGICAL_BUSY	0x05
91 #define	RJT_PROTOCOL_ERR	0x07
92 #define	RJT_UNABLE		0x09
93 #define	RJT_UNSUPPORTED		0x0B
94 #define	RJT_VENDOR		0xFF
95 
96 /*
97  * Basic Reject Explanation Codes
98  */
99 #define	RJT_NOEXPLANATION	0x00
100 #define	RJT_INVALID_OSID	0x01
101 #define	RJT_INVALID_OXID_RXID	0x03
102 #define	RJT_INVALID_SEQID	0x05
103 #define	RJT_ABORT_INACTIVE_SEQ	0x07
104 #define	RJT_UNABLE_TO_SUPPLY	0x09
105 
106 /*
107  * Service parameters.
108  */
109 typedef struct common_service {
110 	uint_t		fcph;
111 	uint_t		btob_crdt;
112 	uint_t		cmn_features;
113 	uint_t		reserved;
114 } common_svc_t;
115 
116 typedef struct service_param {
117 	uchar_t		data[16];
118 } svc_param_t;
119 
120 /* World Wide Name formats */
121 typedef union la_wwn {
122 	uchar_t		raw_wwn[8];
123 	struct {
124 	    uint_t	naa_id : 4;
125 	    uint_t	nport_id : 12;
126 	    uint_t	wwn_hi : 16;
127 	    uint_t	wwn_lo;
128 	} w;
129 } la_wwn_t;
130 
131 /*
132  * Values for naa_id
133  */
134 #define	NAA_ID_IEEE		1
135 #define	NAA_ID_IEEE_EXTENDED	2
136 
137 /* Login Payload. */
138 typedef struct la_logi {
139 	unsigned	code;
140 	common_svc_t	common_service;
141 
142 	la_wwn_t	nport_ww_name;
143 	la_wwn_t	node_ww_name;
144 
145 	svc_param_t	class_1;
146 	svc_param_t	class_2;
147 	svc_param_t	class_3;
148 } la_logi_t;
149 
150 #define	SP_F_PORT_LOGIN	0x10
151 
152 /* Read Link Error Status */
153 typedef struct la_rls {
154 	unsigned	code;
155 	uchar_t		reserved;
156 	uchar_t		nport_id[3];
157 } la_rls_t;
158 
159 /* Read Link Error Status Reply */
160 typedef struct la_rls_reply {
161 	unsigned	code;
162 	unsigned	link_failure;
163 	unsigned	loss_of_sync;
164 	unsigned	loss_of_signal;
165 	unsigned	primitive;
166 	unsigned	invalid_transmission;
167 	unsigned	invalid_crc;
168 } la_rls_reply_t;
169 
170 /* Logout payload. */
171 typedef struct la_logo {
172 	unsigned	cmd;
173 } la_logo_t;
174 
175 /* Logout reply payload. */
176 typedef la_logo_t la_logo_reply_t;
177 
178 /* Link Application Reject */
179 typedef struct la_rjt {
180 	int	code;
181 	uchar_t	reserved;
182 	uchar_t	reason_code;
183 	uchar_t	explanation;
184 	uchar_t	vendor;
185 } la_rjt_t;
186 
187 /*
188  * LA_RJT Reason Codes.
189  */
190 #define	LA_RJT_INVALID			0x01
191 #define	LA_RJT_LOGICAL_ERR		0x03
192 #define	LA_RJT_LOGICAL_BUSY		0x05
193 #define	LA_RJT_PROTOCOL_ERR		0x07
194 #define	LA_RJT_UNABLE_TO_PERFORM	0x09
195 #define	LA_RJT_NOT_SUPPORTED		0x0b
196 #define	LA_RJT_VENDOR			0xff
197 
198 /*
199  * LA_RJT explanations
200  */
201 #define	LA_RJT_NOEXPLANATION	0x00
202 #define	LA_RJT_OPTIONS		0x01
203 #define	LA_RJT_INITIATOR	0x03
204 #define	LA_RJT_RECIPIENT	0x05
205 #define	LA_RJT_DATA_FIELD_SIZE	0x07
206 #define	LA_RJT_CONCURRENT	0x09
207 #define	LA_RJT_CREDIT		0x0b
208 
209 #define	LA_RJT_INVALID_PORT_WWNAME	0x0d
210 #define	LA_RJT_INVALID_NODE_WWNAME	0x0e
211 #define	LA_RJT_INVALID_COMMON_SVC	0x0f
212 
213 #define	LA_RJT_INSUFFICENT	0x29
214 
215 #ifdef	__cplusplus
216 }
217 #endif
218 
219 #endif	/* !_SYS_FC4_LINKAPP_H */
220