Commit | Line | Data |
---|---|---|
6733b39a | 1 | /** |
5faf17b4 | 2 | * Copyright (C) 2005 - 2012 Emulex |
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: | |
255fa9a3 | 11 | * linux-drivers@emulex.com |
6733b39a | 12 | * |
255fa9a3 JK |
13 | * Emulex |
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 | */ |
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) | |
457ff3b7 JK |
50 | #define CQE_FLAGS_COMPLETED_MASK (1 << 28) |
51 | #define CQE_FLAGS_CONSUMED_MASK (1 << 27) | |
6733b39a JK |
52 | |
53 | /* Completion Status */ | |
54 | #define MCC_STATUS_SUCCESS 0x0 | |
55 | ||
56 | #define CQE_STATUS_COMPL_MASK 0xFFFF | |
57 | #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ | |
58 | #define CQE_STATUS_EXTD_MASK 0xFFFF | |
b38c1e8b | 59 | #define CQE_STATUS_EXTD_SHIFT 16 /* bits 0 - 15 */ |
6733b39a | 60 | |
eaae5267 JSJ |
61 | /* MBOX Command VER */ |
62 | #define MBX_CMD_VER2 0x02 | |
63 | ||
6733b39a JK |
64 | struct be_mcc_compl { |
65 | u32 status; /* dword 0 */ | |
66 | u32 tag0; /* dword 1 */ | |
67 | u32 tag1; /* dword 2 */ | |
68 | u32 flags; /* dword 3 */ | |
69 | }; | |
70 | ||
71 | /********* Mailbox door bell *************/ | |
72 | /** | |
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 | |
80 | * queue entry. | |
81 | */ | |
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 */ | |
85 | ||
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 | |
91 | ||
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 */ | |
97 | ||
98 | /* MPU semphore POST stage values */ | |
99 | #define POST_STAGE_ARMFW_RDY 0xc000 /* FW is done with POST */ | |
100 | ||
101 | /** | |
102 | * When the async bit of mcc_compl is set, the last 4 bytes of | |
103 | * mcc_compl is interpreted as follows: | |
104 | */ | |
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 { | |
109 | u32 code; | |
110 | }; | |
111 | ||
112 | enum { | |
113 | ASYNC_EVENT_LINK_DOWN = 0x0, | |
114 | ASYNC_EVENT_LINK_UP = 0x1 | |
115 | }; | |
116 | ||
117 | /** | |
118 | * When the event code of an async trailer is link-state, the mcc_compl | |
119 | * must be interpreted as follows | |
120 | */ | |
121 | struct be_async_event_link_state { | |
122 | u8 physical_port; | |
123 | u8 port_link_status; | |
124 | u8 port_duplex; | |
125 | u8 port_speed; | |
126 | u8 port_fault; | |
127 | u8 rsvd0[7]; | |
128 | struct be_async_event_trailer trailer; | |
129 | } __packed; | |
130 | ||
131 | struct be_mcc_mailbox { | |
132 | struct be_mcc_wrb wrb; | |
133 | struct be_mcc_compl compl; | |
134 | }; | |
135 | ||
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 | |
142 | ||
143 | /** | |
144 | * List of common opcodes subsystem CMD_SUBSYSTEM_COMMON | |
145 | * These opcodes are unique for each subsystem defined above | |
146 | */ | |
147 | #define OPCODE_COMMON_CQ_CREATE 12 | |
148 | #define OPCODE_COMMON_EQ_CREATE 13 | |
457ff3b7 JK |
149 | #define OPCODE_COMMON_MCC_CREATE 21 |
150 | #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32 | |
6733b39a JK |
151 | #define OPCODE_COMMON_GET_FW_VERSION 35 |
152 | #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 | |
153 | #define OPCODE_COMMON_FIRMWARE_CONFIG 42 | |
457ff3b7 JK |
154 | #define OPCODE_COMMON_MCC_DESTROY 53 |
155 | #define OPCODE_COMMON_CQ_DESTROY 54 | |
156 | #define OPCODE_COMMON_EQ_DESTROY 55 | |
6733b39a JK |
157 | #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58 |
158 | #define OPCODE_COMMON_FUNCTION_RESET 61 | |
159 | ||
160 | /** | |
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 | |
164 | */ | |
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 | |
c7acc5b8 | 168 | #define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN 14 |
0e43895e MC |
169 | #define OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR 17 |
170 | #define OPCODE_COMMON_ISCSI_NTWK_REL_STATELESS_IP_ADDR 18 | |
c7acc5b8 JK |
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 | |
6733b39a JK |
176 | #define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61 |
177 | #define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64 | |
457ff3b7 | 178 | #define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65 |
6733b39a | 179 | #define OPCODE_COMMON_ISCSI_WRBQ_CREATE 66 |
457ff3b7 | 180 | #define OPCODE_COMMON_ISCSI_WRBQ_DESTROY 67 |
6733b39a JK |
181 | |
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 */ | |
eaae5267 JSJ |
189 | u8 version; /* dword 3 */ |
190 | u8 rsvd0[3]; /* dword 3 */ | |
6733b39a JK |
191 | }; |
192 | ||
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 */ | |
198 | }; | |
199 | ||
200 | struct phys_addr { | |
201 | u32 lo; | |
202 | u32 hi; | |
203 | }; | |
204 | ||
205 | /************************** | |
206 | * BE Command definitions * | |
207 | **************************/ | |
208 | ||
209 | /** | |
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 | |
212 | */ | |
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 */ | |
236 | } __packed; | |
237 | ||
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]; | |
244 | } __packed; | |
245 | ||
246 | struct be_cmd_resp_eq_create { | |
247 | struct be_cmd_resp_hdr resp_hdr; | |
248 | u16 eq_id; /* sword */ | |
249 | u16 rsvd0; /* sword */ | |
250 | } __packed; | |
251 | ||
c7acc5b8 JK |
252 | struct mgmt_chap_format { |
253 | u32 flags; | |
254 | u8 intr_chap_name[256]; | |
255 | u8 intr_secret[16]; | |
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; | |
262 | } __packed; | |
263 | ||
264 | struct mgmt_auth_method_format { | |
265 | u8 auth_method_type; | |
266 | u8 padding[3]; | |
267 | struct mgmt_chap_format chap; | |
268 | } __packed; | |
269 | ||
270 | struct mgmt_conn_login_options { | |
271 | u8 flags; | |
272 | u8 header_digest; | |
273 | u8 data_digest; | |
274 | u8 rsvd0; | |
275 | u32 max_recv_datasegment_len_ini; | |
276 | u32 max_recv_datasegment_len_tgt; | |
277 | u32 tcp_mss; | |
278 | u32 tcp_window_size; | |
279 | struct mgmt_auth_method_format auth_data; | |
280 | } __packed; | |
281 | ||
0e43895e | 282 | struct ip_addr_format { |
c7acc5b8 JK |
283 | u16 size_of_structure; |
284 | u8 reserved; | |
285 | u8 ip_type; | |
0e43895e | 286 | u8 addr[16]; |
c7acc5b8 JK |
287 | u32 rsvd0; |
288 | } __packed; | |
289 | ||
0e43895e | 290 | struct mgmt_conn_info { |
c7acc5b8 JK |
291 | u32 connection_handle; |
292 | u32 connection_status; | |
293 | u16 src_port; | |
294 | u16 dest_port; | |
295 | u16 dest_port_redirected; | |
296 | u16 cid; | |
297 | u32 estimated_throughput; | |
0e43895e MC |
298 | struct ip_addr_format src_ipaddr; |
299 | struct ip_addr_format dest_ipaddr; | |
300 | struct ip_addr_format dest_ipaddr_redirected; | |
c7acc5b8 JK |
301 | struct mgmt_conn_login_options negotiated_login_options; |
302 | } __packed; | |
303 | ||
304 | struct mgmt_session_login_options { | |
305 | u8 flags; | |
306 | u8 error_recovery_level; | |
307 | u16 rsvd0; | |
308 | u32 first_burst_length; | |
309 | u32 max_burst_length; | |
310 | u16 max_connections; | |
311 | u16 max_outstanding_r2t; | |
312 | u16 default_time2wait; | |
313 | u16 default_time2retain; | |
314 | } __packed; | |
315 | ||
316 | struct mgmt_session_info { | |
317 | u32 session_handle; | |
318 | u32 status; | |
319 | u8 isid[6]; | |
320 | u16 tsih; | |
321 | u32 session_flags; | |
322 | u16 conn_count; | |
323 | u16 pad; | |
324 | u8 target_name[224]; | |
325 | u8 initiator_iscsiname[224]; | |
326 | struct mgmt_session_login_options negotiated_login_options; | |
327 | struct mgmt_conn_info conn_list[1]; | |
328 | } __packed; | |
329 | ||
0e43895e | 330 | struct be_cmd_get_session_req { |
c7acc5b8 JK |
331 | struct be_cmd_req_hdr hdr; |
332 | u32 session_handle; | |
333 | } __packed; | |
334 | ||
0e43895e | 335 | struct be_cmd_get_session_resp { |
c7acc5b8 JK |
336 | struct be_cmd_resp_hdr hdr; |
337 | struct mgmt_session_info session_info; | |
338 | } __packed; | |
339 | ||
6733b39a | 340 | struct mac_addr { |
0e43895e | 341 | u16 size_of_structure; |
6733b39a JK |
342 | u8 addr[ETH_ALEN]; |
343 | } __packed; | |
344 | ||
0e43895e | 345 | struct be_cmd_get_boot_target_req { |
c7acc5b8 JK |
346 | struct be_cmd_req_hdr hdr; |
347 | } __packed; | |
348 | ||
0e43895e | 349 | struct be_cmd_get_boot_target_resp { |
c7acc5b8 JK |
350 | struct be_cmd_resp_hdr hdr; |
351 | u32 boot_session_count; | |
352 | int boot_session_handle; | |
353 | }; | |
354 | ||
9aef4200 JSJ |
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 | |
360 | u16 reopen_type; | |
361 | u16 rsvd; | |
362 | u32 session_handle; | |
363 | } __packed; | |
364 | ||
365 | struct be_cmd_reopen_session_resp { | |
366 | struct be_cmd_resp_hdr hdr; | |
367 | u32 rsvd; | |
368 | u32 session_handle; | |
369 | } __packed; | |
370 | ||
371 | ||
0e43895e | 372 | struct be_cmd_mac_query_req { |
6733b39a JK |
373 | struct be_cmd_req_hdr hdr; |
374 | u8 type; | |
375 | u8 permanent; | |
376 | u16 if_id; | |
377 | } __packed; | |
378 | ||
0e43895e | 379 | struct be_cmd_get_mac_resp { |
6733b39a JK |
380 | struct be_cmd_resp_hdr hdr; |
381 | struct mac_addr mac; | |
382 | }; | |
383 | ||
0e43895e MC |
384 | struct be_ip_addr_subnet_format { |
385 | u16 size_of_structure; | |
386 | u8 ip_type; | |
387 | u8 ipv6_prefix_length; | |
388 | u8 addr[16]; | |
389 | u8 subnet_mask[16]; | |
390 | u32 rsvd0; | |
391 | } __packed; | |
392 | ||
393 | struct be_cmd_get_if_info_req { | |
394 | struct be_cmd_req_hdr hdr; | |
395 | u32 interface_hndl; | |
396 | u32 ip_type; | |
397 | } __packed; | |
398 | ||
399 | struct be_cmd_get_if_info_resp { | |
400 | struct be_cmd_req_hdr hdr; | |
401 | u32 interface_hndl; | |
402 | u32 vlan_priority; | |
403 | u32 ip_addr_count; | |
404 | u32 dhcp_state; | |
405 | struct be_ip_addr_subnet_format ip_addr; | |
406 | } __packed; | |
407 | ||
408 | struct be_ip_addr_record { | |
409 | u32 action; | |
410 | u32 interface_hndl; | |
411 | struct be_ip_addr_subnet_format ip_addr; | |
412 | u32 status; | |
413 | } __packed; | |
414 | ||
415 | struct be_ip_addr_record_params { | |
416 | u32 record_entry_count; | |
417 | struct be_ip_addr_record ip_record; | |
418 | } __packed; | |
419 | ||
420 | struct be_cmd_set_ip_addr_req { | |
421 | struct be_cmd_req_hdr hdr; | |
422 | struct be_ip_addr_record_params ip_params; | |
423 | } __packed; | |
424 | ||
425 | ||
426 | struct be_cmd_set_dhcp_req { | |
427 | struct be_cmd_req_hdr hdr; | |
428 | u32 interface_hndl; | |
429 | u32 ip_type; | |
430 | u32 flags; | |
431 | u32 retry_count; | |
432 | } __packed; | |
433 | ||
434 | struct be_cmd_rel_dhcp_req { | |
435 | struct be_cmd_req_hdr hdr; | |
436 | u32 interface_hndl; | |
437 | u32 ip_type; | |
438 | } __packed; | |
439 | ||
440 | struct be_cmd_set_def_gateway_req { | |
441 | struct be_cmd_req_hdr hdr; | |
442 | u32 action; | |
443 | struct ip_addr_format ip_addr; | |
444 | } __packed; | |
445 | ||
446 | struct be_cmd_get_def_gateway_req { | |
447 | struct be_cmd_req_hdr hdr; | |
448 | u32 ip_type; | |
449 | } __packed; | |
450 | ||
451 | struct be_cmd_get_def_gateway_resp { | |
452 | struct be_cmd_req_hdr hdr; | |
453 | struct ip_addr_format ip_addr; | |
454 | } __packed; | |
455 | ||
6f72238e JSJ |
456 | #define BEISCSI_VLAN_DISABLE 0xFFFF |
457 | struct be_cmd_set_vlan_req { | |
458 | struct be_cmd_req_hdr hdr; | |
459 | u32 interface_hndl; | |
460 | u32 vlan_priority; | |
461 | } __packed; | |
6733b39a JK |
462 | /******************** Create CQ ***************************/ |
463 | /** | |
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 | |
466 | */ | |
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 */ | |
488 | } __packed; | |
489 | ||
eaae5267 JSJ |
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 */ | |
505 | }; | |
506 | ||
6733b39a JK |
507 | struct be_cmd_req_cq_create { |
508 | struct be_cmd_req_hdr hdr; | |
509 | u16 num_pages; | |
eaae5267 JSJ |
510 | u8 page_size; |
511 | u8 rsvd0; | |
6733b39a JK |
512 | u8 context[sizeof(struct amap_cq_context) / 8]; |
513 | struct phys_addr pages[4]; | |
514 | } __packed; | |
515 | ||
516 | struct be_cmd_resp_cq_create { | |
517 | struct be_cmd_resp_hdr hdr; | |
518 | u16 cq_id; | |
519 | u16 rsvd0; | |
520 | } __packed; | |
521 | ||
522 | /******************** Create MCCQ ***************************/ | |
523 | /** | |
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 | |
526 | */ | |
527 | struct amap_mcc_context { | |
528 | u8 con_index[14]; | |
529 | u8 rsvd0[2]; | |
530 | u8 ring_size[4]; | |
531 | u8 fetch_wrb; | |
532 | u8 fetch_r2t; | |
533 | u8 cq_id[10]; | |
534 | u8 prod_index[14]; | |
535 | u8 fid[8]; | |
536 | u8 pdid[9]; | |
537 | u8 valid; | |
538 | u8 rsvd1[32]; | |
539 | u8 rsvd2[32]; | |
540 | } __packed; | |
541 | ||
542 | struct be_cmd_req_mcc_create { | |
543 | struct be_cmd_req_hdr hdr; | |
544 | u16 num_pages; | |
545 | u16 rsvd0; | |
546 | u8 context[sizeof(struct amap_mcc_context) / 8]; | |
547 | struct phys_addr pages[8]; | |
548 | } __packed; | |
549 | ||
550 | struct be_cmd_resp_mcc_create { | |
551 | struct be_cmd_resp_hdr hdr; | |
552 | u16 id; | |
553 | u16 rsvd0; | |
554 | } __packed; | |
555 | ||
556 | /******************** Q Destroy ***************************/ | |
557 | /* Type of Queue to be destroyed */ | |
558 | enum { | |
559 | QTYPE_EQ = 1, | |
560 | QTYPE_CQ, | |
561 | QTYPE_MCCQ, | |
562 | QTYPE_WRBQ, | |
563 | QTYPE_DPDUQ, | |
564 | QTYPE_SGL | |
565 | }; | |
566 | ||
567 | struct be_cmd_req_q_destroy { | |
568 | struct be_cmd_req_hdr hdr; | |
569 | u16 id; | |
570 | u16 bypass_flush; /* valid only for rx q destroy */ | |
571 | } __packed; | |
572 | ||
573 | struct macaddr { | |
574 | u8 byte[ETH_ALEN]; | |
575 | }; | |
576 | ||
577 | struct be_cmd_req_mcast_mac_config { | |
578 | struct be_cmd_req_hdr hdr; | |
579 | u16 num_mac; | |
580 | u8 promiscuous; | |
581 | u8 interface_id; | |
582 | struct macaddr mac[32]; | |
583 | } __packed; | |
584 | ||
585 | static inline void *embedded_payload(struct be_mcc_wrb *wrb) | |
586 | { | |
587 | return wrb->payload.embedded_payload; | |
588 | } | |
589 | ||
590 | static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb) | |
591 | { | |
592 | return &wrb->payload.sgl[0]; | |
593 | } | |
594 | ||
595 | /******************** Modify EQ Delay *******************/ | |
596 | struct be_cmd_req_modify_eq_delay { | |
597 | struct be_cmd_req_hdr hdr; | |
598 | u32 num_eq; | |
599 | struct { | |
600 | u32 eq_id; | |
601 | u32 phase; | |
602 | u32 delay_multiplier; | |
603 | } delay[8]; | |
604 | } __packed; | |
605 | ||
606 | /******************** Get MAC ADDR *******************/ | |
607 | ||
608 | #define ETH_ALEN 6 | |
609 | ||
0e43895e | 610 | struct be_cmd_get_nic_conf_req { |
6733b39a JK |
611 | struct be_cmd_req_hdr hdr; |
612 | u32 nic_port_count; | |
613 | u32 speed; | |
614 | u32 max_speed; | |
615 | u32 link_state; | |
616 | u32 max_frame_size; | |
617 | u16 size_of_structure; | |
618 | u8 mac_address[ETH_ALEN]; | |
619 | u32 rsvd[23]; | |
620 | }; | |
621 | ||
0e43895e | 622 | struct be_cmd_get_nic_conf_resp { |
6733b39a JK |
623 | struct be_cmd_resp_hdr hdr; |
624 | u32 nic_port_count; | |
625 | u32 speed; | |
626 | u32 max_speed; | |
627 | u32 link_state; | |
628 | u32 max_frame_size; | |
629 | u16 size_of_structure; | |
630 | u8 mac_address[6]; | |
631 | u32 rsvd[23]; | |
632 | }; | |
633 | ||
2177199d JSJ |
634 | #define BEISCSI_ALIAS_LEN 32 |
635 | ||
636 | struct be_cmd_hba_name { | |
637 | struct be_cmd_req_hdr hdr; | |
638 | u16 flags; | |
639 | u16 rsvd0; | |
640 | u8 initiator_name[ISCSI_NAME_LEN]; | |
641 | u8 initiator_alias[BEISCSI_ALIAS_LEN]; | |
642 | } __packed; | |
643 | ||
c62eef0d JSJ |
644 | struct be_cmd_ntwk_link_status_req { |
645 | struct be_cmd_req_hdr hdr; | |
646 | u32 rsvd0; | |
647 | } __packed; | |
648 | ||
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; | |
657 | u8 phys_port; | |
658 | u8 mac_duplex; | |
659 | u8 mac_speed; | |
660 | u8 mac_fault; | |
661 | u8 mgmt_mac_duplex; | |
662 | u8 mgmt_mac_speed; | |
663 | u16 qos_link_speed; | |
664 | u32 logical_link_speed; | |
665 | } __packed; | |
2177199d | 666 | |
6733b39a JK |
667 | int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, |
668 | struct be_queue_info *eq, int eq_delay); | |
669 | ||
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); | |
674 | ||
675 | int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q, | |
676 | int type); | |
35e66019 | 677 | int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba, |
bfead3b2 JK |
678 | struct be_queue_info *mccq, |
679 | struct be_queue_info *cq); | |
680 | ||
6733b39a | 681 | int be_poll_mcc(struct be_ctrl_info *ctrl); |
03a12310 | 682 | int mgmt_check_supported_fw(struct be_ctrl_info *ctrl, |
bfead3b2 | 683 | struct beiscsi_hba *phba); |
2177199d | 684 | unsigned int be_cmd_get_initname(struct beiscsi_hba *phba); |
c62eef0d | 685 | unsigned int be_cmd_get_port_speed(struct beiscsi_hba *phba); |
c7acc5b8 | 686 | |
756d29c8 | 687 | void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag); |
6733b39a JK |
688 | /*ISCSI Functuions */ |
689 | int be_cmd_fw_initialize(struct be_ctrl_info *ctrl); | |
690 | ||
691 | struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem); | |
bfead3b2 JK |
692 | struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba); |
693 | int be_mcc_notify_wait(struct beiscsi_hba *phba); | |
756d29c8 JK |
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); | |
6733b39a JK |
700 | |
701 | int be_mbox_notify(struct be_ctrl_info *ctrl); | |
702 | ||
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, | |
706 | int entry_size); | |
707 | ||
708 | int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl, | |
709 | struct be_dma_mem *q_mem, u32 page_offset, | |
710 | u32 num_pages); | |
711 | ||
e5285860 JK |
712 | int beiscsi_cmd_reset_function(struct beiscsi_hba *phba); |
713 | ||
6733b39a JK |
714 | int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem, |
715 | struct be_queue_info *wrbq); | |
716 | ||
756d29c8 JK |
717 | bool is_link_state_evt(u32 trailer); |
718 | ||
6f72238e JSJ |
719 | /* Configuration Functions */ |
720 | int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag); | |
721 | ||
6733b39a JK |
722 | struct be_default_pdu_context { |
723 | u32 dw[4]; | |
724 | } __packed; | |
725 | ||
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 */ | |
742 | } __packed; | |
743 | ||
744 | struct be_defq_create_req { | |
745 | struct be_cmd_req_hdr hdr; | |
746 | u16 num_pages; | |
747 | u8 ulp_num; | |
748 | u8 rsvd0; | |
749 | struct be_default_pdu_context context; | |
750 | struct phys_addr pages[8]; | |
751 | } __packed; | |
752 | ||
753 | struct be_defq_create_resp { | |
754 | struct be_cmd_req_hdr hdr; | |
755 | u16 id; | |
756 | u16 rsvd0; | |
757 | } __packed; | |
758 | ||
759 | struct be_post_sgl_pages_req { | |
760 | struct be_cmd_req_hdr hdr; | |
761 | u16 num_pages; | |
762 | u16 page_offset; | |
763 | u32 rsvd0; | |
764 | struct phys_addr pages[26]; | |
765 | u32 rsvd1; | |
766 | } __packed; | |
767 | ||
768 | struct be_wrbq_create_req { | |
769 | struct be_cmd_req_hdr hdr; | |
770 | u16 num_pages; | |
771 | u8 ulp_num; | |
772 | u8 rsvd0; | |
773 | struct phys_addr pages[8]; | |
774 | } __packed; | |
775 | ||
776 | struct be_wrbq_create_resp { | |
777 | struct be_cmd_resp_hdr resp_hdr; | |
778 | u16 cid; | |
779 | u16 rsvd0; | |
780 | } __packed; | |
781 | ||
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 | |
793 | ||
794 | struct sol_cqe { | |
795 | u32 dw[4]; | |
796 | }; | |
797 | ||
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 */ | |
803 | u8 s; /* 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 */ | |
811 | } __packed; | |
812 | ||
bfead3b2 JK |
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 */ | |
819 | u8 s; /* 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 */ | |
827 | } __packed; | |
828 | ||
73133261 JSJ |
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 */ | |
839 | u8 u; /* dword 2 */ | |
840 | u8 o; /* dword 2 */ | |
841 | u8 s; /* dword 2 */ | |
842 | u8 i_res_cnt[31]; /* dword 3 */ | |
843 | u8 valid; /* dword 3 */ | |
844 | } __packed; | |
845 | ||
846 | struct common_sol_cqe { | |
847 | u32 exp_cmdsn; | |
848 | u32 res_cnt; | |
849 | u16 wrb_index; | |
850 | u16 cid; | |
851 | u8 hw_sts; | |
852 | u8 cmd_wnd; | |
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 */ | |
857 | }; | |
858 | ||
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 */ | |
869 | } __packed; | |
870 | ||
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 */ | |
881 | } __packed; | |
bfead3b2 | 882 | |
6733b39a JK |
883 | |
884 | /** | |
885 | * Post WRB Queue Doorbell Register used by the host Storage | |
886 | * stack to notify the | |
887 | * controller of a posted Work Request Block | |
888 | */ | |
889 | #define DB_WRB_POST_CID_MASK 0x3FF /* bits 0 - 9 */ | |
890 | #define DB_DEF_PDU_WRB_INDEX_MASK 0xFF /* bits 0 - 9 */ | |
891 | ||
892 | #define DB_DEF_PDU_WRB_INDEX_SHIFT 16 | |
893 | #define DB_DEF_PDU_NUM_POSTED_SHIFT 24 | |
894 | ||
895 | struct fragnum_bits_for_sgl_cra_in { | |
896 | struct be_cmd_req_hdr hdr; | |
897 | u32 num_bits; | |
898 | } __packed; | |
899 | ||
900 | struct iscsi_cleanup_req { | |
901 | struct be_cmd_req_hdr hdr; | |
902 | u16 chute; | |
903 | u8 hdr_ring_id; | |
904 | u8 data_ring_id; | |
905 | ||
906 | } __packed; | |
907 | ||
908 | struct eq_delay { | |
909 | u32 eq_id; | |
910 | u32 phase; | |
911 | u32 delay_multiplier; | |
912 | } __packed; | |
913 | ||
914 | struct be_eq_delay_params_in { | |
915 | struct be_cmd_req_hdr hdr; | |
916 | u32 num_eq; | |
917 | struct eq_delay delay[8]; | |
918 | } __packed; | |
919 | ||
6733b39a JK |
920 | struct tcp_connect_and_offload_in { |
921 | struct be_cmd_req_hdr hdr; | |
0e43895e | 922 | struct ip_addr_format ip_address; |
6733b39a JK |
923 | u16 tcp_port; |
924 | u16 cid; | |
925 | u16 cq_id; | |
926 | u16 defq_id; | |
927 | struct phys_addr dataout_template_pa; | |
928 | u16 hdr_ring_id; | |
929 | u16 data_ring_id; | |
930 | u8 do_offload; | |
931 | u8 rsvd0[3]; | |
932 | } __packed; | |
933 | ||
934 | struct tcp_connect_and_offload_out { | |
935 | struct be_cmd_resp_hdr hdr; | |
936 | u32 connection_handle; | |
937 | u16 cid; | |
938 | u16 rsvd0; | |
939 | ||
940 | } __packed; | |
941 | ||
942 | struct be_mcc_wrb_context { | |
943 | struct MCC_WRB *wrb; | |
944 | int *users_final_status; | |
945 | } __packed; | |
946 | ||
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 | |
952 | ||
953 | struct dmsg_cqe { | |
954 | u32 dw[4]; | |
955 | } __packed; | |
956 | ||
957 | struct tcp_upload_params_in { | |
958 | struct be_cmd_req_hdr hdr; | |
959 | u16 id; | |
960 | u16 upload_type; | |
961 | u32 reset_seq; | |
962 | } __packed; | |
963 | ||
964 | struct tcp_upload_params_out { | |
965 | u32 dw[32]; | |
966 | } __packed; | |
967 | ||
968 | union tcp_upload_params { | |
969 | struct tcp_upload_params_in request; | |
970 | struct tcp_upload_params_out response; | |
971 | } __packed; | |
972 | ||
973 | struct be_ulp_fw_cfg { | |
974 | u32 ulp_mode; | |
975 | u32 etx_base; | |
976 | u32 etx_count; | |
977 | u32 sq_base; | |
978 | u32 sq_count; | |
979 | u32 rq_base; | |
980 | u32 rq_count; | |
981 | u32 dq_base; | |
982 | u32 dq_count; | |
983 | u32 lro_base; | |
984 | u32 lro_count; | |
985 | u32 icd_base; | |
986 | u32 icd_count; | |
987 | }; | |
988 | ||
989 | struct be_fw_cfg { | |
990 | struct be_cmd_req_hdr hdr; | |
991 | u32 be_config_number; | |
992 | u32 asic_revision; | |
993 | u32 phys_port; | |
994 | u32 function_mode; | |
995 | struct be_ulp_fw_cfg ulp[2]; | |
996 | u32 function_caps; | |
997 | } __packed; | |
998 | ||
0e43895e | 999 | struct be_cmd_get_all_if_id_req { |
c7acc5b8 JK |
1000 | struct be_cmd_req_hdr hdr; |
1001 | u32 if_count; | |
1002 | u32 if_hndl_list[1]; | |
1003 | } __packed; | |
1004 | ||
1005 | #define ISCSI_OPCODE_SCSI_DATA_OUT 5 | |
c62eef0d | 1006 | #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5 |
c7acc5b8 JK |
1007 | #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 |
1008 | #define OPCODE_COMMON_ISCSI_CLEANUP 59 | |
1009 | #define OPCODE_COMMON_TCP_UPLOAD 56 | |
6733b39a | 1010 | #define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70 |
6733b39a | 1011 | #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1 |
c7acc5b8 JK |
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 | |
9aef4200 | 1015 | #define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36 |
c7acc5b8 | 1016 | #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41 |
6733b39a | 1017 | #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42 |
c7acc5b8 | 1018 | #define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52 |
ffce3e2e JK |
1019 | #define OPCODE_COMMON_WRITE_FLASH 96 |
1020 | #define OPCODE_COMMON_READ_FLASH 97 | |
c7acc5b8 JK |
1021 | |
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 | |
6733b39a JK |
1026 | |
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 | |
1031 | * a read command | |
1032 | */ | |
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 | |
1037 | */ | |
1038 | #define TGT_DATAIN_CMD 9 /* Target Data-Ins in response | |
1039 | * to read command | |
1040 | */ | |
1041 | #define TGT_SOS_PDU 10 /* Target:standalone status | |
1042 | * response | |
1043 | */ | |
1044 | #define TGT_DM_CMD 11 /* Indicates that the bhs | |
1045 | * preparedby | |
1046 | * driver should not be touched | |
1047 | */ | |
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 | |
1052 | ||
1053 | #define EQ_MAJOR_CODE_COMPLETION 0 | |
1054 | ||
1055 | #define CMD_ISCSI_SESSION_DEL_CFG_FROM_FLASH 0 | |
1056 | #define CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH 1 | |
1057 | ||
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 | |
1062 | * reset | |
1063 | */ | |
1064 | #define CONNECTION_UPLOAD_ABORT 3 /* Abortive upload without | |
1065 | * reset | |
1066 | */ | |
1067 | #define CONNECTION_UPLOAD_ABORT_WITH_SEQ 4 /* Abortive upload with reset, | |
1068 | * sequence number by driver */ | |
1069 | ||
6733b39a JK |
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])))\ | |
1073 | ||
1074 | /** | |
1075 | * Different types of iSCSI completions to host driver for both initiator | |
1076 | * and taget mode | |
1077 | * of operation. | |
1078 | */ | |
1079 | #define SOL_CMD_COMPLETE 1 /* Solicited command completed | |
1080 | * normally | |
1081 | */ | |
1082 | #define SOL_CMD_KILLED_DATA_DIGEST_ERR 2 /* Solicited command got | |
1083 | * invalidated internally due | |
1084 | * to Data Digest error | |
1085 | */ | |
1086 | #define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3 /* Connection got invalidated | |
1087 | * internally | |
25985edc | 1088 | * due to a received PDU |
6733b39a JK |
1089 | * size > DSL |
1090 | */ | |
1091 | #define CXN_KILLED_BURST_LEN_MISMATCH 4 /* Connection got invalidated | |
1092 | * internally due ti received | |
1093 | * PDU sequence size > | |
1094 | * FBL/MBL. | |
1095 | */ | |
1096 | #define CXN_KILLED_AHS_RCVD 5 /* Connection got invalidated | |
25985edc | 1097 | * internally due to a received |
6733b39a JK |
1098 | * PDU Hdr that has |
1099 | * AHS */ | |
1100 | #define CXN_KILLED_HDR_DIGEST_ERR 6 /* Connection got invalidated | |
1101 | * internally due to Hdr Digest | |
1102 | * error | |
1103 | */ | |
1104 | #define CXN_KILLED_UNKNOWN_HDR 7 /* Connection got invalidated | |
1105 | * internally | |
1106 | * due to a bad opcode in the | |
1107 | * pdu hdr | |
1108 | */ | |
1109 | #define CXN_KILLED_STALE_ITT_TTT_RCVD 8 /* Connection got invalidated | |
25985edc | 1110 | * internally due to a received |
6733b39a JK |
1111 | * ITT/TTT that does not belong |
1112 | * to this Connection | |
1113 | */ | |
1114 | #define CXN_KILLED_INVALID_ITT_TTT_RCVD 9 /* Connection got invalidated | |
25985edc | 1115 | * internally due to received |
6733b39a JK |
1116 | * ITT/TTT value > Max |
1117 | * Supported ITTs/TTTs | |
1118 | */ | |
1119 | #define CXN_KILLED_RST_RCVD 10 /* Connection got invalidated | |
1120 | * internally due to an | |
1121 | * incoming TCP RST | |
1122 | */ | |
1123 | #define CXN_KILLED_TIMED_OUT 11 /* Connection got invalidated | |
1124 | * internally due to timeout on | |
1125 | * tcp segment 12 retransmit | |
1126 | * attempts failed | |
1127 | */ | |
1128 | #define CXN_KILLED_RST_SENT 12 /* Connection got invalidated | |
1129 | * internally due to TCP RST | |
1130 | * sent by the Tx side | |
1131 | */ | |
1132 | #define CXN_KILLED_FIN_RCVD 13 /* Connection got invalidated | |
1133 | * internally due to an | |
1134 | * incoming TCP FIN. | |
1135 | */ | |
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 | |
1140 | * ITT=0xffffffff | |
1141 | */ | |
1142 | #define CXN_KILLED_BAD_WRB_INDEX_ERROR 15 /* Connection got invalidated | |
1143 | * internally due to bad WRB | |
1144 | * index. | |
1145 | */ | |
1146 | #define CXN_KILLED_OVER_RUN_RESIDUAL 16 /* Command got invalidated | |
25985edc | 1147 | * internally due to received |
6733b39a JK |
1148 | * command has residual |
1149 | * over run bytes. | |
1150 | */ | |
1151 | #define CXN_KILLED_UNDER_RUN_RESIDUAL 17 /* Command got invalidated | |
25985edc | 1152 | * internally due to received |
6733b39a JK |
1153 | * command has residual under |
1154 | * run bytes. | |
1155 | */ | |
1156 | #define CMD_KILLED_INVALID_STATSN_RCVD 18 /* Command got invalidated | |
25985edc | 1157 | * internally due to a received |
6733b39a JK |
1158 | * PDU has an invalid StatusSN |
1159 | */ | |
1160 | #define CMD_KILLED_INVALID_R2T_RCVD 19 /* Command got invalidated | |
25985edc | 1161 | * internally due to a received |
6733b39a JK |
1162 | * an R2T with some invalid |
1163 | * fields in it | |
1164 | */ | |
1165 | #define CMD_CXN_KILLED_LUN_INVALID 20 /* Command got invalidated | |
1166 | * internally due to received | |
1167 | * PDU has an invalid LUN. | |
1168 | */ | |
1169 | #define CMD_CXN_KILLED_ICD_INVALID 21 /* Command got invalidated | |
1170 | * internally due to the | |
1171 | * corresponding ICD not in a | |
1172 | * valid state | |
1173 | */ | |
1174 | #define CMD_CXN_KILLED_ITT_INVALID 22 /* Command got invalidated due | |
1175 | * to received PDU has an | |
1176 | * invalid ITT. | |
1177 | */ | |
1178 | #define CMD_CXN_KILLED_SEQ_OUTOFORDER 23 /* Command got invalidated due | |
1179 | * to received sequence buffer | |
1180 | * offset is out of order. | |
1181 | */ | |
1182 | #define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24 /* Command got invalidated | |
1183 | * internally due to a | |
25985edc | 1184 | * received PDU has an invalid |
6733b39a JK |
1185 | * DataSN |
1186 | */ | |
1187 | #define CXN_INVALIDATE_NOTIFY 25 /* Connection invalidation | |
1188 | * completion notify. | |
1189 | */ | |
1190 | #define CXN_INVALIDATE_INDEX_NOTIFY 26 /* Connection invalidation | |
1191 | * completion | |
1192 | * with data PDU index. | |
1193 | */ | |
1194 | #define CMD_INVALIDATED_NOTIFY 27 /* Command invalidation | |
1195 | * completionnotifify. | |
1196 | */ | |
1197 | #define UNSOL_HDR_NOTIFY 28 /* Unsolicited header notify.*/ | |
1198 | #define UNSOL_DATA_NOTIFY 29 /* Unsolicited data notify.*/ | |
457ff3b7 | 1199 | #define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30 /* Unsolicited data digest |
6733b39a JK |
1200 | * error notify. |
1201 | */ | |
1202 | #define DRIVERMSG_NOTIFY 31 /* TCP acknowledge based | |
1203 | * notification. | |
1204 | */ | |
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 | |
1208 | * connection. | |
1209 | */ | |
1210 | #define SOL_CMD_KILLED_DIF_ERR 33 /* Solicited command got | |
1211 | * invalidated internally due | |
1212 | * to DIF error | |
1213 | */ | |
1214 | #define CXN_KILLED_SYN_RCVD 34 /* Connection got invalidated | |
1215 | * internally due to incoming | |
1216 | * TCP SYN | |
1217 | */ | |
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 | |
1222 | * the cxn | |
1223 | */ | |
1224 | ||
e9b91193 JK |
1225 | int beiscsi_pci_soft_reset(struct beiscsi_hba *phba); |
1226 | int be_chk_reset_complete(struct beiscsi_hba *phba); | |
1227 | ||
6733b39a JK |
1228 | void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len, |
1229 | bool embedded, u8 sge_cnt); | |
1230 | ||
1231 | void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr, | |
1232 | u8 subsystem, u8 opcode, int cmd_len); | |
1233 | ||
1234 | #endif /* !BEISCSI_CMDS_H */ |