cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

57xx_iscsi_hsi.h (37601B)


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