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