xref: /illumos-gate/usr/src/uts/common/sys/fc4/linkapp.h (revision 2d6eb4a5)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1995,1997-1998 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_FC4_LINKAPP_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_FC4_LINKAPP_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
31*7c478bd9Sstevel@tonic-gate extern "C" {
32*7c478bd9Sstevel@tonic-gate #endif
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate /*
35*7c478bd9Sstevel@tonic-gate  * linkapp.h
36*7c478bd9Sstevel@tonic-gate  *
37*7c478bd9Sstevel@tonic-gate  *	This file contains the definitions for structures and macros
38*7c478bd9Sstevel@tonic-gate  *	for fiber channel link application payloads and data.
39*7c478bd9Sstevel@tonic-gate  */
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate /*
42*7c478bd9Sstevel@tonic-gate  * Well Known Fiber Chaneel Addresses to reach the fabric for
43*7c478bd9Sstevel@tonic-gate  * various services.
44*7c478bd9Sstevel@tonic-gate  */
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate #define	FS_GENERAL_MULTICAST	0xfffff7
47*7c478bd9Sstevel@tonic-gate #define	FS_WELL_KNOWN_MULTICAST	0xfffff8
48*7c478bd9Sstevel@tonic-gate #define	FS_HUNT_GROUP		0xfffff9
49*7c478bd9Sstevel@tonic-gate #define	FS_MANAGEMENT_SERVER	0xfffffa
50*7c478bd9Sstevel@tonic-gate #define	FS_TIME_SERVER		0xfffffb
51*7c478bd9Sstevel@tonic-gate #define	FS_NAME_SERVER		0xfffffc
52*7c478bd9Sstevel@tonic-gate #define	FS_FABRIC_CONTROLLER	0xfffffd
53*7c478bd9Sstevel@tonic-gate #define	FS_FABRIC_F_PORT	0xfffffe
54*7c478bd9Sstevel@tonic-gate #define	FS_BROADCAST		0xffffff
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate /*
57*7c478bd9Sstevel@tonic-gate  * Link Application Opcodes.
58*7c478bd9Sstevel@tonic-gate  */
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate #define	LA_RJT		0x01000000
61*7c478bd9Sstevel@tonic-gate #define	LA_ACC		0x02000000
62*7c478bd9Sstevel@tonic-gate #define	LA_LOGI		0x03000000
63*7c478bd9Sstevel@tonic-gate #define	LA_LOGO		0x04000000
64*7c478bd9Sstevel@tonic-gate #define	LA_RLS		0x0d000000
65*7c478bd9Sstevel@tonic-gate #define	LA_IDENT	0x20000000
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate /* Basic Accept Payload. */
68*7c478bd9Sstevel@tonic-gate typedef struct ba_acc {
69*7c478bd9Sstevel@tonic-gate 	uchar_t		seq_id:8;
70*7c478bd9Sstevel@tonic-gate 	uchar_t		org_s_id[3];
71*7c478bd9Sstevel@tonic-gate 	ushort_t	ox_id;
72*7c478bd9Sstevel@tonic-gate 	ushort_t	rx_id;
73*7c478bd9Sstevel@tonic-gate } ba_acc_t;
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate /* Basic Reject. */
76*7c478bd9Sstevel@tonic-gate typedef struct ba_rjt {
77*7c478bd9Sstevel@tonic-gate 	uchar_t		reseved;
78*7c478bd9Sstevel@tonic-gate 	uchar_t		reason_code;
79*7c478bd9Sstevel@tonic-gate 	uchar_t		explanation;
80*7c478bd9Sstevel@tonic-gate 	uchar_t		vendor;
81*7c478bd9Sstevel@tonic-gate } ba_rjt_t;
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate /*
84*7c478bd9Sstevel@tonic-gate  * Basic Reject Reason Codes.
85*7c478bd9Sstevel@tonic-gate  */
86*7c478bd9Sstevel@tonic-gate #define	RJT_INVALID_CMD		0x01
87*7c478bd9Sstevel@tonic-gate #define	RJT_LOGICAL_ERR		0x03
88*7c478bd9Sstevel@tonic-gate #define	RJT_LOGICAL_BUSY	0x05
89*7c478bd9Sstevel@tonic-gate #define	RJT_PROTOCOL_ERR	0x07
90*7c478bd9Sstevel@tonic-gate #define	RJT_UNABLE		0x09
91*7c478bd9Sstevel@tonic-gate #define	RJT_UNSUPPORTED		0x0B
92*7c478bd9Sstevel@tonic-gate #define	RJT_VENDOR		0xFF
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate /*
95*7c478bd9Sstevel@tonic-gate  * Basic Reject Explanation Codes
96*7c478bd9Sstevel@tonic-gate  */
97*7c478bd9Sstevel@tonic-gate #define	RJT_NOEXPLANATION	0x00
98*7c478bd9Sstevel@tonic-gate #define	RJT_INVALID_OSID	0x01
99*7c478bd9Sstevel@tonic-gate #define	RJT_INVALID_OXID_RXID	0x03
100*7c478bd9Sstevel@tonic-gate #define	RJT_INVALID_SEQID	0x05
101*7c478bd9Sstevel@tonic-gate #define	RJT_ABORT_INACTIVE_SEQ	0x07
102*7c478bd9Sstevel@tonic-gate #define	RJT_UNABLE_TO_SUPPLY	0x09
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate /*
105*7c478bd9Sstevel@tonic-gate  * Service parameters.
106*7c478bd9Sstevel@tonic-gate  */
107*7c478bd9Sstevel@tonic-gate typedef struct common_service {
108*7c478bd9Sstevel@tonic-gate 	uint_t		fcph;
109*7c478bd9Sstevel@tonic-gate 	uint_t		btob_crdt;
110*7c478bd9Sstevel@tonic-gate 	uint_t		cmn_features;
111*7c478bd9Sstevel@tonic-gate 	uint_t		reserved;
112*7c478bd9Sstevel@tonic-gate } common_svc_t;
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate typedef struct service_param {
115*7c478bd9Sstevel@tonic-gate 	uchar_t		data[16];
116*7c478bd9Sstevel@tonic-gate } svc_param_t;
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate /* World Wide Name formats */
119*7c478bd9Sstevel@tonic-gate typedef union la_wwn {
120*7c478bd9Sstevel@tonic-gate 	uchar_t		raw_wwn[8];
121*7c478bd9Sstevel@tonic-gate 	struct {
122*7c478bd9Sstevel@tonic-gate 	    uint_t	naa_id : 4;
123*7c478bd9Sstevel@tonic-gate 	    uint_t	nport_id : 12;
124*7c478bd9Sstevel@tonic-gate 	    uint_t	wwn_hi : 16;
125*7c478bd9Sstevel@tonic-gate 	    uint_t	wwn_lo;
126*7c478bd9Sstevel@tonic-gate 	} w;
127*7c478bd9Sstevel@tonic-gate } la_wwn_t;
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate /*
130*7c478bd9Sstevel@tonic-gate  * Values for naa_id
131*7c478bd9Sstevel@tonic-gate  */
132*7c478bd9Sstevel@tonic-gate #define	NAA_ID_IEEE		1
133*7c478bd9Sstevel@tonic-gate #define	NAA_ID_IEEE_EXTENDED	2
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate /* Login Payload. */
136*7c478bd9Sstevel@tonic-gate typedef struct la_logi {
137*7c478bd9Sstevel@tonic-gate 	unsigned	code;
138*7c478bd9Sstevel@tonic-gate 	common_svc_t	common_service;
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate 	la_wwn_t	nport_ww_name;
141*7c478bd9Sstevel@tonic-gate 	la_wwn_t	node_ww_name;
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate 	svc_param_t	class_1;
144*7c478bd9Sstevel@tonic-gate 	svc_param_t	class_2;
145*7c478bd9Sstevel@tonic-gate 	svc_param_t	class_3;
146*7c478bd9Sstevel@tonic-gate } la_logi_t;
147*7c478bd9Sstevel@tonic-gate 
148*7c478bd9Sstevel@tonic-gate #define	SP_F_PORT_LOGIN	0x10
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate /* Read Link Error Status */
151*7c478bd9Sstevel@tonic-gate typedef struct la_rls {
152*7c478bd9Sstevel@tonic-gate 	unsigned	code;
153*7c478bd9Sstevel@tonic-gate 	uchar_t		reserved;
154*7c478bd9Sstevel@tonic-gate 	uchar_t		nport_id[3];
155*7c478bd9Sstevel@tonic-gate } la_rls_t;
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate /* Read Link Error Status Reply */
158*7c478bd9Sstevel@tonic-gate typedef struct la_rls_reply {
159*7c478bd9Sstevel@tonic-gate 	unsigned	code;
160*7c478bd9Sstevel@tonic-gate 	unsigned	link_failure;
161*7c478bd9Sstevel@tonic-gate 	unsigned	loss_of_sync;
162*7c478bd9Sstevel@tonic-gate 	unsigned	loss_of_signal;
163*7c478bd9Sstevel@tonic-gate 	unsigned	primitive;
164*7c478bd9Sstevel@tonic-gate 	unsigned	invalid_transmission;
165*7c478bd9Sstevel@tonic-gate 	unsigned	invalid_crc;
166*7c478bd9Sstevel@tonic-gate } la_rls_reply_t;
167*7c478bd9Sstevel@tonic-gate 
168*7c478bd9Sstevel@tonic-gate /* Logout payload. */
169*7c478bd9Sstevel@tonic-gate typedef struct la_logo {
170*7c478bd9Sstevel@tonic-gate 	unsigned	cmd;
171*7c478bd9Sstevel@tonic-gate } la_logo_t;
172*7c478bd9Sstevel@tonic-gate 
173*7c478bd9Sstevel@tonic-gate /* Logout reply payload. */
174*7c478bd9Sstevel@tonic-gate typedef la_logo_t la_logo_reply_t;
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate /* Link Application Reject */
177*7c478bd9Sstevel@tonic-gate typedef struct la_rjt {
178*7c478bd9Sstevel@tonic-gate 	int	code;
179*7c478bd9Sstevel@tonic-gate 	uchar_t	reserved;
180*7c478bd9Sstevel@tonic-gate 	uchar_t	reason_code;
181*7c478bd9Sstevel@tonic-gate 	uchar_t	explanation;
182*7c478bd9Sstevel@tonic-gate 	uchar_t	vendor;
183*7c478bd9Sstevel@tonic-gate } la_rjt_t;
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate /*
186*7c478bd9Sstevel@tonic-gate  * LA_RJT Reason Codes.
187*7c478bd9Sstevel@tonic-gate  */
188*7c478bd9Sstevel@tonic-gate #define	LA_RJT_INVALID			0x01
189*7c478bd9Sstevel@tonic-gate #define	LA_RJT_LOGICAL_ERR		0x03
190*7c478bd9Sstevel@tonic-gate #define	LA_RJT_LOGICAL_BUSY		0x05
191*7c478bd9Sstevel@tonic-gate #define	LA_RJT_PROTOCOL_ERR		0x07
192*7c478bd9Sstevel@tonic-gate #define	LA_RJT_UNABLE_TO_PERFORM	0x09
193*7c478bd9Sstevel@tonic-gate #define	LA_RJT_NOT_SUPPORTED		0x0b
194*7c478bd9Sstevel@tonic-gate #define	LA_RJT_VENDOR			0xff
195*7c478bd9Sstevel@tonic-gate 
196*7c478bd9Sstevel@tonic-gate /*
197*7c478bd9Sstevel@tonic-gate  * LA_RJT explanations
198*7c478bd9Sstevel@tonic-gate  */
199*7c478bd9Sstevel@tonic-gate #define	LA_RJT_NOEXPLANATION	0x00
200*7c478bd9Sstevel@tonic-gate #define	LA_RJT_OPTIONS		0x01
201*7c478bd9Sstevel@tonic-gate #define	LA_RJT_INITIATOR	0x03
202*7c478bd9Sstevel@tonic-gate #define	LA_RJT_RECIPIENT	0x05
203*7c478bd9Sstevel@tonic-gate #define	LA_RJT_DATA_FIELD_SIZE	0x07
204*7c478bd9Sstevel@tonic-gate #define	LA_RJT_CONCURRENT	0x09
205*7c478bd9Sstevel@tonic-gate #define	LA_RJT_CREDIT		0x0b
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate #define	LA_RJT_INVALID_PORT_WWNAME	0x0d
208*7c478bd9Sstevel@tonic-gate #define	LA_RJT_INVALID_NODE_WWNAME	0x0e
209*7c478bd9Sstevel@tonic-gate #define	LA_RJT_INVALID_COMMON_SVC	0x0f
210*7c478bd9Sstevel@tonic-gate 
211*7c478bd9Sstevel@tonic-gate #define	LA_RJT_INSUFFICENT	0x29
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
214*7c478bd9Sstevel@tonic-gate }
215*7c478bd9Sstevel@tonic-gate #endif
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate #endif	/* !_SYS_FC4_LINKAPP_H */
218