xref: /titanic_50/usr/src/uts/sun/sys/socal_cq_defs.h (revision d2d5cf7c5d909b74a88d499283e24750a9a52c5d)
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 1998 Sun Microsystems, Inc. All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_SOCAL_CQ_DEFS_H
27 #define	_SYS_SOCAL_CQ_DEFS_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #define	SOC_CQE_PAYLOAD 60
36 
37 /*
38  * define the CQ_HEADER for the soc command queue.
39  */
40 
41 typedef struct	cq_hdr {
42 	uchar_t	cq_hdr_count;
43 	uchar_t	cq_hdr_type;
44 	uchar_t	cq_hdr_flags;
45 	uchar_t	cq_hdr_seqno;
46 } cq_hdr_t;
47 
48 /*
49  * Command Queue entry description.
50  */
51 
52 typedef struct cqe {
53 	uchar_t		cqe_payload[SOC_CQE_PAYLOAD];
54 	cq_hdr_t	cqe_hdr;
55 } cqe_t;
56 
57 /*
58  * CQ Entry types.
59  */
60 
61 #define	CQ_TYPE_NOP		0x00
62 #define	CQ_TYPE_OUTBOUND	0x01
63 #define	CQ_TYPE_INBOUND		0x02
64 #define	CQ_TYPE_SIMPLE		0x03
65 #define	CQ_TYPE_IO_WRITE	0x04
66 #define	CQ_TYPE_IO_READ		0x05
67 #define	CQ_TYPE_UNSOLICITED	0x06
68 #define	CQ_TYPE_BYPASS_DEV	0x06	/* supercedes unsolicited in SOC+ */
69 #define	CQ_TYPE_DIAGNOSTIC	0x07
70 #define	CQ_TYPE_OFFLINE		0x08
71 #define	CQ_TYPE_ADD_POOL	0x09	/* SOC+ enhancement */
72 #define	CQ_TYPE_DELETE_POOL	0x0a	/* SOC+ enhancement */
73 #define	CQ_TYPE_ADD_BUFFER	0x0b	/* SOC+ enhancement */
74 #define	CQ_TYPE_ADD_POOL_BUFFER	0x0c	/* SOC+ enhancement */
75 #define	CQ_TYPE_REQUEST_ABORT	0x0d	/* SOC+ enhnacement */
76 #define	CQ_TYPE_REQUEST_LIP	0x0e	/* SOC+ enhancement */
77 #define	CQ_TYPE_REPORT_MAP	0x0f	/* SOC+ enhancement */
78 #define	CQ_TYPE_RESPONSE	0x10
79 #define	CQ_TYPE_INLINE		0x20
80 
81 /*
82  * CQ Entry Flags
83  */
84 
85 #define	CQ_FLAG_CONTINUATION	0x01
86 #define	CQ_FLAG_FULL		0x02
87 #define	CQ_FLAG_BADHEADER	0x04
88 #define	CQ_FLAG_BADPACKET	0x08
89 
90 /*
91  * CQ Descriptor Definition.
92  */
93 
94 typedef	struct cq {
95 	uint32_t	cq_address;
96 	uchar_t		cq_in;
97 	uchar_t		cq_out;
98 	uchar_t		cq_last_index;
99 	uchar_t		cq_seqno;
100 } soc_cq_t;
101 
102 /*
103  * SOC header definition.
104  */
105 
106 typedef struct soc_hdr {
107 	uint_t		sh_request_token;
108 	ushort_t	sh_flags;
109 	uchar_t		sh_class;
110 	uchar_t		sh_seg_cnt;
111 	uint_t		sh_byte_cnt;
112 } soc_header_t;
113 
114 /*
115  * SOC header request packet definition.
116  */
117 
118 typedef struct soc_request {
119 	soc_header_t		sr_soc_hdr;
120 	fc_dataseg_t		sr_dataseg[3];
121 	fc_frame_header_t	sr_fc_frame_hdr;
122 	cq_hdr_t		sr_cqhdr;
123 } soc_request_t;
124 
125 typedef	soc_request_t soc_header_request_t;
126 
127 /*
128  * SOC header response packet definition.
129  */
130 
131 typedef struct soc_response {
132 	soc_header_t		sr_soc_hdr;
133 	uint_t			sr_soc_status;
134 	fc_dataseg_t		sr_dataseg;
135 	uchar_t			sr_reserved[10];
136 	ushort_t 		sr_ncmds;
137 	fc_frame_header_t	sr_fc_frame_hdr;
138 	cq_hdr_t		sr_cqhdr;
139 } soc_response_t;
140 
141 /*
142  * SOC data request packet definition.
143  */
144 
145 typedef struct soc_data_request {
146 	soc_header_t		sdr_soc_hdr;
147 	fc_dataseg_t		sdr_dataseg[6];
148 	cq_hdr_t		sdr_cqhdr;
149 } soc_data_request_t;
150 
151 /*
152  * SOC+ (only) command-only packet definitiion
153  */
154 
155 typedef	struct soc_cmdonly_request {
156 	soc_header_t	scr_soc_hdr;
157 	uchar_t		reserved[48];
158 	cq_hdr_t	scr_cqhdr;
159 } soc_cmdonly_request_t;
160 
161 /*
162  * SOC+ (only) diagnostic request packet definition
163  */
164 
165 typedef	struct soc_diag_request {
166 	soc_header_t	sdr_soc_hdr;
167 	uint_t		sdr_diag_cmd;
168 	uchar_t		reserved[44];
169 	cq_hdr_t	sdr_cqhdr;
170 } soc_diag_request_t;
171 
172 #define	SOC_DIAG_NOP		0x00
173 #define	SOC_DIAG_INT_LOOP	0x01
174 #define	SOC_DIAG_EXT_LOOP	0x02
175 #define	SOC_DIAG_REM_LOOP	0x03
176 #define	SOC_DIAG_XRAM_TEST	0x04
177 #define	SOC_DIAG_SOC_TEST	0x05
178 #define	SOC_DIAG_HCB_TEST	0x06
179 #define	SOC_DIAG_SOCLB_TEST	0x07
180 #define	SOC_DIAG_SRDSLB_TEST	0x08
181 #define	SOC_DIAG_EXTOE_TEST	0x09
182 
183 /*
184  * SOC+ (only) pool request packet definition
185  */
186 
187 typedef	struct soc_pool_request {
188 	soc_header_t		spr_soc_hdr;
189 	uint_t		spr_pool_id;
190 	uint_t		spr_header_mask;
191 	uint_t		spr_buf_size;
192 	uint_t		spr_n_entries;
193 	uchar_t			reserved[8];
194 	fc_frame_header_t	spr_fc_frame_hdr;
195 	cq_hdr_t		spr_cqhdr;
196 } soc_pool_request_t;
197 
198 #define	SOCPR_MASK_RCTL		0x800000
199 #define	SOCPR_MASK_DID		0x700000
200 #define	SOCPR_MASK_SID		0x070000
201 #define	SOCPR_MASK_TYPE		0x008000
202 #define	SOCPR_MASK_F_CTL	0x007000
203 #define	SOCPR_MASK_SEQ_ID	0x000800
204 #define	SOCPR_MASK_D_CTL	0x000400
205 #define	SOCPR_MASK_SEQ_CNT	0x000300
206 #define	SOCPR_MASK_OX_ID	0x0000f0
207 #define	SOCPR_MASK_PARAMETER	0x0000f0
208 
209 
210 /*
211  * Macros for flags field
212  *
213  * values used in both RSP's and REQ's
214  */
215 #define	SOC_PORT_B	0x0001	/* entry to/from SOC Port B */
216 #define	SOC_FC_HEADER	0x0002	/* this entry contains an FC_HEADER */
217 /*
218  *	REQ: this request is supplying buffers
219  *	RSP: this pkt is unsolicited
220  */
221 #define	SOC_UNSOLICITED	0x0080
222 
223 /*
224  * values used only for REQ's
225  */
226 #define	SOC_NO_RESPONSE	0x0004 /* generate niether RSP nor INT */
227 #define	SOC_NO_INTR	0x0008 /* generate RSP only */
228 #define	SOC_XFER_RDY	0x0010 /* issue a XFRRDY packet for this cmd */
229 #define	SOC_IGNORE_RO	0x0020 /* ignore FC_HEADER relative offset */
230 #define	SOC_RESP_HEADER	0x0200	/* return frame header regardless of status */
231 
232 /*
233  * values used only for RSP's
234  */
235 #define	SOC_COMPLETE	0x0040 /* previous CMD completed. */
236 #define	SOC_STATUS	0x0100 /* a SOC status change has occurred */
237 
238 #define	CQ_SUCCESS	0x0
239 #define	CQ_FAILURE	0x1
240 #define	CQ_FULL		0x2
241 
242 #define	CQ_REQUEST_0	0
243 #define	CQ_REQUEST_1	1
244 #define	CQ_REQUEST_2	2
245 #define	CQ_REQUEST_3	3
246 
247 #define	CQ_RESPONSE_0	0
248 #define	CQ_RESPONSE_1	1
249 #define	CQ_RESPONSE_2	2
250 #define	CQ_RESPONSE_3	3
251 
252 #define	CQ_SOLICITED_OK		CQ_RESPONSE_0
253 #define	CQ_SOLICITED_BAD	CQ_RESPONSE_1
254 #define	CQ_UNSOLICITED		CQ_RESPONSE_2
255 
256 
257 typedef struct soc_request_descriptor {
258 	soc_request_t	*srd_sp;
259 	uint_t		srd_sp_count;
260 
261 	caddr_t		srd_cmd;
262 	uint_t		srd_cmd_count;
263 
264 	caddr_t		srd_data;
265 	uint_t		srd_data_count;
266 } soc_request_desc_t;
267 
268 
269 #ifdef __cplusplus
270 }
271 #endif
272 
273 #endif /* !_SYS_SOCAL_CQ_DEFS_H */
274