1 /* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI.
2  *
3  * Copyright (c) 2006 - 2010 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_RESERVED1 (0xF<<4)
711 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1_SHIFT 4
712 #elif defined(__LITTLE_ENDIAN)
713 	u8 conn_flags;
714 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST (0x1<<0)
715 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST_SHIFT 0
716 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST (0x1<<1)
717 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST_SHIFT 1
718 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T (0x1<<2)
719 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T_SHIFT 2
720 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA (0x1<<3)
721 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA_SHIFT 3
722 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1 (0xF<<4)
723 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1_SHIFT 4
724 	u8 reserved2;
725 	u8 max_outstanding_r2ts;
726 	u8 session_error_recovery_level;
727 #endif
728 	u32 context_id;
729 	u32 max_send_pdu_length;
730 	u32 max_recv_pdu_length;
731 	u32 first_burst_length;
732 	u32 max_burst_length;
733 	u32 exp_stat_sn;
734 };
735 
736 /*
737  * iSCSI destroy connection request
738  */
739 struct iscsi_kwqe_conn_destroy {
740 #if defined(__BIG_ENDIAN)
741 	struct iscsi_kwqe_header hdr;
742 	u16 reserved0;
743 #elif defined(__LITTLE_ENDIAN)
744 	u16 reserved0;
745 	struct iscsi_kwqe_header hdr;
746 #endif
747 	u32 context_id;
748 	u32 reserved1[6];
749 };
750 
751 /*
752  * iSCSI KWQ WQE
753  */
754 union iscsi_kwqe {
755 	struct iscsi_kwqe_init1 init1;
756 	struct iscsi_kwqe_init2 init2;
757 	struct iscsi_kwqe_conn_offload1 conn_offload1;
758 	struct iscsi_kwqe_conn_offload2 conn_offload2;
759 	struct iscsi_kwqe_conn_update conn_update;
760 	struct iscsi_kwqe_conn_destroy conn_destroy;
761 };
762 
763 /*
764  * iSCSI Login SQ WQE
765  */
766 struct bnx2i_login_request {
767 #if defined(__BIG_ENDIAN)
768 	u8 op_code;
769 	u8 op_attr;
770 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE (0x3<<0)
771 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE_SHIFT 0
772 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE (0x3<<2)
773 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE_SHIFT 2
774 #define ISCSI_LOGIN_REQUEST_RESERVED0 (0x3<<4)
775 #define ISCSI_LOGIN_REQUEST_RESERVED0_SHIFT 4
776 #define ISCSI_LOGIN_REQUEST_CONT (0x1<<6)
777 #define ISCSI_LOGIN_REQUEST_CONT_SHIFT 6
778 #define ISCSI_LOGIN_REQUEST_TRANSIT (0x1<<7)
779 #define ISCSI_LOGIN_REQUEST_TRANSIT_SHIFT 7
780 	u8 version_max;
781 	u8 version_min;
782 #elif defined(__LITTLE_ENDIAN)
783 	u8 version_min;
784 	u8 version_max;
785 	u8 op_attr;
786 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE (0x3<<0)
787 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE_SHIFT 0
788 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE (0x3<<2)
789 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE_SHIFT 2
790 #define ISCSI_LOGIN_REQUEST_RESERVED0 (0x3<<4)
791 #define ISCSI_LOGIN_REQUEST_RESERVED0_SHIFT 4
792 #define ISCSI_LOGIN_REQUEST_CONT (0x1<<6)
793 #define ISCSI_LOGIN_REQUEST_CONT_SHIFT 6
794 #define ISCSI_LOGIN_REQUEST_TRANSIT (0x1<<7)
795 #define ISCSI_LOGIN_REQUEST_TRANSIT_SHIFT 7
796 	u8 op_code;
797 #endif
798 	u32 data_length;
799 	u32 isid_lo;
800 #if defined(__BIG_ENDIAN)
801 	u16 isid_hi;
802 	u16 tsih;
803 #elif defined(__LITTLE_ENDIAN)
804 	u16 tsih;
805 	u16 isid_hi;
806 #endif
807 #if defined(__BIG_ENDIAN)
808 	u16 reserved2;
809 	u16 itt;
810 #define ISCSI_LOGIN_REQUEST_INDEX (0x3FFF<<0)
811 #define ISCSI_LOGIN_REQUEST_INDEX_SHIFT 0
812 #define ISCSI_LOGIN_REQUEST_TYPE (0x3<<14)
813 #define ISCSI_LOGIN_REQUEST_TYPE_SHIFT 14
814 #elif defined(__LITTLE_ENDIAN)
815 	u16 itt;
816 #define ISCSI_LOGIN_REQUEST_INDEX (0x3FFF<<0)
817 #define ISCSI_LOGIN_REQUEST_INDEX_SHIFT 0
818 #define ISCSI_LOGIN_REQUEST_TYPE (0x3<<14)
819 #define ISCSI_LOGIN_REQUEST_TYPE_SHIFT 14
820 	u16 reserved2;
821 #endif
822 #if defined(__BIG_ENDIAN)
823 	u16 cid;
824 	u16 reserved3;
825 #elif defined(__LITTLE_ENDIAN)
826 	u16 reserved3;
827 	u16 cid;
828 #endif
829 	u32 cmd_sn;
830 	u32 exp_stat_sn;
831 	u32 reserved4;
832 	u32 resp_bd_list_addr_lo;
833 	u32 resp_bd_list_addr_hi;
834 	u32 resp_buffer;
835 #define ISCSI_LOGIN_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0)
836 #define ISCSI_LOGIN_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0
837 #define ISCSI_LOGIN_REQUEST_NUM_RESP_BDS (0xFF<<24)
838 #define ISCSI_LOGIN_REQUEST_NUM_RESP_BDS_SHIFT 24
839 #if defined(__BIG_ENDIAN)
840 	u16 reserved8;
841 	u8 reserved7;
842 	u8 flags;
843 #define ISCSI_LOGIN_REQUEST_RESERVED5 (0x3<<0)
844 #define ISCSI_LOGIN_REQUEST_RESERVED5_SHIFT 0
845 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2)
846 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2
847 #define ISCSI_LOGIN_REQUEST_RESERVED6 (0x1F<<3)
848 #define ISCSI_LOGIN_REQUEST_RESERVED6_SHIFT 3
849 #elif defined(__LITTLE_ENDIAN)
850 	u8 flags;
851 #define ISCSI_LOGIN_REQUEST_RESERVED5 (0x3<<0)
852 #define ISCSI_LOGIN_REQUEST_RESERVED5_SHIFT 0
853 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2)
854 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2
855 #define ISCSI_LOGIN_REQUEST_RESERVED6 (0x1F<<3)
856 #define ISCSI_LOGIN_REQUEST_RESERVED6_SHIFT 3
857 	u8 reserved7;
858 	u16 reserved8;
859 #endif
860 	u32 bd_list_addr_lo;
861 	u32 bd_list_addr_hi;
862 #if defined(__BIG_ENDIAN)
863 	u8 cq_index;
864 	u8 reserved10;
865 	u8 reserved9;
866 	u8 num_bds;
867 #elif defined(__LITTLE_ENDIAN)
868 	u8 num_bds;
869 	u8 reserved9;
870 	u8 reserved10;
871 	u8 cq_index;
872 #endif
873 };
874 
875 
876 /*
877  * iSCSI Login CQE
878  */
879 struct bnx2i_login_response {
880 #if defined(__BIG_ENDIAN)
881 	u8 op_code;
882 	u8 response_flags;
883 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE (0x3<<0)
884 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE_SHIFT 0
885 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE (0x3<<2)
886 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE_SHIFT 2
887 #define ISCSI_LOGIN_RESPONSE_RESERVED0 (0x3<<4)
888 #define ISCSI_LOGIN_RESPONSE_RESERVED0_SHIFT 4
889 #define ISCSI_LOGIN_RESPONSE_CONT (0x1<<6)
890 #define ISCSI_LOGIN_RESPONSE_CONT_SHIFT 6
891 #define ISCSI_LOGIN_RESPONSE_TRANSIT (0x1<<7)
892 #define ISCSI_LOGIN_RESPONSE_TRANSIT_SHIFT 7
893 	u8 version_max;
894 	u8 version_active;
895 #elif defined(__LITTLE_ENDIAN)
896 	u8 version_active;
897 	u8 version_max;
898 	u8 response_flags;
899 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE (0x3<<0)
900 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE_SHIFT 0
901 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE (0x3<<2)
902 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE_SHIFT 2
903 #define ISCSI_LOGIN_RESPONSE_RESERVED0 (0x3<<4)
904 #define ISCSI_LOGIN_RESPONSE_RESERVED0_SHIFT 4
905 #define ISCSI_LOGIN_RESPONSE_CONT (0x1<<6)
906 #define ISCSI_LOGIN_RESPONSE_CONT_SHIFT 6
907 #define ISCSI_LOGIN_RESPONSE_TRANSIT (0x1<<7)
908 #define ISCSI_LOGIN_RESPONSE_TRANSIT_SHIFT 7
909 	u8 op_code;
910 #endif
911 	u32 data_length;
912 	u32 exp_cmd_sn;
913 	u32 max_cmd_sn;
914 	u32 reserved1[2];
915 #if defined(__BIG_ENDIAN)
916 	u16 reserved3;
917 	u8 err_code;
918 	u8 reserved2;
919 #elif defined(__LITTLE_ENDIAN)
920 	u8 reserved2;
921 	u8 err_code;
922 	u16 reserved3;
923 #endif
924 	u32 stat_sn;
925 	u32 isid_lo;
926 #if defined(__BIG_ENDIAN)
927 	u16 isid_hi;
928 	u16 tsih;
929 #elif defined(__LITTLE_ENDIAN)
930 	u16 tsih;
931 	u16 isid_hi;
932 #endif
933 #if defined(__BIG_ENDIAN)
934 	u8 status_class;
935 	u8 status_detail;
936 	u16 reserved4;
937 #elif defined(__LITTLE_ENDIAN)
938 	u16 reserved4;
939 	u8 status_detail;
940 	u8 status_class;
941 #endif
942 	u32 reserved5[3];
943 #if defined(__BIG_ENDIAN)
944 	u16 reserved6;
945 	u16 itt;
946 #define ISCSI_LOGIN_RESPONSE_INDEX (0x3FFF<<0)
947 #define ISCSI_LOGIN_RESPONSE_INDEX_SHIFT 0
948 #define ISCSI_LOGIN_RESPONSE_TYPE (0x3<<14)
949 #define ISCSI_LOGIN_RESPONSE_TYPE_SHIFT 14
950 #elif defined(__LITTLE_ENDIAN)
951 	u16 itt;
952 #define ISCSI_LOGIN_RESPONSE_INDEX (0x3FFF<<0)
953 #define ISCSI_LOGIN_RESPONSE_INDEX_SHIFT 0
954 #define ISCSI_LOGIN_RESPONSE_TYPE (0x3<<14)
955 #define ISCSI_LOGIN_RESPONSE_TYPE_SHIFT 14
956 	u16 reserved6;
957 #endif
958 	u32 cq_req_sn;
959 };
960 
961 
962 /*
963  * iSCSI Logout SQ WQE
964  */
965 struct bnx2i_logout_request {
966 #if defined(__BIG_ENDIAN)
967 	u8 op_code;
968 	u8 op_attr;
969 #define ISCSI_LOGOUT_REQUEST_REASON (0x7F<<0)
970 #define ISCSI_LOGOUT_REQUEST_REASON_SHIFT 0
971 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE (0x1<<7)
972 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE_SHIFT 7
973 	u16 reserved0;
974 #elif defined(__LITTLE_ENDIAN)
975 	u16 reserved0;
976 	u8 op_attr;
977 #define ISCSI_LOGOUT_REQUEST_REASON (0x7F<<0)
978 #define ISCSI_LOGOUT_REQUEST_REASON_SHIFT 0
979 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE (0x1<<7)
980 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE_SHIFT 7
981 	u8 op_code;
982 #endif
983 	u32 data_length;
984 	u32 reserved1[2];
985 #if defined(__BIG_ENDIAN)
986 	u16 reserved2;
987 	u16 itt;
988 #define ISCSI_LOGOUT_REQUEST_INDEX (0x3FFF<<0)
989 #define ISCSI_LOGOUT_REQUEST_INDEX_SHIFT 0
990 #define ISCSI_LOGOUT_REQUEST_TYPE (0x3<<14)
991 #define ISCSI_LOGOUT_REQUEST_TYPE_SHIFT 14
992 #elif defined(__LITTLE_ENDIAN)
993 	u16 itt;
994 #define ISCSI_LOGOUT_REQUEST_INDEX (0x3FFF<<0)
995 #define ISCSI_LOGOUT_REQUEST_INDEX_SHIFT 0
996 #define ISCSI_LOGOUT_REQUEST_TYPE (0x3<<14)
997 #define ISCSI_LOGOUT_REQUEST_TYPE_SHIFT 14
998 	u16 reserved2;
999 #endif
1000 #if defined(__BIG_ENDIAN)
1001 	u16 cid;
1002 	u16 reserved3;
1003 #elif defined(__LITTLE_ENDIAN)
1004 	u16 reserved3;
1005 	u16 cid;
1006 #endif
1007 	u32 cmd_sn;
1008 	u32 reserved4[5];
1009 	u32 zero_fill;
1010 	u32 bd_list_addr_lo;
1011 	u32 bd_list_addr_hi;
1012 #if defined(__BIG_ENDIAN)
1013 	u8 cq_index;
1014 	u8 reserved6;
1015 	u8 reserved5;
1016 	u8 num_bds;
1017 #elif defined(__LITTLE_ENDIAN)
1018 	u8 num_bds;
1019 	u8 reserved5;
1020 	u8 reserved6;
1021 	u8 cq_index;
1022 #endif
1023 };
1024 
1025 
1026 /*
1027  * iSCSI Logout CQE
1028  */
1029 struct bnx2i_logout_response {
1030 #if defined(__BIG_ENDIAN)
1031 	u8 op_code;
1032 	u8 reserved1;
1033 	u8 response;
1034 	u8 reserved0;
1035 #elif defined(__LITTLE_ENDIAN)
1036 	u8 reserved0;
1037 	u8 response;
1038 	u8 reserved1;
1039 	u8 op_code;
1040 #endif
1041 	u32 reserved2;
1042 	u32 exp_cmd_sn;
1043 	u32 max_cmd_sn;
1044 	u32 reserved3[2];
1045 #if defined(__BIG_ENDIAN)
1046 	u16 reserved5;
1047 	u8 err_code;
1048 	u8 reserved4;
1049 #elif defined(__LITTLE_ENDIAN)
1050 	u8 reserved4;
1051 	u8 err_code;
1052 	u16 reserved5;
1053 #endif
1054 	u32 reserved6[3];
1055 #if defined(__BIG_ENDIAN)
1056 	u16 time_to_wait;
1057 	u16 time_to_retain;
1058 #elif defined(__LITTLE_ENDIAN)
1059 	u16 time_to_retain;
1060 	u16 time_to_wait;
1061 #endif
1062 	u32 reserved7[3];
1063 #if defined(__BIG_ENDIAN)
1064 	u16 reserved8;
1065 	u16 itt;
1066 #define ISCSI_LOGOUT_RESPONSE_INDEX (0x3FFF<<0)
1067 #define ISCSI_LOGOUT_RESPONSE_INDEX_SHIFT 0
1068 #define ISCSI_LOGOUT_RESPONSE_TYPE (0x3<<14)
1069 #define ISCSI_LOGOUT_RESPONSE_TYPE_SHIFT 14
1070 #elif defined(__LITTLE_ENDIAN)
1071 	u16 itt;
1072 #define ISCSI_LOGOUT_RESPONSE_INDEX (0x3FFF<<0)
1073 #define ISCSI_LOGOUT_RESPONSE_INDEX_SHIFT 0
1074 #define ISCSI_LOGOUT_RESPONSE_TYPE (0x3<<14)
1075 #define ISCSI_LOGOUT_RESPONSE_TYPE_SHIFT 14
1076 	u16 reserved8;
1077 #endif
1078 	u32 cq_req_sn;
1079 };
1080 
1081 
1082 /*
1083  * iSCSI Nop-In CQE
1084  */
1085 struct bnx2i_nop_in_msg {
1086 #if defined(__BIG_ENDIAN)
1087 	u8 op_code;
1088 	u8 reserved1;
1089 	u16 reserved0;
1090 #elif defined(__LITTLE_ENDIAN)
1091 	u16 reserved0;
1092 	u8 reserved1;
1093 	u8 op_code;
1094 #endif
1095 	u32 data_length;
1096 	u32 exp_cmd_sn;
1097 	u32 max_cmd_sn;
1098 	u32 ttt;
1099 	u32 reserved2;
1100 #if defined(__BIG_ENDIAN)
1101 	u16 reserved4;
1102 	u8 err_code;
1103 	u8 reserved3;
1104 #elif defined(__LITTLE_ENDIAN)
1105 	u8 reserved3;
1106 	u8 err_code;
1107 	u16 reserved4;
1108 #endif
1109 	u32 reserved5;
1110 	u32 lun[2];
1111 	u32 reserved6[4];
1112 #if defined(__BIG_ENDIAN)
1113 	u16 reserved7;
1114 	u16 itt;
1115 #define ISCSI_NOP_IN_MSG_INDEX (0x3FFF<<0)
1116 #define ISCSI_NOP_IN_MSG_INDEX_SHIFT 0
1117 #define ISCSI_NOP_IN_MSG_TYPE (0x3<<14)
1118 #define ISCSI_NOP_IN_MSG_TYPE_SHIFT 14
1119 #elif defined(__LITTLE_ENDIAN)
1120 	u16 itt;
1121 #define ISCSI_NOP_IN_MSG_INDEX (0x3FFF<<0)
1122 #define ISCSI_NOP_IN_MSG_INDEX_SHIFT 0
1123 #define ISCSI_NOP_IN_MSG_TYPE (0x3<<14)
1124 #define ISCSI_NOP_IN_MSG_TYPE_SHIFT 14
1125 	u16 reserved7;
1126 #endif
1127 	u32 cq_req_sn;
1128 };
1129 
1130 
1131 /*
1132  * iSCSI NOP-OUT SQ WQE
1133  */
1134 struct bnx2i_nop_out_request {
1135 #if defined(__BIG_ENDIAN)
1136 	u8 op_code;
1137 	u8 op_attr;
1138 #define ISCSI_NOP_OUT_REQUEST_RESERVED1 (0x7F<<0)
1139 #define ISCSI_NOP_OUT_REQUEST_RESERVED1_SHIFT 0
1140 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE (0x1<<7)
1141 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE_SHIFT 7
1142 	u16 reserved0;
1143 #elif defined(__LITTLE_ENDIAN)
1144 	u16 reserved0;
1145 	u8 op_attr;
1146 #define ISCSI_NOP_OUT_REQUEST_RESERVED1 (0x7F<<0)
1147 #define ISCSI_NOP_OUT_REQUEST_RESERVED1_SHIFT 0
1148 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE (0x1<<7)
1149 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE_SHIFT 7
1150 	u8 op_code;
1151 #endif
1152 	u32 data_length;
1153 	u32 lun[2];
1154 #if defined(__BIG_ENDIAN)
1155 	u16 reserved2;
1156 	u16 itt;
1157 #define ISCSI_NOP_OUT_REQUEST_INDEX (0x3FFF<<0)
1158 #define ISCSI_NOP_OUT_REQUEST_INDEX_SHIFT 0
1159 #define ISCSI_NOP_OUT_REQUEST_TYPE (0x3<<14)
1160 #define ISCSI_NOP_OUT_REQUEST_TYPE_SHIFT 14
1161 #elif defined(__LITTLE_ENDIAN)
1162 	u16 itt;
1163 #define ISCSI_NOP_OUT_REQUEST_INDEX (0x3FFF<<0)
1164 #define ISCSI_NOP_OUT_REQUEST_INDEX_SHIFT 0
1165 #define ISCSI_NOP_OUT_REQUEST_TYPE (0x3<<14)
1166 #define ISCSI_NOP_OUT_REQUEST_TYPE_SHIFT 14
1167 	u16 reserved2;
1168 #endif
1169 	u32 ttt;
1170 	u32 cmd_sn;
1171 	u32 reserved3[2];
1172 	u32 resp_bd_list_addr_lo;
1173 	u32 resp_bd_list_addr_hi;
1174 	u32 resp_buffer;
1175 #define ISCSI_NOP_OUT_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0)
1176 #define ISCSI_NOP_OUT_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0
1177 #define ISCSI_NOP_OUT_REQUEST_NUM_RESP_BDS (0xFF<<24)
1178 #define ISCSI_NOP_OUT_REQUEST_NUM_RESP_BDS_SHIFT 24
1179 #if defined(__BIG_ENDIAN)
1180 	u16 reserved7;
1181 	u8 reserved6;
1182 	u8 flags;
1183 #define ISCSI_NOP_OUT_REQUEST_RESERVED4 (0x1<<0)
1184 #define ISCSI_NOP_OUT_REQUEST_RESERVED4_SHIFT 0
1185 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION (0x1<<1)
1186 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION_SHIFT 1
1187 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL (0x3F<<2)
1188 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL_SHIFT 2
1189 #elif defined(__LITTLE_ENDIAN)
1190 	u8 flags;
1191 #define ISCSI_NOP_OUT_REQUEST_RESERVED4 (0x1<<0)
1192 #define ISCSI_NOP_OUT_REQUEST_RESERVED4_SHIFT 0
1193 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION (0x1<<1)
1194 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION_SHIFT 1
1195 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL (0x3F<<2)
1196 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL_SHIFT 2
1197 	u8 reserved6;
1198 	u16 reserved7;
1199 #endif
1200 	u32 bd_list_addr_lo;
1201 	u32 bd_list_addr_hi;
1202 #if defined(__BIG_ENDIAN)
1203 	u8 cq_index;
1204 	u8 reserved9;
1205 	u8 reserved8;
1206 	u8 num_bds;
1207 #elif defined(__LITTLE_ENDIAN)
1208 	u8 num_bds;
1209 	u8 reserved8;
1210 	u8 reserved9;
1211 	u8 cq_index;
1212 #endif
1213 };
1214 
1215 /*
1216  * iSCSI Reject CQE
1217  */
1218 struct bnx2i_reject_msg {
1219 #if defined(__BIG_ENDIAN)
1220 	u8 op_code;
1221 	u8 reserved1;
1222 	u8 reason;
1223 	u8 reserved0;
1224 #elif defined(__LITTLE_ENDIAN)
1225 	u8 reserved0;
1226 	u8 reason;
1227 	u8 reserved1;
1228 	u8 op_code;
1229 #endif
1230 	u32 data_length;
1231 	u32 exp_cmd_sn;
1232 	u32 max_cmd_sn;
1233 	u32 reserved2[2];
1234 #if defined(__BIG_ENDIAN)
1235 	u16 reserved4;
1236 	u8 err_code;
1237 	u8 reserved3;
1238 #elif defined(__LITTLE_ENDIAN)
1239 	u8 reserved3;
1240 	u8 err_code;
1241 	u16 reserved4;
1242 #endif
1243 	u32 reserved5[8];
1244 	u32 cq_req_sn;
1245 };
1246 
1247 /*
1248  * bnx2i iSCSI TMF SQ WQE
1249  */
1250 struct bnx2i_tmf_request {
1251 #if defined(__BIG_ENDIAN)
1252 	u8 op_code;
1253 	u8 op_attr;
1254 #define ISCSI_TMF_REQUEST_FUNCTION (0x7F<<0)
1255 #define ISCSI_TMF_REQUEST_FUNCTION_SHIFT 0
1256 #define ISCSI_TMF_REQUEST_ALWAYS_ONE (0x1<<7)
1257 #define ISCSI_TMF_REQUEST_ALWAYS_ONE_SHIFT 7
1258 	u16 reserved0;
1259 #elif defined(__LITTLE_ENDIAN)
1260 	u16 reserved0;
1261 	u8 op_attr;
1262 #define ISCSI_TMF_REQUEST_FUNCTION (0x7F<<0)
1263 #define ISCSI_TMF_REQUEST_FUNCTION_SHIFT 0
1264 #define ISCSI_TMF_REQUEST_ALWAYS_ONE (0x1<<7)
1265 #define ISCSI_TMF_REQUEST_ALWAYS_ONE_SHIFT 7
1266 	u8 op_code;
1267 #endif
1268 	u32 data_length;
1269 	u32 lun[2];
1270 #if defined(__BIG_ENDIAN)
1271 	u16 reserved1;
1272 	u16 itt;
1273 #define ISCSI_TMF_REQUEST_INDEX (0x3FFF<<0)
1274 #define ISCSI_TMF_REQUEST_INDEX_SHIFT 0
1275 #define ISCSI_TMF_REQUEST_TYPE (0x3<<14)
1276 #define ISCSI_TMF_REQUEST_TYPE_SHIFT 14
1277 #elif defined(__LITTLE_ENDIAN)
1278 	u16 itt;
1279 #define ISCSI_TMF_REQUEST_INDEX (0x3FFF<<0)
1280 #define ISCSI_TMF_REQUEST_INDEX_SHIFT 0
1281 #define ISCSI_TMF_REQUEST_TYPE (0x3<<14)
1282 #define ISCSI_TMF_REQUEST_TYPE_SHIFT 14
1283 	u16 reserved1;
1284 #endif
1285 	u32 ref_itt;
1286 	u32 cmd_sn;
1287 	u32 reserved2;
1288 	u32 ref_cmd_sn;
1289 	u32 reserved3[3];
1290 	u32 zero_fill;
1291 	u32 bd_list_addr_lo;
1292 	u32 bd_list_addr_hi;
1293 #if defined(__BIG_ENDIAN)
1294 	u8 cq_index;
1295 	u8 reserved5;
1296 	u8 reserved4;
1297 	u8 num_bds;
1298 #elif defined(__LITTLE_ENDIAN)
1299 	u8 num_bds;
1300 	u8 reserved4;
1301 	u8 reserved5;
1302 	u8 cq_index;
1303 #endif
1304 };
1305 
1306 /*
1307  * iSCSI Text SQ WQE
1308  */
1309 struct bnx2i_text_request {
1310 #if defined(__BIG_ENDIAN)
1311 	u8 op_code;
1312 	u8 op_attr;
1313 #define ISCSI_TEXT_REQUEST_RESERVED1 (0x3F<<0)
1314 #define ISCSI_TEXT_REQUEST_RESERVED1_SHIFT 0
1315 #define ISCSI_TEXT_REQUEST_CONT (0x1<<6)
1316 #define ISCSI_TEXT_REQUEST_CONT_SHIFT 6
1317 #define ISCSI_TEXT_REQUEST_FINAL (0x1<<7)
1318 #define ISCSI_TEXT_REQUEST_FINAL_SHIFT 7
1319 	u16 reserved0;
1320 #elif defined(__LITTLE_ENDIAN)
1321 	u16 reserved0;
1322 	u8 op_attr;
1323 #define ISCSI_TEXT_REQUEST_RESERVED1 (0x3F<<0)
1324 #define ISCSI_TEXT_REQUEST_RESERVED1_SHIFT 0
1325 #define ISCSI_TEXT_REQUEST_CONT (0x1<<6)
1326 #define ISCSI_TEXT_REQUEST_CONT_SHIFT 6
1327 #define ISCSI_TEXT_REQUEST_FINAL (0x1<<7)
1328 #define ISCSI_TEXT_REQUEST_FINAL_SHIFT 7
1329 	u8 op_code;
1330 #endif
1331 	u32 data_length;
1332 	u32 lun[2];
1333 #if defined(__BIG_ENDIAN)
1334 	u16 reserved3;
1335 	u16 itt;
1336 #define ISCSI_TEXT_REQUEST_INDEX (0x3FFF<<0)
1337 #define ISCSI_TEXT_REQUEST_INDEX_SHIFT 0
1338 #define ISCSI_TEXT_REQUEST_TYPE (0x3<<14)
1339 #define ISCSI_TEXT_REQUEST_TYPE_SHIFT 14
1340 #elif defined(__LITTLE_ENDIAN)
1341 	u16 itt;
1342 #define ISCSI_TEXT_REQUEST_INDEX (0x3FFF<<0)
1343 #define ISCSI_TEXT_REQUEST_INDEX_SHIFT 0
1344 #define ISCSI_TEXT_REQUEST_TYPE (0x3<<14)
1345 #define ISCSI_TEXT_REQUEST_TYPE_SHIFT 14
1346 	u16 reserved3;
1347 #endif
1348 	u32 ttt;
1349 	u32 cmd_sn;
1350 	u32 reserved4[2];
1351 	u32 resp_bd_list_addr_lo;
1352 	u32 resp_bd_list_addr_hi;
1353 	u32 resp_buffer;
1354 #define ISCSI_TEXT_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0)
1355 #define ISCSI_TEXT_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0
1356 #define ISCSI_TEXT_REQUEST_NUM_RESP_BDS (0xFF<<24)
1357 #define ISCSI_TEXT_REQUEST_NUM_RESP_BDS_SHIFT 24
1358 	u32 zero_fill;
1359 	u32 bd_list_addr_lo;
1360 	u32 bd_list_addr_hi;
1361 #if defined(__BIG_ENDIAN)
1362 	u8 cq_index;
1363 	u8 reserved7;
1364 	u8 reserved6;
1365 	u8 num_bds;
1366 #elif defined(__LITTLE_ENDIAN)
1367 	u8 num_bds;
1368 	u8 reserved6;
1369 	u8 reserved7;
1370 	u8 cq_index;
1371 #endif
1372 };
1373 
1374 /*
1375  * iSCSI SQ WQE
1376  */
1377 union iscsi_request {
1378 	struct bnx2i_cmd_request cmd;
1379 	struct bnx2i_tmf_request tmf;
1380 	struct bnx2i_nop_out_request nop_out;
1381 	struct bnx2i_login_request login_req;
1382 	struct bnx2i_text_request text;
1383 	struct bnx2i_logout_request logout_req;
1384 	struct bnx2i_cleanup_request cleanup;
1385 };
1386 
1387 
1388 /*
1389  * iSCSI TMF CQE
1390  */
1391 struct bnx2i_tmf_response {
1392 #if defined(__BIG_ENDIAN)
1393 	u8 op_code;
1394 	u8 reserved1;
1395 	u8 response;
1396 	u8 reserved0;
1397 #elif defined(__LITTLE_ENDIAN)
1398 	u8 reserved0;
1399 	u8 response;
1400 	u8 reserved1;
1401 	u8 op_code;
1402 #endif
1403 	u32 reserved2;
1404 	u32 exp_cmd_sn;
1405 	u32 max_cmd_sn;
1406 	u32 reserved3[2];
1407 #if defined(__BIG_ENDIAN)
1408 	u16 reserved5;
1409 	u8 err_code;
1410 	u8 reserved4;
1411 #elif defined(__LITTLE_ENDIAN)
1412 	u8 reserved4;
1413 	u8 err_code;
1414 	u16 reserved5;
1415 #endif
1416 	u32 reserved6[7];
1417 #if defined(__BIG_ENDIAN)
1418 	u16 reserved7;
1419 	u16 itt;
1420 #define ISCSI_TMF_RESPONSE_INDEX (0x3FFF<<0)
1421 #define ISCSI_TMF_RESPONSE_INDEX_SHIFT 0
1422 #define ISCSI_TMF_RESPONSE_TYPE (0x3<<14)
1423 #define ISCSI_TMF_RESPONSE_TYPE_SHIFT 14
1424 #elif defined(__LITTLE_ENDIAN)
1425 	u16 itt;
1426 #define ISCSI_TMF_RESPONSE_INDEX (0x3FFF<<0)
1427 #define ISCSI_TMF_RESPONSE_INDEX_SHIFT 0
1428 #define ISCSI_TMF_RESPONSE_TYPE (0x3<<14)
1429 #define ISCSI_TMF_RESPONSE_TYPE_SHIFT 14
1430 	u16 reserved7;
1431 #endif
1432 	u32 cq_req_sn;
1433 };
1434 
1435 /*
1436  * iSCSI Text CQE
1437  */
1438 struct bnx2i_text_response {
1439 #if defined(__BIG_ENDIAN)
1440 	u8 op_code;
1441 	u8 response_flags;
1442 #define ISCSI_TEXT_RESPONSE_RESERVED1 (0x3F<<0)
1443 #define ISCSI_TEXT_RESPONSE_RESERVED1_SHIFT 0
1444 #define ISCSI_TEXT_RESPONSE_CONT (0x1<<6)
1445 #define ISCSI_TEXT_RESPONSE_CONT_SHIFT 6
1446 #define ISCSI_TEXT_RESPONSE_FINAL (0x1<<7)
1447 #define ISCSI_TEXT_RESPONSE_FINAL_SHIFT 7
1448 	u16 reserved0;
1449 #elif defined(__LITTLE_ENDIAN)
1450 	u16 reserved0;
1451 	u8 response_flags;
1452 #define ISCSI_TEXT_RESPONSE_RESERVED1 (0x3F<<0)
1453 #define ISCSI_TEXT_RESPONSE_RESERVED1_SHIFT 0
1454 #define ISCSI_TEXT_RESPONSE_CONT (0x1<<6)
1455 #define ISCSI_TEXT_RESPONSE_CONT_SHIFT 6
1456 #define ISCSI_TEXT_RESPONSE_FINAL (0x1<<7)
1457 #define ISCSI_TEXT_RESPONSE_FINAL_SHIFT 7
1458 	u8 op_code;
1459 #endif
1460 	u32 data_length;
1461 	u32 exp_cmd_sn;
1462 	u32 max_cmd_sn;
1463 	u32 ttt;
1464 	u32 reserved2;
1465 #if defined(__BIG_ENDIAN)
1466 	u16 reserved4;
1467 	u8 err_code;
1468 	u8 reserved3;
1469 #elif defined(__LITTLE_ENDIAN)
1470 	u8 reserved3;
1471 	u8 err_code;
1472 	u16 reserved4;
1473 #endif
1474 	u32 reserved5;
1475 	u32 lun[2];
1476 	u32 reserved6[4];
1477 #if defined(__BIG_ENDIAN)
1478 	u16 reserved7;
1479 	u16 itt;
1480 #define ISCSI_TEXT_RESPONSE_INDEX (0x3FFF<<0)
1481 #define ISCSI_TEXT_RESPONSE_INDEX_SHIFT 0
1482 #define ISCSI_TEXT_RESPONSE_TYPE (0x3<<14)
1483 #define ISCSI_TEXT_RESPONSE_TYPE_SHIFT 14
1484 #elif defined(__LITTLE_ENDIAN)
1485 	u16 itt;
1486 #define ISCSI_TEXT_RESPONSE_INDEX (0x3FFF<<0)
1487 #define ISCSI_TEXT_RESPONSE_INDEX_SHIFT 0
1488 #define ISCSI_TEXT_RESPONSE_TYPE (0x3<<14)
1489 #define ISCSI_TEXT_RESPONSE_TYPE_SHIFT 14
1490 	u16 reserved7;
1491 #endif
1492 	u32 cq_req_sn;
1493 };
1494 
1495 /*
1496  * iSCSI CQE
1497  */
1498 union iscsi_response {
1499 	struct bnx2i_cmd_response cmd;
1500 	struct bnx2i_tmf_response tmf;
1501 	struct bnx2i_login_response login_resp;
1502 	struct bnx2i_text_response text;
1503 	struct bnx2i_logout_response logout_resp;
1504 	struct bnx2i_cleanup_response cleanup;
1505 	struct bnx2i_reject_msg reject;
1506 	struct bnx2i_async_msg async;
1507 	struct bnx2i_nop_in_msg nop_in;
1508 };
1509 
1510 #endif /* __57XX_ISCSI_HSI_LINUX_LE__ */
1511