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