2 * Copyright (C) 2005 - 2012 Emulex
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation. The full GNU General
8 * Public License is included in this distribution in the file called COPYING.
10 * Contact Information:
11 * linux-drivers@emulex.com
15 * Costa Mesa, CA 92626
18 #ifndef BEISCSI_CMDS_H
19 #define BEISCSI_CMDS_H
22 * The driver sends configuration and managements command requests to the
23 * firmware in the BE. These requests are communicated to the processor
24 * using Work Request Blocks (WRBs) submitted to the MCC-WRB ring or via one
25 * WRB inside a MAILBOX.
26 * The commands are serviced by the ARM processor in the OneConnect's MPU.
34 #define MCC_WRB_SGE_CNT_SHIFT 3 /* bits 3 - 7 of dword 0 */
35 #define MCC_WRB_SGE_CNT_MASK 0x1F /* bits 3 - 7 of dword 0 */
37 u32 embedded; /* dword 0 */
38 u32 payload_length; /* dword 1 */
39 u32 tag0; /* dword 2 */
40 u32 tag1; /* dword 3 */
41 u32 rsvd; /* dword 4 */
43 u8 embedded_payload[236]; /* used by embedded cmds */
44 struct be_sge sgl[19]; /* used by non-embedded cmds */
48 #define CQE_FLAGS_VALID_MASK (1 << 31)
49 #define CQE_FLAGS_ASYNC_MASK (1 << 30)
50 #define CQE_FLAGS_COMPLETED_MASK (1 << 28)
51 #define CQE_FLAGS_CONSUMED_MASK (1 << 27)
53 /* Completion Status */
54 #define MCC_STATUS_SUCCESS 0x0
56 #define CQE_STATUS_COMPL_MASK 0xFFFF
57 #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */
58 #define CQE_STATUS_EXTD_MASK 0xFFFF
59 #define CQE_STATUS_EXTD_SHIFT 16 /* bits 0 - 15 */
61 /* MBOX Command VER */
62 #define MBX_CMD_VER2 0x02
65 u32 status; /* dword 0 */
66 u32 tag0; /* dword 1 */
67 u32 tag1; /* dword 2 */
68 u32 flags; /* dword 3 */
71 /********* Mailbox door bell *************/
73 * Used for driver communication with the FW.
74 * The software must write this register twice to post any command. First,
75 * it writes the register with hi=1 and the upper bits of the physical address
76 * for the MAILBOX structure. Software must poll the ready bit until this
77 * is acknowledged. Then, sotware writes the register with hi=0 with the lower
78 * bits in the address. It must poll the ready bit until the command is
79 * complete. Upon completion, the MAILBOX will contain a valid completion
82 #define MPU_MAILBOX_DB_OFFSET 0x160
83 #define MPU_MAILBOX_DB_RDY_MASK 0x1 /* bit 0 */
84 #define MPU_MAILBOX_DB_HI_MASK 0x2 /* bit 1 */
86 /********** MPU semphore ******************/
87 #define MPU_EP_SEMAPHORE_OFFSET 0xac
88 #define EP_SEMAPHORE_POST_STAGE_MASK 0x0000FFFF
89 #define EP_SEMAPHORE_POST_ERR_MASK 0x1
90 #define EP_SEMAPHORE_POST_ERR_SHIFT 31
92 /********** MCC door bell ************/
93 #define DB_MCCQ_OFFSET 0x140
94 #define DB_MCCQ_RING_ID_MASK 0x7FF /* bits 0 - 10 */
95 /* Number of entries posted */
96 #define DB_MCCQ_NUM_POSTED_SHIFT 16 /* bits 16 - 29 */
98 /* MPU semphore POST stage values */
99 #define POST_STAGE_ARMFW_RDY 0xc000 /* FW is done with POST */
102 * When the async bit of mcc_compl is set, the last 4 bytes of
103 * mcc_compl is interpreted as follows:
105 #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
106 #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
107 #define ASYNC_EVENT_CODE_LINK_STATE 0x1
108 struct be_async_event_trailer {
113 ASYNC_EVENT_LINK_DOWN = 0x0,
114 ASYNC_EVENT_LINK_UP = 0x1
118 * When the event code of an async trailer is link-state, the mcc_compl
119 * must be interpreted as follows
121 struct be_async_event_link_state {
128 struct be_async_event_trailer trailer;
131 struct be_mcc_mailbox {
132 struct be_mcc_wrb wrb;
133 struct be_mcc_compl compl;
136 /* Type of subsystems supported by FW */
137 #define CMD_SUBSYSTEM_COMMON 0x1
138 #define CMD_SUBSYSTEM_ISCSI 0x2
139 #define CMD_SUBSYSTEM_ETH 0x3
140 #define CMD_SUBSYSTEM_ISCSI_INI 0x6
141 #define CMD_COMMON_TCP_UPLOAD 0x1
144 * List of common opcodes subsystem CMD_SUBSYSTEM_COMMON
145 * These opcodes are unique for each subsystem defined above
147 #define OPCODE_COMMON_CQ_CREATE 12
148 #define OPCODE_COMMON_EQ_CREATE 13
149 #define OPCODE_COMMON_MCC_CREATE 21
150 #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
151 #define OPCODE_COMMON_GET_FW_VERSION 35
152 #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
153 #define OPCODE_COMMON_FIRMWARE_CONFIG 42
154 #define OPCODE_COMMON_MCC_DESTROY 53
155 #define OPCODE_COMMON_CQ_DESTROY 54
156 #define OPCODE_COMMON_EQ_DESTROY 55
157 #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
158 #define OPCODE_COMMON_FUNCTION_RESET 61
161 * LIST of opcodes that are common between Initiator and Target
162 * used by CMD_SUBSYSTEM_ISCSI
163 * These opcodes are unique for each subsystem defined above
165 #define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES 2
166 #define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES 3
167 #define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG 7
168 #define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN 14
169 #define OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR 17
170 #define OPCODE_COMMON_ISCSI_NTWK_REL_STATELESS_IP_ADDR 18
171 #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR 21
172 #define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY 22
173 #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23
174 #define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID 24
175 #define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO 25
176 #define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61
177 #define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64
178 #define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65
179 #define OPCODE_COMMON_ISCSI_WRBQ_CREATE 66
180 #define OPCODE_COMMON_ISCSI_WRBQ_DESTROY 67
182 struct be_cmd_req_hdr {
183 u8 opcode; /* dword 0 */
184 u8 subsystem; /* dword 0 */
185 u8 port_number; /* dword 0 */
186 u8 domain; /* dword 0 */
187 u32 timeout; /* dword 1 */
188 u32 request_length; /* dword 2 */
189 u8 version; /* dword 3 */
190 u8 rsvd0[3]; /* dword 3 */
193 struct be_cmd_resp_hdr {
194 u32 info; /* dword 0 */
195 u32 status; /* dword 1 */
196 u32 response_length; /* dword 2 */
197 u32 actual_resp_len; /* dword 3 */
205 /**************************
206 * BE Command definitions *
207 **************************/
210 * Pseudo amap definition in which each bit of the actual structure is defined
211 * as a byte - used to calculate offset/shift/mask of each field
213 struct amap_eq_context {
214 u8 cidx[13]; /* dword 0 */
215 u8 rsvd0[3]; /* dword 0 */
216 u8 epidx[13]; /* dword 0 */
217 u8 valid; /* dword 0 */
218 u8 rsvd1; /* dword 0 */
219 u8 size; /* dword 0 */
220 u8 pidx[13]; /* dword 1 */
221 u8 rsvd2[3]; /* dword 1 */
222 u8 pd[10]; /* dword 1 */
223 u8 count[3]; /* dword 1 */
224 u8 solevent; /* dword 1 */
225 u8 stalled; /* dword 1 */
226 u8 armed; /* dword 1 */
227 u8 rsvd3[4]; /* dword 2 */
228 u8 func[8]; /* dword 2 */
229 u8 rsvd4; /* dword 2 */
230 u8 delaymult[10]; /* dword 2 */
231 u8 rsvd5[2]; /* dword 2 */
232 u8 phase[2]; /* dword 2 */
233 u8 nodelay; /* dword 2 */
234 u8 rsvd6[4]; /* dword 2 */
235 u8 rsvd7[32]; /* dword 3 */
238 struct be_cmd_req_eq_create {
239 struct be_cmd_req_hdr hdr; /* dw[4] */
240 u16 num_pages; /* sword */
241 u16 rsvd0; /* sword */
242 u8 context[sizeof(struct amap_eq_context) / 8]; /* dw[4] */
243 struct phys_addr pages[8];
246 struct be_cmd_resp_eq_create {
247 struct be_cmd_resp_hdr resp_hdr;
248 u16 eq_id; /* sword */
249 u16 rsvd0; /* sword */
252 struct mgmt_chap_format {
254 u8 intr_chap_name[256];
256 u8 target_chap_name[256];
257 u8 target_secret[16];
258 u16 intr_chap_name_length;
259 u16 intr_secret_length;
260 u16 target_chap_name_length;
261 u16 target_secret_length;
264 struct mgmt_auth_method_format {
267 struct mgmt_chap_format chap;
270 struct mgmt_conn_login_options {
275 u32 max_recv_datasegment_len_ini;
276 u32 max_recv_datasegment_len_tgt;
279 struct mgmt_auth_method_format auth_data;
282 struct ip_addr_format {
283 u16 size_of_structure;
290 struct mgmt_conn_info {
291 u32 connection_handle;
292 u32 connection_status;
295 u16 dest_port_redirected;
297 u32 estimated_throughput;
298 struct ip_addr_format src_ipaddr;
299 struct ip_addr_format dest_ipaddr;
300 struct ip_addr_format dest_ipaddr_redirected;
301 struct mgmt_conn_login_options negotiated_login_options;
304 struct mgmt_session_login_options {
306 u8 error_recovery_level;
308 u32 first_burst_length;
309 u32 max_burst_length;
311 u16 max_outstanding_r2t;
312 u16 default_time2wait;
313 u16 default_time2retain;
316 struct mgmt_session_info {
325 u8 initiator_iscsiname[224];
326 struct mgmt_session_login_options negotiated_login_options;
327 struct mgmt_conn_info conn_list[1];
330 struct be_cmd_get_session_req {
331 struct be_cmd_req_hdr hdr;
335 struct be_cmd_get_session_resp {
336 struct be_cmd_resp_hdr hdr;
337 struct mgmt_session_info session_info;
341 u16 size_of_structure;
345 struct be_cmd_get_boot_target_req {
346 struct be_cmd_req_hdr hdr;
349 struct be_cmd_get_boot_target_resp {
350 struct be_cmd_resp_hdr hdr;
351 u32 boot_session_count;
352 int boot_session_handle;
355 struct be_cmd_reopen_session_req {
356 struct be_cmd_req_hdr hdr;
357 #define BE_REOPEN_ALL_SESSIONS 0x00
358 #define BE_REOPEN_BOOT_SESSIONS 0x01
359 #define BE_REOPEN_A_SESSION 0x02
365 struct be_cmd_reopen_session_resp {
366 struct be_cmd_resp_hdr hdr;
372 struct be_cmd_mac_query_req {
373 struct be_cmd_req_hdr hdr;
379 struct be_cmd_get_mac_resp {
380 struct be_cmd_resp_hdr hdr;
384 struct be_ip_addr_subnet_format {
385 u16 size_of_structure;
387 u8 ipv6_prefix_length;
393 struct be_cmd_get_if_info_req {
394 struct be_cmd_req_hdr hdr;
399 struct be_cmd_get_if_info_resp {
400 struct be_cmd_req_hdr hdr;
405 struct be_ip_addr_subnet_format ip_addr;
408 struct be_ip_addr_record {
411 struct be_ip_addr_subnet_format ip_addr;
415 struct be_ip_addr_record_params {
416 u32 record_entry_count;
417 struct be_ip_addr_record ip_record;
420 struct be_cmd_set_ip_addr_req {
421 struct be_cmd_req_hdr hdr;
422 struct be_ip_addr_record_params ip_params;
426 struct be_cmd_set_dhcp_req {
427 struct be_cmd_req_hdr hdr;
434 struct be_cmd_rel_dhcp_req {
435 struct be_cmd_req_hdr hdr;
440 struct be_cmd_set_def_gateway_req {
441 struct be_cmd_req_hdr hdr;
443 struct ip_addr_format ip_addr;
446 struct be_cmd_get_def_gateway_req {
447 struct be_cmd_req_hdr hdr;
451 struct be_cmd_get_def_gateway_resp {
452 struct be_cmd_req_hdr hdr;
453 struct ip_addr_format ip_addr;
456 #define BEISCSI_VLAN_DISABLE 0xFFFF
457 struct be_cmd_set_vlan_req {
458 struct be_cmd_req_hdr hdr;
462 /******************** Create CQ ***************************/
464 * Pseudo amap definition in which each bit of the actual structure is defined
465 * as a byte - used to calculate offset/shift/mask of each field
467 struct amap_cq_context {
468 u8 cidx[11]; /* dword 0 */
469 u8 rsvd0; /* dword 0 */
470 u8 coalescwm[2]; /* dword 0 */
471 u8 nodelay; /* dword 0 */
472 u8 epidx[11]; /* dword 0 */
473 u8 rsvd1; /* dword 0 */
474 u8 count[2]; /* dword 0 */
475 u8 valid; /* dword 0 */
476 u8 solevent; /* dword 0 */
477 u8 eventable; /* dword 0 */
478 u8 pidx[11]; /* dword 1 */
479 u8 rsvd2; /* dword 1 */
480 u8 pd[10]; /* dword 1 */
481 u8 eqid[8]; /* dword 1 */
482 u8 stalled; /* dword 1 */
483 u8 armed; /* dword 1 */
484 u8 rsvd3[4]; /* dword 2 */
485 u8 func[8]; /* dword 2 */
486 u8 rsvd4[20]; /* dword 2 */
487 u8 rsvd5[32]; /* dword 3 */
490 struct amap_cq_context_v2 {
491 u8 rsvd0[12]; /* dword 0 */
492 u8 coalescwm[2]; /* dword 0 */
493 u8 nodelay; /* dword 0 */
494 u8 rsvd1[12]; /* dword 0 */
495 u8 count[2]; /* dword 0 */
496 u8 valid; /* dword 0 */
497 u8 rsvd2; /* dword 0 */
498 u8 eventable; /* dword 0 */
499 u8 eqid[16]; /* dword 1 */
500 u8 rsvd3[15]; /* dword 1 */
501 u8 armed; /* dword 1 */
502 u8 cqecount[16];/* dword 2 */
503 u8 rsvd4[16]; /* dword 2 */
504 u8 rsvd5[32]; /* dword 3 */
507 struct be_cmd_req_cq_create {
508 struct be_cmd_req_hdr hdr;
512 u8 context[sizeof(struct amap_cq_context) / 8];
513 struct phys_addr pages[4];
516 struct be_cmd_resp_cq_create {
517 struct be_cmd_resp_hdr hdr;
522 /******************** Create MCCQ ***************************/
524 * Pseudo amap definition in which each bit of the actual structure is defined
525 * as a byte - used to calculate offset/shift/mask of each field
527 struct amap_mcc_context {
542 struct be_cmd_req_mcc_create {
543 struct be_cmd_req_hdr hdr;
546 u8 context[sizeof(struct amap_mcc_context) / 8];
547 struct phys_addr pages[8];
550 struct be_cmd_resp_mcc_create {
551 struct be_cmd_resp_hdr hdr;
556 /******************** Q Destroy ***************************/
557 /* Type of Queue to be destroyed */
567 struct be_cmd_req_q_destroy {
568 struct be_cmd_req_hdr hdr;
570 u16 bypass_flush; /* valid only for rx q destroy */
577 struct be_cmd_req_mcast_mac_config {
578 struct be_cmd_req_hdr hdr;
582 struct macaddr mac[32];
585 static inline void *embedded_payload(struct be_mcc_wrb *wrb)
587 return wrb->payload.embedded_payload;
590 static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb)
592 return &wrb->payload.sgl[0];
595 /******************** Modify EQ Delay *******************/
596 struct be_cmd_req_modify_eq_delay {
597 struct be_cmd_req_hdr hdr;
602 u32 delay_multiplier;
606 /******************** Get MAC ADDR *******************/
610 struct be_cmd_get_nic_conf_req {
611 struct be_cmd_req_hdr hdr;
617 u16 size_of_structure;
618 u8 mac_address[ETH_ALEN];
622 struct be_cmd_get_nic_conf_resp {
623 struct be_cmd_resp_hdr hdr;
629 u16 size_of_structure;
634 #define BEISCSI_ALIAS_LEN 32
636 struct be_cmd_hba_name {
637 struct be_cmd_req_hdr hdr;
640 u8 initiator_name[ISCSI_NAME_LEN];
641 u8 initiator_alias[BEISCSI_ALIAS_LEN];
644 struct be_cmd_ntwk_link_status_req {
645 struct be_cmd_req_hdr hdr;
649 /*** Port Speed Values ***/
650 #define BE2ISCSI_LINK_SPEED_ZERO 0x00
651 #define BE2ISCSI_LINK_SPEED_10MBPS 0x01
652 #define BE2ISCSI_LINK_SPEED_100MBPS 0x02
653 #define BE2ISCSI_LINK_SPEED_1GBPS 0x03
654 #define BE2ISCSI_LINK_SPEED_10GBPS 0x04
655 struct be_cmd_ntwk_link_status_resp {
656 struct be_cmd_resp_hdr hdr;
664 u32 logical_link_speed;
667 int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
668 struct be_queue_info *eq, int eq_delay);
670 int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
671 struct be_queue_info *cq, struct be_queue_info *eq,
672 bool sol_evts, bool no_delay,
673 int num_cqe_dma_coalesce);
675 int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q,
677 int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
678 struct be_queue_info *mccq,
679 struct be_queue_info *cq);
681 int be_poll_mcc(struct be_ctrl_info *ctrl);
682 int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
683 struct beiscsi_hba *phba);
684 unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
685 unsigned int be_cmd_get_port_speed(struct beiscsi_hba *phba);
687 void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
688 /*ISCSI Functuions */
689 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
691 struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
692 struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
693 int be_mcc_notify_wait(struct beiscsi_hba *phba);
694 void be_mcc_notify(struct beiscsi_hba *phba);
695 unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
696 void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
697 struct be_async_event_link_state *evt);
698 int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
699 struct be_mcc_compl *compl);
701 int be_mbox_notify(struct be_ctrl_info *ctrl);
703 int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl,
704 struct be_queue_info *cq,
705 struct be_queue_info *dq, int length,
708 int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
709 struct be_dma_mem *q_mem, u32 page_offset,
712 int beiscsi_cmd_reset_function(struct beiscsi_hba *phba);
714 int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem,
715 struct be_queue_info *wrbq);
717 bool is_link_state_evt(u32 trailer);
719 /* Configuration Functions */
720 int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
722 struct be_default_pdu_context {
726 struct amap_be_default_pdu_context {
727 u8 dbuf_cindex[13]; /* dword 0 */
728 u8 rsvd0[3]; /* dword 0 */
729 u8 ring_size[4]; /* dword 0 */
730 u8 ring_state[4]; /* dword 0 */
731 u8 rsvd1[8]; /* dword 0 */
732 u8 dbuf_pindex[13]; /* dword 1 */
733 u8 rsvd2; /* dword 1 */
734 u8 pci_func_id[8]; /* dword 1 */
735 u8 rx_pdid[9]; /* dword 1 */
736 u8 rx_pdid_valid; /* dword 1 */
737 u8 default_buffer_size[16]; /* dword 2 */
738 u8 cq_id_recv[10]; /* dword 2 */
739 u8 rx_pdid_not_valid; /* dword 2 */
740 u8 rsvd3[5]; /* dword 2 */
741 u8 rsvd4[32]; /* dword 3 */
744 struct be_defq_create_req {
745 struct be_cmd_req_hdr hdr;
749 struct be_default_pdu_context context;
750 struct phys_addr pages[8];
753 struct be_defq_create_resp {
754 struct be_cmd_req_hdr hdr;
759 struct be_post_sgl_pages_req {
760 struct be_cmd_req_hdr hdr;
764 struct phys_addr pages[26];
768 struct be_wrbq_create_req {
769 struct be_cmd_req_hdr hdr;
773 struct phys_addr pages[8];
776 struct be_wrbq_create_resp {
777 struct be_cmd_resp_hdr resp_hdr;
782 #define SOL_CID_MASK 0x0000FFC0
783 #define SOL_CODE_MASK 0x0000003F
784 #define SOL_WRB_INDEX_MASK 0x00FF0000
785 #define SOL_CMD_WND_MASK 0xFF000000
786 #define SOL_RES_CNT_MASK 0x7FFFFFFF
787 #define SOL_EXP_CMD_SN_MASK 0xFFFFFFFF
788 #define SOL_HW_STS_MASK 0x000000FF
789 #define SOL_STS_MASK 0x0000FF00
790 #define SOL_RESP_MASK 0x00FF0000
791 #define SOL_FLAGS_MASK 0x7F000000
792 #define SOL_S_MASK 0x80000000
798 struct amap_sol_cqe {
799 u8 hw_sts[8]; /* dword 0 */
800 u8 i_sts[8]; /* dword 0 */
801 u8 i_resp[8]; /* dword 0 */
802 u8 i_flags[7]; /* dword 0 */
804 u8 i_exp_cmd_sn[32]; /* dword 1 */
805 u8 code[6]; /* dword 2 */
806 u8 cid[10]; /* dword 2 */
807 u8 wrb_index[8]; /* dword 2 */
808 u8 i_cmd_wnd[8]; /* dword 2 */
809 u8 i_res_cnt[31]; /* dword 3 */
810 u8 valid; /* dword 3 */
813 #define SOL_ICD_INDEX_MASK 0x0003FFC0
814 struct amap_sol_cqe_ring {
815 u8 hw_sts[8]; /* dword 0 */
816 u8 i_sts[8]; /* dword 0 */
817 u8 i_resp[8]; /* dword 0 */
818 u8 i_flags[7]; /* dword 0 */
820 u8 i_exp_cmd_sn[32]; /* dword 1 */
821 u8 code[6]; /* dword 2 */
822 u8 icd_index[12]; /* dword 2 */
823 u8 rsvd[6]; /* dword 2 */
824 u8 i_cmd_wnd[8]; /* dword 2 */
825 u8 i_res_cnt[31]; /* dword 3 */
826 u8 valid; /* dword 3 */
829 struct amap_sol_cqe_v2 {
830 u8 hw_sts[8]; /* dword 0 */
831 u8 i_sts[8]; /* dword 0 */
832 u8 wrb_index[16]; /* dword 0 */
833 u8 i_exp_cmd_sn[32]; /* dword 1 */
834 u8 code[6]; /* dword 2 */
835 u8 cmd_cmpl; /* dword 2 */
836 u8 rsvd0; /* dword 2 */
837 u8 i_cmd_wnd[8]; /* dword 2 */
838 u8 cid[13]; /* dword 2 */
842 u8 i_res_cnt[31]; /* dword 3 */
843 u8 valid; /* dword 3 */
846 struct common_sol_cqe {
853 u8 res_flag; /* the s feild of structure */
854 u8 i_resp; /* for skh if cmd_complete is set then i_sts is response */
855 u8 i_flags; /* for skh or the u and o feilds */
856 u8 i_sts; /* for skh if cmd_complete is not-set then i_sts is status */
859 /*** iSCSI ack/driver message completions ***/
860 struct amap_it_dmsg_cqe {
861 u8 ack_num[32]; /* DWORD 0 */
862 u8 pdu_bytes_rcvd[32]; /* DWORD 1 */
863 u8 code[6]; /* DWORD 2 */
864 u8 cid[10]; /* DWORD 2 */
865 u8 wrb_idx[8]; /* DWORD 2 */
866 u8 rsvd0[8]; /* DWORD 2*/
867 u8 rsvd1[31]; /* DWORD 3*/
868 u8 valid; /* DWORD 3 */
871 struct amap_it_dmsg_cqe_v2 {
872 u8 ack_num[32]; /* DWORD 0 */
873 u8 pdu_bytes_rcvd[32]; /* DWORD 1 */
874 u8 code[6]; /* DWORD 2 */
875 u8 rsvd0[10]; /* DWORD 2 */
876 u8 wrb_idx[16]; /* DWORD 2 */
877 u8 rsvd1[16]; /* DWORD 3 */
878 u8 cid[13]; /* DWORD 3 */
879 u8 rsvd2[2]; /* DWORD 3 */
880 u8 valid; /* DWORD 3 */
885 * Post WRB Queue Doorbell Register used by the host Storage
886 * stack to notify the
887 * controller of a posted Work Request Block
889 #define DB_WRB_POST_CID_MASK 0x3FF /* bits 0 - 9 */
890 #define DB_DEF_PDU_WRB_INDEX_MASK 0xFF /* bits 0 - 9 */
892 #define DB_DEF_PDU_WRB_INDEX_SHIFT 16
893 #define DB_DEF_PDU_NUM_POSTED_SHIFT 24
895 struct fragnum_bits_for_sgl_cra_in {
896 struct be_cmd_req_hdr hdr;
900 struct iscsi_cleanup_req {
901 struct be_cmd_req_hdr hdr;
911 u32 delay_multiplier;
914 struct be_eq_delay_params_in {
915 struct be_cmd_req_hdr hdr;
917 struct eq_delay delay[8];
920 struct tcp_connect_and_offload_in {
921 struct be_cmd_req_hdr hdr;
922 struct ip_addr_format ip_address;
927 struct phys_addr dataout_template_pa;
934 struct tcp_connect_and_offload_out {
935 struct be_cmd_resp_hdr hdr;
936 u32 connection_handle;
942 struct be_mcc_wrb_context {
944 int *users_final_status;
947 #define DB_DEF_PDU_RING_ID_MASK 0x3FF /* bits 0 - 9 */
948 #define DB_DEF_PDU_CQPROC_MASK 0x3FFF /* bits 0 - 9 */
949 #define DB_DEF_PDU_REARM_SHIFT 14
950 #define DB_DEF_PDU_EVENT_SHIFT 15
951 #define DB_DEF_PDU_CQPROC_SHIFT 16
957 struct tcp_upload_params_in {
958 struct be_cmd_req_hdr hdr;
964 struct tcp_upload_params_out {
968 union tcp_upload_params {
969 struct tcp_upload_params_in request;
970 struct tcp_upload_params_out response;
973 struct be_ulp_fw_cfg {
990 struct be_cmd_req_hdr hdr;
991 u32 be_config_number;
995 struct be_ulp_fw_cfg ulp[2];
999 struct be_cmd_get_all_if_id_req {
1000 struct be_cmd_req_hdr hdr;
1002 u32 if_hndl_list[1];
1005 #define ISCSI_OPCODE_SCSI_DATA_OUT 5
1006 #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
1007 #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
1008 #define OPCODE_COMMON_ISCSI_CLEANUP 59
1009 #define OPCODE_COMMON_TCP_UPLOAD 56
1010 #define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70
1011 #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1
1012 #define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6
1013 #define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7
1014 #define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14
1015 #define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36
1016 #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
1017 #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
1018 #define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52
1019 #define OPCODE_COMMON_WRITE_FLASH 96
1020 #define OPCODE_COMMON_READ_FLASH 97
1022 /* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */
1023 #define CMD_ISCSI_COMMAND_INVALIDATE 1
1024 #define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001
1025 #define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002
1027 #define INI_WR_CMD 1 /* Initiator write command */
1028 #define INI_TMF_CMD 2 /* Initiator TMF command */
1029 #define INI_NOPOUT_CMD 3 /* Initiator; Send a NOP-OUT */
1030 #define INI_RD_CMD 5 /* Initiator requesting to send
1033 #define TGT_CTX_UPDT_CMD 7 /* Target context update */
1034 #define TGT_STS_CMD 8 /* Target R2T and other BHS
1035 * where only the status number
1036 * need to be updated
1038 #define TGT_DATAIN_CMD 9 /* Target Data-Ins in response
1041 #define TGT_SOS_PDU 10 /* Target:standalone status
1044 #define TGT_DM_CMD 11 /* Indicates that the bhs
1046 * driver should not be touched
1048 /* --- CMD_CHUTE_TYPE --- */
1049 #define CMD_CONNECTION_CHUTE_0 1
1050 #define CMD_CONNECTION_CHUTE_1 2
1051 #define CMD_CONNECTION_CHUTE_2 3
1053 #define EQ_MAJOR_CODE_COMPLETION 0
1055 #define CMD_ISCSI_SESSION_DEL_CFG_FROM_FLASH 0
1056 #define CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH 1
1058 /* --- CONNECTION_UPLOAD_PARAMS --- */
1059 /* These parameters are used to define the type of upload desired. */
1060 #define CONNECTION_UPLOAD_GRACEFUL 1 /* Graceful upload */
1061 #define CONNECTION_UPLOAD_ABORT_RESET 2 /* Abortive upload with
1064 #define CONNECTION_UPLOAD_ABORT 3 /* Abortive upload without
1067 #define CONNECTION_UPLOAD_ABORT_WITH_SEQ 4 /* Abortive upload with reset,
1068 * sequence number by driver */
1070 /* Returns the number of items in the field array. */
1071 #define BE_NUMBER_OF_FIELD(_type_, _field_) \
1072 (FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\
1075 * Different types of iSCSI completions to host driver for both initiator
1079 #define SOL_CMD_COMPLETE 1 /* Solicited command completed
1082 #define SOL_CMD_KILLED_DATA_DIGEST_ERR 2 /* Solicited command got
1083 * invalidated internally due
1084 * to Data Digest error
1086 #define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3 /* Connection got invalidated
1088 * due to a received PDU
1091 #define CXN_KILLED_BURST_LEN_MISMATCH 4 /* Connection got invalidated
1092 * internally due ti received
1093 * PDU sequence size >
1096 #define CXN_KILLED_AHS_RCVD 5 /* Connection got invalidated
1097 * internally due to a received
1100 #define CXN_KILLED_HDR_DIGEST_ERR 6 /* Connection got invalidated
1101 * internally due to Hdr Digest
1104 #define CXN_KILLED_UNKNOWN_HDR 7 /* Connection got invalidated
1106 * due to a bad opcode in the
1109 #define CXN_KILLED_STALE_ITT_TTT_RCVD 8 /* Connection got invalidated
1110 * internally due to a received
1111 * ITT/TTT that does not belong
1112 * to this Connection
1114 #define CXN_KILLED_INVALID_ITT_TTT_RCVD 9 /* Connection got invalidated
1115 * internally due to received
1116 * ITT/TTT value > Max
1117 * Supported ITTs/TTTs
1119 #define CXN_KILLED_RST_RCVD 10 /* Connection got invalidated
1120 * internally due to an
1123 #define CXN_KILLED_TIMED_OUT 11 /* Connection got invalidated
1124 * internally due to timeout on
1125 * tcp segment 12 retransmit
1128 #define CXN_KILLED_RST_SENT 12 /* Connection got invalidated
1129 * internally due to TCP RST
1130 * sent by the Tx side
1132 #define CXN_KILLED_FIN_RCVD 13 /* Connection got invalidated
1133 * internally due to an
1136 #define CXN_KILLED_BAD_UNSOL_PDU_RCVD 14 /* Connection got invalidated
1137 * internally due to bad
1138 * unsolicited PDU Unsolicited
1139 * PDUs are PDUs with
1142 #define CXN_KILLED_BAD_WRB_INDEX_ERROR 15 /* Connection got invalidated
1143 * internally due to bad WRB
1146 #define CXN_KILLED_OVER_RUN_RESIDUAL 16 /* Command got invalidated
1147 * internally due to received
1148 * command has residual
1151 #define CXN_KILLED_UNDER_RUN_RESIDUAL 17 /* Command got invalidated
1152 * internally due to received
1153 * command has residual under
1156 #define CMD_KILLED_INVALID_STATSN_RCVD 18 /* Command got invalidated
1157 * internally due to a received
1158 * PDU has an invalid StatusSN
1160 #define CMD_KILLED_INVALID_R2T_RCVD 19 /* Command got invalidated
1161 * internally due to a received
1162 * an R2T with some invalid
1165 #define CMD_CXN_KILLED_LUN_INVALID 20 /* Command got invalidated
1166 * internally due to received
1167 * PDU has an invalid LUN.
1169 #define CMD_CXN_KILLED_ICD_INVALID 21 /* Command got invalidated
1170 * internally due to the
1171 * corresponding ICD not in a
1174 #define CMD_CXN_KILLED_ITT_INVALID 22 /* Command got invalidated due
1175 * to received PDU has an
1178 #define CMD_CXN_KILLED_SEQ_OUTOFORDER 23 /* Command got invalidated due
1179 * to received sequence buffer
1180 * offset is out of order.
1182 #define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24 /* Command got invalidated
1183 * internally due to a
1184 * received PDU has an invalid
1187 #define CXN_INVALIDATE_NOTIFY 25 /* Connection invalidation
1188 * completion notify.
1190 #define CXN_INVALIDATE_INDEX_NOTIFY 26 /* Connection invalidation
1192 * with data PDU index.
1194 #define CMD_INVALIDATED_NOTIFY 27 /* Command invalidation
1195 * completionnotifify.
1197 #define UNSOL_HDR_NOTIFY 28 /* Unsolicited header notify.*/
1198 #define UNSOL_DATA_NOTIFY 29 /* Unsolicited data notify.*/
1199 #define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30 /* Unsolicited data digest
1202 #define DRIVERMSG_NOTIFY 31 /* TCP acknowledge based
1205 #define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32 /* Connection got invalidated
1206 * internally due to command
1207 * and data are not on same
1210 #define SOL_CMD_KILLED_DIF_ERR 33 /* Solicited command got
1211 * invalidated internally due
1214 #define CXN_KILLED_SYN_RCVD 34 /* Connection got invalidated
1215 * internally due to incoming
1218 #define CXN_KILLED_IMM_DATA_RCVD 35 /* Connection got invalidated
1219 * internally due to an
1220 * incoming Unsolicited PDU
1221 * that has immediate data on
1225 int beiscsi_pci_soft_reset(struct beiscsi_hba *phba);
1226 int be_chk_reset_complete(struct beiscsi_hba *phba);
1228 void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
1229 bool embedded, u8 sge_cnt);
1231 void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
1232 u8 subsystem, u8 opcode, int cmd_len);
1234 #endif /* !BEISCSI_CMDS_H */