xref: /illumos-gate/usr/src/uts/common/sys/fibre-channel/impl/fc_fla.h (revision 3299f39fdcbdab4be7a9c70daa3873f2b78a398d)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_FIBRE_CHANNEL_IMPL_FC_FLA_H
27 #define	_SYS_FIBRE_CHANNEL_IMPL_FC_FLA_H
28 
29 
30 #include <sys/note.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL)
37 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
38 #endif	/* _BIT_FIELDS_LTOH */
39 
40 /*
41  * Fabric Loop timers; Double check them with standards
42  */
43 #define	FLA_RR_TOV			2
44 
45 /*
46  * SCR registration function codes
47  */
48 #define	FC_SCR_FABRIC_REGISTRATION	0x01
49 #define	FC_SCR_NPORT_REGISTRATION	0x02
50 #define	FC_SCR_FULL_REGISTRATION	0x03
51 #define	FC_SCR_CLEAR_REGISTRATION	0xFF
52 
53 /*
54  * Address format of affected D_ID in RSCN Payload
55  */
56 #define	FC_RSCN_PORT_ADDRESS		0x00
57 #define	FC_RSCN_AREA_ADDRESS		0x01
58 #define	FC_RSCN_DOMAIN_ADDRESS		0x02
59 #define	FC_RSCN_FABRIC_ADDRESS		0x03
60 
61 #define	FC_RSCN_ADDRESS_MASK		0x03
62 
63 /*
64  * State Change Registration
65  */
66 typedef struct scr_request {
67 	ls_code_t	ls_code;
68 
69 #if defined(_BIT_FIELDS_LTOH)
70 	uint32_t	scr_func : 8,
71 			scr_rsvd : 24;
72 #else
73 	uint32_t	scr_rsvd : 24,
74 			scr_func : 8;
75 #endif	/* _BIT_FIELDS_LTOH */
76 
77 } fc_scr_req_t;
78 
79 typedef struct scr_response {
80 	uint32_t	scr_acc;
81 } fc_scr_resp_t;
82 
83 typedef struct rscn_payload {
84 	uchar_t		rscn_code;
85 	uchar_t		rscn_len;
86 	uint16_t	rscn_payload_len;
87 } fc_rscn_t;
88 
89 typedef struct affected_id {
90 #if defined(_BIT_FIELDS_LTOH)
91 	uint32_t	aff_d_id : 24,
92 			aff_format : 8;
93 #else
94 	uint32_t	aff_format : 8,
95 			aff_d_id : 24;
96 #endif	/* _BIT_FIELDS_LTOH */
97 
98 } fc_affected_id_t;
99 
100 typedef struct linit_req {
101 	ls_code_t	ls_code;
102 	uchar_t		rsvd;
103 	uchar_t		func;
104 	uchar_t		lip_b3;
105 	uchar_t		lip_b4;
106 } fc_linit_req_t;
107 
108 typedef struct linit_resp {
109 	ls_code_t	ls_code;
110 #if defined(_BIT_FIELDS_LTOH)
111 	uint32_t	status: 8,
112 			rsvd : 24;
113 #else
114 	uint32_t	rsvd : 24,
115 			status : 8;
116 #endif	/* _BIT_FIELDS_LTOH */
117 
118 } fc_linit_resp_t;
119 
120 typedef struct loop_status_req {
121 	ls_code_t	ls_code;
122 } fc_lsts_req_t;
123 
124 typedef struct loop_status_resp {
125 	ls_code_t	lsts_ls_code;
126 	uchar_t		lsts_rsvd1;
127 	uchar_t		lsts_failed_rx;
128 	uchar_t		lsts_fla_rev;
129 	uchar_t		lsts_state;
130 	uchar_t		lsts_pub_bitmap[16];
131 	uchar_t		lsts_priv_bitmap[16];
132 	uchar_t		lsts_lilp_length;
133 	uchar_t		lsts_lilp_map[127];
134 } fc_lsts_resp_t;
135 
136 #if	!defined(__lint)
137 _NOTE(SCHEME_PROTECTS_DATA("unique per request", scr_response))
138 _NOTE(SCHEME_PROTECTS_DATA("unique per request", scr_request))
139 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rscn_payload))
140 _NOTE(SCHEME_PROTECTS_DATA("unique per request", linit_req))
141 _NOTE(SCHEME_PROTECTS_DATA("unique per request", linit_resp))
142 _NOTE(SCHEME_PROTECTS_DATA("unique per request", loop_status_resp))
143 _NOTE(SCHEME_PROTECTS_DATA("unique per request", loop_status_req))
144 #endif /* __lint */
145 
146 #ifdef	__cplusplus
147 }
148 #endif
149 
150 #endif	/* _SYS_FIBRE_CHANNEL_IMPL_FC_FLA_H */
151