Merge branches 'misc', 'drv_cleanup', 'devm-cleanup' and 'ti-soc' of .git into next
[cascardo/linux.git] / drivers / scsi / be2iscsi / be_cmds.h
1 /**
2  * Copyright (C) 2005 - 2013 Emulex
3  * All rights reserved.
4  *
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.
9  *
10  * Contact Information:
11  * linux-drivers@emulex.com
12  *
13  * Emulex
14  * 3333 Susan Street
15  * Costa Mesa, CA 92626
16  */
17
18 #ifndef BEISCSI_CMDS_H
19 #define BEISCSI_CMDS_H
20
21 /**
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.
27  */
28 struct be_sge {
29         u32 pa_lo;
30         u32 pa_hi;
31         u32 len;
32 };
33
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 */
36 struct be_mcc_wrb {
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 */
42         union {
43                 u8 embedded_payload[236];       /* used by embedded cmds */
44                 struct be_sge sgl[19];  /* used by non-embedded cmds */
45         } payload;
46 };
47
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)
52
53 /* Completion Status */
54 #define MCC_STATUS_SUCCESS 0x0
55 #define MCC_STATUS_FAILED 0x1
56 #define MCC_STATUS_ILLEGAL_REQUEST 0x2
57 #define MCC_STATUS_ILLEGAL_FIELD 0x3
58 #define MCC_STATUS_INSUFFICIENT_BUFFER 0x4
59
60 #define CQE_STATUS_COMPL_MASK 0xFFFF
61 #define CQE_STATUS_COMPL_SHIFT 0        /* bits 0 - 15 */
62 #define CQE_STATUS_EXTD_MASK 0xFFFF
63 #define CQE_STATUS_EXTD_SHIFT 16                /* bits 0 - 15 */
64 #define CQE_STATUS_ADDL_MASK    0xFF00
65 #define CQE_STATUS_MASK 0xFF
66 #define CQE_STATUS_ADDL_SHIFT   0x08
67 #define CQE_STATUS_WRB_MASK     0xFF0000
68 #define CQE_STATUS_WRB_SHIFT    16
69 #define BEISCSI_HOST_MBX_TIMEOUT (110 * 1000)
70 #define BEISCSI_FW_MBX_TIMEOUT  100
71
72 /* MBOX Command VER */
73 #define MBX_CMD_VER2    0x02
74
75 struct be_mcc_compl {
76         u32 status;             /* dword 0 */
77         u32 tag0;               /* dword 1 */
78         u32 tag1;               /* dword 2 */
79         u32 flags;              /* dword 3 */
80 };
81
82 /********* Mailbox door bell *************/
83 /**
84  * Used for driver communication with the FW.
85  * The software must write this register twice to post any command. First,
86  * it writes the register with hi=1 and the upper bits of the physical address
87  * for the MAILBOX structure. Software must poll the ready bit until this
88  * is acknowledged. Then, sotware writes the register with hi=0 with the lower
89  * bits in the address. It must poll the ready bit until the command is
90  * complete. Upon completion, the MAILBOX will contain a valid completion
91  * queue entry.
92  */
93 #define MPU_MAILBOX_DB_OFFSET   0x160
94 #define MPU_MAILBOX_DB_RDY_MASK 0x1     /* bit 0 */
95 #define MPU_MAILBOX_DB_HI_MASK  0x2     /* bit 1 */
96
97 /********** MPU semphore ******************/
98 #define MPU_EP_SEMAPHORE_OFFSET 0xac
99 #define EP_SEMAPHORE_POST_STAGE_MASK 0x0000FFFF
100 #define EP_SEMAPHORE_POST_ERR_MASK 0x1
101 #define EP_SEMAPHORE_POST_ERR_SHIFT 31
102
103 /********** MCC door bell ************/
104 #define DB_MCCQ_OFFSET 0x140
105 #define DB_MCCQ_RING_ID_MASK 0x7FF              /* bits 0 - 10 */
106 /* Number of entries posted */
107 #define DB_MCCQ_NUM_POSTED_SHIFT 16             /* bits 16 - 29 */
108
109 /* MPU semphore POST stage values */
110 #define POST_STAGE_ARMFW_RDY            0xc000  /* FW is done with POST */
111
112 /**
113  * When the async bit of mcc_compl is set, the last 4 bytes of
114  * mcc_compl is interpreted as follows:
115  */
116 #define ASYNC_TRAILER_EVENT_CODE_SHIFT  8       /* bits 8 - 15 */
117 #define ASYNC_TRAILER_EVENT_CODE_MASK   0xFF
118 #define ASYNC_EVENT_CODE_LINK_STATE     0x1
119 struct be_async_event_trailer {
120         u32 code;
121 };
122
123 enum {
124         ASYNC_EVENT_LINK_DOWN = 0x0,
125         ASYNC_EVENT_LINK_UP = 0x1,
126         ASYNC_EVENT_LOGICAL = 0x2
127 };
128
129 /**
130  * When the event code of an async trailer is link-state, the mcc_compl
131  * must be interpreted as follows
132  */
133 struct be_async_event_link_state {
134         u8 physical_port;
135         u8 port_link_status;
136         u8 port_duplex;
137         u8 port_speed;
138 #define BEISCSI_PHY_LINK_FAULT_NONE     0x00
139 #define BEISCSI_PHY_LINK_FAULT_LOCAL    0x01
140 #define BEISCSI_PHY_LINK_FAULT_REMOTE   0x02
141         u8 port_fault;
142         u8 rsvd0[7];
143         struct be_async_event_trailer trailer;
144 } __packed;
145
146 struct be_mcc_mailbox {
147         struct be_mcc_wrb wrb;
148         struct be_mcc_compl compl;
149 };
150
151 /* Type of subsystems supported by FW */
152 #define CMD_SUBSYSTEM_COMMON    0x1
153 #define CMD_SUBSYSTEM_ISCSI     0x2
154 #define CMD_SUBSYSTEM_ETH       0x3
155 #define CMD_SUBSYSTEM_ISCSI_INI 0x6
156 #define CMD_COMMON_TCP_UPLOAD   0x1
157
158 /**
159  * List of common opcodes subsystem  CMD_SUBSYSTEM_COMMON
160  * These opcodes are unique for each subsystem defined above
161  */
162 #define OPCODE_COMMON_CQ_CREATE                         12
163 #define OPCODE_COMMON_EQ_CREATE                         13
164 #define OPCODE_COMMON_MCC_CREATE                        21
165 #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES               32
166 #define OPCODE_COMMON_GET_FW_VERSION                    35
167 #define OPCODE_COMMON_MODIFY_EQ_DELAY                   41
168 #define OPCODE_COMMON_FIRMWARE_CONFIG                   42
169 #define OPCODE_COMMON_MCC_DESTROY                       53
170 #define OPCODE_COMMON_CQ_DESTROY                        54
171 #define OPCODE_COMMON_EQ_DESTROY                        55
172 #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG             58
173 #define OPCODE_COMMON_FUNCTION_RESET                    61
174
175 /**
176  * LIST of opcodes that are common between Initiator and Target
177  * used by CMD_SUBSYSTEM_ISCSI
178  * These opcodes are unique for each subsystem defined above
179  */
180 #define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES          2
181 #define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES        3
182 #define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG         7
183 #define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN               14
184 #define OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR       17
185 #define OPCODE_COMMON_ISCSI_NTWK_REL_STATELESS_IP_ADDR  18
186 #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR         21
187 #define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY    22
188 #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23
189 #define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID          24
190 #define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO            25
191 #define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61
192 #define OPCODE_COMMON_ISCSI_DEFQ_CREATE                 64
193 #define OPCODE_COMMON_ISCSI_DEFQ_DESTROY                65
194 #define OPCODE_COMMON_ISCSI_WRBQ_CREATE                 66
195 #define OPCODE_COMMON_ISCSI_WRBQ_DESTROY                67
196
197 struct be_cmd_req_hdr {
198         u8 opcode;              /* dword 0 */
199         u8 subsystem;           /* dword 0 */
200         u8 port_number;         /* dword 0 */
201         u8 domain;              /* dword 0 */
202         u32 timeout;            /* dword 1 */
203         u32 request_length;     /* dword 2 */
204         u8 version;             /* dword 3 */
205         u8 rsvd0[3];            /* dword 3 */
206 };
207
208 struct be_cmd_resp_hdr {
209         u32 info;               /* dword 0 */
210         u32 status;             /* dword 1 */
211         u32 response_length;    /* dword 2 */
212         u32 actual_resp_len;    /* dword 3 */
213 };
214
215 struct phys_addr {
216         u32 lo;
217         u32 hi;
218 };
219
220 /**************************
221  * BE Command definitions *
222  **************************/
223
224 /**
225  * Pseudo amap definition in which each bit of the actual structure is defined
226  * as a byte - used to calculate offset/shift/mask of each field
227  */
228 struct amap_eq_context {
229         u8 cidx[13];            /* dword 0 */
230         u8 rsvd0[3];            /* dword 0 */
231         u8 epidx[13];           /* dword 0 */
232         u8 valid;               /* dword 0 */
233         u8 rsvd1;               /* dword 0 */
234         u8 size;                /* dword 0 */
235         u8 pidx[13];            /* dword 1 */
236         u8 rsvd2[3];            /* dword 1 */
237         u8 pd[10];              /* dword 1 */
238         u8 count[3];            /* dword 1 */
239         u8 solevent;            /* dword 1 */
240         u8 stalled;             /* dword 1 */
241         u8 armed;               /* dword 1 */
242         u8 rsvd3[4];            /* dword 2 */
243         u8 func[8];             /* dword 2 */
244         u8 rsvd4;               /* dword 2 */
245         u8 delaymult[10];       /* dword 2 */
246         u8 rsvd5[2];            /* dword 2 */
247         u8 phase[2];            /* dword 2 */
248         u8 nodelay;             /* dword 2 */
249         u8 rsvd6[4];            /* dword 2 */
250         u8 rsvd7[32];           /* dword 3 */
251 } __packed;
252
253 struct be_cmd_req_eq_create {
254         struct be_cmd_req_hdr hdr;      /* dw[4] */
255         u16 num_pages;          /* sword */
256         u16 rsvd0;              /* sword */
257         u8 context[sizeof(struct amap_eq_context) / 8]; /* dw[4] */
258         struct phys_addr pages[8];
259 } __packed;
260
261 struct be_cmd_resp_eq_create {
262         struct be_cmd_resp_hdr resp_hdr;
263         u16 eq_id;              /* sword */
264         u16 rsvd0;              /* sword */
265 } __packed;
266
267 struct mgmt_chap_format {
268         u32 flags;
269         u8  intr_chap_name[256];
270         u8  intr_secret[16];
271         u8  target_chap_name[256];
272         u8  target_secret[16];
273         u16 intr_chap_name_length;
274         u16 intr_secret_length;
275         u16 target_chap_name_length;
276         u16 target_secret_length;
277 } __packed;
278
279 struct mgmt_auth_method_format {
280         u8      auth_method_type;
281         u8      padding[3];
282         struct  mgmt_chap_format chap;
283 } __packed;
284
285 struct mgmt_conn_login_options {
286         u8 flags;
287         u8 header_digest;
288         u8 data_digest;
289         u8 rsvd0;
290         u32 max_recv_datasegment_len_ini;
291         u32 max_recv_datasegment_len_tgt;
292         u32 tcp_mss;
293         u32 tcp_window_size;
294         struct  mgmt_auth_method_format auth_data;
295 } __packed;
296
297 struct ip_addr_format {
298         u16 size_of_structure;
299         u8 reserved;
300         u8 ip_type;
301         u8 addr[16];
302         u32 rsvd0;
303 } __packed;
304
305 struct mgmt_conn_info {
306         u32     connection_handle;
307         u32     connection_status;
308         u16     src_port;
309         u16     dest_port;
310         u16     dest_port_redirected;
311         u16     cid;
312         u32     estimated_throughput;
313         struct  ip_addr_format  src_ipaddr;
314         struct  ip_addr_format  dest_ipaddr;
315         struct  ip_addr_format  dest_ipaddr_redirected;
316         struct  mgmt_conn_login_options negotiated_login_options;
317 } __packed;
318
319 struct mgmt_session_login_options {
320         u8      flags;
321         u8      error_recovery_level;
322         u16     rsvd0;
323         u32     first_burst_length;
324         u32     max_burst_length;
325         u16     max_connections;
326         u16     max_outstanding_r2t;
327         u16     default_time2wait;
328         u16     default_time2retain;
329 } __packed;
330
331 struct mgmt_session_info {
332         u32     session_handle;
333         u32     status;
334         u8      isid[6];
335         u16     tsih;
336         u32     session_flags;
337         u16     conn_count;
338         u16     pad;
339         u8      target_name[224];
340         u8      initiator_iscsiname[224];
341         struct  mgmt_session_login_options negotiated_login_options;
342         struct  mgmt_conn_info  conn_list[1];
343 } __packed;
344
345 struct be_cmd_get_session_req {
346         struct be_cmd_req_hdr hdr;
347         u32 session_handle;
348 } __packed;
349
350 struct be_cmd_get_session_resp {
351         struct be_cmd_resp_hdr hdr;
352         struct mgmt_session_info session_info;
353 } __packed;
354
355 struct mac_addr {
356         u16 size_of_structure;
357         u8 addr[ETH_ALEN];
358 } __packed;
359
360 struct be_cmd_get_boot_target_req {
361         struct be_cmd_req_hdr hdr;
362 } __packed;
363
364 struct be_cmd_get_boot_target_resp {
365         struct be_cmd_resp_hdr hdr;
366         u32  boot_session_count;
367         int  boot_session_handle;
368 };
369
370 struct be_cmd_reopen_session_req {
371         struct be_cmd_req_hdr hdr;
372 #define BE_REOPEN_ALL_SESSIONS  0x00
373 #define BE_REOPEN_BOOT_SESSIONS 0x01
374 #define BE_REOPEN_A_SESSION     0x02
375         u16 reopen_type;
376         u16 rsvd;
377         u32 session_handle;
378 } __packed;
379
380 struct be_cmd_reopen_session_resp {
381         struct be_cmd_resp_hdr hdr;
382         u32 rsvd;
383         u32 session_handle;
384 } __packed;
385
386
387 struct be_cmd_mac_query_req {
388         struct be_cmd_req_hdr hdr;
389         u8 type;
390         u8 permanent;
391         u16 if_id;
392 } __packed;
393
394 struct be_cmd_get_mac_resp {
395         struct be_cmd_resp_hdr hdr;
396         struct mac_addr mac;
397 };
398
399 struct be_ip_addr_subnet_format {
400         u16 size_of_structure;
401         u8 ip_type;
402         u8 ipv6_prefix_length;
403         u8 addr[16];
404         u8 subnet_mask[16];
405         u32 rsvd0;
406 } __packed;
407
408 struct be_cmd_get_if_info_req {
409         struct be_cmd_req_hdr hdr;
410         u32 interface_hndl;
411         u32 ip_type;
412 } __packed;
413
414 struct be_cmd_get_if_info_resp {
415         struct be_cmd_req_hdr hdr;
416         u32 interface_hndl;
417         u32 vlan_priority;
418         u32 ip_addr_count;
419         u32 dhcp_state;
420         struct be_ip_addr_subnet_format ip_addr;
421 } __packed;
422
423 struct be_ip_addr_record {
424         u32 action;
425         u32 interface_hndl;
426         struct be_ip_addr_subnet_format ip_addr;
427         u32 status;
428 } __packed;
429
430 struct be_ip_addr_record_params {
431         u32 record_entry_count;
432         struct be_ip_addr_record ip_record;
433 } __packed;
434
435 struct be_cmd_set_ip_addr_req {
436         struct be_cmd_req_hdr hdr;
437         struct be_ip_addr_record_params ip_params;
438 } __packed;
439
440
441 struct be_cmd_set_dhcp_req {
442         struct be_cmd_req_hdr hdr;
443         u32 interface_hndl;
444         u32 ip_type;
445         u32 flags;
446         u32 retry_count;
447 } __packed;
448
449 struct be_cmd_rel_dhcp_req {
450         struct be_cmd_req_hdr hdr;
451         u32 interface_hndl;
452         u32 ip_type;
453 } __packed;
454
455 struct be_cmd_set_def_gateway_req {
456         struct be_cmd_req_hdr hdr;
457         u32 action;
458         struct ip_addr_format ip_addr;
459 } __packed;
460
461 struct be_cmd_get_def_gateway_req {
462         struct be_cmd_req_hdr hdr;
463         u32 ip_type;
464 } __packed;
465
466 struct be_cmd_get_def_gateway_resp {
467         struct be_cmd_req_hdr hdr;
468         struct ip_addr_format ip_addr;
469 } __packed;
470
471 #define BEISCSI_VLAN_DISABLE    0xFFFF
472 struct be_cmd_set_vlan_req {
473         struct be_cmd_req_hdr hdr;
474         u32 interface_hndl;
475         u32 vlan_priority;
476 } __packed;
477 /******************** Create CQ ***************************/
478 /**
479  * Pseudo amap definition in which each bit of the actual structure is defined
480  * as a byte - used to calculate offset/shift/mask of each field
481  */
482 struct amap_cq_context {
483         u8 cidx[11];            /* dword 0 */
484         u8 rsvd0;               /* dword 0 */
485         u8 coalescwm[2];        /* dword 0 */
486         u8 nodelay;             /* dword 0 */
487         u8 epidx[11];           /* dword 0 */
488         u8 rsvd1;               /* dword 0 */
489         u8 count[2];            /* dword 0 */
490         u8 valid;               /* dword 0 */
491         u8 solevent;            /* dword 0 */
492         u8 eventable;           /* dword 0 */
493         u8 pidx[11];            /* dword 1 */
494         u8 rsvd2;               /* dword 1 */
495         u8 pd[10];              /* dword 1 */
496         u8 eqid[8];             /* dword 1 */
497         u8 stalled;             /* dword 1 */
498         u8 armed;               /* dword 1 */
499         u8 rsvd3[4];            /* dword 2 */
500         u8 func[8];             /* dword 2 */
501         u8 rsvd4[20];           /* dword 2 */
502         u8 rsvd5[32];           /* dword 3 */
503 } __packed;
504
505 struct amap_cq_context_v2 {
506         u8 rsvd0[12];   /* dword 0 */
507         u8 coalescwm[2];    /* dword 0 */
508         u8 nodelay;     /* dword 0 */
509         u8 rsvd1[12];   /* dword 0 */
510         u8 count[2];    /* dword 0 */
511         u8 valid;       /* dword 0 */
512         u8 rsvd2;       /* dword 0 */
513         u8 eventable;   /* dword 0 */
514         u8 eqid[16];    /* dword 1 */
515         u8 rsvd3[15];   /* dword 1 */
516         u8 armed;       /* dword 1 */
517         u8 cqecount[16];/* dword 2 */
518         u8 rsvd4[16];   /* dword 2 */
519         u8 rsvd5[32];   /* dword 3 */
520 };
521
522 struct be_cmd_req_cq_create {
523         struct be_cmd_req_hdr hdr;
524         u16 num_pages;
525         u8 page_size;
526         u8 rsvd0;
527         u8 context[sizeof(struct amap_cq_context) / 8];
528         struct phys_addr pages[4];
529 } __packed;
530
531 struct be_cmd_resp_cq_create {
532         struct be_cmd_resp_hdr hdr;
533         u16 cq_id;
534         u16 rsvd0;
535 } __packed;
536
537 /******************** Create MCCQ ***************************/
538 /**
539  * Pseudo amap definition in which each bit of the actual structure is defined
540  * as a byte - used to calculate offset/shift/mask of each field
541  */
542 struct amap_mcc_context {
543         u8 con_index[14];
544         u8 rsvd0[2];
545         u8 ring_size[4];
546         u8 fetch_wrb;
547         u8 fetch_r2t;
548         u8 cq_id[10];
549         u8 prod_index[14];
550         u8 fid[8];
551         u8 pdid[9];
552         u8 valid;
553         u8 rsvd1[32];
554         u8 rsvd2[32];
555 } __packed;
556
557 struct be_cmd_req_mcc_create {
558         struct be_cmd_req_hdr hdr;
559         u16 num_pages;
560         u16 rsvd0;
561         u8 context[sizeof(struct amap_mcc_context) / 8];
562         struct phys_addr pages[8];
563 } __packed;
564
565 struct be_cmd_resp_mcc_create {
566         struct be_cmd_resp_hdr hdr;
567         u16 id;
568         u16 rsvd0;
569 } __packed;
570
571 /******************** Q Destroy  ***************************/
572 /* Type of Queue to be destroyed */
573 enum {
574         QTYPE_EQ = 1,
575         QTYPE_CQ,
576         QTYPE_MCCQ,
577         QTYPE_WRBQ,
578         QTYPE_DPDUQ,
579         QTYPE_SGL
580 };
581
582 struct be_cmd_req_q_destroy {
583         struct be_cmd_req_hdr hdr;
584         u16 id;
585         u16 bypass_flush;       /* valid only for rx q destroy */
586 } __packed;
587
588 struct macaddr {
589         u8 byte[ETH_ALEN];
590 };
591
592 struct be_cmd_req_mcast_mac_config {
593         struct be_cmd_req_hdr hdr;
594         u16 num_mac;
595         u8 promiscuous;
596         u8 interface_id;
597         struct macaddr mac[32];
598 } __packed;
599
600 static inline void *embedded_payload(struct be_mcc_wrb *wrb)
601 {
602         return wrb->payload.embedded_payload;
603 }
604
605 static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb)
606 {
607         return &wrb->payload.sgl[0];
608 }
609
610 /******************** Modify EQ Delay *******************/
611 struct be_cmd_req_modify_eq_delay {
612         struct be_cmd_req_hdr hdr;
613         u32 num_eq;
614         struct {
615                 u32 eq_id;
616                 u32 phase;
617                 u32 delay_multiplier;
618         } delay[8];
619 } __packed;
620
621 /******************** Get MAC ADDR *******************/
622
623 #define ETH_ALEN        6
624
625 struct be_cmd_get_nic_conf_req {
626         struct be_cmd_req_hdr hdr;
627         u32 nic_port_count;
628         u32 speed;
629         u32 max_speed;
630         u32 link_state;
631         u32 max_frame_size;
632         u16 size_of_structure;
633         u8 mac_address[ETH_ALEN];
634         u32 rsvd[23];
635 };
636
637 struct be_cmd_get_nic_conf_resp {
638         struct be_cmd_resp_hdr hdr;
639         u32 nic_port_count;
640         u32 speed;
641         u32 max_speed;
642         u32 link_state;
643         u32 max_frame_size;
644         u16 size_of_structure;
645         u8 mac_address[6];
646         u32 rsvd[23];
647 };
648
649 #define BEISCSI_ALIAS_LEN 32
650
651 struct be_cmd_hba_name {
652         struct be_cmd_req_hdr hdr;
653         u16 flags;
654         u16 rsvd0;
655         u8 initiator_name[ISCSI_NAME_LEN];
656         u8 initiator_alias[BEISCSI_ALIAS_LEN];
657 } __packed;
658
659 struct be_cmd_ntwk_link_status_req {
660         struct be_cmd_req_hdr hdr;
661         u32 rsvd0;
662 } __packed;
663
664 /*** Port Speed Values ***/
665 #define BE2ISCSI_LINK_SPEED_ZERO        0x00
666 #define BE2ISCSI_LINK_SPEED_10MBPS      0x01
667 #define BE2ISCSI_LINK_SPEED_100MBPS     0x02
668 #define BE2ISCSI_LINK_SPEED_1GBPS       0x03
669 #define BE2ISCSI_LINK_SPEED_10GBPS      0x04
670 struct be_cmd_ntwk_link_status_resp {
671         struct be_cmd_resp_hdr hdr;
672         u8 phys_port;
673         u8 mac_duplex;
674         u8 mac_speed;
675         u8 mac_fault;
676         u8 mgmt_mac_duplex;
677         u8 mgmt_mac_speed;
678         u16 qos_link_speed;
679         u32 logical_link_speed;
680 } __packed;
681
682 int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
683                           struct be_queue_info *eq, int eq_delay);
684
685 int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
686                           struct be_queue_info *cq, struct be_queue_info *eq,
687                           bool sol_evts, bool no_delay,
688                           int num_cqe_dma_coalesce);
689
690 int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q,
691                           int type);
692 int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
693                         struct be_queue_info *mccq,
694                         struct be_queue_info *cq);
695
696 int be_poll_mcc(struct be_ctrl_info *ctrl);
697 int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
698                                       struct beiscsi_hba *phba);
699 unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
700 unsigned int be_cmd_get_port_speed(struct beiscsi_hba *phba);
701
702 void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
703
704 int beiscsi_mccq_compl(struct beiscsi_hba *phba,
705                         uint32_t tag, struct be_mcc_wrb **wrb, void *cmd_va);
706 /*ISCSI Functuions */
707 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
708 int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
709
710 struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
711 struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
712 int be_mcc_notify_wait(struct beiscsi_hba *phba);
713 void be_mcc_notify(struct beiscsi_hba *phba);
714 unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
715 void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
716                 struct be_async_event_link_state *evt);
717 int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
718                                     struct be_mcc_compl *compl);
719
720 int be_mbox_notify(struct be_ctrl_info *ctrl);
721
722 int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl,
723                                     struct be_queue_info *cq,
724                                     struct be_queue_info *dq, int length,
725                                     int entry_size);
726
727 int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
728                                 struct be_dma_mem *q_mem, u32 page_offset,
729                                 u32 num_pages);
730
731 int beiscsi_cmd_reset_function(struct beiscsi_hba *phba);
732
733 int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem,
734                        struct be_queue_info *wrbq);
735
736 bool is_link_state_evt(u32 trailer);
737
738 /* Configuration Functions */
739 int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
740
741 struct be_default_pdu_context {
742         u32 dw[4];
743 } __packed;
744
745 struct amap_be_default_pdu_context {
746         u8 dbuf_cindex[13];     /* dword 0 */
747         u8 rsvd0[3];            /* dword 0 */
748         u8 ring_size[4];        /* dword 0 */
749         u8 ring_state[4];       /* dword 0 */
750         u8 rsvd1[8];            /* dword 0 */
751         u8 dbuf_pindex[13];     /* dword 1 */
752         u8 rsvd2;               /* dword 1 */
753         u8 pci_func_id[8];      /* dword 1 */
754         u8 rx_pdid[9];          /* dword 1 */
755         u8 rx_pdid_valid;       /* dword 1 */
756         u8 default_buffer_size[16];     /* dword 2 */
757         u8 cq_id_recv[10];      /* dword 2 */
758         u8 rx_pdid_not_valid;   /* dword 2 */
759         u8 rsvd3[5];            /* dword 2 */
760         u8 rsvd4[32];           /* dword 3 */
761 } __packed;
762
763 struct amap_default_pdu_context_ext {
764         u8 rsvd0[16];   /* dword 0 */
765         u8 ring_size[4];    /* dword 0 */
766         u8 rsvd1[12];   /* dword 0 */
767         u8 rsvd2[22];   /* dword 1 */
768         u8 rx_pdid[9];  /* dword 1 */
769         u8 rx_pdid_valid;   /* dword 1 */
770         u8 default_buffer_size[16]; /* dword 2 */
771         u8 cq_id_recv[16];  /* dword 2 */
772         u8 rsvd3[32];   /* dword 3 */
773 } __packed;
774
775 struct be_defq_create_req {
776         struct be_cmd_req_hdr hdr;
777         u16 num_pages;
778         u8 ulp_num;
779         u8 rsvd0;
780         struct be_default_pdu_context context;
781         struct phys_addr pages[8];
782 } __packed;
783
784 struct be_defq_create_resp {
785         struct be_cmd_req_hdr hdr;
786         u16 id;
787         u16 rsvd0;
788 } __packed;
789
790 struct be_post_sgl_pages_req {
791         struct be_cmd_req_hdr hdr;
792         u16 num_pages;
793         u16 page_offset;
794         u32 rsvd0;
795         struct phys_addr pages[26];
796         u32 rsvd1;
797 } __packed;
798
799 struct be_wrbq_create_req {
800         struct be_cmd_req_hdr hdr;
801         u16 num_pages;
802         u8 ulp_num;
803         u8 rsvd0;
804         struct phys_addr pages[8];
805 } __packed;
806
807 struct be_wrbq_create_resp {
808         struct be_cmd_resp_hdr resp_hdr;
809         u16 cid;
810         u16 rsvd0;
811 } __packed;
812
813 #define SOL_CID_MASK            0x0000FFC0
814 #define SOL_CODE_MASK           0x0000003F
815 #define SOL_WRB_INDEX_MASK      0x00FF0000
816 #define SOL_CMD_WND_MASK        0xFF000000
817 #define SOL_RES_CNT_MASK        0x7FFFFFFF
818 #define SOL_EXP_CMD_SN_MASK     0xFFFFFFFF
819 #define SOL_HW_STS_MASK         0x000000FF
820 #define SOL_STS_MASK            0x0000FF00
821 #define SOL_RESP_MASK           0x00FF0000
822 #define SOL_FLAGS_MASK          0x7F000000
823 #define SOL_S_MASK              0x80000000
824
825 struct sol_cqe {
826         u32 dw[4];
827 };
828
829 struct amap_sol_cqe {
830         u8 hw_sts[8];           /* dword 0 */
831         u8 i_sts[8];            /* dword 0 */
832         u8 i_resp[8];           /* dword 0 */
833         u8 i_flags[7];          /* dword 0 */
834         u8 s;                   /* dword 0 */
835         u8 i_exp_cmd_sn[32];    /* dword 1 */
836         u8 code[6];             /* dword 2 */
837         u8 cid[10];             /* dword 2 */
838         u8 wrb_index[8];        /* dword 2 */
839         u8 i_cmd_wnd[8];        /* dword 2 */
840         u8 i_res_cnt[31];       /* dword 3 */
841         u8 valid;               /* dword 3 */
842 } __packed;
843
844 #define SOL_ICD_INDEX_MASK      0x0003FFC0
845 struct amap_sol_cqe_ring {
846         u8 hw_sts[8];           /* dword 0 */
847         u8 i_sts[8];            /* dword 0 */
848         u8 i_resp[8];           /* dword 0 */
849         u8 i_flags[7];          /* dword 0 */
850         u8 s;                   /* dword 0 */
851         u8 i_exp_cmd_sn[32];    /* dword 1 */
852         u8 code[6];             /* dword 2 */
853         u8 icd_index[12];       /* dword 2 */
854         u8 rsvd[6];             /* dword 2 */
855         u8 i_cmd_wnd[8];        /* dword 2 */
856         u8 i_res_cnt[31];       /* dword 3 */
857         u8 valid;               /* dword 3 */
858 } __packed;
859
860 struct amap_sol_cqe_v2 {
861         u8 hw_sts[8];   /* dword 0 */
862         u8 i_sts[8];    /* dword 0 */
863         u8 wrb_index[16];   /* dword 0 */
864         u8 i_exp_cmd_sn[32];    /* dword 1 */
865         u8 code[6]; /* dword 2 */
866         u8 cmd_cmpl;    /* dword 2 */
867         u8 rsvd0;   /* dword 2 */
868         u8 i_cmd_wnd[8];    /* dword 2 */
869         u8 cid[13]; /* dword 2 */
870         u8 u;   /* dword 2 */
871         u8 o;   /* dword 2 */
872         u8 s;   /* dword 2 */
873         u8 i_res_cnt[31];   /* dword 3 */
874         u8 valid;   /* dword 3 */
875 } __packed;
876
877 struct common_sol_cqe {
878         u32 exp_cmdsn;
879         u32 res_cnt;
880         u16 wrb_index;
881         u16 cid;
882         u8 hw_sts;
883         u8 cmd_wnd;
884         u8 res_flag; /* the s feild of structure */
885         u8 i_resp; /* for skh if cmd_complete is set then i_sts is response */
886         u8 i_flags; /* for skh or the u and o feilds */
887         u8 i_sts; /* for skh if cmd_complete is not-set then i_sts is status */
888 };
889
890 /*** iSCSI ack/driver message completions ***/
891 struct amap_it_dmsg_cqe {
892         u8 ack_num[32]; /* DWORD 0 */
893         u8 pdu_bytes_rcvd[32];  /* DWORD 1 */
894         u8 code[6]; /* DWORD 2 */
895         u8 cid[10]; /* DWORD 2 */
896         u8 wrb_idx[8];  /* DWORD 2 */
897         u8 rsvd0[8];    /* DWORD 2*/
898         u8 rsvd1[31];   /* DWORD 3*/
899         u8 valid;   /* DWORD 3 */
900 } __packed;
901
902 struct amap_it_dmsg_cqe_v2 {
903         u8 ack_num[32]; /* DWORD 0 */
904         u8 pdu_bytes_rcvd[32];  /* DWORD 1 */
905         u8 code[6]; /* DWORD 2 */
906         u8 rsvd0[10];   /* DWORD 2 */
907         u8 wrb_idx[16]; /* DWORD 2 */
908         u8 rsvd1[16];   /* DWORD 3 */
909         u8 cid[13]; /* DWORD 3 */
910         u8 rsvd2[2];    /* DWORD 3 */
911         u8 valid;   /* DWORD 3 */
912 } __packed;
913
914
915 /**
916  * Post WRB Queue Doorbell Register used by the host Storage
917  * stack to notify the
918  * controller of a posted Work Request Block
919  */
920 #define DB_WRB_POST_CID_MASK            0xFFFF  /* bits 0 - 16 */
921 #define DB_DEF_PDU_WRB_INDEX_MASK       0xFF    /* bits 0 - 9 */
922
923 #define DB_DEF_PDU_WRB_INDEX_SHIFT      16
924 #define DB_DEF_PDU_NUM_POSTED_SHIFT     24
925
926 struct fragnum_bits_for_sgl_cra_in {
927         struct be_cmd_req_hdr hdr;
928         u32 num_bits;
929 } __packed;
930
931 struct iscsi_cleanup_req {
932         struct be_cmd_req_hdr hdr;
933         u16 chute;
934         u8 hdr_ring_id;
935         u8 data_ring_id;
936
937 } __packed;
938
939 struct eq_delay {
940         u32 eq_id;
941         u32 phase;
942         u32 delay_multiplier;
943 } __packed;
944
945 struct be_eq_delay_params_in {
946         struct be_cmd_req_hdr hdr;
947         u32 num_eq;
948         struct eq_delay delay[8];
949 } __packed;
950
951 struct tcp_connect_and_offload_in {
952         struct be_cmd_req_hdr hdr;
953         struct ip_addr_format ip_address;
954         u16 tcp_port;
955         u16 cid;
956         u16 cq_id;
957         u16 defq_id;
958         struct phys_addr dataout_template_pa;
959         u16 hdr_ring_id;
960         u16 data_ring_id;
961         u8 do_offload;
962         u8 rsvd0[3];
963 } __packed;
964
965 struct tcp_connect_and_offload_out {
966         struct be_cmd_resp_hdr hdr;
967         u32 connection_handle;
968         u16 cid;
969         u16 rsvd0;
970
971 } __packed;
972
973 struct be_mcc_wrb_context {
974         struct MCC_WRB *wrb;
975         int *users_final_status;
976 } __packed;
977
978 #define DB_DEF_PDU_RING_ID_MASK         0x3FF   /* bits 0 - 9 */
979 #define DB_DEF_PDU_CQPROC_MASK          0x3FFF  /* bits 0 - 9 */
980 #define DB_DEF_PDU_REARM_SHIFT          14
981 #define DB_DEF_PDU_EVENT_SHIFT          15
982 #define DB_DEF_PDU_CQPROC_SHIFT         16
983
984 struct dmsg_cqe {
985         u32 dw[4];
986 } __packed;
987
988 struct tcp_upload_params_in {
989         struct be_cmd_req_hdr hdr;
990         u16 id;
991         u16 upload_type;
992         u32 reset_seq;
993 } __packed;
994
995 struct tcp_upload_params_out {
996         u32 dw[32];
997 } __packed;
998
999 union tcp_upload_params {
1000         struct tcp_upload_params_in request;
1001         struct tcp_upload_params_out response;
1002 } __packed;
1003
1004 struct be_ulp_fw_cfg {
1005         u32 ulp_mode;
1006         u32 etx_base;
1007         u32 etx_count;
1008         u32 sq_base;
1009         u32 sq_count;
1010         u32 rq_base;
1011         u32 rq_count;
1012         u32 dq_base;
1013         u32 dq_count;
1014         u32 lro_base;
1015         u32 lro_count;
1016         u32 icd_base;
1017         u32 icd_count;
1018 };
1019
1020 struct be_fw_cfg {
1021         struct be_cmd_req_hdr hdr;
1022         u32 be_config_number;
1023         u32 asic_revision;
1024         u32 phys_port;
1025         u32 function_mode;
1026         struct be_ulp_fw_cfg ulp[2];
1027         u32 function_caps;
1028 } __packed;
1029
1030 struct be_cmd_get_all_if_id_req {
1031         struct be_cmd_req_hdr hdr;
1032         u32 if_count;
1033         u32 if_hndl_list[1];
1034 } __packed;
1035
1036 #define ISCSI_OPCODE_SCSI_DATA_OUT              5
1037 #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
1038 #define OPCODE_COMMON_MODIFY_EQ_DELAY           41
1039 #define OPCODE_COMMON_ISCSI_CLEANUP             59
1040 #define OPCODE_COMMON_TCP_UPLOAD                56
1041 #define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70
1042 #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1
1043 #define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME       6
1044 #define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME       7
1045 #define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION  14
1046 #define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36
1047 #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
1048 #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
1049 #define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET   52
1050 #define OPCODE_COMMON_WRITE_FLASH               96
1051 #define OPCODE_COMMON_READ_FLASH                97
1052
1053 /* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */
1054 #define CMD_ISCSI_COMMAND_INVALIDATE            1
1055 #define CMD_ISCSI_CONNECTION_INVALIDATE         0x8001
1056 #define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST      0x8002
1057
1058 #define INI_WR_CMD                      1       /* Initiator write command */
1059 #define INI_TMF_CMD                     2       /* Initiator TMF command */
1060 #define INI_NOPOUT_CMD                  3       /* Initiator; Send a NOP-OUT */
1061 #define INI_RD_CMD                      5       /* Initiator requesting to send
1062                                                  * a read command
1063                                                  */
1064 #define TGT_CTX_UPDT_CMD                7       /* Target context update */
1065 #define TGT_STS_CMD                     8       /* Target R2T and other BHS
1066                                                  * where only the status number
1067                                                  * need to be updated
1068                                                  */
1069 #define TGT_DATAIN_CMD                  9       /* Target Data-Ins in response
1070                                                  * to read command
1071                                                  */
1072 #define TGT_SOS_PDU                     10      /* Target:standalone status
1073                                                  * response
1074                                                  */
1075 #define TGT_DM_CMD                      11      /* Indicates that the bhs
1076                                                  *  preparedby
1077                                                  * driver should not be touched
1078                                                  */
1079 /* --- CMD_CHUTE_TYPE --- */
1080 #define CMD_CONNECTION_CHUTE_0          1
1081 #define CMD_CONNECTION_CHUTE_1          2
1082 #define CMD_CONNECTION_CHUTE_2          3
1083
1084 #define EQ_MAJOR_CODE_COMPLETION        0
1085
1086 #define CMD_ISCSI_SESSION_DEL_CFG_FROM_FLASH 0
1087 #define CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH 1
1088
1089 /* --- CONNECTION_UPLOAD_PARAMS --- */
1090 /* These parameters are used to define the type of upload desired.  */
1091 #define CONNECTION_UPLOAD_GRACEFUL      1       /* Graceful upload  */
1092 #define CONNECTION_UPLOAD_ABORT_RESET   2       /* Abortive upload with
1093                                                  * reset
1094                                                  */
1095 #define CONNECTION_UPLOAD_ABORT         3       /* Abortive upload without
1096                                                  * reset
1097                                                  */
1098 #define CONNECTION_UPLOAD_ABORT_WITH_SEQ 4      /* Abortive upload with reset,
1099                                                  * sequence number by driver  */
1100
1101 /* Returns the number of items in the field array. */
1102 #define BE_NUMBER_OF_FIELD(_type_, _field_)     \
1103         (FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\
1104
1105 /**
1106  * Different types of iSCSI completions to host driver for both initiator
1107  * and taget mode
1108  * of operation.
1109  */
1110 #define SOL_CMD_COMPLETE                1       /* Solicited command completed
1111                                                  * normally
1112                                                  */
1113 #define SOL_CMD_KILLED_DATA_DIGEST_ERR  2       /* Solicited command got
1114                                                  * invalidated internally due
1115                                                  * to Data Digest error
1116                                                  */
1117 #define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3       /* Connection got invalidated
1118                                                  * internally
1119                                                  * due to a received PDU
1120                                                  * size > DSL
1121                                                  */
1122 #define CXN_KILLED_BURST_LEN_MISMATCH   4       /* Connection got invalidated
1123                                                  * internally due ti received
1124                                                  * PDU sequence size >
1125                                                  * FBL/MBL.
1126                                                  */
1127 #define CXN_KILLED_AHS_RCVD             5       /* Connection got invalidated
1128                                                  * internally due to a received
1129                                                  * PDU Hdr that has
1130                                                  * AHS */
1131 #define CXN_KILLED_HDR_DIGEST_ERR       6       /* Connection got invalidated
1132                                                  * internally due to Hdr Digest
1133                                                  * error
1134                                                  */
1135 #define CXN_KILLED_UNKNOWN_HDR          7       /* Connection got invalidated
1136                                                  *  internally
1137                                                  * due to a bad opcode in the
1138                                                  * pdu hdr
1139                                                  */
1140 #define CXN_KILLED_STALE_ITT_TTT_RCVD   8       /* Connection got invalidated
1141                                                  * internally due to a received
1142                                                  * ITT/TTT that does not belong
1143                                                  * to this Connection
1144                                                  */
1145 #define CXN_KILLED_INVALID_ITT_TTT_RCVD 9       /* Connection got invalidated
1146                                                  * internally due to received
1147                                                  * ITT/TTT value > Max
1148                                                  * Supported ITTs/TTTs
1149                                                  */
1150 #define CXN_KILLED_RST_RCVD             10      /* Connection got invalidated
1151                                                  * internally due to an
1152                                                  * incoming TCP RST
1153                                                  */
1154 #define CXN_KILLED_TIMED_OUT            11      /* Connection got invalidated
1155                                                  * internally due to timeout on
1156                                                  * tcp segment 12 retransmit
1157                                                  * attempts failed
1158                                                  */
1159 #define CXN_KILLED_RST_SENT             12      /* Connection got invalidated
1160                                                  * internally due to TCP RST
1161                                                  * sent by the Tx side
1162                                                  */
1163 #define CXN_KILLED_FIN_RCVD             13      /* Connection got invalidated
1164                                                  * internally due to an
1165                                                  * incoming TCP FIN.
1166                                                  */
1167 #define CXN_KILLED_BAD_UNSOL_PDU_RCVD   14      /* Connection got invalidated
1168                                                  * internally due to bad
1169                                                  * unsolicited PDU Unsolicited
1170                                                  * PDUs are PDUs with
1171                                                  * ITT=0xffffffff
1172                                                  */
1173 #define CXN_KILLED_BAD_WRB_INDEX_ERROR  15      /* Connection got invalidated
1174                                                  * internally due to bad WRB
1175                                                  * index.
1176                                                  */
1177 #define CXN_KILLED_OVER_RUN_RESIDUAL    16      /* Command got invalidated
1178                                                  * internally due to received
1179                                                  * command has residual
1180                                                  * over run bytes.
1181                                                  */
1182 #define CXN_KILLED_UNDER_RUN_RESIDUAL   17      /* Command got invalidated
1183                                                  * internally due to received
1184                                                  * command has residual under
1185                                                  * run bytes.
1186                                                  */
1187 #define CMD_KILLED_INVALID_STATSN_RCVD  18      /* Command got invalidated
1188                                                  * internally due to a received
1189                                                  * PDU has an invalid StatusSN
1190                                                  */
1191 #define CMD_KILLED_INVALID_R2T_RCVD     19      /* Command got invalidated
1192                                                  * internally due to a received
1193                                                  * an R2T with some invalid
1194                                                  * fields in it
1195                                                  */
1196 #define CMD_CXN_KILLED_LUN_INVALID      20      /* Command got invalidated
1197                                                  * internally due to received
1198                                                  * PDU has an invalid LUN.
1199                                                  */
1200 #define CMD_CXN_KILLED_ICD_INVALID      21      /* Command got invalidated
1201                                                  * internally due to the
1202                                                  * corresponding ICD not in a
1203                                                  * valid state
1204                                                  */
1205 #define CMD_CXN_KILLED_ITT_INVALID      22      /* Command got invalidated due
1206                                                  *  to received PDU has an
1207                                                  *  invalid ITT.
1208                                                  */
1209 #define CMD_CXN_KILLED_SEQ_OUTOFORDER   23      /* Command got invalidated due
1210                                                  * to received sequence buffer
1211                                                  * offset is out of order.
1212                                                  */
1213 #define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24   /* Command got invalidated
1214                                                  * internally due to a
1215                                                  * received PDU has an invalid
1216                                                  * DataSN
1217                                                  */
1218 #define CXN_INVALIDATE_NOTIFY           25      /* Connection invalidation
1219                                                  * completion notify.
1220                                                  */
1221 #define CXN_INVALIDATE_INDEX_NOTIFY     26      /* Connection invalidation
1222                                                  * completion
1223                                                  * with data PDU index.
1224                                                  */
1225 #define CMD_INVALIDATED_NOTIFY          27      /* Command invalidation
1226                                                  * completionnotifify.
1227                                                  */
1228 #define UNSOL_HDR_NOTIFY                28      /* Unsolicited header notify.*/
1229 #define UNSOL_DATA_NOTIFY               29      /* Unsolicited data notify.*/
1230 #define UNSOL_DATA_DIGEST_ERROR_NOTIFY  30      /* Unsolicited data digest
1231                                                  * error notify.
1232                                                  */
1233 #define DRIVERMSG_NOTIFY                31      /* TCP acknowledge based
1234                                                  * notification.
1235                                                  */
1236 #define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32 /* Connection got invalidated
1237                                                   * internally due to command
1238                                                   * and data are not on same
1239                                                   * connection.
1240                                                   */
1241 #define SOL_CMD_KILLED_DIF_ERR          33      /* Solicited command got
1242                                                  *  invalidated internally due
1243                                                  *  to DIF error
1244                                                  */
1245 #define CXN_KILLED_SYN_RCVD             34      /* Connection got invalidated
1246                                                  * internally due to incoming
1247                                                  * TCP SYN
1248                                                  */
1249 #define CXN_KILLED_IMM_DATA_RCVD        35      /* Connection got invalidated
1250                                                  * internally due to an
1251                                                  * incoming Unsolicited PDU
1252                                                  * that has immediate data on
1253                                                  * the cxn
1254                                                  */
1255
1256 int beiscsi_pci_soft_reset(struct beiscsi_hba *phba);
1257 int be_chk_reset_complete(struct beiscsi_hba *phba);
1258
1259 void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
1260                         bool embedded, u8 sge_cnt);
1261
1262 void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
1263                         u8 subsystem, u8 opcode, int cmd_len);
1264
1265 #endif /* !BEISCSI_CMDS_H */