summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/fc4/linkapp.h
blob: 2ef4cb10c1898f7457e191493848d9aac9f7d8e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 1995,1997-1998 by Sun Microsystems, Inc.
 * All rights reserved.
 */

#ifndef _SYS_FC4_LINKAPP_H
#define	_SYS_FC4_LINKAPP_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

/*
 * linkapp.h
 *
 *	This file contains the definitions for structures and macros
 *	for fiber channel link application payloads and data.
 */

/*
 * Well Known Fiber Chaneel Addresses to reach the fabric for
 * various services.
 */

#define	FS_GENERAL_MULTICAST	0xfffff7
#define	FS_WELL_KNOWN_MULTICAST	0xfffff8
#define	FS_HUNT_GROUP		0xfffff9
#define	FS_MANAGEMENT_SERVER	0xfffffa
#define	FS_TIME_SERVER		0xfffffb
#define	FS_NAME_SERVER		0xfffffc
#define	FS_FABRIC_CONTROLLER	0xfffffd
#define	FS_FABRIC_F_PORT	0xfffffe
#define	FS_BROADCAST		0xffffff

/*
 * Link Application Opcodes.
 */

#define	LA_RJT		0x01000000
#define	LA_ACC		0x02000000
#define	LA_LOGI		0x03000000
#define	LA_LOGO		0x04000000
#define	LA_RLS		0x0d000000
#define	LA_IDENT	0x20000000

/* Basic Accept Payload. */
typedef struct ba_acc {
	uchar_t		seq_id:8;
	uchar_t		org_s_id[3];
	ushort_t	ox_id;
	ushort_t	rx_id;
} ba_acc_t;

/* Basic Reject. */
typedef struct ba_rjt {
	uchar_t		reseved;
	uchar_t		reason_code;
	uchar_t		explanation;
	uchar_t		vendor;
} ba_rjt_t;

/*
 * Basic Reject Reason Codes.
 */
#define	RJT_INVALID_CMD		0x01
#define	RJT_LOGICAL_ERR		0x03
#define	RJT_LOGICAL_BUSY	0x05
#define	RJT_PROTOCOL_ERR	0x07
#define	RJT_UNABLE		0x09
#define	RJT_UNSUPPORTED		0x0B
#define	RJT_VENDOR		0xFF

/*
 * Basic Reject Explanation Codes
 */
#define	RJT_NOEXPLANATION	0x00
#define	RJT_INVALID_OSID	0x01
#define	RJT_INVALID_OXID_RXID	0x03
#define	RJT_INVALID_SEQID	0x05
#define	RJT_ABORT_INACTIVE_SEQ	0x07
#define	RJT_UNABLE_TO_SUPPLY	0x09

/*
 * Service parameters.
 */
typedef struct common_service {
	uint_t		fcph;
	uint_t		btob_crdt;
	uint_t		cmn_features;
	uint_t		reserved;
} common_svc_t;

typedef struct service_param {
	uchar_t		data[16];
} svc_param_t;

/* World Wide Name formats */
typedef union la_wwn {
	uchar_t		raw_wwn[8];
	struct {
	    uint_t	naa_id : 4;
	    uint_t	nport_id : 12;
	    uint_t	wwn_hi : 16;
	    uint_t	wwn_lo;
	} w;
} la_wwn_t;

/*
 * Values for naa_id
 */
#define	NAA_ID_IEEE		1
#define	NAA_ID_IEEE_EXTENDED	2

/* Login Payload. */
typedef struct la_logi {
	unsigned	code;
	common_svc_t	common_service;

	la_wwn_t	nport_ww_name;
	la_wwn_t	node_ww_name;

	svc_param_t	class_1;
	svc_param_t	class_2;
	svc_param_t	class_3;
} la_logi_t;

#define	SP_F_PORT_LOGIN	0x10

/* Read Link Error Status */
typedef struct la_rls {
	unsigned	code;
	uchar_t		reserved;
	uchar_t		nport_id[3];
} la_rls_t;

/* Read Link Error Status Reply */
typedef struct la_rls_reply {
	unsigned	code;
	unsigned	link_failure;
	unsigned	loss_of_sync;
	unsigned	loss_of_signal;
	unsigned	primitive;
	unsigned	invalid_transmission;
	unsigned	invalid_crc;
} la_rls_reply_t;

/* Logout payload. */
typedef struct la_logo {
	unsigned	cmd;
} la_logo_t;

/* Logout reply payload. */
typedef la_logo_t la_logo_reply_t;

/* Link Application Reject */
typedef struct la_rjt {
	int	code;
	uchar_t	reserved;
	uchar_t	reason_code;
	uchar_t	explanation;
	uchar_t	vendor;
} la_rjt_t;

/*
 * LA_RJT Reason Codes.
 */
#define	LA_RJT_INVALID			0x01
#define	LA_RJT_LOGICAL_ERR		0x03
#define	LA_RJT_LOGICAL_BUSY		0x05
#define	LA_RJT_PROTOCOL_ERR		0x07
#define	LA_RJT_UNABLE_TO_PERFORM	0x09
#define	LA_RJT_NOT_SUPPORTED		0x0b
#define	LA_RJT_VENDOR			0xff

/*
 * LA_RJT explanations
 */
#define	LA_RJT_NOEXPLANATION	0x00
#define	LA_RJT_OPTIONS		0x01
#define	LA_RJT_INITIATOR	0x03
#define	LA_RJT_RECIPIENT	0x05
#define	LA_RJT_DATA_FIELD_SIZE	0x07
#define	LA_RJT_CONCURRENT	0x09
#define	LA_RJT_CREDIT		0x0b

#define	LA_RJT_INVALID_PORT_WWNAME	0x0d
#define	LA_RJT_INVALID_NODE_WWNAME	0x0e
#define	LA_RJT_INVALID_COMMON_SVC	0x0f

#define	LA_RJT_INSUFFICENT	0x29

#ifdef	__cplusplus
}
#endif

#endif	/* !_SYS_FC4_LINKAPP_H */