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