18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright 2017 Broadcom. All Rights Reserved. 48c2ecf20Sopenharmony_ci * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Contact Information: 78c2ecf20Sopenharmony_ci * linux-drivers@broadcom.com 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifndef BEISCSI_CMDS_H 118c2ecf20Sopenharmony_ci#define BEISCSI_CMDS_H 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/** 148c2ecf20Sopenharmony_ci * The driver sends configuration and managements command requests to the 158c2ecf20Sopenharmony_ci * firmware in the BE. These requests are communicated to the processor 168c2ecf20Sopenharmony_ci * using Work Request Blocks (WRBs) submitted to the MCC-WRB ring or via one 178c2ecf20Sopenharmony_ci * WRB inside a MAILBOX. 188c2ecf20Sopenharmony_ci * The commands are serviced by the ARM processor in the OneConnect's MPU. 198c2ecf20Sopenharmony_ci */ 208c2ecf20Sopenharmony_cistruct be_sge { 218c2ecf20Sopenharmony_ci __le32 pa_lo; 228c2ecf20Sopenharmony_ci __le32 pa_hi; 238c2ecf20Sopenharmony_ci __le32 len; 248c2ecf20Sopenharmony_ci}; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistruct be_mcc_wrb { 278c2ecf20Sopenharmony_ci u32 emb_sgecnt_special; /* dword 0 */ 288c2ecf20Sopenharmony_ci /* bits 0 - embedded */ 298c2ecf20Sopenharmony_ci /* bits 1 - 2 reserved */ 308c2ecf20Sopenharmony_ci /* bits 3 - 7 sge count */ 318c2ecf20Sopenharmony_ci /* bits 8 - 23 reserved */ 328c2ecf20Sopenharmony_ci /* bits 24 - 31 special */ 338c2ecf20Sopenharmony_ci#define MCC_WRB_EMBEDDED_MASK 1 348c2ecf20Sopenharmony_ci#define MCC_WRB_SGE_CNT_SHIFT 3 358c2ecf20Sopenharmony_ci#define MCC_WRB_SGE_CNT_MASK 0x1F 368c2ecf20Sopenharmony_ci u32 payload_length; /* dword 1 */ 378c2ecf20Sopenharmony_ci u32 tag0; /* dword 2 */ 388c2ecf20Sopenharmony_ci u32 tag1; /* dword 3 */ 398c2ecf20Sopenharmony_ci u32 rsvd; /* dword 4 */ 408c2ecf20Sopenharmony_ci union { 418c2ecf20Sopenharmony_ci#define EMBED_MBX_MAX_PAYLOAD_SIZE 220 428c2ecf20Sopenharmony_ci u8 embedded_payload[236]; /* used by embedded cmds */ 438c2ecf20Sopenharmony_ci struct be_sge sgl[19]; /* used by non-embedded cmds */ 448c2ecf20Sopenharmony_ci } payload; 458c2ecf20Sopenharmony_ci}; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define CQE_FLAGS_VALID_MASK (1 << 31) 488c2ecf20Sopenharmony_ci#define CQE_FLAGS_ASYNC_MASK (1 << 30) 498c2ecf20Sopenharmony_ci#define CQE_FLAGS_COMPLETED_MASK (1 << 28) 508c2ecf20Sopenharmony_ci#define CQE_FLAGS_CONSUMED_MASK (1 << 27) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* Completion Status */ 538c2ecf20Sopenharmony_ci#define MCC_STATUS_SUCCESS 0x0 548c2ecf20Sopenharmony_ci#define MCC_STATUS_FAILED 0x1 558c2ecf20Sopenharmony_ci#define MCC_STATUS_ILLEGAL_REQUEST 0x2 568c2ecf20Sopenharmony_ci#define MCC_STATUS_ILLEGAL_FIELD 0x3 578c2ecf20Sopenharmony_ci#define MCC_STATUS_INSUFFICIENT_BUFFER 0x4 588c2ecf20Sopenharmony_ci#define MCC_STATUS_INVALID_LENGTH 0x74 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define CQE_STATUS_COMPL_MASK 0xFFFF 618c2ecf20Sopenharmony_ci#define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ 628c2ecf20Sopenharmony_ci#define CQE_STATUS_EXTD_MASK 0xFFFF 638c2ecf20Sopenharmony_ci#define CQE_STATUS_EXTD_SHIFT 16 /* bits 31 - 16 */ 648c2ecf20Sopenharmony_ci#define CQE_STATUS_ADDL_MASK 0xFF00 658c2ecf20Sopenharmony_ci#define CQE_STATUS_ADDL_SHIFT 8 668c2ecf20Sopenharmony_ci#define CQE_STATUS_MASK 0xFF 678c2ecf20Sopenharmony_ci#define CQE_STATUS_WRB_MASK 0xFF0000 688c2ecf20Sopenharmony_ci#define CQE_STATUS_WRB_SHIFT 16 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#define BEISCSI_HOST_MBX_TIMEOUT (110 * 1000) 718c2ecf20Sopenharmony_ci#define BEISCSI_FW_MBX_TIMEOUT 100 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci/* MBOX Command VER */ 748c2ecf20Sopenharmony_ci#define MBX_CMD_VER1 0x01 758c2ecf20Sopenharmony_ci#define MBX_CMD_VER2 0x02 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_cistruct be_mcc_compl { 788c2ecf20Sopenharmony_ci u32 status; /* dword 0 */ 798c2ecf20Sopenharmony_ci u32 tag0; /* dword 1 */ 808c2ecf20Sopenharmony_ci u32 tag1; /* dword 2 */ 818c2ecf20Sopenharmony_ci u32 flags; /* dword 3 */ 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/********* Mailbox door bell *************/ 858c2ecf20Sopenharmony_ci/** 868c2ecf20Sopenharmony_ci * Used for driver communication with the FW. 878c2ecf20Sopenharmony_ci * The software must write this register twice to post any command. First, 888c2ecf20Sopenharmony_ci * it writes the register with hi=1 and the upper bits of the physical address 898c2ecf20Sopenharmony_ci * for the MAILBOX structure. Software must poll the ready bit until this 908c2ecf20Sopenharmony_ci * is acknowledged. Then, sotware writes the register with hi=0 with the lower 918c2ecf20Sopenharmony_ci * bits in the address. It must poll the ready bit until the command is 928c2ecf20Sopenharmony_ci * complete. Upon completion, the MAILBOX will contain a valid completion 938c2ecf20Sopenharmony_ci * queue entry. 948c2ecf20Sopenharmony_ci */ 958c2ecf20Sopenharmony_ci#define MPU_MAILBOX_DB_OFFSET 0x160 968c2ecf20Sopenharmony_ci#define MPU_MAILBOX_DB_RDY_MASK 0x1 /* bit 0 */ 978c2ecf20Sopenharmony_ci#define MPU_MAILBOX_DB_HI_MASK 0x2 /* bit 1 */ 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci/********** MPU semphore: used for SH & BE ******************/ 1008c2ecf20Sopenharmony_ci#define SLIPORT_SOFTRESET_OFFSET 0x5c /* CSR BAR offset */ 1018c2ecf20Sopenharmony_ci#define SLIPORT_SEMAPHORE_OFFSET_BEx 0xac /* CSR BAR offset */ 1028c2ecf20Sopenharmony_ci#define SLIPORT_SEMAPHORE_OFFSET_SH 0x94 /* PCI-CFG offset */ 1038c2ecf20Sopenharmony_ci#define POST_STAGE_MASK 0x0000FFFF 1048c2ecf20Sopenharmony_ci#define POST_ERROR_BIT 0x80000000 1058c2ecf20Sopenharmony_ci#define POST_ERR_RECOVERY_CODE_MASK 0xF000 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci/* Soft Reset register masks */ 1088c2ecf20Sopenharmony_ci#define SLIPORT_SOFTRESET_SR_MASK 0x00000080 /* SR bit */ 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci/* MPU semphore POST stage values */ 1118c2ecf20Sopenharmony_ci#define POST_STAGE_AWAITING_HOST_RDY 0x1 /* FW awaiting goahead from host */ 1128c2ecf20Sopenharmony_ci#define POST_STAGE_HOST_RDY 0x2 /* Host has given go-ahed to FW */ 1138c2ecf20Sopenharmony_ci#define POST_STAGE_BE_RESET 0x3 /* Host wants to reset chip */ 1148c2ecf20Sopenharmony_ci#define POST_STAGE_ARMFW_RDY 0xC000 /* FW is done with POST */ 1158c2ecf20Sopenharmony_ci#define POST_STAGE_RECOVERABLE_ERR 0xE000 /* Recoverable err detected */ 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci/********** MCC door bell ************/ 1188c2ecf20Sopenharmony_ci#define DB_MCCQ_OFFSET 0x140 1198c2ecf20Sopenharmony_ci#define DB_MCCQ_RING_ID_MASK 0xFFFF /* bits 0 - 15 */ 1208c2ecf20Sopenharmony_ci/* Number of entries posted */ 1218c2ecf20Sopenharmony_ci#define DB_MCCQ_NUM_POSTED_SHIFT 16 /* bits 16 - 29 */ 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci/** 1248c2ecf20Sopenharmony_ci * When the async bit of mcc_compl is set, the last 4 bytes of 1258c2ecf20Sopenharmony_ci * mcc_compl is interpreted as follows: 1268c2ecf20Sopenharmony_ci */ 1278c2ecf20Sopenharmony_ci#define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */ 1288c2ecf20Sopenharmony_ci#define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF 1298c2ecf20Sopenharmony_ci#define ASYNC_EVENT_CODE_LINK_STATE 0x1 1308c2ecf20Sopenharmony_ci#define ASYNC_EVENT_CODE_ISCSI 0x4 1318c2ecf20Sopenharmony_ci#define ASYNC_EVENT_CODE_SLI 0x11 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci#define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16 /* bits 16 - 23 */ 1348c2ecf20Sopenharmony_ci#define ASYNC_TRAILER_EVENT_TYPE_MASK 0xFF 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci/* iSCSI events */ 1378c2ecf20Sopenharmony_ci#define ASYNC_EVENT_NEW_ISCSI_TGT_DISC 0x4 1388c2ecf20Sopenharmony_ci#define ASYNC_EVENT_NEW_ISCSI_CONN 0x5 1398c2ecf20Sopenharmony_ci#define ASYNC_EVENT_NEW_TCP_CONN 0x7 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci/* SLI events */ 1428c2ecf20Sopenharmony_ci#define ASYNC_SLI_EVENT_TYPE_MISCONFIGURED 0x9 1438c2ecf20Sopenharmony_ci#define ASYNC_SLI_LINK_EFFECT_VALID(le) (le & 0x80) 1448c2ecf20Sopenharmony_ci#define ASYNC_SLI_LINK_EFFECT_SEV(le) ((le >> 1) & 0x03) 1458c2ecf20Sopenharmony_ci#define ASYNC_SLI_LINK_EFFECT_STATE(le) (le & 0x01) 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_cistruct be_async_event_trailer { 1488c2ecf20Sopenharmony_ci u32 code; 1498c2ecf20Sopenharmony_ci}; 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_cienum { 1528c2ecf20Sopenharmony_ci ASYNC_EVENT_LINK_DOWN = 0x0, 1538c2ecf20Sopenharmony_ci ASYNC_EVENT_LINK_UP = 0x1, 1548c2ecf20Sopenharmony_ci}; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci/** 1578c2ecf20Sopenharmony_ci * When the event code of an async trailer is link-state, the mcc_compl 1588c2ecf20Sopenharmony_ci * must be interpreted as follows 1598c2ecf20Sopenharmony_ci */ 1608c2ecf20Sopenharmony_cistruct be_async_event_link_state { 1618c2ecf20Sopenharmony_ci u8 physical_port; 1628c2ecf20Sopenharmony_ci u8 port_link_status; 1638c2ecf20Sopenharmony_ci/** 1648c2ecf20Sopenharmony_ci * ASYNC_EVENT_LINK_DOWN 0x0 1658c2ecf20Sopenharmony_ci * ASYNC_EVENT_LINK_UP 0x1 1668c2ecf20Sopenharmony_ci * ASYNC_EVENT_LINK_LOGICAL_DOWN 0x2 1678c2ecf20Sopenharmony_ci * ASYNC_EVENT_LINK_LOGICAL_UP 0x3 1688c2ecf20Sopenharmony_ci */ 1698c2ecf20Sopenharmony_ci#define BE_ASYNC_LINK_UP_MASK 0x01 1708c2ecf20Sopenharmony_ci u8 port_duplex; 1718c2ecf20Sopenharmony_ci u8 port_speed; 1728c2ecf20Sopenharmony_ci/* BE2ISCSI_LINK_SPEED_ZERO 0x00 - no link */ 1738c2ecf20Sopenharmony_ci#define BE2ISCSI_LINK_SPEED_10MBPS 0x01 1748c2ecf20Sopenharmony_ci#define BE2ISCSI_LINK_SPEED_100MBPS 0x02 1758c2ecf20Sopenharmony_ci#define BE2ISCSI_LINK_SPEED_1GBPS 0x03 1768c2ecf20Sopenharmony_ci#define BE2ISCSI_LINK_SPEED_10GBPS 0x04 1778c2ecf20Sopenharmony_ci#define BE2ISCSI_LINK_SPEED_25GBPS 0x06 1788c2ecf20Sopenharmony_ci#define BE2ISCSI_LINK_SPEED_40GBPS 0x07 1798c2ecf20Sopenharmony_ci u8 port_fault; 1808c2ecf20Sopenharmony_ci u8 event_reason; 1818c2ecf20Sopenharmony_ci u16 qos_link_speed; 1828c2ecf20Sopenharmony_ci u32 event_tag; 1838c2ecf20Sopenharmony_ci struct be_async_event_trailer trailer; 1848c2ecf20Sopenharmony_ci} __packed; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci/** 1878c2ecf20Sopenharmony_ci * When async-trailer is SLI event, mcc_compl is interpreted as 1888c2ecf20Sopenharmony_ci */ 1898c2ecf20Sopenharmony_cistruct be_async_event_sli { 1908c2ecf20Sopenharmony_ci u32 event_data1; 1918c2ecf20Sopenharmony_ci u32 event_data2; 1928c2ecf20Sopenharmony_ci u32 reserved; 1938c2ecf20Sopenharmony_ci u32 trailer; 1948c2ecf20Sopenharmony_ci} __packed; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_cistruct be_mcc_mailbox { 1978c2ecf20Sopenharmony_ci struct be_mcc_wrb wrb; 1988c2ecf20Sopenharmony_ci struct be_mcc_compl compl; 1998c2ecf20Sopenharmony_ci}; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* Type of subsystems supported by FW */ 2028c2ecf20Sopenharmony_ci#define CMD_SUBSYSTEM_COMMON 0x1 2038c2ecf20Sopenharmony_ci#define CMD_SUBSYSTEM_ISCSI 0x2 2048c2ecf20Sopenharmony_ci#define CMD_SUBSYSTEM_ETH 0x3 2058c2ecf20Sopenharmony_ci#define CMD_SUBSYSTEM_ISCSI_INI 0x6 2068c2ecf20Sopenharmony_ci#define CMD_COMMON_TCP_UPLOAD 0x1 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci/** 2098c2ecf20Sopenharmony_ci * List of common opcodes subsystem CMD_SUBSYSTEM_COMMON 2108c2ecf20Sopenharmony_ci * These opcodes are unique for each subsystem defined above 2118c2ecf20Sopenharmony_ci */ 2128c2ecf20Sopenharmony_ci#define OPCODE_COMMON_CQ_CREATE 12 2138c2ecf20Sopenharmony_ci#define OPCODE_COMMON_EQ_CREATE 13 2148c2ecf20Sopenharmony_ci#define OPCODE_COMMON_MCC_CREATE 21 2158c2ecf20Sopenharmony_ci#define OPCODE_COMMON_MCC_CREATE_EXT 90 2168c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ADD_TEMPLATE_HEADER_BUFFERS 24 2178c2ecf20Sopenharmony_ci#define OPCODE_COMMON_REMOVE_TEMPLATE_HEADER_BUFFERS 25 2188c2ecf20Sopenharmony_ci#define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32 2198c2ecf20Sopenharmony_ci#define OPCODE_COMMON_GET_FW_VERSION 35 2208c2ecf20Sopenharmony_ci#define OPCODE_COMMON_MODIFY_EQ_DELAY 41 2218c2ecf20Sopenharmony_ci#define OPCODE_COMMON_FIRMWARE_CONFIG 42 2228c2ecf20Sopenharmony_ci#define OPCODE_COMMON_MCC_DESTROY 53 2238c2ecf20Sopenharmony_ci#define OPCODE_COMMON_CQ_DESTROY 54 2248c2ecf20Sopenharmony_ci#define OPCODE_COMMON_EQ_DESTROY 55 2258c2ecf20Sopenharmony_ci#define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58 2268c2ecf20Sopenharmony_ci#define OPCODE_COMMON_FUNCTION_RESET 61 2278c2ecf20Sopenharmony_ci#define OPCODE_COMMON_GET_PORT_NAME 77 2288c2ecf20Sopenharmony_ci#define OPCODE_COMMON_SET_HOST_DATA 93 2298c2ecf20Sopenharmony_ci#define OPCODE_COMMON_SET_FEATURES 191 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci/** 2328c2ecf20Sopenharmony_ci * LIST of opcodes that are common between Initiator and Target 2338c2ecf20Sopenharmony_ci * used by CMD_SUBSYSTEM_ISCSI 2348c2ecf20Sopenharmony_ci * These opcodes are unique for each subsystem defined above 2358c2ecf20Sopenharmony_ci */ 2368c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES 2 2378c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES 3 2388c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG 7 2398c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN 14 2408c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR 17 2418c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_NTWK_REL_STATELESS_IP_ADDR 18 2428c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR 21 2438c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY 22 2448c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23 2458c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID 24 2468c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO 25 2478c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61 2488c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64 2498c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65 2508c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_WRBQ_CREATE 66 2518c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_WRBQ_DESTROY 67 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_cistruct be_cmd_req_hdr { 2548c2ecf20Sopenharmony_ci u8 opcode; /* dword 0 */ 2558c2ecf20Sopenharmony_ci u8 subsystem; /* dword 0 */ 2568c2ecf20Sopenharmony_ci u8 port_number; /* dword 0 */ 2578c2ecf20Sopenharmony_ci u8 domain; /* dword 0 */ 2588c2ecf20Sopenharmony_ci u32 timeout; /* dword 1 */ 2598c2ecf20Sopenharmony_ci u32 request_length; /* dword 2 */ 2608c2ecf20Sopenharmony_ci u8 version; /* dword 3 */ 2618c2ecf20Sopenharmony_ci u8 rsvd0[3]; /* dword 3 */ 2628c2ecf20Sopenharmony_ci}; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_cistruct be_cmd_resp_hdr { 2658c2ecf20Sopenharmony_ci u32 info; /* dword 0 */ 2668c2ecf20Sopenharmony_ci u32 status; /* dword 1 */ 2678c2ecf20Sopenharmony_ci u32 response_length; /* dword 2 */ 2688c2ecf20Sopenharmony_ci u32 actual_resp_len; /* dword 3 */ 2698c2ecf20Sopenharmony_ci}; 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_cistruct phys_addr { 2728c2ecf20Sopenharmony_ci u32 lo; 2738c2ecf20Sopenharmony_ci u32 hi; 2748c2ecf20Sopenharmony_ci}; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_cistruct virt_addr { 2778c2ecf20Sopenharmony_ci u32 lo; 2788c2ecf20Sopenharmony_ci u32 hi; 2798c2ecf20Sopenharmony_ci}; 2808c2ecf20Sopenharmony_ci/************************** 2818c2ecf20Sopenharmony_ci * BE Command definitions * 2828c2ecf20Sopenharmony_ci **************************/ 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci/** 2858c2ecf20Sopenharmony_ci * Pseudo amap definition in which each bit of the actual structure is defined 2868c2ecf20Sopenharmony_ci * as a byte - used to calculate offset/shift/mask of each field 2878c2ecf20Sopenharmony_ci */ 2888c2ecf20Sopenharmony_cistruct amap_eq_context { 2898c2ecf20Sopenharmony_ci u8 cidx[13]; /* dword 0 */ 2908c2ecf20Sopenharmony_ci u8 rsvd0[3]; /* dword 0 */ 2918c2ecf20Sopenharmony_ci u8 epidx[13]; /* dword 0 */ 2928c2ecf20Sopenharmony_ci u8 valid; /* dword 0 */ 2938c2ecf20Sopenharmony_ci u8 rsvd1; /* dword 0 */ 2948c2ecf20Sopenharmony_ci u8 size; /* dword 0 */ 2958c2ecf20Sopenharmony_ci u8 pidx[13]; /* dword 1 */ 2968c2ecf20Sopenharmony_ci u8 rsvd2[3]; /* dword 1 */ 2978c2ecf20Sopenharmony_ci u8 pd[10]; /* dword 1 */ 2988c2ecf20Sopenharmony_ci u8 count[3]; /* dword 1 */ 2998c2ecf20Sopenharmony_ci u8 solevent; /* dword 1 */ 3008c2ecf20Sopenharmony_ci u8 stalled; /* dword 1 */ 3018c2ecf20Sopenharmony_ci u8 armed; /* dword 1 */ 3028c2ecf20Sopenharmony_ci u8 rsvd3[4]; /* dword 2 */ 3038c2ecf20Sopenharmony_ci u8 func[8]; /* dword 2 */ 3048c2ecf20Sopenharmony_ci u8 rsvd4; /* dword 2 */ 3058c2ecf20Sopenharmony_ci u8 delaymult[10]; /* dword 2 */ 3068c2ecf20Sopenharmony_ci u8 rsvd5[2]; /* dword 2 */ 3078c2ecf20Sopenharmony_ci u8 phase[2]; /* dword 2 */ 3088c2ecf20Sopenharmony_ci u8 nodelay; /* dword 2 */ 3098c2ecf20Sopenharmony_ci u8 rsvd6[4]; /* dword 2 */ 3108c2ecf20Sopenharmony_ci u8 rsvd7[32]; /* dword 3 */ 3118c2ecf20Sopenharmony_ci} __packed; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_cistruct be_cmd_req_eq_create { 3148c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; /* dw[4] */ 3158c2ecf20Sopenharmony_ci u16 num_pages; /* sword */ 3168c2ecf20Sopenharmony_ci u16 rsvd0; /* sword */ 3178c2ecf20Sopenharmony_ci u8 context[sizeof(struct amap_eq_context) / 8]; /* dw[4] */ 3188c2ecf20Sopenharmony_ci struct phys_addr pages[8]; 3198c2ecf20Sopenharmony_ci} __packed; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_cistruct be_cmd_resp_eq_create { 3228c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr resp_hdr; 3238c2ecf20Sopenharmony_ci u16 eq_id; /* sword */ 3248c2ecf20Sopenharmony_ci u16 rsvd0; /* sword */ 3258c2ecf20Sopenharmony_ci} __packed; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_cistruct be_set_eqd { 3288c2ecf20Sopenharmony_ci u32 eq_id; 3298c2ecf20Sopenharmony_ci u32 phase; 3308c2ecf20Sopenharmony_ci u32 delay_multiplier; 3318c2ecf20Sopenharmony_ci} __packed; 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_cistruct mgmt_chap_format { 3348c2ecf20Sopenharmony_ci u32 flags; 3358c2ecf20Sopenharmony_ci u8 intr_chap_name[256]; 3368c2ecf20Sopenharmony_ci u8 intr_secret[16]; 3378c2ecf20Sopenharmony_ci u8 target_chap_name[256]; 3388c2ecf20Sopenharmony_ci u8 target_secret[16]; 3398c2ecf20Sopenharmony_ci u16 intr_chap_name_length; 3408c2ecf20Sopenharmony_ci u16 intr_secret_length; 3418c2ecf20Sopenharmony_ci u16 target_chap_name_length; 3428c2ecf20Sopenharmony_ci u16 target_secret_length; 3438c2ecf20Sopenharmony_ci} __packed; 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_cistruct mgmt_auth_method_format { 3468c2ecf20Sopenharmony_ci u8 auth_method_type; 3478c2ecf20Sopenharmony_ci u8 padding[3]; 3488c2ecf20Sopenharmony_ci struct mgmt_chap_format chap; 3498c2ecf20Sopenharmony_ci} __packed; 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_cistruct be_cmd_req_logout_fw_sess { 3528c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; /* dw[4] */ 3538c2ecf20Sopenharmony_ci uint32_t session_handle; 3548c2ecf20Sopenharmony_ci} __packed; 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_cistruct be_cmd_resp_logout_fw_sess { 3578c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr hdr; /* dw[4] */ 3588c2ecf20Sopenharmony_ci uint32_t session_status; 3598c2ecf20Sopenharmony_ci#define BE_SESS_STATUS_CLOSE 0x20 3608c2ecf20Sopenharmony_ci} __packed; 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_cistruct mgmt_conn_login_options { 3638c2ecf20Sopenharmony_ci u8 flags; 3648c2ecf20Sopenharmony_ci u8 header_digest; 3658c2ecf20Sopenharmony_ci u8 data_digest; 3668c2ecf20Sopenharmony_ci u8 rsvd0; 3678c2ecf20Sopenharmony_ci u32 max_recv_datasegment_len_ini; 3688c2ecf20Sopenharmony_ci u32 max_recv_datasegment_len_tgt; 3698c2ecf20Sopenharmony_ci u32 tcp_mss; 3708c2ecf20Sopenharmony_ci u32 tcp_window_size; 3718c2ecf20Sopenharmony_ci struct mgmt_auth_method_format auth_data; 3728c2ecf20Sopenharmony_ci} __packed; 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_cistruct ip_addr_format { 3758c2ecf20Sopenharmony_ci u16 size_of_structure; 3768c2ecf20Sopenharmony_ci u8 reserved; 3778c2ecf20Sopenharmony_ci u8 ip_type; 3788c2ecf20Sopenharmony_ci#define BEISCSI_IP_TYPE_V4 0x1 3798c2ecf20Sopenharmony_ci#define BEISCSI_IP_TYPE_STATIC_V4 0x3 3808c2ecf20Sopenharmony_ci#define BEISCSI_IP_TYPE_DHCP_V4 0x5 3818c2ecf20Sopenharmony_ci/* type v4 values < type v6 values */ 3828c2ecf20Sopenharmony_ci#define BEISCSI_IP_TYPE_V6 0x10 3838c2ecf20Sopenharmony_ci#define BEISCSI_IP_TYPE_ROUTABLE_V6 0x30 3848c2ecf20Sopenharmony_ci#define BEISCSI_IP_TYPE_LINK_LOCAL_V6 0x50 3858c2ecf20Sopenharmony_ci#define BEISCSI_IP_TYPE_AUTO_V6 0x90 3868c2ecf20Sopenharmony_ci u8 addr[16]; 3878c2ecf20Sopenharmony_ci u32 rsvd0; 3888c2ecf20Sopenharmony_ci} __packed; 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_cistruct mgmt_conn_info { 3918c2ecf20Sopenharmony_ci u32 connection_handle; 3928c2ecf20Sopenharmony_ci u32 connection_status; 3938c2ecf20Sopenharmony_ci u16 src_port; 3948c2ecf20Sopenharmony_ci u16 dest_port; 3958c2ecf20Sopenharmony_ci u16 dest_port_redirected; 3968c2ecf20Sopenharmony_ci u16 cid; 3978c2ecf20Sopenharmony_ci u32 estimated_throughput; 3988c2ecf20Sopenharmony_ci struct ip_addr_format src_ipaddr; 3998c2ecf20Sopenharmony_ci struct ip_addr_format dest_ipaddr; 4008c2ecf20Sopenharmony_ci struct ip_addr_format dest_ipaddr_redirected; 4018c2ecf20Sopenharmony_ci struct mgmt_conn_login_options negotiated_login_options; 4028c2ecf20Sopenharmony_ci} __packed; 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_cistruct mgmt_session_login_options { 4058c2ecf20Sopenharmony_ci u8 flags; 4068c2ecf20Sopenharmony_ci u8 error_recovery_level; 4078c2ecf20Sopenharmony_ci u16 rsvd0; 4088c2ecf20Sopenharmony_ci u32 first_burst_length; 4098c2ecf20Sopenharmony_ci u32 max_burst_length; 4108c2ecf20Sopenharmony_ci u16 max_connections; 4118c2ecf20Sopenharmony_ci u16 max_outstanding_r2t; 4128c2ecf20Sopenharmony_ci u16 default_time2wait; 4138c2ecf20Sopenharmony_ci u16 default_time2retain; 4148c2ecf20Sopenharmony_ci} __packed; 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_cistruct mgmt_session_info { 4178c2ecf20Sopenharmony_ci u32 session_handle; 4188c2ecf20Sopenharmony_ci u32 status; 4198c2ecf20Sopenharmony_ci u8 isid[6]; 4208c2ecf20Sopenharmony_ci u16 tsih; 4218c2ecf20Sopenharmony_ci u32 session_flags; 4228c2ecf20Sopenharmony_ci u16 conn_count; 4238c2ecf20Sopenharmony_ci u16 pad; 4248c2ecf20Sopenharmony_ci u8 target_name[224]; 4258c2ecf20Sopenharmony_ci u8 initiator_iscsiname[224]; 4268c2ecf20Sopenharmony_ci struct mgmt_session_login_options negotiated_login_options; 4278c2ecf20Sopenharmony_ci struct mgmt_conn_info conn_list[1]; 4288c2ecf20Sopenharmony_ci} __packed; 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_cistruct be_cmd_get_session_req { 4318c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 4328c2ecf20Sopenharmony_ci u32 session_handle; 4338c2ecf20Sopenharmony_ci} __packed; 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_cistruct be_cmd_get_session_resp { 4368c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr hdr; 4378c2ecf20Sopenharmony_ci struct mgmt_session_info session_info; 4388c2ecf20Sopenharmony_ci} __packed; 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_cistruct mac_addr { 4418c2ecf20Sopenharmony_ci u16 size_of_structure; 4428c2ecf20Sopenharmony_ci u8 addr[ETH_ALEN]; 4438c2ecf20Sopenharmony_ci} __packed; 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_cistruct be_cmd_get_boot_target_req { 4468c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 4478c2ecf20Sopenharmony_ci} __packed; 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_cistruct be_cmd_get_boot_target_resp { 4508c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr hdr; 4518c2ecf20Sopenharmony_ci u32 boot_session_count; 4528c2ecf20Sopenharmony_ci u32 boot_session_handle; 4538c2ecf20Sopenharmony_ci/** 4548c2ecf20Sopenharmony_ci * FW returns 0xffffffff if it couldn't establish connection with 4558c2ecf20Sopenharmony_ci * configured boot target. 4568c2ecf20Sopenharmony_ci */ 4578c2ecf20Sopenharmony_ci#define BE_BOOT_INVALID_SHANDLE 0xffffffff 4588c2ecf20Sopenharmony_ci}; 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_cistruct be_cmd_reopen_session_req { 4618c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 4628c2ecf20Sopenharmony_ci#define BE_REOPEN_ALL_SESSIONS 0x00 4638c2ecf20Sopenharmony_ci#define BE_REOPEN_BOOT_SESSIONS 0x01 4648c2ecf20Sopenharmony_ci#define BE_REOPEN_A_SESSION 0x02 4658c2ecf20Sopenharmony_ci u16 reopen_type; 4668c2ecf20Sopenharmony_ci u16 rsvd; 4678c2ecf20Sopenharmony_ci u32 session_handle; 4688c2ecf20Sopenharmony_ci} __packed; 4698c2ecf20Sopenharmony_ci 4708c2ecf20Sopenharmony_cistruct be_cmd_reopen_session_resp { 4718c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr hdr; 4728c2ecf20Sopenharmony_ci u32 rsvd; 4738c2ecf20Sopenharmony_ci u32 session_handle; 4748c2ecf20Sopenharmony_ci} __packed; 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_cistruct be_cmd_mac_query_req { 4788c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 4798c2ecf20Sopenharmony_ci u8 type; 4808c2ecf20Sopenharmony_ci u8 permanent; 4818c2ecf20Sopenharmony_ci u16 if_id; 4828c2ecf20Sopenharmony_ci} __packed; 4838c2ecf20Sopenharmony_ci 4848c2ecf20Sopenharmony_cistruct be_cmd_get_mac_resp { 4858c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr hdr; 4868c2ecf20Sopenharmony_ci struct mac_addr mac; 4878c2ecf20Sopenharmony_ci}; 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_cistruct be_ip_addr_subnet_format { 4908c2ecf20Sopenharmony_ci u16 size_of_structure; 4918c2ecf20Sopenharmony_ci u8 ip_type; 4928c2ecf20Sopenharmony_ci u8 ipv6_prefix_length; 4938c2ecf20Sopenharmony_ci u8 addr[16]; 4948c2ecf20Sopenharmony_ci u8 subnet_mask[16]; 4958c2ecf20Sopenharmony_ci u32 rsvd0; 4968c2ecf20Sopenharmony_ci} __packed; 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_cistruct be_cmd_get_if_info_req { 4998c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 5008c2ecf20Sopenharmony_ci u32 interface_hndl; 5018c2ecf20Sopenharmony_ci u32 ip_type; 5028c2ecf20Sopenharmony_ci} __packed; 5038c2ecf20Sopenharmony_ci 5048c2ecf20Sopenharmony_cistruct be_cmd_get_if_info_resp { 5058c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 5068c2ecf20Sopenharmony_ci u32 interface_hndl; 5078c2ecf20Sopenharmony_ci u32 vlan_priority; 5088c2ecf20Sopenharmony_ci u32 ip_addr_count; 5098c2ecf20Sopenharmony_ci u32 dhcp_state; 5108c2ecf20Sopenharmony_ci struct be_ip_addr_subnet_format ip_addr; 5118c2ecf20Sopenharmony_ci} __packed; 5128c2ecf20Sopenharmony_ci 5138c2ecf20Sopenharmony_cistruct be_ip_addr_record { 5148c2ecf20Sopenharmony_ci u32 action; 5158c2ecf20Sopenharmony_ci u32 interface_hndl; 5168c2ecf20Sopenharmony_ci struct be_ip_addr_subnet_format ip_addr; 5178c2ecf20Sopenharmony_ci u32 status; 5188c2ecf20Sopenharmony_ci} __packed; 5198c2ecf20Sopenharmony_ci 5208c2ecf20Sopenharmony_cistruct be_ip_addr_record_params { 5218c2ecf20Sopenharmony_ci u32 record_entry_count; 5228c2ecf20Sopenharmony_ci struct be_ip_addr_record ip_record; 5238c2ecf20Sopenharmony_ci} __packed; 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_cistruct be_cmd_set_ip_addr_req { 5268c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 5278c2ecf20Sopenharmony_ci struct be_ip_addr_record_params ip_params; 5288c2ecf20Sopenharmony_ci} __packed; 5298c2ecf20Sopenharmony_ci 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_cistruct be_cmd_set_dhcp_req { 5328c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 5338c2ecf20Sopenharmony_ci u32 interface_hndl; 5348c2ecf20Sopenharmony_ci u32 ip_type; 5358c2ecf20Sopenharmony_ci u32 flags; 5368c2ecf20Sopenharmony_ci u32 retry_count; 5378c2ecf20Sopenharmony_ci} __packed; 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_cistruct be_cmd_rel_dhcp_req { 5408c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 5418c2ecf20Sopenharmony_ci u32 interface_hndl; 5428c2ecf20Sopenharmony_ci u32 ip_type; 5438c2ecf20Sopenharmony_ci} __packed; 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_cistruct be_cmd_set_def_gateway_req { 5468c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 5478c2ecf20Sopenharmony_ci u32 action; 5488c2ecf20Sopenharmony_ci struct ip_addr_format ip_addr; 5498c2ecf20Sopenharmony_ci} __packed; 5508c2ecf20Sopenharmony_ci 5518c2ecf20Sopenharmony_cistruct be_cmd_get_def_gateway_req { 5528c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 5538c2ecf20Sopenharmony_ci u32 ip_type; 5548c2ecf20Sopenharmony_ci} __packed; 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_cistruct be_cmd_get_def_gateway_resp { 5578c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 5588c2ecf20Sopenharmony_ci struct ip_addr_format ip_addr; 5598c2ecf20Sopenharmony_ci} __packed; 5608c2ecf20Sopenharmony_ci 5618c2ecf20Sopenharmony_ci#define BEISCSI_VLAN_DISABLE 0xFFFF 5628c2ecf20Sopenharmony_cistruct be_cmd_set_vlan_req { 5638c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 5648c2ecf20Sopenharmony_ci u32 interface_hndl; 5658c2ecf20Sopenharmony_ci u32 vlan_priority; 5668c2ecf20Sopenharmony_ci} __packed; 5678c2ecf20Sopenharmony_ci/******************** Create CQ ***************************/ 5688c2ecf20Sopenharmony_ci/** 5698c2ecf20Sopenharmony_ci * Pseudo amap definition in which each bit of the actual structure is defined 5708c2ecf20Sopenharmony_ci * as a byte - used to calculate offset/shift/mask of each field 5718c2ecf20Sopenharmony_ci */ 5728c2ecf20Sopenharmony_cistruct amap_cq_context { 5738c2ecf20Sopenharmony_ci u8 cidx[11]; /* dword 0 */ 5748c2ecf20Sopenharmony_ci u8 rsvd0; /* dword 0 */ 5758c2ecf20Sopenharmony_ci u8 coalescwm[2]; /* dword 0 */ 5768c2ecf20Sopenharmony_ci u8 nodelay; /* dword 0 */ 5778c2ecf20Sopenharmony_ci u8 epidx[11]; /* dword 0 */ 5788c2ecf20Sopenharmony_ci u8 rsvd1; /* dword 0 */ 5798c2ecf20Sopenharmony_ci u8 count[2]; /* dword 0 */ 5808c2ecf20Sopenharmony_ci u8 valid; /* dword 0 */ 5818c2ecf20Sopenharmony_ci u8 solevent; /* dword 0 */ 5828c2ecf20Sopenharmony_ci u8 eventable; /* dword 0 */ 5838c2ecf20Sopenharmony_ci u8 pidx[11]; /* dword 1 */ 5848c2ecf20Sopenharmony_ci u8 rsvd2; /* dword 1 */ 5858c2ecf20Sopenharmony_ci u8 pd[10]; /* dword 1 */ 5868c2ecf20Sopenharmony_ci u8 eqid[8]; /* dword 1 */ 5878c2ecf20Sopenharmony_ci u8 stalled; /* dword 1 */ 5888c2ecf20Sopenharmony_ci u8 armed; /* dword 1 */ 5898c2ecf20Sopenharmony_ci u8 rsvd3[4]; /* dword 2 */ 5908c2ecf20Sopenharmony_ci u8 func[8]; /* dword 2 */ 5918c2ecf20Sopenharmony_ci u8 rsvd4[20]; /* dword 2 */ 5928c2ecf20Sopenharmony_ci u8 rsvd5[32]; /* dword 3 */ 5938c2ecf20Sopenharmony_ci} __packed; 5948c2ecf20Sopenharmony_ci 5958c2ecf20Sopenharmony_cistruct amap_cq_context_v2 { 5968c2ecf20Sopenharmony_ci u8 rsvd0[12]; /* dword 0 */ 5978c2ecf20Sopenharmony_ci u8 coalescwm[2]; /* dword 0 */ 5988c2ecf20Sopenharmony_ci u8 nodelay; /* dword 0 */ 5998c2ecf20Sopenharmony_ci u8 rsvd1[12]; /* dword 0 */ 6008c2ecf20Sopenharmony_ci u8 count[2]; /* dword 0 */ 6018c2ecf20Sopenharmony_ci u8 valid; /* dword 0 */ 6028c2ecf20Sopenharmony_ci u8 rsvd2; /* dword 0 */ 6038c2ecf20Sopenharmony_ci u8 eventable; /* dword 0 */ 6048c2ecf20Sopenharmony_ci u8 eqid[16]; /* dword 1 */ 6058c2ecf20Sopenharmony_ci u8 rsvd3[15]; /* dword 1 */ 6068c2ecf20Sopenharmony_ci u8 armed; /* dword 1 */ 6078c2ecf20Sopenharmony_ci u8 cqecount[16];/* dword 2 */ 6088c2ecf20Sopenharmony_ci u8 rsvd4[16]; /* dword 2 */ 6098c2ecf20Sopenharmony_ci u8 rsvd5[32]; /* dword 3 */ 6108c2ecf20Sopenharmony_ci}; 6118c2ecf20Sopenharmony_ci 6128c2ecf20Sopenharmony_cistruct be_cmd_req_cq_create { 6138c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 6148c2ecf20Sopenharmony_ci u16 num_pages; 6158c2ecf20Sopenharmony_ci u8 page_size; 6168c2ecf20Sopenharmony_ci u8 rsvd0; 6178c2ecf20Sopenharmony_ci u8 context[sizeof(struct amap_cq_context) / 8]; 6188c2ecf20Sopenharmony_ci struct phys_addr pages[4]; 6198c2ecf20Sopenharmony_ci} __packed; 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_cistruct be_cmd_resp_cq_create { 6228c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr hdr; 6238c2ecf20Sopenharmony_ci u16 cq_id; 6248c2ecf20Sopenharmony_ci u16 rsvd0; 6258c2ecf20Sopenharmony_ci} __packed; 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci/******************** Create MCCQ ***************************/ 6288c2ecf20Sopenharmony_ci/** 6298c2ecf20Sopenharmony_ci * Pseudo amap definition in which each bit of the actual structure is defined 6308c2ecf20Sopenharmony_ci * as a byte - used to calculate offset/shift/mask of each field 6318c2ecf20Sopenharmony_ci */ 6328c2ecf20Sopenharmony_cistruct amap_mcc_context { 6338c2ecf20Sopenharmony_ci u8 con_index[14]; 6348c2ecf20Sopenharmony_ci u8 rsvd0[2]; 6358c2ecf20Sopenharmony_ci u8 ring_size[4]; 6368c2ecf20Sopenharmony_ci u8 fetch_wrb; 6378c2ecf20Sopenharmony_ci u8 fetch_r2t; 6388c2ecf20Sopenharmony_ci u8 cq_id[10]; 6398c2ecf20Sopenharmony_ci u8 prod_index[14]; 6408c2ecf20Sopenharmony_ci u8 fid[8]; 6418c2ecf20Sopenharmony_ci u8 pdid[9]; 6428c2ecf20Sopenharmony_ci u8 valid; 6438c2ecf20Sopenharmony_ci u8 rsvd1[32]; 6448c2ecf20Sopenharmony_ci u8 rsvd2[32]; 6458c2ecf20Sopenharmony_ci} __packed; 6468c2ecf20Sopenharmony_ci 6478c2ecf20Sopenharmony_cistruct be_cmd_req_mcc_create_ext { 6488c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 6498c2ecf20Sopenharmony_ci u16 num_pages; 6508c2ecf20Sopenharmony_ci u16 rsvd0; 6518c2ecf20Sopenharmony_ci u32 async_evt_bitmap; 6528c2ecf20Sopenharmony_ci u8 context[sizeof(struct amap_mcc_context) / 8]; 6538c2ecf20Sopenharmony_ci struct phys_addr pages[8]; 6548c2ecf20Sopenharmony_ci} __packed; 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_cistruct be_cmd_resp_mcc_create { 6578c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr hdr; 6588c2ecf20Sopenharmony_ci u16 id; 6598c2ecf20Sopenharmony_ci u16 rsvd0; 6608c2ecf20Sopenharmony_ci} __packed; 6618c2ecf20Sopenharmony_ci 6628c2ecf20Sopenharmony_ci/******************** Q Destroy ***************************/ 6638c2ecf20Sopenharmony_ci/* Type of Queue to be destroyed */ 6648c2ecf20Sopenharmony_cienum { 6658c2ecf20Sopenharmony_ci QTYPE_EQ = 1, 6668c2ecf20Sopenharmony_ci QTYPE_CQ, 6678c2ecf20Sopenharmony_ci QTYPE_MCCQ, 6688c2ecf20Sopenharmony_ci QTYPE_WRBQ, 6698c2ecf20Sopenharmony_ci QTYPE_DPDUQ, 6708c2ecf20Sopenharmony_ci QTYPE_SGL 6718c2ecf20Sopenharmony_ci}; 6728c2ecf20Sopenharmony_ci 6738c2ecf20Sopenharmony_cistruct be_cmd_req_q_destroy { 6748c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 6758c2ecf20Sopenharmony_ci u16 id; 6768c2ecf20Sopenharmony_ci u16 bypass_flush; /* valid only for rx q destroy */ 6778c2ecf20Sopenharmony_ci} __packed; 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_cistruct macaddr { 6808c2ecf20Sopenharmony_ci u8 byte[ETH_ALEN]; 6818c2ecf20Sopenharmony_ci}; 6828c2ecf20Sopenharmony_ci 6838c2ecf20Sopenharmony_cistruct be_cmd_req_mcast_mac_config { 6848c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 6858c2ecf20Sopenharmony_ci u16 num_mac; 6868c2ecf20Sopenharmony_ci u8 promiscuous; 6878c2ecf20Sopenharmony_ci u8 interface_id; 6888c2ecf20Sopenharmony_ci struct macaddr mac[32]; 6898c2ecf20Sopenharmony_ci} __packed; 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_cistatic inline void *embedded_payload(struct be_mcc_wrb *wrb) 6928c2ecf20Sopenharmony_ci{ 6938c2ecf20Sopenharmony_ci return wrb->payload.embedded_payload; 6948c2ecf20Sopenharmony_ci} 6958c2ecf20Sopenharmony_ci 6968c2ecf20Sopenharmony_cistatic inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb) 6978c2ecf20Sopenharmony_ci{ 6988c2ecf20Sopenharmony_ci return &wrb->payload.sgl[0]; 6998c2ecf20Sopenharmony_ci} 7008c2ecf20Sopenharmony_ci 7018c2ecf20Sopenharmony_ci/******************** Modify EQ Delay *******************/ 7028c2ecf20Sopenharmony_cistruct be_cmd_req_modify_eq_delay { 7038c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 7048c2ecf20Sopenharmony_ci __le32 num_eq; 7058c2ecf20Sopenharmony_ci struct { 7068c2ecf20Sopenharmony_ci __le32 eq_id; 7078c2ecf20Sopenharmony_ci __le32 phase; 7088c2ecf20Sopenharmony_ci __le32 delay_multiplier; 7098c2ecf20Sopenharmony_ci } delay[MAX_CPUS]; 7108c2ecf20Sopenharmony_ci} __packed; 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_ci/******************** Get MAC ADDR *******************/ 7138c2ecf20Sopenharmony_ci 7148c2ecf20Sopenharmony_cistruct be_cmd_get_nic_conf_resp { 7158c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr hdr; 7168c2ecf20Sopenharmony_ci u32 nic_port_count; 7178c2ecf20Sopenharmony_ci u32 speed; 7188c2ecf20Sopenharmony_ci u32 max_speed; 7198c2ecf20Sopenharmony_ci u32 link_state; 7208c2ecf20Sopenharmony_ci u32 max_frame_size; 7218c2ecf20Sopenharmony_ci u16 size_of_structure; 7228c2ecf20Sopenharmony_ci u8 mac_address[ETH_ALEN]; 7238c2ecf20Sopenharmony_ci} __packed; 7248c2ecf20Sopenharmony_ci 7258c2ecf20Sopenharmony_ci/******************** Get HBA NAME *******************/ 7268c2ecf20Sopenharmony_ci 7278c2ecf20Sopenharmony_cistruct be_cmd_hba_name { 7288c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 7298c2ecf20Sopenharmony_ci u16 flags; 7308c2ecf20Sopenharmony_ci u16 rsvd0; 7318c2ecf20Sopenharmony_ci u8 initiator_name[ISCSI_NAME_LEN]; 7328c2ecf20Sopenharmony_ci#define BE_INI_ALIAS_LEN 32 7338c2ecf20Sopenharmony_ci u8 initiator_alias[BE_INI_ALIAS_LEN]; 7348c2ecf20Sopenharmony_ci} __packed; 7358c2ecf20Sopenharmony_ci 7368c2ecf20Sopenharmony_ci/******************** COMMON SET HOST DATA *******************/ 7378c2ecf20Sopenharmony_ci#define BE_CMD_SET_HOST_PARAM_ID 0x2 7388c2ecf20Sopenharmony_ci#define BE_CMD_MAX_DRV_VERSION 0x30 7398c2ecf20Sopenharmony_cistruct be_sethost_req { 7408c2ecf20Sopenharmony_ci u32 param_id; 7418c2ecf20Sopenharmony_ci u32 param_len; 7428c2ecf20Sopenharmony_ci u32 param_data[32]; 7438c2ecf20Sopenharmony_ci}; 7448c2ecf20Sopenharmony_ci 7458c2ecf20Sopenharmony_cistruct be_sethost_resp { 7468c2ecf20Sopenharmony_ci u32 rsvd0; 7478c2ecf20Sopenharmony_ci}; 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_cistruct be_cmd_set_host_data { 7508c2ecf20Sopenharmony_ci union { 7518c2ecf20Sopenharmony_ci struct be_cmd_req_hdr req_hdr; 7528c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr resp_hdr; 7538c2ecf20Sopenharmony_ci } h; 7548c2ecf20Sopenharmony_ci union { 7558c2ecf20Sopenharmony_ci struct be_sethost_req req; 7568c2ecf20Sopenharmony_ci struct be_sethost_resp resp; 7578c2ecf20Sopenharmony_ci } param; 7588c2ecf20Sopenharmony_ci} __packed; 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_ci/******************** COMMON SET Features *******************/ 7618c2ecf20Sopenharmony_ci#define BE_CMD_SET_FEATURE_UER 0x10 7628c2ecf20Sopenharmony_ci#define BE_CMD_UER_SUPP_BIT 0x1 7638c2ecf20Sopenharmony_cistruct be_uer_req { 7648c2ecf20Sopenharmony_ci u32 uer; 7658c2ecf20Sopenharmony_ci u32 rsvd; 7668c2ecf20Sopenharmony_ci}; 7678c2ecf20Sopenharmony_ci 7688c2ecf20Sopenharmony_cistruct be_uer_resp { 7698c2ecf20Sopenharmony_ci u32 uer; 7708c2ecf20Sopenharmony_ci u16 ue2rp; 7718c2ecf20Sopenharmony_ci u16 ue2sr; 7728c2ecf20Sopenharmony_ci}; 7738c2ecf20Sopenharmony_ci 7748c2ecf20Sopenharmony_cistruct be_cmd_set_features { 7758c2ecf20Sopenharmony_ci union { 7768c2ecf20Sopenharmony_ci struct be_cmd_req_hdr req_hdr; 7778c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr resp_hdr; 7788c2ecf20Sopenharmony_ci } h; 7798c2ecf20Sopenharmony_ci u32 feature; 7808c2ecf20Sopenharmony_ci u32 param_len; 7818c2ecf20Sopenharmony_ci union { 7828c2ecf20Sopenharmony_ci struct be_uer_req req; 7838c2ecf20Sopenharmony_ci struct be_uer_resp resp; 7848c2ecf20Sopenharmony_ci u32 rsvd[2]; 7858c2ecf20Sopenharmony_ci } param; 7868c2ecf20Sopenharmony_ci} __packed; 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_ciint beiscsi_cmd_function_reset(struct beiscsi_hba *phba); 7898c2ecf20Sopenharmony_ci 7908c2ecf20Sopenharmony_ciint beiscsi_cmd_special_wrb(struct be_ctrl_info *ctrl, u32 load); 7918c2ecf20Sopenharmony_ci 7928c2ecf20Sopenharmony_ciint beiscsi_check_fw_rdy(struct beiscsi_hba *phba); 7938c2ecf20Sopenharmony_ci 7948c2ecf20Sopenharmony_ciint beiscsi_init_sliport(struct beiscsi_hba *phba); 7958c2ecf20Sopenharmony_ci 7968c2ecf20Sopenharmony_ciint beiscsi_cmd_iscsi_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num); 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_ciint beiscsi_detect_ue(struct beiscsi_hba *phba); 7998c2ecf20Sopenharmony_ci 8008c2ecf20Sopenharmony_ciint beiscsi_detect_tpe(struct beiscsi_hba *phba); 8018c2ecf20Sopenharmony_ci 8028c2ecf20Sopenharmony_ciint beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, 8038c2ecf20Sopenharmony_ci struct be_queue_info *eq, int eq_delay); 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_ciint beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl, 8068c2ecf20Sopenharmony_ci struct be_queue_info *cq, struct be_queue_info *eq, 8078c2ecf20Sopenharmony_ci bool sol_evts, bool no_delay, 8088c2ecf20Sopenharmony_ci int num_cqe_dma_coalesce); 8098c2ecf20Sopenharmony_ci 8108c2ecf20Sopenharmony_ciint beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q, 8118c2ecf20Sopenharmony_ci int type); 8128c2ecf20Sopenharmony_ciint beiscsi_cmd_mccq_create(struct beiscsi_hba *phba, 8138c2ecf20Sopenharmony_ci struct be_queue_info *mccq, 8148c2ecf20Sopenharmony_ci struct be_queue_info *cq); 8158c2ecf20Sopenharmony_ci 8168c2ecf20Sopenharmony_civoid free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag); 8178c2ecf20Sopenharmony_ci 8188c2ecf20Sopenharmony_ciint beiscsi_modify_eq_delay(struct beiscsi_hba *phba, struct be_set_eqd *, 8198c2ecf20Sopenharmony_ci int num); 8208c2ecf20Sopenharmony_ciint beiscsi_mccq_compl_wait(struct beiscsi_hba *phba, 8218c2ecf20Sopenharmony_ci unsigned int tag, 8228c2ecf20Sopenharmony_ci struct be_mcc_wrb **wrb, 8238c2ecf20Sopenharmony_ci struct be_dma_mem *mbx_cmd_mem); 8248c2ecf20Sopenharmony_ciint __beiscsi_mcc_compl_status(struct beiscsi_hba *phba, 8258c2ecf20Sopenharmony_ci unsigned int tag, 8268c2ecf20Sopenharmony_ci struct be_mcc_wrb **wrb, 8278c2ecf20Sopenharmony_ci struct be_dma_mem *mbx_cmd_mem); 8288c2ecf20Sopenharmony_cistruct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem); 8298c2ecf20Sopenharmony_civoid be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag); 8308c2ecf20Sopenharmony_cistruct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba, 8318c2ecf20Sopenharmony_ci unsigned int *ref_tag); 8328c2ecf20Sopenharmony_civoid beiscsi_process_async_event(struct beiscsi_hba *phba, 8338c2ecf20Sopenharmony_ci struct be_mcc_compl *compl); 8348c2ecf20Sopenharmony_ciint beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl, 8358c2ecf20Sopenharmony_ci struct be_mcc_compl *compl); 8368c2ecf20Sopenharmony_ci 8378c2ecf20Sopenharmony_ciint be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl, 8388c2ecf20Sopenharmony_ci struct be_queue_info *cq, 8398c2ecf20Sopenharmony_ci struct be_queue_info *dq, int length, 8408c2ecf20Sopenharmony_ci int entry_size, uint8_t is_header, 8418c2ecf20Sopenharmony_ci uint8_t ulp_num); 8428c2ecf20Sopenharmony_ci 8438c2ecf20Sopenharmony_ciint be_cmd_iscsi_post_template_hdr(struct be_ctrl_info *ctrl, 8448c2ecf20Sopenharmony_ci struct be_dma_mem *q_mem); 8458c2ecf20Sopenharmony_ci 8468c2ecf20Sopenharmony_ciint be_cmd_iscsi_remove_template_hdr(struct be_ctrl_info *ctrl); 8478c2ecf20Sopenharmony_ci 8488c2ecf20Sopenharmony_ciint be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl, 8498c2ecf20Sopenharmony_ci struct be_dma_mem *q_mem, u32 page_offset, 8508c2ecf20Sopenharmony_ci u32 num_pages); 8518c2ecf20Sopenharmony_ci 8528c2ecf20Sopenharmony_ciint be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem, 8538c2ecf20Sopenharmony_ci struct be_queue_info *wrbq, 8548c2ecf20Sopenharmony_ci struct hwi_wrb_context *pwrb_context, 8558c2ecf20Sopenharmony_ci uint8_t ulp_num); 8568c2ecf20Sopenharmony_ci 8578c2ecf20Sopenharmony_ci/* Configuration Functions */ 8588c2ecf20Sopenharmony_ciint be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag); 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_ciint beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, 8618c2ecf20Sopenharmony_ci struct beiscsi_hba *phba); 8628c2ecf20Sopenharmony_ci 8638c2ecf20Sopenharmony_ciint beiscsi_get_fw_config(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba); 8648c2ecf20Sopenharmony_ci 8658c2ecf20Sopenharmony_ciint beiscsi_get_port_name(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba); 8668c2ecf20Sopenharmony_ci 8678c2ecf20Sopenharmony_ciint beiscsi_set_uer_feature(struct beiscsi_hba *phba); 8688c2ecf20Sopenharmony_ciint beiscsi_set_host_data(struct beiscsi_hba *phba); 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_cistruct be_default_pdu_context { 8718c2ecf20Sopenharmony_ci u32 dw[4]; 8728c2ecf20Sopenharmony_ci} __packed; 8738c2ecf20Sopenharmony_ci 8748c2ecf20Sopenharmony_cistruct amap_be_default_pdu_context { 8758c2ecf20Sopenharmony_ci u8 dbuf_cindex[13]; /* dword 0 */ 8768c2ecf20Sopenharmony_ci u8 rsvd0[3]; /* dword 0 */ 8778c2ecf20Sopenharmony_ci u8 ring_size[4]; /* dword 0 */ 8788c2ecf20Sopenharmony_ci u8 ring_state[4]; /* dword 0 */ 8798c2ecf20Sopenharmony_ci u8 rsvd1[8]; /* dword 0 */ 8808c2ecf20Sopenharmony_ci u8 dbuf_pindex[13]; /* dword 1 */ 8818c2ecf20Sopenharmony_ci u8 rsvd2; /* dword 1 */ 8828c2ecf20Sopenharmony_ci u8 pci_func_id[8]; /* dword 1 */ 8838c2ecf20Sopenharmony_ci u8 rx_pdid[9]; /* dword 1 */ 8848c2ecf20Sopenharmony_ci u8 rx_pdid_valid; /* dword 1 */ 8858c2ecf20Sopenharmony_ci u8 default_buffer_size[16]; /* dword 2 */ 8868c2ecf20Sopenharmony_ci u8 cq_id_recv[10]; /* dword 2 */ 8878c2ecf20Sopenharmony_ci u8 rx_pdid_not_valid; /* dword 2 */ 8888c2ecf20Sopenharmony_ci u8 rsvd3[5]; /* dword 2 */ 8898c2ecf20Sopenharmony_ci u8 rsvd4[32]; /* dword 3 */ 8908c2ecf20Sopenharmony_ci} __packed; 8918c2ecf20Sopenharmony_ci 8928c2ecf20Sopenharmony_cistruct amap_default_pdu_context_ext { 8938c2ecf20Sopenharmony_ci u8 rsvd0[16]; /* dword 0 */ 8948c2ecf20Sopenharmony_ci u8 ring_size[4]; /* dword 0 */ 8958c2ecf20Sopenharmony_ci u8 rsvd1[12]; /* dword 0 */ 8968c2ecf20Sopenharmony_ci u8 rsvd2[22]; /* dword 1 */ 8978c2ecf20Sopenharmony_ci u8 rx_pdid[9]; /* dword 1 */ 8988c2ecf20Sopenharmony_ci u8 rx_pdid_valid; /* dword 1 */ 8998c2ecf20Sopenharmony_ci u8 default_buffer_size[16]; /* dword 2 */ 9008c2ecf20Sopenharmony_ci u8 cq_id_recv[16]; /* dword 2 */ 9018c2ecf20Sopenharmony_ci u8 rsvd3[32]; /* dword 3 */ 9028c2ecf20Sopenharmony_ci} __packed; 9038c2ecf20Sopenharmony_ci 9048c2ecf20Sopenharmony_cistruct be_defq_create_req { 9058c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 9068c2ecf20Sopenharmony_ci u16 num_pages; 9078c2ecf20Sopenharmony_ci u8 ulp_num; 9088c2ecf20Sopenharmony_ci#define BEISCSI_DUAL_ULP_AWARE_BIT 0 /* Byte 3 - Bit 0 */ 9098c2ecf20Sopenharmony_ci#define BEISCSI_BIND_Q_TO_ULP_BIT 1 /* Byte 3 - Bit 1 */ 9108c2ecf20Sopenharmony_ci u8 dua_feature; 9118c2ecf20Sopenharmony_ci struct be_default_pdu_context context; 9128c2ecf20Sopenharmony_ci struct phys_addr pages[8]; 9138c2ecf20Sopenharmony_ci} __packed; 9148c2ecf20Sopenharmony_ci 9158c2ecf20Sopenharmony_cistruct be_defq_create_resp { 9168c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 9178c2ecf20Sopenharmony_ci u16 id; 9188c2ecf20Sopenharmony_ci u8 rsvd0; 9198c2ecf20Sopenharmony_ci u8 ulp_num; 9208c2ecf20Sopenharmony_ci u32 doorbell_offset; 9218c2ecf20Sopenharmony_ci u16 register_set; 9228c2ecf20Sopenharmony_ci u16 doorbell_format; 9238c2ecf20Sopenharmony_ci} __packed; 9248c2ecf20Sopenharmony_ci 9258c2ecf20Sopenharmony_cistruct be_post_template_pages_req { 9268c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 9278c2ecf20Sopenharmony_ci u16 num_pages; 9288c2ecf20Sopenharmony_ci#define BEISCSI_TEMPLATE_HDR_TYPE_ISCSI 0x1 9298c2ecf20Sopenharmony_ci u16 type; 9308c2ecf20Sopenharmony_ci struct phys_addr scratch_pa; 9318c2ecf20Sopenharmony_ci struct virt_addr scratch_va; 9328c2ecf20Sopenharmony_ci struct virt_addr pages_va; 9338c2ecf20Sopenharmony_ci struct phys_addr pages[16]; 9348c2ecf20Sopenharmony_ci} __packed; 9358c2ecf20Sopenharmony_ci 9368c2ecf20Sopenharmony_cistruct be_remove_template_pages_req { 9378c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 9388c2ecf20Sopenharmony_ci u16 type; 9398c2ecf20Sopenharmony_ci u16 rsvd0; 9408c2ecf20Sopenharmony_ci} __packed; 9418c2ecf20Sopenharmony_ci 9428c2ecf20Sopenharmony_cistruct be_post_sgl_pages_req { 9438c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 9448c2ecf20Sopenharmony_ci u16 num_pages; 9458c2ecf20Sopenharmony_ci u16 page_offset; 9468c2ecf20Sopenharmony_ci u32 rsvd0; 9478c2ecf20Sopenharmony_ci struct phys_addr pages[26]; 9488c2ecf20Sopenharmony_ci u32 rsvd1; 9498c2ecf20Sopenharmony_ci} __packed; 9508c2ecf20Sopenharmony_ci 9518c2ecf20Sopenharmony_cistruct be_wrbq_create_req { 9528c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 9538c2ecf20Sopenharmony_ci u16 num_pages; 9548c2ecf20Sopenharmony_ci u8 ulp_num; 9558c2ecf20Sopenharmony_ci u8 dua_feature; 9568c2ecf20Sopenharmony_ci struct phys_addr pages[8]; 9578c2ecf20Sopenharmony_ci} __packed; 9588c2ecf20Sopenharmony_ci 9598c2ecf20Sopenharmony_cistruct be_wrbq_create_resp { 9608c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr resp_hdr; 9618c2ecf20Sopenharmony_ci u16 cid; 9628c2ecf20Sopenharmony_ci u8 rsvd0; 9638c2ecf20Sopenharmony_ci u8 ulp_num; 9648c2ecf20Sopenharmony_ci u32 doorbell_offset; 9658c2ecf20Sopenharmony_ci u16 register_set; 9668c2ecf20Sopenharmony_ci u16 doorbell_format; 9678c2ecf20Sopenharmony_ci} __packed; 9688c2ecf20Sopenharmony_ci 9698c2ecf20Sopenharmony_ci#define SOL_CID_MASK 0x0000FFC0 9708c2ecf20Sopenharmony_ci#define SOL_CODE_MASK 0x0000003F 9718c2ecf20Sopenharmony_ci#define SOL_WRB_INDEX_MASK 0x00FF0000 9728c2ecf20Sopenharmony_ci#define SOL_CMD_WND_MASK 0xFF000000 9738c2ecf20Sopenharmony_ci#define SOL_RES_CNT_MASK 0x7FFFFFFF 9748c2ecf20Sopenharmony_ci#define SOL_EXP_CMD_SN_MASK 0xFFFFFFFF 9758c2ecf20Sopenharmony_ci#define SOL_HW_STS_MASK 0x000000FF 9768c2ecf20Sopenharmony_ci#define SOL_STS_MASK 0x0000FF00 9778c2ecf20Sopenharmony_ci#define SOL_RESP_MASK 0x00FF0000 9788c2ecf20Sopenharmony_ci#define SOL_FLAGS_MASK 0x7F000000 9798c2ecf20Sopenharmony_ci#define SOL_S_MASK 0x80000000 9808c2ecf20Sopenharmony_ci 9818c2ecf20Sopenharmony_cistruct sol_cqe { 9828c2ecf20Sopenharmony_ci u32 dw[4]; 9838c2ecf20Sopenharmony_ci}; 9848c2ecf20Sopenharmony_ci 9858c2ecf20Sopenharmony_cistruct amap_sol_cqe { 9868c2ecf20Sopenharmony_ci u8 hw_sts[8]; /* dword 0 */ 9878c2ecf20Sopenharmony_ci u8 i_sts[8]; /* dword 0 */ 9888c2ecf20Sopenharmony_ci u8 i_resp[8]; /* dword 0 */ 9898c2ecf20Sopenharmony_ci u8 i_flags[7]; /* dword 0 */ 9908c2ecf20Sopenharmony_ci u8 s; /* dword 0 */ 9918c2ecf20Sopenharmony_ci u8 i_exp_cmd_sn[32]; /* dword 1 */ 9928c2ecf20Sopenharmony_ci u8 code[6]; /* dword 2 */ 9938c2ecf20Sopenharmony_ci u8 cid[10]; /* dword 2 */ 9948c2ecf20Sopenharmony_ci u8 wrb_index[8]; /* dword 2 */ 9958c2ecf20Sopenharmony_ci u8 i_cmd_wnd[8]; /* dword 2 */ 9968c2ecf20Sopenharmony_ci u8 i_res_cnt[31]; /* dword 3 */ 9978c2ecf20Sopenharmony_ci u8 valid; /* dword 3 */ 9988c2ecf20Sopenharmony_ci} __packed; 9998c2ecf20Sopenharmony_ci 10008c2ecf20Sopenharmony_ci#define SOL_ICD_INDEX_MASK 0x0003FFC0 10018c2ecf20Sopenharmony_cistruct amap_sol_cqe_ring { 10028c2ecf20Sopenharmony_ci u8 hw_sts[8]; /* dword 0 */ 10038c2ecf20Sopenharmony_ci u8 i_sts[8]; /* dword 0 */ 10048c2ecf20Sopenharmony_ci u8 i_resp[8]; /* dword 0 */ 10058c2ecf20Sopenharmony_ci u8 i_flags[7]; /* dword 0 */ 10068c2ecf20Sopenharmony_ci u8 s; /* dword 0 */ 10078c2ecf20Sopenharmony_ci u8 i_exp_cmd_sn[32]; /* dword 1 */ 10088c2ecf20Sopenharmony_ci u8 code[6]; /* dword 2 */ 10098c2ecf20Sopenharmony_ci u8 icd_index[12]; /* dword 2 */ 10108c2ecf20Sopenharmony_ci u8 rsvd[6]; /* dword 2 */ 10118c2ecf20Sopenharmony_ci u8 i_cmd_wnd[8]; /* dword 2 */ 10128c2ecf20Sopenharmony_ci u8 i_res_cnt[31]; /* dword 3 */ 10138c2ecf20Sopenharmony_ci u8 valid; /* dword 3 */ 10148c2ecf20Sopenharmony_ci} __packed; 10158c2ecf20Sopenharmony_ci 10168c2ecf20Sopenharmony_cistruct amap_sol_cqe_v2 { 10178c2ecf20Sopenharmony_ci u8 hw_sts[8]; /* dword 0 */ 10188c2ecf20Sopenharmony_ci u8 i_sts[8]; /* dword 0 */ 10198c2ecf20Sopenharmony_ci u8 wrb_index[16]; /* dword 0 */ 10208c2ecf20Sopenharmony_ci u8 i_exp_cmd_sn[32]; /* dword 1 */ 10218c2ecf20Sopenharmony_ci u8 code[6]; /* dword 2 */ 10228c2ecf20Sopenharmony_ci u8 cmd_cmpl; /* dword 2 */ 10238c2ecf20Sopenharmony_ci u8 rsvd0; /* dword 2 */ 10248c2ecf20Sopenharmony_ci u8 i_cmd_wnd[8]; /* dword 2 */ 10258c2ecf20Sopenharmony_ci u8 cid[13]; /* dword 2 */ 10268c2ecf20Sopenharmony_ci u8 u; /* dword 2 */ 10278c2ecf20Sopenharmony_ci u8 o; /* dword 2 */ 10288c2ecf20Sopenharmony_ci u8 s; /* dword 2 */ 10298c2ecf20Sopenharmony_ci u8 i_res_cnt[31]; /* dword 3 */ 10308c2ecf20Sopenharmony_ci u8 valid; /* dword 3 */ 10318c2ecf20Sopenharmony_ci} __packed; 10328c2ecf20Sopenharmony_ci 10338c2ecf20Sopenharmony_cistruct common_sol_cqe { 10348c2ecf20Sopenharmony_ci u32 exp_cmdsn; 10358c2ecf20Sopenharmony_ci u32 res_cnt; 10368c2ecf20Sopenharmony_ci u16 wrb_index; 10378c2ecf20Sopenharmony_ci u16 cid; 10388c2ecf20Sopenharmony_ci u8 hw_sts; 10398c2ecf20Sopenharmony_ci u8 cmd_wnd; 10408c2ecf20Sopenharmony_ci u8 res_flag; /* the s feild of structure */ 10418c2ecf20Sopenharmony_ci u8 i_resp; /* for skh if cmd_complete is set then i_sts is response */ 10428c2ecf20Sopenharmony_ci u8 i_flags; /* for skh or the u and o feilds */ 10438c2ecf20Sopenharmony_ci u8 i_sts; /* for skh if cmd_complete is not-set then i_sts is status */ 10448c2ecf20Sopenharmony_ci}; 10458c2ecf20Sopenharmony_ci 10468c2ecf20Sopenharmony_ci/*** iSCSI ack/driver message completions ***/ 10478c2ecf20Sopenharmony_cistruct amap_it_dmsg_cqe { 10488c2ecf20Sopenharmony_ci u8 ack_num[32]; /* DWORD 0 */ 10498c2ecf20Sopenharmony_ci u8 pdu_bytes_rcvd[32]; /* DWORD 1 */ 10508c2ecf20Sopenharmony_ci u8 code[6]; /* DWORD 2 */ 10518c2ecf20Sopenharmony_ci u8 cid[10]; /* DWORD 2 */ 10528c2ecf20Sopenharmony_ci u8 wrb_idx[8]; /* DWORD 2 */ 10538c2ecf20Sopenharmony_ci u8 rsvd0[8]; /* DWORD 2*/ 10548c2ecf20Sopenharmony_ci u8 rsvd1[31]; /* DWORD 3*/ 10558c2ecf20Sopenharmony_ci u8 valid; /* DWORD 3 */ 10568c2ecf20Sopenharmony_ci} __packed; 10578c2ecf20Sopenharmony_ci 10588c2ecf20Sopenharmony_cistruct amap_it_dmsg_cqe_v2 { 10598c2ecf20Sopenharmony_ci u8 ack_num[32]; /* DWORD 0 */ 10608c2ecf20Sopenharmony_ci u8 pdu_bytes_rcvd[32]; /* DWORD 1 */ 10618c2ecf20Sopenharmony_ci u8 code[6]; /* DWORD 2 */ 10628c2ecf20Sopenharmony_ci u8 rsvd0[10]; /* DWORD 2 */ 10638c2ecf20Sopenharmony_ci u8 wrb_idx[16]; /* DWORD 2 */ 10648c2ecf20Sopenharmony_ci u8 rsvd1[16]; /* DWORD 3 */ 10658c2ecf20Sopenharmony_ci u8 cid[13]; /* DWORD 3 */ 10668c2ecf20Sopenharmony_ci u8 rsvd2[2]; /* DWORD 3 */ 10678c2ecf20Sopenharmony_ci u8 valid; /* DWORD 3 */ 10688c2ecf20Sopenharmony_ci} __packed; 10698c2ecf20Sopenharmony_ci 10708c2ecf20Sopenharmony_ci 10718c2ecf20Sopenharmony_ci/** 10728c2ecf20Sopenharmony_ci * Post WRB Queue Doorbell Register used by the host Storage 10738c2ecf20Sopenharmony_ci * stack to notify the 10748c2ecf20Sopenharmony_ci * controller of a posted Work Request Block 10758c2ecf20Sopenharmony_ci */ 10768c2ecf20Sopenharmony_ci#define DB_WRB_POST_CID_MASK 0xFFFF /* bits 0 - 16 */ 10778c2ecf20Sopenharmony_ci#define DB_DEF_PDU_WRB_INDEX_MASK 0xFF /* bits 0 - 9 */ 10788c2ecf20Sopenharmony_ci 10798c2ecf20Sopenharmony_ci#define DB_DEF_PDU_WRB_INDEX_SHIFT 16 10808c2ecf20Sopenharmony_ci#define DB_DEF_PDU_NUM_POSTED_SHIFT 24 10818c2ecf20Sopenharmony_ci 10828c2ecf20Sopenharmony_cistruct fragnum_bits_for_sgl_cra_in { 10838c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 10848c2ecf20Sopenharmony_ci u32 num_bits; 10858c2ecf20Sopenharmony_ci} __packed; 10868c2ecf20Sopenharmony_ci 10878c2ecf20Sopenharmony_cistruct iscsi_cleanup_req { 10888c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 10898c2ecf20Sopenharmony_ci u16 chute; 10908c2ecf20Sopenharmony_ci u8 hdr_ring_id; 10918c2ecf20Sopenharmony_ci u8 data_ring_id; 10928c2ecf20Sopenharmony_ci} __packed; 10938c2ecf20Sopenharmony_ci 10948c2ecf20Sopenharmony_cistruct iscsi_cleanup_req_v1 { 10958c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 10968c2ecf20Sopenharmony_ci u16 chute; 10978c2ecf20Sopenharmony_ci u16 rsvd1; 10988c2ecf20Sopenharmony_ci u16 hdr_ring_id; 10998c2ecf20Sopenharmony_ci u16 rsvd2; 11008c2ecf20Sopenharmony_ci u16 data_ring_id; 11018c2ecf20Sopenharmony_ci u16 rsvd3; 11028c2ecf20Sopenharmony_ci} __packed; 11038c2ecf20Sopenharmony_ci 11048c2ecf20Sopenharmony_cistruct eq_delay { 11058c2ecf20Sopenharmony_ci u32 eq_id; 11068c2ecf20Sopenharmony_ci u32 phase; 11078c2ecf20Sopenharmony_ci u32 delay_multiplier; 11088c2ecf20Sopenharmony_ci} __packed; 11098c2ecf20Sopenharmony_ci 11108c2ecf20Sopenharmony_cistruct be_eq_delay_params_in { 11118c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 11128c2ecf20Sopenharmony_ci u32 num_eq; 11138c2ecf20Sopenharmony_ci struct eq_delay delay[8]; 11148c2ecf20Sopenharmony_ci} __packed; 11158c2ecf20Sopenharmony_ci 11168c2ecf20Sopenharmony_cistruct tcp_connect_and_offload_in { 11178c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 11188c2ecf20Sopenharmony_ci struct ip_addr_format ip_address; 11198c2ecf20Sopenharmony_ci u16 tcp_port; 11208c2ecf20Sopenharmony_ci u16 cid; 11218c2ecf20Sopenharmony_ci u16 cq_id; 11228c2ecf20Sopenharmony_ci u16 defq_id; 11238c2ecf20Sopenharmony_ci struct phys_addr dataout_template_pa; 11248c2ecf20Sopenharmony_ci u16 hdr_ring_id; 11258c2ecf20Sopenharmony_ci u16 data_ring_id; 11268c2ecf20Sopenharmony_ci u8 do_offload; 11278c2ecf20Sopenharmony_ci u8 rsvd0[3]; 11288c2ecf20Sopenharmony_ci} __packed; 11298c2ecf20Sopenharmony_ci 11308c2ecf20Sopenharmony_cistruct tcp_connect_and_offload_in_v1 { 11318c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 11328c2ecf20Sopenharmony_ci struct ip_addr_format ip_address; 11338c2ecf20Sopenharmony_ci u16 tcp_port; 11348c2ecf20Sopenharmony_ci u16 cid; 11358c2ecf20Sopenharmony_ci u16 cq_id; 11368c2ecf20Sopenharmony_ci u16 defq_id; 11378c2ecf20Sopenharmony_ci struct phys_addr dataout_template_pa; 11388c2ecf20Sopenharmony_ci u16 hdr_ring_id; 11398c2ecf20Sopenharmony_ci u16 data_ring_id; 11408c2ecf20Sopenharmony_ci u8 do_offload; 11418c2ecf20Sopenharmony_ci u8 ifd_state; 11428c2ecf20Sopenharmony_ci u8 rsvd0[2]; 11438c2ecf20Sopenharmony_ci u16 tcp_window_size; 11448c2ecf20Sopenharmony_ci u8 tcp_window_scale_count; 11458c2ecf20Sopenharmony_ci u8 rsvd1; 11468c2ecf20Sopenharmony_ci u32 tcp_mss:24; 11478c2ecf20Sopenharmony_ci u8 rsvd2; 11488c2ecf20Sopenharmony_ci} __packed; 11498c2ecf20Sopenharmony_ci 11508c2ecf20Sopenharmony_cistruct tcp_connect_and_offload_out { 11518c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr hdr; 11528c2ecf20Sopenharmony_ci u32 connection_handle; 11538c2ecf20Sopenharmony_ci u16 cid; 11548c2ecf20Sopenharmony_ci u16 rsvd0; 11558c2ecf20Sopenharmony_ci 11568c2ecf20Sopenharmony_ci} __packed; 11578c2ecf20Sopenharmony_ci 11588c2ecf20Sopenharmony_ci#define DB_DEF_PDU_RING_ID_MASK 0x3FFF /* bits 0 - 13 */ 11598c2ecf20Sopenharmony_ci#define DB_DEF_PDU_CQPROC_MASK 0x3FFF /* bits 16 - 29 */ 11608c2ecf20Sopenharmony_ci#define DB_DEF_PDU_REARM_SHIFT 14 11618c2ecf20Sopenharmony_ci#define DB_DEF_PDU_EVENT_SHIFT 15 11628c2ecf20Sopenharmony_ci#define DB_DEF_PDU_CQPROC_SHIFT 16 11638c2ecf20Sopenharmony_ci 11648c2ecf20Sopenharmony_cistruct be_invalidate_connection_params_in { 11658c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 11668c2ecf20Sopenharmony_ci u32 session_handle; 11678c2ecf20Sopenharmony_ci u16 cid; 11688c2ecf20Sopenharmony_ci u16 unused; 11698c2ecf20Sopenharmony_ci#define BE_CLEANUP_TYPE_INVALIDATE 0x8001 11708c2ecf20Sopenharmony_ci#define BE_CLEANUP_TYPE_ISSUE_TCP_RST 0x8002 11718c2ecf20Sopenharmony_ci u16 cleanup_type; 11728c2ecf20Sopenharmony_ci u16 save_cfg; 11738c2ecf20Sopenharmony_ci} __packed; 11748c2ecf20Sopenharmony_ci 11758c2ecf20Sopenharmony_cistruct be_invalidate_connection_params_out { 11768c2ecf20Sopenharmony_ci u32 session_handle; 11778c2ecf20Sopenharmony_ci u16 cid; 11788c2ecf20Sopenharmony_ci u16 unused; 11798c2ecf20Sopenharmony_ci} __packed; 11808c2ecf20Sopenharmony_ci 11818c2ecf20Sopenharmony_ciunion be_invalidate_connection_params { 11828c2ecf20Sopenharmony_ci struct be_invalidate_connection_params_in req; 11838c2ecf20Sopenharmony_ci struct be_invalidate_connection_params_out resp; 11848c2ecf20Sopenharmony_ci} __packed; 11858c2ecf20Sopenharmony_ci 11868c2ecf20Sopenharmony_cistruct be_tcp_upload_params_in { 11878c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 11888c2ecf20Sopenharmony_ci u16 id; 11898c2ecf20Sopenharmony_ci#define BE_UPLOAD_TYPE_GRACEFUL 1 11908c2ecf20Sopenharmony_ci/* abortive upload with reset */ 11918c2ecf20Sopenharmony_ci#define BE_UPLOAD_TYPE_ABORT_RESET 2 11928c2ecf20Sopenharmony_ci/* abortive upload without reset */ 11938c2ecf20Sopenharmony_ci#define BE_UPLOAD_TYPE_ABORT 3 11948c2ecf20Sopenharmony_ci/* abortive upload with reset, sequence number by driver */ 11958c2ecf20Sopenharmony_ci#define BE_UPLOAD_TYPE_ABORT_WITH_SEQ 4 11968c2ecf20Sopenharmony_ci u16 upload_type; 11978c2ecf20Sopenharmony_ci u32 reset_seq; 11988c2ecf20Sopenharmony_ci} __packed; 11998c2ecf20Sopenharmony_ci 12008c2ecf20Sopenharmony_cistruct be_tcp_upload_params_out { 12018c2ecf20Sopenharmony_ci u32 dw[32]; 12028c2ecf20Sopenharmony_ci} __packed; 12038c2ecf20Sopenharmony_ci 12048c2ecf20Sopenharmony_ciunion be_tcp_upload_params { 12058c2ecf20Sopenharmony_ci struct be_tcp_upload_params_in request; 12068c2ecf20Sopenharmony_ci struct be_tcp_upload_params_out response; 12078c2ecf20Sopenharmony_ci} __packed; 12088c2ecf20Sopenharmony_ci 12098c2ecf20Sopenharmony_cistruct be_ulp_fw_cfg { 12108c2ecf20Sopenharmony_ci#define BEISCSI_ULP_ISCSI_INI_MODE 0x10 12118c2ecf20Sopenharmony_ci u32 ulp_mode; 12128c2ecf20Sopenharmony_ci u32 etx_base; 12138c2ecf20Sopenharmony_ci u32 etx_count; 12148c2ecf20Sopenharmony_ci u32 sq_base; 12158c2ecf20Sopenharmony_ci u32 sq_count; 12168c2ecf20Sopenharmony_ci u32 rq_base; 12178c2ecf20Sopenharmony_ci u32 rq_count; 12188c2ecf20Sopenharmony_ci u32 dq_base; 12198c2ecf20Sopenharmony_ci u32 dq_count; 12208c2ecf20Sopenharmony_ci u32 lro_base; 12218c2ecf20Sopenharmony_ci u32 lro_count; 12228c2ecf20Sopenharmony_ci u32 icd_base; 12238c2ecf20Sopenharmony_ci u32 icd_count; 12248c2ecf20Sopenharmony_ci}; 12258c2ecf20Sopenharmony_ci 12268c2ecf20Sopenharmony_cistruct be_ulp_chain_icd { 12278c2ecf20Sopenharmony_ci u32 chain_base; 12288c2ecf20Sopenharmony_ci u32 chain_count; 12298c2ecf20Sopenharmony_ci}; 12308c2ecf20Sopenharmony_ci 12318c2ecf20Sopenharmony_cistruct be_fw_cfg { 12328c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 12338c2ecf20Sopenharmony_ci u32 be_config_number; 12348c2ecf20Sopenharmony_ci u32 asic_revision; 12358c2ecf20Sopenharmony_ci u32 phys_port; 12368c2ecf20Sopenharmony_ci#define BEISCSI_FUNC_ISCSI_INI_MODE 0x10 12378c2ecf20Sopenharmony_ci#define BEISCSI_FUNC_DUA_MODE 0x800 12388c2ecf20Sopenharmony_ci u32 function_mode; 12398c2ecf20Sopenharmony_ci struct be_ulp_fw_cfg ulp[2]; 12408c2ecf20Sopenharmony_ci u32 function_caps; 12418c2ecf20Sopenharmony_ci u32 cqid_base; 12428c2ecf20Sopenharmony_ci u32 cqid_count; 12438c2ecf20Sopenharmony_ci u32 eqid_base; 12448c2ecf20Sopenharmony_ci u32 eqid_count; 12458c2ecf20Sopenharmony_ci struct be_ulp_chain_icd chain_icd[2]; 12468c2ecf20Sopenharmony_ci} __packed; 12478c2ecf20Sopenharmony_ci 12488c2ecf20Sopenharmony_cistruct be_cmd_get_all_if_id_req { 12498c2ecf20Sopenharmony_ci struct be_cmd_req_hdr hdr; 12508c2ecf20Sopenharmony_ci u32 if_count; 12518c2ecf20Sopenharmony_ci u32 if_hndl_list[1]; 12528c2ecf20Sopenharmony_ci} __packed; 12538c2ecf20Sopenharmony_ci 12548c2ecf20Sopenharmony_cistruct be_cmd_get_port_name { 12558c2ecf20Sopenharmony_ci union { 12568c2ecf20Sopenharmony_ci struct be_cmd_req_hdr req_hdr; 12578c2ecf20Sopenharmony_ci struct be_cmd_resp_hdr resp_hdr; 12588c2ecf20Sopenharmony_ci } h; 12598c2ecf20Sopenharmony_ci union { 12608c2ecf20Sopenharmony_ci struct { 12618c2ecf20Sopenharmony_ci u32 reserved; 12628c2ecf20Sopenharmony_ci } req; 12638c2ecf20Sopenharmony_ci struct { 12648c2ecf20Sopenharmony_ci u32 port_names; 12658c2ecf20Sopenharmony_ci } resp; 12668c2ecf20Sopenharmony_ci } p; 12678c2ecf20Sopenharmony_ci} __packed; 12688c2ecf20Sopenharmony_ci 12698c2ecf20Sopenharmony_ci#define ISCSI_OPCODE_SCSI_DATA_OUT 5 12708c2ecf20Sopenharmony_ci#define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5 12718c2ecf20Sopenharmony_ci#define OPCODE_COMMON_MODIFY_EQ_DELAY 41 12728c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_CLEANUP 59 12738c2ecf20Sopenharmony_ci#define OPCODE_COMMON_TCP_UPLOAD 56 12748c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70 12758c2ecf20Sopenharmony_ci#define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1 12768c2ecf20Sopenharmony_ci#define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6 12778c2ecf20Sopenharmony_ci#define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7 12788c2ecf20Sopenharmony_ci#define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14 12798c2ecf20Sopenharmony_ci#define OPCODE_ISCSI_INI_SESSION_LOGOUT_TARGET 24 12808c2ecf20Sopenharmony_ci#define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36 12818c2ecf20Sopenharmony_ci#define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41 12828c2ecf20Sopenharmony_ci#define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42 12838c2ecf20Sopenharmony_ci#define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52 12848c2ecf20Sopenharmony_ci#define OPCODE_COMMON_WRITE_FLASH 96 12858c2ecf20Sopenharmony_ci#define OPCODE_COMMON_READ_FLASH 97 12868c2ecf20Sopenharmony_ci 12878c2ecf20Sopenharmony_ci#define CMD_ISCSI_COMMAND_INVALIDATE 1 12888c2ecf20Sopenharmony_ci 12898c2ecf20Sopenharmony_ci#define INI_WR_CMD 1 /* Initiator write command */ 12908c2ecf20Sopenharmony_ci#define INI_TMF_CMD 2 /* Initiator TMF command */ 12918c2ecf20Sopenharmony_ci#define INI_NOPOUT_CMD 3 /* Initiator; Send a NOP-OUT */ 12928c2ecf20Sopenharmony_ci#define INI_RD_CMD 5 /* Initiator requesting to send 12938c2ecf20Sopenharmony_ci * a read command 12948c2ecf20Sopenharmony_ci */ 12958c2ecf20Sopenharmony_ci#define TGT_CTX_UPDT_CMD 7 /* Target context update */ 12968c2ecf20Sopenharmony_ci#define TGT_DM_CMD 11 /* Indicates that the bhs 12978c2ecf20Sopenharmony_ci * prepared by driver should not 12988c2ecf20Sopenharmony_ci * be touched. 12998c2ecf20Sopenharmony_ci */ 13008c2ecf20Sopenharmony_ci 13018c2ecf20Sopenharmony_ci/* Returns the number of items in the field array. */ 13028c2ecf20Sopenharmony_ci#define BE_NUMBER_OF_FIELD(_type_, _field_) \ 13038c2ecf20Sopenharmony_ci (sizeof_field(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\ 13048c2ecf20Sopenharmony_ci 13058c2ecf20Sopenharmony_ci/** 13068c2ecf20Sopenharmony_ci * Different types of iSCSI completions to host driver for both initiator 13078c2ecf20Sopenharmony_ci * and taget mode 13088c2ecf20Sopenharmony_ci * of operation. 13098c2ecf20Sopenharmony_ci */ 13108c2ecf20Sopenharmony_ci#define SOL_CMD_COMPLETE 1 /* Solicited command completed 13118c2ecf20Sopenharmony_ci * normally 13128c2ecf20Sopenharmony_ci */ 13138c2ecf20Sopenharmony_ci#define SOL_CMD_KILLED_DATA_DIGEST_ERR 2 /* Solicited command got 13148c2ecf20Sopenharmony_ci * invalidated internally due 13158c2ecf20Sopenharmony_ci * to Data Digest error 13168c2ecf20Sopenharmony_ci */ 13178c2ecf20Sopenharmony_ci#define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3 /* Connection got invalidated 13188c2ecf20Sopenharmony_ci * internally 13198c2ecf20Sopenharmony_ci * due to a received PDU 13208c2ecf20Sopenharmony_ci * size > DSL 13218c2ecf20Sopenharmony_ci */ 13228c2ecf20Sopenharmony_ci#define CXN_KILLED_BURST_LEN_MISMATCH 4 /* Connection got invalidated 13238c2ecf20Sopenharmony_ci * internally due ti received 13248c2ecf20Sopenharmony_ci * PDU sequence size > 13258c2ecf20Sopenharmony_ci * FBL/MBL. 13268c2ecf20Sopenharmony_ci */ 13278c2ecf20Sopenharmony_ci#define CXN_KILLED_AHS_RCVD 5 /* Connection got invalidated 13288c2ecf20Sopenharmony_ci * internally due to a received 13298c2ecf20Sopenharmony_ci * PDU Hdr that has 13308c2ecf20Sopenharmony_ci * AHS */ 13318c2ecf20Sopenharmony_ci#define CXN_KILLED_HDR_DIGEST_ERR 6 /* Connection got invalidated 13328c2ecf20Sopenharmony_ci * internally due to Hdr Digest 13338c2ecf20Sopenharmony_ci * error 13348c2ecf20Sopenharmony_ci */ 13358c2ecf20Sopenharmony_ci#define CXN_KILLED_UNKNOWN_HDR 7 /* Connection got invalidated 13368c2ecf20Sopenharmony_ci * internally 13378c2ecf20Sopenharmony_ci * due to a bad opcode in the 13388c2ecf20Sopenharmony_ci * pdu hdr 13398c2ecf20Sopenharmony_ci */ 13408c2ecf20Sopenharmony_ci#define CXN_KILLED_STALE_ITT_TTT_RCVD 8 /* Connection got invalidated 13418c2ecf20Sopenharmony_ci * internally due to a received 13428c2ecf20Sopenharmony_ci * ITT/TTT that does not belong 13438c2ecf20Sopenharmony_ci * to this Connection 13448c2ecf20Sopenharmony_ci */ 13458c2ecf20Sopenharmony_ci#define CXN_KILLED_INVALID_ITT_TTT_RCVD 9 /* Connection got invalidated 13468c2ecf20Sopenharmony_ci * internally due to received 13478c2ecf20Sopenharmony_ci * ITT/TTT value > Max 13488c2ecf20Sopenharmony_ci * Supported ITTs/TTTs 13498c2ecf20Sopenharmony_ci */ 13508c2ecf20Sopenharmony_ci#define CXN_KILLED_RST_RCVD 10 /* Connection got invalidated 13518c2ecf20Sopenharmony_ci * internally due to an 13528c2ecf20Sopenharmony_ci * incoming TCP RST 13538c2ecf20Sopenharmony_ci */ 13548c2ecf20Sopenharmony_ci#define CXN_KILLED_TIMED_OUT 11 /* Connection got invalidated 13558c2ecf20Sopenharmony_ci * internally due to timeout on 13568c2ecf20Sopenharmony_ci * tcp segment 12 retransmit 13578c2ecf20Sopenharmony_ci * attempts failed 13588c2ecf20Sopenharmony_ci */ 13598c2ecf20Sopenharmony_ci#define CXN_KILLED_RST_SENT 12 /* Connection got invalidated 13608c2ecf20Sopenharmony_ci * internally due to TCP RST 13618c2ecf20Sopenharmony_ci * sent by the Tx side 13628c2ecf20Sopenharmony_ci */ 13638c2ecf20Sopenharmony_ci#define CXN_KILLED_FIN_RCVD 13 /* Connection got invalidated 13648c2ecf20Sopenharmony_ci * internally due to an 13658c2ecf20Sopenharmony_ci * incoming TCP FIN. 13668c2ecf20Sopenharmony_ci */ 13678c2ecf20Sopenharmony_ci#define CXN_KILLED_BAD_UNSOL_PDU_RCVD 14 /* Connection got invalidated 13688c2ecf20Sopenharmony_ci * internally due to bad 13698c2ecf20Sopenharmony_ci * unsolicited PDU Unsolicited 13708c2ecf20Sopenharmony_ci * PDUs are PDUs with 13718c2ecf20Sopenharmony_ci * ITT=0xffffffff 13728c2ecf20Sopenharmony_ci */ 13738c2ecf20Sopenharmony_ci#define CXN_KILLED_BAD_WRB_INDEX_ERROR 15 /* Connection got invalidated 13748c2ecf20Sopenharmony_ci * internally due to bad WRB 13758c2ecf20Sopenharmony_ci * index. 13768c2ecf20Sopenharmony_ci */ 13778c2ecf20Sopenharmony_ci#define CXN_KILLED_OVER_RUN_RESIDUAL 16 /* Command got invalidated 13788c2ecf20Sopenharmony_ci * internally due to received 13798c2ecf20Sopenharmony_ci * command has residual 13808c2ecf20Sopenharmony_ci * over run bytes. 13818c2ecf20Sopenharmony_ci */ 13828c2ecf20Sopenharmony_ci#define CXN_KILLED_UNDER_RUN_RESIDUAL 17 /* Command got invalidated 13838c2ecf20Sopenharmony_ci * internally due to received 13848c2ecf20Sopenharmony_ci * command has residual under 13858c2ecf20Sopenharmony_ci * run bytes. 13868c2ecf20Sopenharmony_ci */ 13878c2ecf20Sopenharmony_ci#define CMD_KILLED_INVALID_STATSN_RCVD 18 /* Command got invalidated 13888c2ecf20Sopenharmony_ci * internally due to a received 13898c2ecf20Sopenharmony_ci * PDU has an invalid StatusSN 13908c2ecf20Sopenharmony_ci */ 13918c2ecf20Sopenharmony_ci#define CMD_KILLED_INVALID_R2T_RCVD 19 /* Command got invalidated 13928c2ecf20Sopenharmony_ci * internally due to a received 13938c2ecf20Sopenharmony_ci * an R2T with some invalid 13948c2ecf20Sopenharmony_ci * fields in it 13958c2ecf20Sopenharmony_ci */ 13968c2ecf20Sopenharmony_ci#define CMD_CXN_KILLED_LUN_INVALID 20 /* Command got invalidated 13978c2ecf20Sopenharmony_ci * internally due to received 13988c2ecf20Sopenharmony_ci * PDU has an invalid LUN. 13998c2ecf20Sopenharmony_ci */ 14008c2ecf20Sopenharmony_ci#define CMD_CXN_KILLED_ICD_INVALID 21 /* Command got invalidated 14018c2ecf20Sopenharmony_ci * internally due to the 14028c2ecf20Sopenharmony_ci * corresponding ICD not in a 14038c2ecf20Sopenharmony_ci * valid state 14048c2ecf20Sopenharmony_ci */ 14058c2ecf20Sopenharmony_ci#define CMD_CXN_KILLED_ITT_INVALID 22 /* Command got invalidated due 14068c2ecf20Sopenharmony_ci * to received PDU has an 14078c2ecf20Sopenharmony_ci * invalid ITT. 14088c2ecf20Sopenharmony_ci */ 14098c2ecf20Sopenharmony_ci#define CMD_CXN_KILLED_SEQ_OUTOFORDER 23 /* Command got invalidated due 14108c2ecf20Sopenharmony_ci * to received sequence buffer 14118c2ecf20Sopenharmony_ci * offset is out of order. 14128c2ecf20Sopenharmony_ci */ 14138c2ecf20Sopenharmony_ci#define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24 /* Command got invalidated 14148c2ecf20Sopenharmony_ci * internally due to a 14158c2ecf20Sopenharmony_ci * received PDU has an invalid 14168c2ecf20Sopenharmony_ci * DataSN 14178c2ecf20Sopenharmony_ci */ 14188c2ecf20Sopenharmony_ci#define CXN_INVALIDATE_NOTIFY 25 /* Connection invalidation 14198c2ecf20Sopenharmony_ci * completion notify. 14208c2ecf20Sopenharmony_ci */ 14218c2ecf20Sopenharmony_ci#define CXN_INVALIDATE_INDEX_NOTIFY 26 /* Connection invalidation 14228c2ecf20Sopenharmony_ci * completion 14238c2ecf20Sopenharmony_ci * with data PDU index. 14248c2ecf20Sopenharmony_ci */ 14258c2ecf20Sopenharmony_ci#define CMD_INVALIDATED_NOTIFY 27 /* Command invalidation 14268c2ecf20Sopenharmony_ci * completionnotifify. 14278c2ecf20Sopenharmony_ci */ 14288c2ecf20Sopenharmony_ci#define UNSOL_HDR_NOTIFY 28 /* Unsolicited header notify.*/ 14298c2ecf20Sopenharmony_ci#define UNSOL_DATA_NOTIFY 29 /* Unsolicited data notify.*/ 14308c2ecf20Sopenharmony_ci#define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30 /* Unsolicited data digest 14318c2ecf20Sopenharmony_ci * error notify. 14328c2ecf20Sopenharmony_ci */ 14338c2ecf20Sopenharmony_ci#define DRIVERMSG_NOTIFY 31 /* TCP acknowledge based 14348c2ecf20Sopenharmony_ci * notification. 14358c2ecf20Sopenharmony_ci */ 14368c2ecf20Sopenharmony_ci#define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32 /* Connection got invalidated 14378c2ecf20Sopenharmony_ci * internally due to command 14388c2ecf20Sopenharmony_ci * and data are not on same 14398c2ecf20Sopenharmony_ci * connection. 14408c2ecf20Sopenharmony_ci */ 14418c2ecf20Sopenharmony_ci#define SOL_CMD_KILLED_DIF_ERR 33 /* Solicited command got 14428c2ecf20Sopenharmony_ci * invalidated internally due 14438c2ecf20Sopenharmony_ci * to DIF error 14448c2ecf20Sopenharmony_ci */ 14458c2ecf20Sopenharmony_ci#define CXN_KILLED_SYN_RCVD 34 /* Connection got invalidated 14468c2ecf20Sopenharmony_ci * internally due to incoming 14478c2ecf20Sopenharmony_ci * TCP SYN 14488c2ecf20Sopenharmony_ci */ 14498c2ecf20Sopenharmony_ci#define CXN_KILLED_IMM_DATA_RCVD 35 /* Connection got invalidated 14508c2ecf20Sopenharmony_ci * internally due to an 14518c2ecf20Sopenharmony_ci * incoming Unsolicited PDU 14528c2ecf20Sopenharmony_ci * that has immediate data on 14538c2ecf20Sopenharmony_ci * the cxn 14548c2ecf20Sopenharmony_ci */ 14558c2ecf20Sopenharmony_ci 14568c2ecf20Sopenharmony_civoid be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, u32 payload_len, 14578c2ecf20Sopenharmony_ci bool embedded, u8 sge_cnt); 14588c2ecf20Sopenharmony_ci 14598c2ecf20Sopenharmony_civoid be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr, 14608c2ecf20Sopenharmony_ci u8 subsystem, u8 opcode, u32 cmd_len); 14618c2ecf20Sopenharmony_ci#endif /* !BEISCSI_CMDS_H */ 1462