1 /* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI.
2  *
3  * Copyright (c) 2006 - 2011 Broadcom Corporation
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation.
8  *
9  * Written by: Anil Veerabhadrappa (anilgv@broadcom.com)
10  * Maintained by: Eddie Wai (eddie.wai@broadcom.com)
11  */
12 #ifndef __57XX_ISCSI_HSI_LINUX_LE__
13 #define __57XX_ISCSI_HSI_LINUX_LE__
14 
15 /*
16  * iSCSI Async CQE
17  */
18 struct bnx2i_async_msg {
19 #if defined(__BIG_ENDIAN)
20 	u8 op_code;
21 	u8 reserved1;
22 	u16 reserved0;
23 #elif defined(__LITTLE_ENDIAN)
24 	u16 reserved0;
25 	u8 reserved1;
26 	u8 op_code;
27 #endif
28 	u32 reserved2;
29 	u32 exp_cmd_sn;
30 	u32 max_cmd_sn;
31 	u32 reserved3[2];
32 #if defined(__BIG_ENDIAN)
33 	u16 reserved5;
34 	u8 err_code;
35 	u8 reserved4;
36 #elif defined(__LITTLE_ENDIAN)
37 	u8 reserved4;
38 	u8 err_code;
39 	u16 reserved5;
40 #endif
41 	u32 reserved6;
42 	u32 lun[2];
43 #if defined(__BIG_ENDIAN)
44 	u8 async_event;
45 	u8 async_vcode;
46 	u16 param1;
47 #elif defined(__LITTLE_ENDIAN)
48 	u16 param1;
49 	u8 async_vcode;
50 	u8 async_event;
51 #endif
52 #if defined(__BIG_ENDIAN)
53 	u16 param2;
54 	u16 param3;
55 #elif defined(__LITTLE_ENDIAN)
56 	u16 param3;
57 	u16 param2;
58 #endif
59 	u32 reserved7[3];
60 	u32 cq_req_sn;
61 };
62 
63 
64 /*
65  * iSCSI Buffer Descriptor (BD)
66  */
67 struct iscsi_bd {
68 	u32 buffer_addr_hi;
69 	u32 buffer_addr_lo;
70 #if defined(__BIG_ENDIAN)
71 	u16 reserved0;
72 	u16 buffer_length;
73 #elif defined(__LITTLE_ENDIAN)
74 	u16 buffer_length;
75 	u16 reserved0;
76 #endif
77 #if defined(__BIG_ENDIAN)
78 	u16 reserved3;
79 	u16 flags;
80 #define ISCSI_BD_RESERVED1 (0x3F<<0)
81 #define ISCSI_BD_RESERVED1_SHIFT 0
82 #define ISCSI_BD_LAST_IN_BD_CHAIN (0x1<<6)
83 #define ISCSI_BD_LAST_IN_BD_CHAIN_SHIFT 6
84 #define ISCSI_BD_FIRST_IN_BD_CHAIN (0x1<<7)
85 #define ISCSI_BD_FIRST_IN_BD_CHAIN_SHIFT 7
86 #define ISCSI_BD_RESERVED2 (0xFF<<8)
87 #define ISCSI_BD_RESERVED2_SHIFT 8
88 #elif defined(__LITTLE_ENDIAN)
89 	u16 flags;
90 #define ISCSI_BD_RESERVED1 (0x3F<<0)
91 #define ISCSI_BD_RESERVED1_SHIFT 0
92 #define ISCSI_BD_LAST_IN_BD_CHAIN (0x1<<6)
93 #define ISCSI_BD_LAST_IN_BD_CHAIN_SHIFT 6
94 #define ISCSI_BD_FIRST_IN_BD_CHAIN (0x1<<7)
95 #define ISCSI_BD_FIRST_IN_BD_CHAIN_SHIFT 7
96 #define ISCSI_BD_RESERVED2 (0xFF<<8)
97 #define ISCSI_BD_RESERVED2_SHIFT 8
98 	u16 reserved3;
99 #endif
100 };
101 
102 
103 /*
104  * iSCSI Cleanup SQ WQE
105  */
106 struct bnx2i_cleanup_request {
107 #if defined(__BIG_ENDIAN)
108 	u8 op_code;
109 	u8 reserved1;
110 	u16 reserved0;
111 #elif defined(__LITTLE_ENDIAN)
112 	u16 reserved0;
113 	u8 reserved1;
114 	u8 op_code;
115 #endif
116 	u32 reserved2[3];
117 #if defined(__BIG_ENDIAN)
118 	u16 reserved3;
119 	u16 itt;
120 #define ISCSI_CLEANUP_REQUEST_INDEX (0x3FFF<<0)
121 #define ISCSI_CLEANUP_REQUEST_INDEX_SHIFT 0
122 #define ISCSI_CLEANUP_REQUEST_TYPE (0x3<<14)
123 #define ISCSI_CLEANUP_REQUEST_TYPE_SHIFT 14
124 #elif defined(__LITTLE_ENDIAN)
125 	u16 itt;
126 #define ISCSI_CLEANUP_REQUEST_INDEX (0x3FFF<<0)
127 #define ISCSI_CLEANUP_REQUEST_INDEX_SHIFT 0
128 #define ISCSI_CLEANUP_REQUEST_TYPE (0x3<<14)
129 #define ISCSI_CLEANUP_REQUEST_TYPE_SHIFT 14
130 	u16 reserved3;
131 #endif
132 	u32 reserved4[10];
133 #if defined(__BIG_ENDIAN)
134 	u8 cq_index;
135 	u8 reserved6;
136 	u16 reserved5;
137 #elif defined(__LITTLE_ENDIAN)
138 	u16 reserved5;
139 	u8 reserved6;
140 	u8 cq_index;
141 #endif
142 };
143 
144 
145 /*
146  * iSCSI Cleanup CQE
147  */
148 struct bnx2i_cleanup_response {
149 #if defined(__BIG_ENDIAN)
150 	u8 op_code;
151 	u8 status;
152 	u16 reserved0;
153 #elif defined(__LITTLE_ENDIAN)
154 	u16 reserved0;
155 	u8 status;
156 	u8 op_code;
157 #endif
158 	u32 reserved1[3];
159 	u32 reserved2[2];
160 #if defined(__BIG_ENDIAN)
161 	u16 reserved4;
162 	u8 err_code;
163 	u8 reserved3;
164 #elif defined(__LITTLE_ENDIAN)
165 	u8 reserved3;
166 	u8 err_code;
167 	u16 reserved4;
168 #endif
169 	u32 reserved5[7];
170 #if defined(__BIG_ENDIAN)
171 	u16 reserved6;
172 	u16 itt;
173 #define ISCSI_CLEANUP_RESPONSE_INDEX (0x3FFF<<0)
174 #define ISCSI_CLEANUP_RESPONSE_INDEX_SHIFT 0
175 #define ISCSI_CLEANUP_RESPONSE_TYPE (0x3<<14)
176 #define ISCSI_CLEANUP_RESPONSE_TYPE_SHIFT 14
177 #elif defined(__LITTLE_ENDIAN)
178 	u16 itt;
179 #define ISCSI_CLEANUP_RESPONSE_INDEX (0x3FFF<<0)
180 #define ISCSI_CLEANUP_RESPONSE_INDEX_SHIFT 0
181 #define ISCSI_CLEANUP_RESPONSE_TYPE (0x3<<14)
182 #define ISCSI_CLEANUP_RESPONSE_TYPE_SHIFT 14
183 	u16 reserved6;
184 #endif
185 	u32 cq_req_sn;
186 };
187 
188 
189 /*
190  * SCSI read/write SQ WQE
191  */
192 struct bnx2i_cmd_request {
193 #if defined(__BIG_ENDIAN)
194 	u8 op_code;
195 	u8 op_attr;
196 #define ISCSI_CMD_REQUEST_TASK_ATTR (0x7<<0)
197 #define ISCSI_CMD_REQUEST_TASK_ATTR_SHIFT 0
198 #define ISCSI_CMD_REQUEST_RESERVED1 (0x3<<3)
199 #define ISCSI_CMD_REQUEST_RESERVED1_SHIFT 3
200 #define ISCSI_CMD_REQUEST_WRITE (0x1<<5)
201 #define ISCSI_CMD_REQUEST_WRITE_SHIFT 5
202 #define ISCSI_CMD_REQUEST_READ (0x1<<6)
203 #define ISCSI_CMD_REQUEST_READ_SHIFT 6
204 #define ISCSI_CMD_REQUEST_FINAL (0x1<<7)
205 #define ISCSI_CMD_REQUEST_FINAL_SHIFT 7
206 	u16 reserved0;
207 #elif defined(__LITTLE_ENDIAN)
208 	u16 reserved0;
209 	u8 op_attr;
210 #define ISCSI_CMD_REQUEST_TASK_ATTR (0x7<<0)
211 #define ISCSI_CMD_REQUEST_TASK_ATTR_SHIFT 0
212 #define ISCSI_CMD_REQUEST_RESERVED1 (0x3<<3)
213 #define ISCSI_CMD_REQUEST_RESERVED1_SHIFT 3
214 #define ISCSI_CMD_REQUEST_WRITE (0x1<<5)
215 #define ISCSI_CMD_REQUEST_WRITE_SHIFT 5
216 #define ISCSI_CMD_REQUEST_READ (0x1<<6)
217 #define ISCSI_CMD_REQUEST_READ_SHIFT 6
218 #define ISCSI_CMD_REQUEST_FINAL (0x1<<7)
219 #define ISCSI_CMD_REQUEST_FINAL_SHIFT 7
220 	u8 op_code;
221 #endif
222 #if defined(__BIG_ENDIAN)
223 	u16 ud_buffer_offset;
224 	u16 sd_buffer_offset;
225 #elif defined(__LITTLE_ENDIAN)
226 	u16 sd_buffer_offset;
227 	u16 ud_buffer_offset;
228 #endif
229 	u32 lun[2];
230 #if defined(__BIG_ENDIAN)
231 	u16 reserved2;
232 	u16 itt;
233 #define ISCSI_CMD_REQUEST_INDEX (0x3FFF<<0)
234 #define ISCSI_CMD_REQUEST_INDEX_SHIFT 0
235 #define ISCSI_CMD_REQUEST_TYPE (0x3<<14)
236 #define ISCSI_CMD_REQUEST_TYPE_SHIFT 14
237 #elif defined(__LITTLE_ENDIAN)
238 	u16 itt;
239 #define ISCSI_CMD_REQUEST_INDEX (0x3FFF<<0)
240 #define ISCSI_CMD_REQUEST_INDEX_SHIFT 0
241 #define ISCSI_CMD_REQUEST_TYPE (0x3<<14)
242 #define ISCSI_CMD_REQUEST_TYPE_SHIFT 14
243 	u16 reserved2;
244 #endif
245 	u32 total_data_transfer_length;
246 	u32 cmd_sn;
247 	u32 reserved3;
248 	u32 cdb[4];
249 	u32 zero_fill;
250 	u32 bd_list_addr_lo;
251 	u32 bd_list_addr_hi;
252 #if defined(__BIG_ENDIAN)
253 	u8 cq_index;
254 	u8 sd_start_bd_index;
255 	u8 ud_start_bd_index;
256 	u8 num_bds;
257 #elif defined(__LITTLE_ENDIAN)
258 	u8 num_bds;
259 	u8 ud_start_bd_index;
260 	u8 sd_start_bd_index;
261 	u8 cq_index;
262 #endif
263 };
264 
265 
266 /*
267  * task statistics for write response
268  */
269 struct bnx2i_write_resp_task_stat {
270 	u32 num_data_ins;
271 };
272 
273 /*
274  * task statistics for read response
275  */
276 struct bnx2i_read_resp_task_stat {
277 #if defined(__BIG_ENDIAN)
278 	u16 num_data_outs;
279 	u16 num_r2ts;
280 #elif defined(__LITTLE_ENDIAN)
281 	u16 num_r2ts;
282 	u16 num_data_outs;
283 #endif
284 };
285 
286 /*
287  * task statistics for iSCSI cmd response
288  */
289 union bnx2i_cmd_resp_task_stat {
290 	struct bnx2i_write_resp_task_stat write_stat;
291 	struct bnx2i_read_resp_task_stat read_stat;
292 };
293 
294 /*
295  * SCSI Command CQE
296  */
297 struct bnx2i_cmd_response {
298 #if defined(__BIG_ENDIAN)
299 	u8 op_code;
300 	u8 response_flags;
301 #define ISCSI_CMD_RESPONSE_RESERVED0 (0x1<<0)
302 #define ISCSI_CMD_RESPONSE_RESERVED0_SHIFT 0
303 #define ISCSI_CMD_RESPONSE_RESIDUAL_UNDERFLOW (0x1<<1)
304 #define ISCSI_CMD_RESPONSE_RESIDUAL_UNDERFLOW_SHIFT 1
305 #define ISCSI_CMD_RESPONSE_RESIDUAL_OVERFLOW (0x1<<2)
306 #define ISCSI_CMD_RESPONSE_RESIDUAL_OVERFLOW_SHIFT 2
307 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_UNDERFLOW (0x1<<3)
308 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_UNDERFLOW_SHIFT 3
309 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_OVERFLOW (0x1<<4)
310 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_OVERFLOW_SHIFT 4
311 #define ISCSI_CMD_RESPONSE_RESERVED1 (0x7<<5)
312 #define ISCSI_CMD_RESPONSE_RESERVED1_SHIFT 5
313 	u8 response;
314 	u8 status;
315 #elif defined(__LITTLE_ENDIAN)
316 	u8 status;
317 	u8 response;
318 	u8 response_flags;
319 #define ISCSI_CMD_RESPONSE_RESERVED0 (0x1<<0)
320 #define ISCSI_CMD_RESPONSE_RESERVED0_SHIFT 0
321 #define ISCSI_CMD_RESPONSE_RESIDUAL_UNDERFLOW (0x1<<1)
322 #define ISCSI_CMD_RESPONSE_RESIDUAL_UNDERFLOW_SHIFT 1
323 #define ISCSI_CMD_RESPONSE_RESIDUAL_OVERFLOW (0x1<<2)
324 #define ISCSI_CMD_RESPONSE_RESIDUAL_OVERFLOW_SHIFT 2
325 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_UNDERFLOW (0x1<<3)
326 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_UNDERFLOW_SHIFT 3
327 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_OVERFLOW (0x1<<4)
328 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_OVERFLOW_SHIFT 4
329 #define ISCSI_CMD_RESPONSE_RESERVED1 (0x7<<5)
330 #define ISCSI_CMD_RESPONSE_RESERVED1_SHIFT 5
331 	u8 op_code;
332 #endif
333 	u32 data_length;
334 	u32 exp_cmd_sn;
335 	u32 max_cmd_sn;
336 	u32 reserved2;
337 	u32 residual_count;
338 #if defined(__BIG_ENDIAN)
339 	u16 reserved4;
340 	u8 err_code;
341 	u8 reserved3;
342 #elif defined(__LITTLE_ENDIAN)
343 	u8 reserved3;
344 	u8 err_code;
345 	u16 reserved4;
346 #endif
347 	u32 reserved5[5];
348 	union bnx2i_cmd_resp_task_stat task_stat;
349 	u32 reserved6;
350 #if defined(__BIG_ENDIAN)
351 	u16 reserved7;
352 	u16 itt;
353 #define ISCSI_CMD_RESPONSE_INDEX (0x3FFF<<0)
354 #define ISCSI_CMD_RESPONSE_INDEX_SHIFT 0
355 #define ISCSI_CMD_RESPONSE_TYPE (0x3<<14)
356 #define ISCSI_CMD_RESPONSE_TYPE_SHIFT 14
357 #elif defined(__LITTLE_ENDIAN)
358 	u16 itt;
359 #define ISCSI_CMD_RESPONSE_INDEX (0x3FFF<<0)
360 #define ISCSI_CMD_RESPONSE_INDEX_SHIFT 0
361 #define ISCSI_CMD_RESPONSE_TYPE (0x3<<14)
362 #define ISCSI_CMD_RESPONSE_TYPE_SHIFT 14
363 	u16 reserved7;
364 #endif
365 	u32 cq_req_sn;
366 };
367 
368 
369 
370 /*
371  * firmware middle-path request SQ WQE
372  */
373 struct bnx2i_fw_mp_request {
374 #if defined(__BIG_ENDIAN)
375 	u8 op_code;
376 	u8 op_attr;
377 	u16 hdr_opaque1;
378 #elif defined(__LITTLE_ENDIAN)
379 	u16 hdr_opaque1;
380 	u8 op_attr;
381 	u8 op_code;
382 #endif
383 	u32 data_length;
384 	u32 hdr_opaque2[2];
385 #if defined(__BIG_ENDIAN)
386 	u16 reserved0;
387 	u16 itt;
388 #define ISCSI_FW_MP_REQUEST_INDEX (0x3FFF<<0)
389 #define ISCSI_FW_MP_REQUEST_INDEX_SHIFT 0
390 #define ISCSI_FW_MP_REQUEST_TYPE (0x3<<14)
391 #define ISCSI_FW_MP_REQUEST_TYPE_SHIFT 14
392 #elif defined(__LITTLE_ENDIAN)
393 	u16 itt;
394 #define ISCSI_FW_MP_REQUEST_INDEX (0x3FFF<<0)
395 #define ISCSI_FW_MP_REQUEST_INDEX_SHIFT 0
396 #define ISCSI_FW_MP_REQUEST_TYPE (0x3<<14)
397 #define ISCSI_FW_MP_REQUEST_TYPE_SHIFT 14
398 	u16 reserved0;
399 #endif
400 	u32 hdr_opaque3[4];
401 	u32 resp_bd_list_addr_lo;
402 	u32 resp_bd_list_addr_hi;
403 	u32 resp_buffer;
404 #define ISCSI_FW_MP_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0)
405 #define ISCSI_FW_MP_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0
406 #define ISCSI_FW_MP_REQUEST_NUM_RESP_BDS (0xFF<<24)
407 #define ISCSI_FW_MP_REQUEST_NUM_RESP_BDS_SHIFT 24
408 #if defined(__BIG_ENDIAN)
409 	u16 reserved4;
410 	u8 reserved3;
411 	u8 flags;
412 #define ISCSI_FW_MP_REQUEST_RESERVED1 (0x1<<0)
413 #define ISCSI_FW_MP_REQUEST_RESERVED1_SHIFT 0
414 #define ISCSI_FW_MP_REQUEST_LOCAL_COMPLETION (0x1<<1)
415 #define ISCSI_FW_MP_REQUEST_LOCAL_COMPLETION_SHIFT 1
416 #define ISCSI_FW_MP_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2)
417 #define ISCSI_FW_MP_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2
418 #define ISCSI_FW_MP_REQUEST_RESERVED2 (0x1F<<3)
419 #define ISCSI_FW_MP_REQUEST_RESERVED2_SHIFT 3
420 #elif defined(__LITTLE_ENDIAN)
421 	u8 flags;
422 #define ISCSI_FW_MP_REQUEST_RESERVED1 (0x1<<0)
423 #define ISCSI_FW_MP_REQUEST_RESERVED1_SHIFT 0
424 #define ISCSI_FW_MP_REQUEST_LOCAL_COMPLETION (0x1<<1)
425 #define ISCSI_FW_MP_REQUEST_LOCAL_COMPLETION_SHIFT 1
426 #define ISCSI_FW_MP_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2)
427 #define ISCSI_FW_MP_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2
428 #define ISCSI_FW_MP_REQUEST_RESERVED2 (0x1F<<3)
429 #define ISCSI_FW_MP_REQUEST_RESERVED2_SHIFT 3
430 	u8 reserved3;
431 	u16 reserved4;
432 #endif
433 	u32 bd_list_addr_lo;
434 	u32 bd_list_addr_hi;
435 #if defined(__BIG_ENDIAN)
436 	u8 cq_index;
437 	u8 reserved6;
438 	u8 reserved5;
439 	u8 num_bds;
440 #elif defined(__LITTLE_ENDIAN)
441 	u8 num_bds;
442 	u8 reserved5;
443 	u8 reserved6;
444 	u8 cq_index;
445 #endif
446 };
447 
448 
449 /*
450  * firmware response - CQE: used only by firmware
451  */
452 struct bnx2i_fw_response {
453 	u32 hdr_dword1[2];
454 	u32 hdr_exp_cmd_sn;
455 	u32 hdr_max_cmd_sn;
456 	u32 hdr_ttt;
457 	u32 hdr_res_cnt;
458 	u32 cqe_flags;
459 #define ISCSI_FW_RESPONSE_RESERVED2 (0xFF<<0)
460 #define ISCSI_FW_RESPONSE_RESERVED2_SHIFT 0
461 #define ISCSI_FW_RESPONSE_ERR_CODE (0xFF<<8)
462 #define ISCSI_FW_RESPONSE_ERR_CODE_SHIFT 8
463 #define ISCSI_FW_RESPONSE_RESERVED3 (0xFFFF<<16)
464 #define ISCSI_FW_RESPONSE_RESERVED3_SHIFT 16
465 	u32 stat_sn;
466 	u32 hdr_dword2[2];
467 	u32 hdr_dword3[2];
468 	u32 task_stat;
469 	u32 reserved0;
470 	u32 hdr_itt;
471 	u32 cq_req_sn;
472 };
473 
474 
475 /*
476  * iSCSI KCQ CQE parameters
477  */
478 union iscsi_kcqe_params {
479 	u32 reserved0[4];
480 };
481 
482 /*
483  * iSCSI KCQ CQE
484  */
485 struct iscsi_kcqe {
486 	u32 iscsi_conn_id;
487 	u32 completion_status;
488 	u32 iscsi_conn_context_id;
489 	union iscsi_kcqe_params params;
490 #if defined(__BIG_ENDIAN)
491 	u8 flags;
492 #define ISCSI_KCQE_RESERVED0 (0xF<<0)
493 #define ISCSI_KCQE_RESERVED0_SHIFT 0
494 #define ISCSI_KCQE_LAYER_CODE (0x7<<4)
495 #define ISCSI_KCQE_LAYER_CODE_SHIFT 4
496 #define ISCSI_KCQE_RESERVED1 (0x1<<7)
497 #define ISCSI_KCQE_RESERVED1_SHIFT 7
498 	u8 op_code;
499 	u16 qe_self_seq;
500 #elif defined(__LITTLE_ENDIAN)
501 	u16 qe_self_seq;
502 	u8 op_code;
503 	u8 flags;
504 #define ISCSI_KCQE_RESERVED0 (0xF<<0)
505 #define ISCSI_KCQE_RESERVED0_SHIFT 0
506 #define ISCSI_KCQE_LAYER_CODE (0x7<<4)
507 #define ISCSI_KCQE_LAYER_CODE_SHIFT 4
508 #define ISCSI_KCQE_RESERVED1 (0x1<<7)
509 #define ISCSI_KCQE_RESERVED1_SHIFT 7
510 #endif
511 };
512 
513 
514 
515 /*
516  * iSCSI KWQE header
517  */
518 struct iscsi_kwqe_header {
519 #if defined(__BIG_ENDIAN)
520 	u8 flags;
521 #define ISCSI_KWQE_HEADER_RESERVED0 (0xF<<0)
522 #define ISCSI_KWQE_HEADER_RESERVED0_SHIFT 0
523 #define ISCSI_KWQE_HEADER_LAYER_CODE (0x7<<4)
524 #define ISCSI_KWQE_HEADER_LAYER_CODE_SHIFT 4
525 #define ISCSI_KWQE_HEADER_RESERVED1 (0x1<<7)
526 #define ISCSI_KWQE_HEADER_RESERVED1_SHIFT 7
527 	u8 op_code;
528 #elif defined(__LITTLE_ENDIAN)
529 	u8 op_code;
530 	u8 flags;
531 #define ISCSI_KWQE_HEADER_RESERVED0 (0xF<<0)
532 #define ISCSI_KWQE_HEADER_RESERVED0_SHIFT 0
533 #define ISCSI_KWQE_HEADER_LAYER_CODE (0x7<<4)
534 #define ISCSI_KWQE_HEADER_LAYER_CODE_SHIFT 4
535 #define ISCSI_KWQE_HEADER_RESERVED1 (0x1<<7)
536 #define ISCSI_KWQE_HEADER_RESERVED1_SHIFT 7
537 #endif
538 };
539 
540 /*
541  * iSCSI firmware init request 1
542  */
543 struct iscsi_kwqe_init1 {
544 #if defined(__BIG_ENDIAN)
545 	struct iscsi_kwqe_header hdr;
546 	u8 reserved0;
547 	u8 num_cqs;
548 #elif defined(__LITTLE_ENDIAN)
549 	u8 num_cqs;
550 	u8 reserved0;
551 	struct iscsi_kwqe_header hdr;
552 #endif
553 	u32 dummy_buffer_addr_lo;
554 	u32 dummy_buffer_addr_hi;
555 #if defined(__BIG_ENDIAN)
556 	u16 num_ccells_per_conn;
557 	u16 num_tasks_per_conn;
558 #elif defined(__LITTLE_ENDIAN)
559 	u16 num_tasks_per_conn;
560 	u16 num_ccells_per_conn;
561 #endif
562 #if defined(__BIG_ENDIAN)
563 	u16 sq_wqes_per_page;
564 	u16 sq_num_wqes;
565 #elif defined(__LITTLE_ENDIAN)
566 	u16 sq_num_wqes;
567 	u16 sq_wqes_per_page;
568 #endif
569 #if defined(__BIG_ENDIAN)
570 	u8 cq_log_wqes_per_page;
571 	u8 flags;
572 #define ISCSI_KWQE_INIT1_PAGE_SIZE (0xF<<0)
573 #define ISCSI_KWQE_INIT1_PAGE_SIZE_SHIFT 0
574 #define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE (0x1<<4)
575 #define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE_SHIFT 4
576 #define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE (0x1<<5)
577 #define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE_SHIFT 5
578 #define ISCSI_KWQE_INIT1_RESERVED1 (0x3<<6)
579 #define ISCSI_KWQE_INIT1_RESERVED1_SHIFT 6
580 	u16 cq_num_wqes;
581 #elif defined(__LITTLE_ENDIAN)
582 	u16 cq_num_wqes;
583 	u8 flags;
584 #define ISCSI_KWQE_INIT1_PAGE_SIZE (0xF<<0)
585 #define ISCSI_KWQE_INIT1_PAGE_SIZE_SHIFT 0
586 #define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE (0x1<<4)
587 #define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE_SHIFT 4
588 #define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE (0x1<<5)
589 #define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE_SHIFT 5
590 #define ISCSI_KWQE_INIT1_RESERVED1 (0x3<<6)
591 #define ISCSI_KWQE_INIT1_RESERVED1_SHIFT 6
592 	u8 cq_log_wqes_per_page;
593 #endif
594 #if defined(__BIG_ENDIAN)
595 	u16 cq_num_pages;
596 	u16 sq_num_pages;
597 #elif defined(__LITTLE_ENDIAN)
598 	u16 sq_num_pages;
599 	u16 cq_num_pages;
600 #endif
601 #if defined(__BIG_ENDIAN)
602 	u16 rq_buffer_size;
603 	u16 rq_num_wqes;
604 #elif defined(__LITTLE_ENDIAN)
605 	u16 rq_num_wqes;
606 	u16 rq_buffer_size;
607 #endif
608 };
609 
610 /*
611  * iSCSI firmware init request 2
612  */
613 struct iscsi_kwqe_init2 {
614 #if defined(__BIG_ENDIAN)
615 	struct iscsi_kwqe_header hdr;
616 	u16 max_cq_sqn;
617 #elif defined(__LITTLE_ENDIAN)
618 	u16 max_cq_sqn;
619 	struct iscsi_kwqe_header hdr;
620 #endif
621 	u32 error_bit_map[2];
622 	u32 reserved1[5];
623 };
624 
625 /*
626  * Initial iSCSI connection offload request 1
627  */
628 struct iscsi_kwqe_conn_offload1 {
629 #if defined(__BIG_ENDIAN)
630 	struct iscsi_kwqe_header hdr;
631 	u16 iscsi_conn_id;
632 #elif defined(__LITTLE_ENDIAN)
633 	u16 iscsi_conn_id;
634 	struct iscsi_kwqe_header hdr;
635 #endif
636 	u32 sq_page_table_addr_lo;
637 	u32 sq_page_table_addr_hi;
638 	u32 cq_page_table_addr_lo;
639 	u32 cq_page_table_addr_hi;
640 	u32 reserved0[3];
641 };
642 
643 /*
644  * iSCSI Page Table Entry (PTE)
645  */
646 struct iscsi_pte {
647 	u32 hi;
648 	u32 lo;
649 };
650 
651 /*
652  * Initial iSCSI connection offload request 2
653  */
654 struct iscsi_kwqe_conn_offload2 {
655 #if defined(__BIG_ENDIAN)
656 	struct iscsi_kwqe_header hdr;
657 	u16 reserved0;
658 #elif defined(__LITTLE_ENDIAN)
659 	u16 reserved0;
660 	struct iscsi_kwqe_header hdr;
661 #endif
662 	u32 rq_page_table_addr_lo;
663 	u32 rq_page_table_addr_hi;
664 	struct iscsi_pte sq_first_pte;
665 	struct iscsi_pte cq_first_pte;
666 	u32 num_additional_wqes;
667 };
668 
669 
670 /*
671  * Initial iSCSI connection offload request 3
672  */
673 struct iscsi_kwqe_conn_offload3 {
674 #if defined(__BIG_ENDIAN)
675 	struct iscsi_kwqe_header hdr;
676 	u16 reserved0;
677 #elif defined(__LITTLE_ENDIAN)
678 	u16 reserved0;
679 	struct iscsi_kwqe_header hdr;
680 #endif
681 	u32 reserved1;
682 	struct iscsi_pte qp_first_pte[3];
683 };
684 
685 
686 /*
687  * iSCSI connection update request
688  */
689 struct iscsi_kwqe_conn_update {
690 #if defined(__BIG_ENDIAN)
691 	struct iscsi_kwqe_header hdr;
692 	u16 reserved0;
693 #elif defined(__LITTLE_ENDIAN)
694 	u16 reserved0;
695 	struct iscsi_kwqe_header hdr;
696 #endif
697 #if defined(__BIG_ENDIAN)
698 	u8 session_error_recovery_level;
699 	u8 max_outstanding_r2ts;
700 	u8 reserved2;
701 	u8 conn_flags;
702 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST (0x1<<0)
703 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST_SHIFT 0
704 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST (0x1<<1)
705 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST_SHIFT 1
706 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T (0x1<<2)
707 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T_SHIFT 2
708 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA (0x1<<3)
709 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA_SHIFT 3
710 #define ISCSI_KWQE_CONN_UPDATE_OOO_SUPPORT_MODE (0x3<<4)
711 #define ISCSI_KWQE_CONN_UPDATE_OOO_SUPPORT_MODE_SHIFT 4
712 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1 (0x3<<6)
713 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1_SHIFT 6
714 #elif defined(__LITTLE_ENDIAN)
715 	u8 conn_flags;
716 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST (0x1<<0)
717 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST_SHIFT 0
718 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST (0x1<<1)
719 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST_SHIFT 1
720 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T (0x1<<2)
721 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T_SHIFT 2
722 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA (0x1<<3)
723 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA_SHIFT 3
724 #define ISCSI_KWQE_CONN_UPDATE_OOO_SUPPORT_MODE (0x3<<4)
725 #define ISCSI_KWQE_CONN_UPDATE_OOO_SUPPORT_MODE_SHIFT 4
726 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1 (0x3<<6)
727 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1_SHIFT 6
728 	u8 reserved2;
729 	u8 max_outstanding_r2ts;
730 	u8 session_error_recovery_level;
731 #endif
732 	u32 context_id;
733 	u32 max_send_pdu_length;
734 	u32 max_recv_pdu_length;
735 	u32 first_burst_length;
736 	u32 max_burst_length;
737 	u32 exp_stat_sn;
738 };
739 
740 /*
741  * iSCSI destroy connection request
742  */
743 struct iscsi_kwqe_conn_destroy {
744 #if defined(__BIG_ENDIAN)
745 	struct iscsi_kwqe_header hdr;
746 	u16 reserved0;
747 #elif defined(__LITTLE_ENDIAN)
748 	u16 reserved0;
749 	struct iscsi_kwqe_header hdr;
750 #endif
751 	u32 context_id;
752 	u32 reserved1[6];
753 };
754 
755 /*
756  * iSCSI KWQ WQE
757  */
758 union iscsi_kwqe {
759 	struct iscsi_kwqe_init1 init1;
760 	struct iscsi_kwqe_init2 init2;
761 	struct iscsi_kwqe_conn_offload1 conn_offload1;
762 	struct iscsi_kwqe_conn_offload2 conn_offload2;
763 	struct iscsi_kwqe_conn_update conn_update;
764 	struct iscsi_kwqe_conn_destroy conn_destroy;
765 };
766 
767 /*
768  * iSCSI Login SQ WQE
769  */
770 struct bnx2i_login_request {
771 #if defined(__BIG_ENDIAN)
772 	u8 op_code;
773 	u8 op_attr;
774 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE (0x3<<0)
775 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE_SHIFT 0
776 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE (0x3<<2)
777 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE_SHIFT 2
778 #define ISCSI_LOGIN_REQUEST_RESERVED0 (0x3<<4)
779 #define ISCSI_LOGIN_REQUEST_RESERVED0_SHIFT 4
780 #define ISCSI_LOGIN_REQUEST_CONT (0x1<<6)
781 #define ISCSI_LOGIN_REQUEST_CONT_SHIFT 6
782 #define ISCSI_LOGIN_REQUEST_TRANSIT (0x1<<7)
783 #define ISCSI_LOGIN_REQUEST_TRANSIT_SHIFT 7
784 	u8 version_max;
785 	u8 version_min;
786 #elif defined(__LITTLE_ENDIAN)
787 	u8 version_min;
788 	u8 version_max;
789 	u8 op_attr;
790 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE (0x3<<0)
791 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE_SHIFT 0
792 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE (0x3<<2)
793 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE_SHIFT 2
794 #define ISCSI_LOGIN_REQUEST_RESERVED0 (0x3<<4)
795 #define ISCSI_LOGIN_REQUEST_RESERVED0_SHIFT 4
796 #define ISCSI_LOGIN_REQUEST_CONT (0x1<<6)
797 #define ISCSI_LOGIN_REQUEST_CONT_SHIFT 6
798 #define ISCSI_LOGIN_REQUEST_TRANSIT (0x1<<7)
799 #define ISCSI_LOGIN_REQUEST_TRANSIT_SHIFT 7
800 	u8 op_code;
801 #endif
802 	u32 data_length;
803 	u32 isid_lo;
804 #if defined(__BIG_ENDIAN)
805 	u16 isid_hi;
806 	u16 tsih;
807 #elif defined(__LITTLE_ENDIAN)
808 	u16 tsih;
809 	u16 isid_hi;
810 #endif
811 #if defined(__BIG_ENDIAN)
812 	u16 reserved2;
813 	u16 itt;
814 #define ISCSI_LOGIN_REQUEST_INDEX (0x3FFF<<0)
815 #define ISCSI_LOGIN_REQUEST_INDEX_SHIFT 0
816 #define ISCSI_LOGIN_REQUEST_TYPE (0x3<<14)
817 #define ISCSI_LOGIN_REQUEST_TYPE_SHIFT 14
818 #elif defined(__LITTLE_ENDIAN)
819 	u16 itt;
820 #define ISCSI_LOGIN_REQUEST_INDEX (0x3FFF<<0)
821 #define ISCSI_LOGIN_REQUEST_INDEX_SHIFT 0
822 #define ISCSI_LOGIN_REQUEST_TYPE (0x3<<14)
823 #define ISCSI_LOGIN_REQUEST_TYPE_SHIFT 14
824 	u16 reserved2;
825 #endif
826 #if defined(__BIG_ENDIAN)
827 	u16 cid;
828 	u16 reserved3;
829 #elif defined(__LITTLE_ENDIAN)
830 	u16 reserved3;
831 	u16 cid;
832 #endif
833 	u32 cmd_sn;
834 	u32 exp_stat_sn;
835 	u32 reserved4;
836 	u32 resp_bd_list_addr_lo;
837 	u32 resp_bd_list_addr_hi;
838 	u32 resp_buffer;
839 #define ISCSI_LOGIN_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0)
840 #define ISCSI_LOGIN_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0
841 #define ISCSI_LOGIN_REQUEST_NUM_RESP_BDS (0xFF<<24)
842 #define ISCSI_LOGIN_REQUEST_NUM_RESP_BDS_SHIFT 24
843 #if defined(__BIG_ENDIAN)
844 	u16 reserved8;
845 	u8 reserved7;
846 	u8 flags;
847 #define ISCSI_LOGIN_REQUEST_RESERVED5 (0x3<<0)
848 #define ISCSI_LOGIN_REQUEST_RESERVED5_SHIFT 0
849 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2)
850 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2
851 #define ISCSI_LOGIN_REQUEST_RESERVED6 (0x1F<<3)
852 #define ISCSI_LOGIN_REQUEST_RESERVED6_SHIFT 3
853 #elif defined(__LITTLE_ENDIAN)
854 	u8 flags;
855 #define ISCSI_LOGIN_REQUEST_RESERVED5 (0x3<<0)
856 #define ISCSI_LOGIN_REQUEST_RESERVED5_SHIFT 0
857 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2)
858 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2
859 #define ISCSI_LOGIN_REQUEST_RESERVED6 (0x1F<<3)
860 #define ISCSI_LOGIN_REQUEST_RESERVED6_SHIFT 3
861 	u8 reserved7;
862 	u16 reserved8;
863 #endif
864 	u32 bd_list_addr_lo;
865 	u32 bd_list_addr_hi;
866 #if defined(__BIG_ENDIAN)
867 	u8 cq_index;
868 	u8 reserved10;
869 	u8 reserved9;
870 	u8 num_bds;
871 #elif defined(__LITTLE_ENDIAN)
872 	u8 num_bds;
873 	u8 reserved9;
874 	u8 reserved10;
875 	u8 cq_index;
876 #endif
877 };
878 
879 
880 /*
881  * iSCSI Login CQE
882  */
883 struct bnx2i_login_response {
884 #if defined(__BIG_ENDIAN)
885 	u8 op_code;
886 	u8 response_flags;
887 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE (0x3<<0)
888 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE_SHIFT 0
889 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE (0x3<<2)
890 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE_SHIFT 2
891 #define ISCSI_LOGIN_RESPONSE_RESERVED0 (0x3<<4)
892 #define ISCSI_LOGIN_RESPONSE_RESERVED0_SHIFT 4
893 #define ISCSI_LOGIN_RESPONSE_CONT (0x1<<6)
894 #define ISCSI_LOGIN_RESPONSE_CONT_SHIFT 6
895 #define ISCSI_LOGIN_RESPONSE_TRANSIT (0x1<<7)
896 #define ISCSI_LOGIN_RESPONSE_TRANSIT_SHIFT 7
897 	u8 version_max;
898 	u8 version_active;
899 #elif defined(__LITTLE_ENDIAN)
900 	u8 version_active;
901 	u8 version_max;
902 	u8 response_flags;
903 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE (0x3<<0)
904 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE_SHIFT 0
905 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE (0x3<<2)
906 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE_SHIFT 2
907 #define ISCSI_LOGIN_RESPONSE_RESERVED0 (0x3<<4)
908 #define ISCSI_LOGIN_RESPONSE_RESERVED0_SHIFT 4
909 #define ISCSI_LOGIN_RESPONSE_CONT (0x1<<6)
910 #define ISCSI_LOGIN_RESPONSE_CONT_SHIFT 6
911 #define ISCSI_LOGIN_RESPONSE_TRANSIT (0x1<<7)
912 #define ISCSI_LOGIN_RESPONSE_TRANSIT_SHIFT 7
913 	u8 op_code;
914 #endif
915 	u32 data_length;
916 	u32 exp_cmd_sn;
917 	u32 max_cmd_sn;
918 	u32 reserved1[2];
919 #if defined(__BIG_ENDIAN)
920 	u16 reserved3;
921 	u8 err_code;
922 	u8 reserved2;
923 #elif defined(__LITTLE_ENDIAN)
924 	u8 reserved2;
925 	u8 err_code;
926 	u16 reserved3;
927 #endif
928 	u32 stat_sn;
929 	u32 isid_lo;
930 #if defined(__BIG_ENDIAN)
931 	u16 isid_hi;
932 	u16 tsih;
933 #elif defined(__LITTLE_ENDIAN)
934 	u16 tsih;
935 	u16 isid_hi;
936 #endif
937 #if defined(__BIG_ENDIAN)
938 	u8 status_class;
939 	u8 status_detail;
940 	u16 reserved4;
941 #elif defined(__LITTLE_ENDIAN)
942 	u16 reserved4;
943 	u8 status_detail;
944 	u8 status_class;
945 #endif
946 	u32 reserved5[3];
947 #if defined(__BIG_ENDIAN)
948 	u16 reserved6;
949 	u16 itt;
950 #define ISCSI_LOGIN_RESPONSE_INDEX (0x3FFF<<0)
951 #define ISCSI_LOGIN_RESPONSE_INDEX_SHIFT 0
952 #define ISCSI_LOGIN_RESPONSE_TYPE (0x3<<14)
953 #define ISCSI_LOGIN_RESPONSE_TYPE_SHIFT 14
954 #elif defined(__LITTLE_ENDIAN)
955 	u16 itt;
956 #define ISCSI_LOGIN_RESPONSE_INDEX (0x3FFF<<0)
957 #define ISCSI_LOGIN_RESPONSE_INDEX_SHIFT 0
958 #define ISCSI_LOGIN_RESPONSE_TYPE (0x3<<14)
959 #define ISCSI_LOGIN_RESPONSE_TYPE_SHIFT 14
960 	u16 reserved6;
961 #endif
962 	u32 cq_req_sn;
963 };
964 
965 
966 /*
967  * iSCSI Logout SQ WQE
968  */
969 struct bnx2i_logout_request {
970 #if defined(__BIG_ENDIAN)
971 	u8 op_code;
972 	u8 op_attr;
973 #define ISCSI_LOGOUT_REQUEST_REASON (0x7F<<0)
974 #define ISCSI_LOGOUT_REQUEST_REASON_SHIFT 0
975 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE (0x1<<7)
976 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE_SHIFT 7
977 	u16 reserved0;
978 #elif defined(__LITTLE_ENDIAN)
979 	u16 reserved0;
980 	u8 op_attr;
981 #define ISCSI_LOGOUT_REQUEST_REASON (0x7F<<0)
982 #define ISCSI_LOGOUT_REQUEST_REASON_SHIFT 0
983 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE (0x1<<7)
984 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE_SHIFT 7
985 	u8 op_code;
986 #endif
987 	u32 data_length;
988 	u32 reserved1[2];
989 #if defined(__BIG_ENDIAN)
990 	u16 reserved2;
991 	u16 itt;
992 #define ISCSI_LOGOUT_REQUEST_INDEX (0x3FFF<<0)
993 #define ISCSI_LOGOUT_REQUEST_INDEX_SHIFT 0
994 #define ISCSI_LOGOUT_REQUEST_TYPE (0x3<<14)
995 #define ISCSI_LOGOUT_REQUEST_TYPE_SHIFT 14
996 #elif defined(__LITTLE_ENDIAN)
997 	u16 itt;
998 #define ISCSI_LOGOUT_REQUEST_INDEX (0x3FFF<<0)
999 #define ISCSI_LOGOUT_REQUEST_INDEX_SHIFT 0
1000 #define ISCSI_LOGOUT_REQUEST_TYPE (0x3<<14)
1001 #define ISCSI_LOGOUT_REQUEST_TYPE_SHIFT 14
1002 	u16 reserved2;
1003 #endif
1004 #if defined(__BIG_ENDIAN)
1005 	u16 cid;
1006 	u16 reserved3;
1007 #elif defined(__LITTLE_ENDIAN)
1008 	u16 reserved3;
1009 	u16 cid;
1010 #endif
1011 	u32 cmd_sn;
1012 	u32 reserved4[5];
1013 	u32 zero_fill;
1014 	u32 bd_list_addr_lo;
1015 	u32 bd_list_addr_hi;
1016 #if defined(__BIG_ENDIAN)
1017 	u8 cq_index;
1018 	u8 reserved6;
1019 	u8 reserved5;
1020 	u8 num_bds;
1021 #elif defined(__LITTLE_ENDIAN)
1022 	u8 num_bds;
1023 	u8 reserved5;
1024 	u8 reserved6;
1025 	u8 cq_index;
1026 #endif
1027 };
1028 
1029 
1030 /*
1031  * iSCSI Logout CQE
1032  */
1033 struct bnx2i_logout_response {
1034 #if defined(__BIG_ENDIAN)
1035 	u8 op_code;
1036 	u8 reserved1;
1037 	u8 response;
1038 	u8 reserved0;
1039 #elif defined(__LITTLE_ENDIAN)
1040 	u8 reserved0;
1041 	u8 response;
1042 	u8 reserved1;
1043 	u8 op_code;
1044 #endif
1045 	u32 reserved2;
1046 	u32 exp_cmd_sn;
1047 	u32 max_cmd_sn;
1048 	u32 reserved3[2];
1049 #if defined(__BIG_ENDIAN)
1050 	u16 reserved5;
1051 	u8 err_code;
1052 	u8 reserved4;
1053 #elif defined(__LITTLE_ENDIAN)
1054 	u8 reserved4;
1055 	u8 err_code;
1056 	u16 reserved5;
1057 #endif
1058 	u32 reserved6[3];
1059 #if defined(__BIG_ENDIAN)
1060 	u16 time_to_wait;
1061 	u16 time_to_retain;
1062 #elif defined(__LITTLE_ENDIAN)
1063 	u16 time_to_retain;
1064 	u16 time_to_wait;
1065 #endif
1066 	u32 reserved7[3];
1067 #if defined(__BIG_ENDIAN)
1068 	u16 reserved8;
1069 	u16 itt;
1070 #define ISCSI_LOGOUT_RESPONSE_INDEX (0x3FFF<<0)
1071 #define ISCSI_LOGOUT_RESPONSE_INDEX_SHIFT 0
1072 #define ISCSI_LOGOUT_RESPONSE_TYPE (0x3<<14)
1073 #define ISCSI_LOGOUT_RESPONSE_TYPE_SHIFT 14
1074 #elif defined(__LITTLE_ENDIAN)
1075 	u16 itt;
1076 #define ISCSI_LOGOUT_RESPONSE_INDEX (0x3FFF<<0)
1077 #define ISCSI_LOGOUT_RESPONSE_INDEX_SHIFT 0
1078 #define ISCSI_LOGOUT_RESPONSE_TYPE (0x3<<14)
1079 #define ISCSI_LOGOUT_RESPONSE_TYPE_SHIFT 14
1080 	u16 reserved8;
1081 #endif
1082 	u32 cq_req_sn;
1083 };
1084 
1085 
1086 /*
1087  * iSCSI Nop-In CQE
1088  */
1089 struct bnx2i_nop_in_msg {
1090 #if defined(__BIG_ENDIAN)
1091 	u8 op_code;
1092 	u8 reserved1;
1093 	u16 reserved0;
1094 #elif defined(__LITTLE_ENDIAN)
1095 	u16 reserved0;
1096 	u8 reserved1;
1097 	u8 op_code;
1098 #endif
1099 	u32 data_length;
1100 	u32 exp_cmd_sn;
1101 	u32 max_cmd_sn;
1102 	u32 ttt;
1103 	u32 reserved2;
1104 #if defined(__BIG_ENDIAN)
1105 	u16 reserved4;
1106 	u8 err_code;
1107 	u8 reserved3;
1108 #elif defined(__LITTLE_ENDIAN)
1109 	u8 reserved3;
1110 	u8 err_code;
1111 	u16 reserved4;
1112 #endif
1113 	u32 reserved5;
1114 	u32 lun[2];
1115 	u32 reserved6[4];
1116 #if defined(__BIG_ENDIAN)
1117 	u16 reserved7;
1118 	u16 itt;
1119 #define ISCSI_NOP_IN_MSG_INDEX (0x3FFF<<0)
1120 #define ISCSI_NOP_IN_MSG_INDEX_SHIFT 0
1121 #define ISCSI_NOP_IN_MSG_TYPE (0x3<<14)
1122 #define ISCSI_NOP_IN_MSG_TYPE_SHIFT 14
1123 #elif defined(__LITTLE_ENDIAN)
1124 	u16 itt;
1125 #define ISCSI_NOP_IN_MSG_INDEX (0x3FFF<<0)
1126 #define ISCSI_NOP_IN_MSG_INDEX_SHIFT 0
1127 #define ISCSI_NOP_IN_MSG_TYPE (0x3<<14)
1128 #define ISCSI_NOP_IN_MSG_TYPE_SHIFT 14
1129 	u16 reserved7;
1130 #endif
1131 	u32 cq_req_sn;
1132 };
1133 
1134 
1135 /*
1136  * iSCSI NOP-OUT SQ WQE
1137  */
1138 struct bnx2i_nop_out_request {
1139 #if defined(__BIG_ENDIAN)
1140 	u8 op_code;
1141 	u8 op_attr;
1142 #define ISCSI_NOP_OUT_REQUEST_RESERVED1 (0x7F<<0)
1143 #define ISCSI_NOP_OUT_REQUEST_RESERVED1_SHIFT 0
1144 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE (0x1<<7)
1145 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE_SHIFT 7
1146 	u16 reserved0;
1147 #elif defined(__LITTLE_ENDIAN)
1148 	u16 reserved0;
1149 	u8 op_attr;
1150 #define ISCSI_NOP_OUT_REQUEST_RESERVED1 (0x7F<<0)
1151 #define ISCSI_NOP_OUT_REQUEST_RESERVED1_SHIFT 0
1152 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE (0x1<<7)
1153 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE_SHIFT 7
1154 	u8 op_code;
1155 #endif
1156 	u32 data_length;
1157 	u32 lun[2];
1158 #if defined(__BIG_ENDIAN)
1159 	u16 reserved2;
1160 	u16 itt;
1161 #define ISCSI_NOP_OUT_REQUEST_INDEX (0x3FFF<<0)
1162 #define ISCSI_NOP_OUT_REQUEST_INDEX_SHIFT 0
1163 #define ISCSI_NOP_OUT_REQUEST_TYPE (0x3<<14)
1164 #define ISCSI_NOP_OUT_REQUEST_TYPE_SHIFT 14
1165 #elif defined(__LITTLE_ENDIAN)
1166 	u16 itt;
1167 #define ISCSI_NOP_OUT_REQUEST_INDEX (0x3FFF<<0)
1168 #define ISCSI_NOP_OUT_REQUEST_INDEX_SHIFT 0
1169 #define ISCSI_NOP_OUT_REQUEST_TYPE (0x3<<14)
1170 #define ISCSI_NOP_OUT_REQUEST_TYPE_SHIFT 14
1171 	u16 reserved2;
1172 #endif
1173 	u32 ttt;
1174 	u32 cmd_sn;
1175 	u32 reserved3[2];
1176 	u32 resp_bd_list_addr_lo;
1177 	u32 resp_bd_list_addr_hi;
1178 	u32 resp_buffer;
1179 #define ISCSI_NOP_OUT_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0)
1180 #define ISCSI_NOP_OUT_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0
1181 #define ISCSI_NOP_OUT_REQUEST_NUM_RESP_BDS (0xFF<<24)
1182 #define ISCSI_NOP_OUT_REQUEST_NUM_RESP_BDS_SHIFT 24
1183 #if defined(__BIG_ENDIAN)
1184 	u16 reserved7;
1185 	u8 reserved6;
1186 	u8 flags;
1187 #define ISCSI_NOP_OUT_REQUEST_RESERVED4 (0x1<<0)
1188 #define ISCSI_NOP_OUT_REQUEST_RESERVED4_SHIFT 0
1189 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION (0x1<<1)
1190 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION_SHIFT 1
1191 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL (0x3F<<2)
1192 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL_SHIFT 2
1193 #elif defined(__LITTLE_ENDIAN)
1194 	u8 flags;
1195 #define ISCSI_NOP_OUT_REQUEST_RESERVED4 (0x1<<0)
1196 #define ISCSI_NOP_OUT_REQUEST_RESERVED4_SHIFT 0
1197 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION (0x1<<1)
1198 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION_SHIFT 1
1199 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL (0x3F<<2)
1200 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL_SHIFT 2
1201 	u8 reserved6;
1202 	u16 reserved7;
1203 #endif
1204 	u32 bd_list_addr_lo;
1205 	u32 bd_list_addr_hi;
1206 #if defined(__BIG_ENDIAN)
1207 	u8 cq_index;
1208 	u8 reserved9;
1209 	u8 reserved8;
1210 	u8 num_bds;
1211 #elif defined(__LITTLE_ENDIAN)
1212 	u8 num_bds;
1213 	u8 reserved8;
1214 	u8 reserved9;
1215 	u8 cq_index;
1216 #endif
1217 };
1218 
1219 /*
1220  * iSCSI Reject CQE
1221  */
1222 struct bnx2i_reject_msg {
1223 #if defined(__BIG_ENDIAN)
1224 	u8 op_code;
1225 	u8 reserved1;
1226 	u8 reason;
1227 	u8 reserved0;
1228 #elif defined(__LITTLE_ENDIAN)
1229 	u8 reserved0;
1230 	u8 reason;
1231 	u8 reserved1;
1232 	u8 op_code;
1233 #endif
1234 	u32 data_length;
1235 	u32 exp_cmd_sn;
1236 	u32 max_cmd_sn;
1237 	u32 reserved2[2];
1238 #if defined(__BIG_ENDIAN)
1239 	u16 reserved4;
1240 	u8 err_code;
1241 	u8 reserved3;
1242 #elif defined(__LITTLE_ENDIAN)
1243 	u8 reserved3;
1244 	u8 err_code;
1245 	u16 reserved4;
1246 #endif
1247 	u32 reserved5[8];
1248 	u32 cq_req_sn;
1249 };
1250 
1251 /*
1252  * bnx2i iSCSI TMF SQ WQE
1253  */
1254 struct bnx2i_tmf_request {
1255 #if defined(__BIG_ENDIAN)
1256 	u8 op_code;
1257 	u8 op_attr;
1258 #define ISCSI_TMF_REQUEST_FUNCTION (0x7F<<0)
1259 #define ISCSI_TMF_REQUEST_FUNCTION_SHIFT 0
1260 #define ISCSI_TMF_REQUEST_ALWAYS_ONE (0x1<<7)
1261 #define ISCSI_TMF_REQUEST_ALWAYS_ONE_SHIFT 7
1262 	u16 reserved0;
1263 #elif defined(__LITTLE_ENDIAN)
1264 	u16 reserved0;
1265 	u8 op_attr;
1266 #define ISCSI_TMF_REQUEST_FUNCTION (0x7F<<0)
1267 #define ISCSI_TMF_REQUEST_FUNCTION_SHIFT 0
1268 #define ISCSI_TMF_REQUEST_ALWAYS_ONE (0x1<<7)
1269 #define ISCSI_TMF_REQUEST_ALWAYS_ONE_SHIFT 7
1270 	u8 op_code;
1271 #endif
1272 	u32 data_length;
1273 	u32 lun[2];
1274 #if defined(__BIG_ENDIAN)
1275 	u16 reserved1;
1276 	u16 itt;
1277 #define ISCSI_TMF_REQUEST_INDEX (0x3FFF<<0)
1278 #define ISCSI_TMF_REQUEST_INDEX_SHIFT 0
1279 #define ISCSI_TMF_REQUEST_TYPE (0x3<<14)
1280 #define ISCSI_TMF_REQUEST_TYPE_SHIFT 14
1281 #elif defined(__LITTLE_ENDIAN)
1282 	u16 itt;
1283 #define ISCSI_TMF_REQUEST_INDEX (0x3FFF<<0)
1284 #define ISCSI_TMF_REQUEST_INDEX_SHIFT 0
1285 #define ISCSI_TMF_REQUEST_TYPE (0x3<<14)
1286 #define ISCSI_TMF_REQUEST_TYPE_SHIFT 14
1287 	u16 reserved1;
1288 #endif
1289 	u32 ref_itt;
1290 	u32 cmd_sn;
1291 	u32 reserved2;
1292 	u32 ref_cmd_sn;
1293 	u32 reserved3[3];
1294 	u32 zero_fill;
1295 	u32 bd_list_addr_lo;
1296 	u32 bd_list_addr_hi;
1297 #if defined(__BIG_ENDIAN)
1298 	u8 cq_index;
1299 	u8 reserved5;
1300 	u8 reserved4;
1301 	u8 num_bds;
1302 #elif defined(__LITTLE_ENDIAN)
1303 	u8 num_bds;
1304 	u8 reserved4;
1305 	u8 reserved5;
1306 	u8 cq_index;
1307 #endif
1308 };
1309 
1310 /*
1311  * iSCSI Text SQ WQE
1312  */
1313 struct bnx2i_text_request {
1314 #if defined(__BIG_ENDIAN)
1315 	u8 op_code;
1316 	u8 op_attr;
1317 #define ISCSI_TEXT_REQUEST_RESERVED1 (0x3F<<0)
1318 #define ISCSI_TEXT_REQUEST_RESERVED1_SHIFT 0
1319 #define ISCSI_TEXT_REQUEST_CONT (0x1<<6)
1320 #define ISCSI_TEXT_REQUEST_CONT_SHIFT 6
1321 #define ISCSI_TEXT_REQUEST_FINAL (0x1<<7)
1322 #define ISCSI_TEXT_REQUEST_FINAL_SHIFT 7
1323 	u16 reserved0;
1324 #elif defined(__LITTLE_ENDIAN)
1325 	u16 reserved0;
1326 	u8 op_attr;
1327 #define ISCSI_TEXT_REQUEST_RESERVED1 (0x3F<<0)
1328 #define ISCSI_TEXT_REQUEST_RESERVED1_SHIFT 0
1329 #define ISCSI_TEXT_REQUEST_CONT (0x1<<6)
1330 #define ISCSI_TEXT_REQUEST_CONT_SHIFT 6
1331 #define ISCSI_TEXT_REQUEST_FINAL (0x1<<7)
1332 #define ISCSI_TEXT_REQUEST_FINAL_SHIFT 7
1333 	u8 op_code;
1334 #endif
1335 	u32 data_length;
1336 	u32 lun[2];
1337 #if defined(__BIG_ENDIAN)
1338 	u16 reserved3;
1339 	u16 itt;
1340 #define ISCSI_TEXT_REQUEST_INDEX (0x3FFF<<0)
1341 #define ISCSI_TEXT_REQUEST_INDEX_SHIFT 0
1342 #define ISCSI_TEXT_REQUEST_TYPE (0x3<<14)
1343 #define ISCSI_TEXT_REQUEST_TYPE_SHIFT 14
1344 #elif defined(__LITTLE_ENDIAN)
1345 	u16 itt;
1346 #define ISCSI_TEXT_REQUEST_INDEX (0x3FFF<<0)
1347 #define ISCSI_TEXT_REQUEST_INDEX_SHIFT 0
1348 #define ISCSI_TEXT_REQUEST_TYPE (0x3<<14)
1349 #define ISCSI_TEXT_REQUEST_TYPE_SHIFT 14
1350 	u16 reserved3;
1351 #endif
1352 	u32 ttt;
1353 	u32 cmd_sn;
1354 	u32 reserved4[2];
1355 	u32 resp_bd_list_addr_lo;
1356 	u32 resp_bd_list_addr_hi;
1357 	u32 resp_buffer;
1358 #define ISCSI_TEXT_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0)
1359 #define ISCSI_TEXT_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0
1360 #define ISCSI_TEXT_REQUEST_NUM_RESP_BDS (0xFF<<24)
1361 #define ISCSI_TEXT_REQUEST_NUM_RESP_BDS_SHIFT 24
1362 	u32 zero_fill;
1363 	u32 bd_list_addr_lo;
1364 	u32 bd_list_addr_hi;
1365 #if defined(__BIG_ENDIAN)
1366 	u8 cq_index;
1367 	u8 reserved7;
1368 	u8 reserved6;
1369 	u8 num_bds;
1370 #elif defined(__LITTLE_ENDIAN)
1371 	u8 num_bds;
1372 	u8 reserved6;
1373 	u8 reserved7;
1374 	u8 cq_index;
1375 #endif
1376 };
1377 
1378 /*
1379  * iSCSI SQ WQE
1380  */
1381 union iscsi_request {
1382 	struct bnx2i_cmd_request cmd;
1383 	struct bnx2i_tmf_request tmf;
1384 	struct bnx2i_nop_out_request nop_out;
1385 	struct bnx2i_login_request login_req;
1386 	struct bnx2i_text_request text;
1387 	struct bnx2i_logout_request logout_req;
1388 	struct bnx2i_cleanup_request cleanup;
1389 };
1390 
1391 
1392 /*
1393  * iSCSI TMF CQE
1394  */
1395 struct bnx2i_tmf_response {
1396 #if defined(__BIG_ENDIAN)
1397 	u8 op_code;
1398 	u8 reserved1;
1399 	u8 response;
1400 	u8 reserved0;
1401 #elif defined(__LITTLE_ENDIAN)
1402 	u8 reserved0;
1403 	u8 response;
1404 	u8 reserved1;
1405 	u8 op_code;
1406 #endif
1407 	u32 reserved2;
1408 	u32 exp_cmd_sn;
1409 	u32 max_cmd_sn;
1410 	u32 reserved3[2];
1411 #if defined(__BIG_ENDIAN)
1412 	u16 reserved5;
1413 	u8 err_code;
1414 	u8 reserved4;
1415 #elif defined(__LITTLE_ENDIAN)
1416 	u8 reserved4;
1417 	u8 err_code;
1418 	u16 reserved5;
1419 #endif
1420 	u32 reserved6[7];
1421 #if defined(__BIG_ENDIAN)
1422 	u16 reserved7;
1423 	u16 itt;
1424 #define ISCSI_TMF_RESPONSE_INDEX (0x3FFF<<0)
1425 #define ISCSI_TMF_RESPONSE_INDEX_SHIFT 0
1426 #define ISCSI_TMF_RESPONSE_TYPE (0x3<<14)
1427 #define ISCSI_TMF_RESPONSE_TYPE_SHIFT 14
1428 #elif defined(__LITTLE_ENDIAN)
1429 	u16 itt;
1430 #define ISCSI_TMF_RESPONSE_INDEX (0x3FFF<<0)
1431 #define ISCSI_TMF_RESPONSE_INDEX_SHIFT 0
1432 #define ISCSI_TMF_RESPONSE_TYPE (0x3<<14)
1433 #define ISCSI_TMF_RESPONSE_TYPE_SHIFT 14
1434 	u16 reserved7;
1435 #endif
1436 	u32 cq_req_sn;
1437 };
1438 
1439 /*
1440  * iSCSI Text CQE
1441  */
1442 struct bnx2i_text_response {
1443 #if defined(__BIG_ENDIAN)
1444 	u8 op_code;
1445 	u8 response_flags;
1446 #define ISCSI_TEXT_RESPONSE_RESERVED1 (0x3F<<0)
1447 #define ISCSI_TEXT_RESPONSE_RESERVED1_SHIFT 0
1448 #define ISCSI_TEXT_RESPONSE_CONT (0x1<<6)
1449 #define ISCSI_TEXT_RESPONSE_CONT_SHIFT 6
1450 #define ISCSI_TEXT_RESPONSE_FINAL (0x1<<7)
1451 #define ISCSI_TEXT_RESPONSE_FINAL_SHIFT 7
1452 	u16 reserved0;
1453 #elif defined(__LITTLE_ENDIAN)
1454 	u16 reserved0;
1455 	u8 response_flags;
1456 #define ISCSI_TEXT_RESPONSE_RESERVED1 (0x3F<<0)
1457 #define ISCSI_TEXT_RESPONSE_RESERVED1_SHIFT 0
1458 #define ISCSI_TEXT_RESPONSE_CONT (0x1<<6)
1459 #define ISCSI_TEXT_RESPONSE_CONT_SHIFT 6
1460 #define ISCSI_TEXT_RESPONSE_FINAL (0x1<<7)
1461 #define ISCSI_TEXT_RESPONSE_FINAL_SHIFT 7
1462 	u8 op_code;
1463 #endif
1464 	u32 data_length;
1465 	u32 exp_cmd_sn;
1466 	u32 max_cmd_sn;
1467 	u32 ttt;
1468 	u32 reserved2;
1469 #if defined(__BIG_ENDIAN)
1470 	u16 reserved4;
1471 	u8 err_code;
1472 	u8 reserved3;
1473 #elif defined(__LITTLE_ENDIAN)
1474 	u8 reserved3;
1475 	u8 err_code;
1476 	u16 reserved4;
1477 #endif
1478 	u32 reserved5;
1479 	u32 lun[2];
1480 	u32 reserved6[4];
1481 #if defined(__BIG_ENDIAN)
1482 	u16 reserved7;
1483 	u16 itt;
1484 #define ISCSI_TEXT_RESPONSE_INDEX (0x3FFF<<0)
1485 #define ISCSI_TEXT_RESPONSE_INDEX_SHIFT 0
1486 #define ISCSI_TEXT_RESPONSE_TYPE (0x3<<14)
1487 #define ISCSI_TEXT_RESPONSE_TYPE_SHIFT 14
1488 #elif defined(__LITTLE_ENDIAN)
1489 	u16 itt;
1490 #define ISCSI_TEXT_RESPONSE_INDEX (0x3FFF<<0)
1491 #define ISCSI_TEXT_RESPONSE_INDEX_SHIFT 0
1492 #define ISCSI_TEXT_RESPONSE_TYPE (0x3<<14)
1493 #define ISCSI_TEXT_RESPONSE_TYPE_SHIFT 14
1494 	u16 reserved7;
1495 #endif
1496 	u32 cq_req_sn;
1497 };
1498 
1499 /*
1500  * iSCSI CQE
1501  */
1502 union iscsi_response {
1503 	struct bnx2i_cmd_response cmd;
1504 	struct bnx2i_tmf_response tmf;
1505 	struct bnx2i_login_response login_resp;
1506 	struct bnx2i_text_response text;
1507 	struct bnx2i_logout_response logout_resp;
1508 	struct bnx2i_cleanup_response cleanup;
1509 	struct bnx2i_reject_msg reject;
1510 	struct bnx2i_async_msg async;
1511 	struct bnx2i_nop_in_msg nop_in;
1512 };
1513 
1514 #endif /* __57XX_ISCSI_HSI_LINUX_LE__ */
1515