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