blob: 8f22ef1a6ed9940aa6f70c0e3752ac6d4c2f6cd3 [file] [log] [blame]
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001/*
2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef __BFI_MS_H__
19#define __BFI_MS_H__
20
21#include "bfi.h"
22#include "bfa_fc.h"
23#include "bfa_defs_svc.h"
24
25#pragma pack(1)
26
27enum bfi_iocfc_h2i_msgs {
28 BFI_IOCFC_H2I_CFG_REQ = 1,
29 BFI_IOCFC_H2I_SET_INTR_REQ = 2,
30 BFI_IOCFC_H2I_UPDATEQ_REQ = 3,
31};
32
33enum bfi_iocfc_i2h_msgs {
34 BFI_IOCFC_I2H_CFG_REPLY = BFA_I2HM(1),
35 BFI_IOCFC_I2H_UPDATEQ_RSP = BFA_I2HM(3),
36};
37
38struct bfi_iocfc_cfg_s {
39 u8 num_cqs; /* Number of CQs to be used */
40 u8 sense_buf_len; /* SCSI sense length */
41 u16 rsvd_1;
42 u32 endian_sig; /* endian signature of host */
43
Jing Huangacdc79a2010-10-18 17:15:55 -070044 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070045 * Request and response circular queue base addresses, size and
46 * shadow index pointers.
47 */
48 union bfi_addr_u req_cq_ba[BFI_IOC_MAX_CQS];
49 union bfi_addr_u req_shadow_ci[BFI_IOC_MAX_CQS];
Maggie50444a32010-11-29 18:26:32 -080050 __be16 req_cq_elems[BFI_IOC_MAX_CQS];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070051 union bfi_addr_u rsp_cq_ba[BFI_IOC_MAX_CQS];
52 union bfi_addr_u rsp_shadow_pi[BFI_IOC_MAX_CQS];
Maggie50444a32010-11-29 18:26:32 -080053 __be16 rsp_cq_elems[BFI_IOC_MAX_CQS];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070054
55 union bfi_addr_u stats_addr; /* DMA-able address for stats */
56 union bfi_addr_u cfgrsp_addr; /* config response dma address */
57 union bfi_addr_u ioim_snsbase; /* IO sense buffer base address */
58 struct bfa_iocfc_intr_attr_s intr_attr; /* IOC interrupt attributes */
59};
60
Jing Huangacdc79a2010-10-18 17:15:55 -070061/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070062 * Boot target wwn information for this port. This contains either the stored
63 * or discovered boot target port wwns for the port.
64 */
65struct bfi_iocfc_bootwwns {
66 wwn_t wwn[BFA_BOOT_BOOTLUN_MAX];
67 u8 nwwns;
68 u8 rsvd[7];
69};
70
71struct bfi_iocfc_cfgrsp_s {
72 struct bfa_iocfc_fwcfg_s fwcfg;
73 struct bfa_iocfc_intr_attr_s intr_attr;
74 struct bfi_iocfc_bootwwns bootwwns;
75 struct bfi_pbc_s pbc_cfg;
76};
77
Jing Huangacdc79a2010-10-18 17:15:55 -070078/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070079 * BFI_IOCFC_H2I_CFG_REQ message
80 */
81struct bfi_iocfc_cfg_req_s {
82 struct bfi_mhdr_s mh;
83 union bfi_addr_u ioc_cfg_dma_addr;
84};
85
86
Jing Huangacdc79a2010-10-18 17:15:55 -070087/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070088 * BFI_IOCFC_I2H_CFG_REPLY message
89 */
90struct bfi_iocfc_cfg_reply_s {
91 struct bfi_mhdr_s mh; /* Common msg header */
92 u8 cfg_success; /* cfg reply status */
93 u8 lpu_bm; /* LPUs assigned for this IOC */
94 u8 rsvd[2];
95};
96
97
Jing Huangacdc79a2010-10-18 17:15:55 -070098/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070099 * BFI_IOCFC_H2I_SET_INTR_REQ message
100 */
101struct bfi_iocfc_set_intr_req_s {
102 struct bfi_mhdr_s mh; /* common msg header */
103 u8 coalesce; /* enable intr coalescing */
104 u8 rsvd[3];
Maggie50444a32010-11-29 18:26:32 -0800105 __be16 delay; /* delay timer 0..1125us */
106 __be16 latency; /* latency timer 0..225us */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700107};
108
109
Jing Huangacdc79a2010-10-18 17:15:55 -0700110/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700111 * BFI_IOCFC_H2I_UPDATEQ_REQ message
112 */
113struct bfi_iocfc_updateq_req_s {
114 struct bfi_mhdr_s mh; /* common msg header */
115 u32 reqq_ba; /* reqq base addr */
116 u32 rspq_ba; /* rspq base addr */
117 u32 reqq_sci; /* reqq shadow ci */
118 u32 rspq_spi; /* rspq shadow pi */
119};
120
121
Jing Huangacdc79a2010-10-18 17:15:55 -0700122/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700123 * BFI_IOCFC_I2H_UPDATEQ_RSP message
124 */
125struct bfi_iocfc_updateq_rsp_s {
126 struct bfi_mhdr_s mh; /* common msg header */
127 u8 status; /* updateq status */
128 u8 rsvd[3];
129};
130
131
Jing Huangacdc79a2010-10-18 17:15:55 -0700132/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700133 * H2I Messages
134 */
135union bfi_iocfc_h2i_msg_u {
136 struct bfi_mhdr_s mh;
137 struct bfi_iocfc_cfg_req_s cfg_req;
138 struct bfi_iocfc_updateq_req_s updateq_req;
139 u32 mboxmsg[BFI_IOC_MSGSZ];
140};
141
142
Jing Huangacdc79a2010-10-18 17:15:55 -0700143/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700144 * I2H Messages
145 */
146union bfi_iocfc_i2h_msg_u {
147 struct bfi_mhdr_s mh;
148 struct bfi_iocfc_cfg_reply_s cfg_reply;
149 struct bfi_iocfc_updateq_rsp_s updateq_rsp;
150 u32 mboxmsg[BFI_IOC_MSGSZ];
151};
152
153
154enum bfi_fcport_h2i {
155 BFI_FCPORT_H2I_ENABLE_REQ = (1),
156 BFI_FCPORT_H2I_DISABLE_REQ = (2),
157 BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3),
158 BFI_FCPORT_H2I_STATS_GET_REQ = (4),
159 BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5),
160};
161
162
163enum bfi_fcport_i2h {
164 BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1),
165 BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2),
166 BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3),
167 BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4),
168 BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5),
169 BFI_FCPORT_I2H_EVENT = BFA_I2HM(6),
170 BFI_FCPORT_I2H_TRUNK_SCN = BFA_I2HM(7),
171 BFI_FCPORT_I2H_ENABLE_AEN = BFA_I2HM(8),
172 BFI_FCPORT_I2H_DISABLE_AEN = BFA_I2HM(9),
173};
174
175
Jing Huangacdc79a2010-10-18 17:15:55 -0700176/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700177 * Generic REQ type
178 */
179struct bfi_fcport_req_s {
180 struct bfi_mhdr_s mh; /* msg header */
181 u32 msgtag; /* msgtag for reply */
182};
183
Jing Huangacdc79a2010-10-18 17:15:55 -0700184/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700185 * Generic RSP type
186 */
187struct bfi_fcport_rsp_s {
188 struct bfi_mhdr_s mh; /* common msg header */
189 u8 status; /* port enable status */
190 u8 rsvd[3];
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800191 struct bfa_port_cfg_s port_cfg;/* port configuration */
192 u32 msgtag; /* msgtag for reply */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700193};
194
Jing Huangacdc79a2010-10-18 17:15:55 -0700195/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700196 * BFI_FCPORT_H2I_ENABLE_REQ
197 */
198struct bfi_fcport_enable_req_s {
199 struct bfi_mhdr_s mh; /* msg header */
200 u32 rsvd1;
201 wwn_t nwwn; /* node wwn of physical port */
202 wwn_t pwwn; /* port wwn of physical port */
203 struct bfa_port_cfg_s port_cfg; /* port configuration */
204 union bfi_addr_u stats_dma_addr; /* DMA address for stats */
205 u32 msgtag; /* msgtag for reply */
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800206 u8 use_flash_cfg; /* get prot cfg from flash */
207 u8 rsvd2[3];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700208};
209
Jing Huangacdc79a2010-10-18 17:15:55 -0700210/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700211 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
212 */
213struct bfi_fcport_set_svc_params_req_s {
214 struct bfi_mhdr_s mh; /* msg header */
Maggie50444a32010-11-29 18:26:32 -0800215 __be16 tx_bbcredit; /* Tx credits */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700216 u16 rsvd;
217};
218
Jing Huangacdc79a2010-10-18 17:15:55 -0700219/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700220 * BFI_FCPORT_I2H_EVENT
221 */
222struct bfi_fcport_event_s {
223 struct bfi_mhdr_s mh; /* common msg header */
224 struct bfa_port_link_s link_state;
225};
226
Jing Huangacdc79a2010-10-18 17:15:55 -0700227/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700228 * BFI_FCPORT_I2H_TRUNK_SCN
229 */
230struct bfi_fcport_trunk_link_s {
231 wwn_t trunk_wwn;
232 u8 fctl; /* bfa_trunk_link_fctl_t */
233 u8 state; /* bfa_trunk_link_state_t */
234 u8 speed; /* bfa_port_speed_t */
235 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800236 __be32 deskew;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700237};
238
239#define BFI_FCPORT_MAX_LINKS 2
240struct bfi_fcport_trunk_scn_s {
241 struct bfi_mhdr_s mh;
242 u8 trunk_state; /* bfa_trunk_state_t */
243 u8 trunk_speed; /* bfa_port_speed_t */
244 u8 rsvd_a[2];
245 struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
246};
247
Jing Huangacdc79a2010-10-18 17:15:55 -0700248/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700249 * fcport H2I message
250 */
251union bfi_fcport_h2i_msg_u {
252 struct bfi_mhdr_s *mhdr;
253 struct bfi_fcport_enable_req_s *penable;
254 struct bfi_fcport_req_s *pdisable;
255 struct bfi_fcport_set_svc_params_req_s *psetsvcparams;
256 struct bfi_fcport_req_s *pstatsget;
257 struct bfi_fcport_req_s *pstatsclear;
258};
259
Jing Huangacdc79a2010-10-18 17:15:55 -0700260/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700261 * fcport I2H message
262 */
263union bfi_fcport_i2h_msg_u {
264 struct bfi_msg_s *msg;
265 struct bfi_fcport_rsp_s *penable_rsp;
266 struct bfi_fcport_rsp_s *pdisable_rsp;
267 struct bfi_fcport_rsp_s *psetsvcparams_rsp;
268 struct bfi_fcport_rsp_s *pstatsget_rsp;
269 struct bfi_fcport_rsp_s *pstatsclear_rsp;
270 struct bfi_fcport_event_s *event;
271 struct bfi_fcport_trunk_scn_s *trunk_scn;
272};
273
274enum bfi_fcxp_h2i {
275 BFI_FCXP_H2I_SEND_REQ = 1,
276};
277
278enum bfi_fcxp_i2h {
279 BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
280};
281
282#define BFA_FCXP_MAX_SGES 2
283
Jing Huangacdc79a2010-10-18 17:15:55 -0700284/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700285 * FCXP send request structure
286 */
287struct bfi_fcxp_send_req_s {
288 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800289 __be16 fcxp_tag; /* driver request tag */
290 __be16 max_frmsz; /* max send frame size */
291 __be16 vf_id; /* vsan tag if applicable */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700292 u16 rport_fw_hndl; /* FW Handle for the remote port */
293 u8 class; /* FC class used for req/rsp */
294 u8 rsp_timeout; /* timeout in secs, 0-no response */
295 u8 cts; /* continue sequence */
296 u8 lp_tag; /* lport tag */
297 struct fchs_s fchs; /* request FC header structure */
Maggie50444a32010-11-29 18:26:32 -0800298 __be32 req_len; /* request payload length */
299 __be32 rsp_maxlen; /* max response length expected */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700300 struct bfi_sge_s req_sge[BFA_FCXP_MAX_SGES]; /* request buf */
301 struct bfi_sge_s rsp_sge[BFA_FCXP_MAX_SGES]; /* response buf */
302};
303
Jing Huangacdc79a2010-10-18 17:15:55 -0700304/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700305 * FCXP send response structure
306 */
307struct bfi_fcxp_send_rsp_s {
308 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800309 __be16 fcxp_tag; /* send request tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700310 u8 req_status; /* request status */
311 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800312 __be32 rsp_len; /* actual response length */
313 __be32 residue_len; /* residual response length */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700314 struct fchs_s fchs; /* response FC header structure */
315};
316
317enum bfi_uf_h2i {
318 BFI_UF_H2I_BUF_POST = 1,
319};
320
321enum bfi_uf_i2h {
322 BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
323};
324
325#define BFA_UF_MAX_SGES 2
326
327struct bfi_uf_buf_post_s {
328 struct bfi_mhdr_s mh; /* Common msg header */
329 u16 buf_tag; /* buffer tag */
Maggie50444a32010-11-29 18:26:32 -0800330 __be16 buf_len; /* total buffer length */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700331 struct bfi_sge_s sge[BFA_UF_MAX_SGES]; /* buffer DMA SGEs */
332};
333
334struct bfi_uf_frm_rcvd_s {
335 struct bfi_mhdr_s mh; /* Common msg header */
336 u16 buf_tag; /* buffer tag */
337 u16 rsvd;
338 u16 frm_len; /* received frame length */
339 u16 xfr_len; /* tranferred length */
340};
341
342enum bfi_lps_h2i_msgs {
343 BFI_LPS_H2I_LOGIN_REQ = 1,
344 BFI_LPS_H2I_LOGOUT_REQ = 2,
345};
346
347enum bfi_lps_i2h_msgs {
348 BFI_LPS_H2I_LOGIN_RSP = BFA_I2HM(1),
349 BFI_LPS_H2I_LOGOUT_RSP = BFA_I2HM(2),
350 BFI_LPS_H2I_CVL_EVENT = BFA_I2HM(3),
351};
352
353struct bfi_lps_login_req_s {
354 struct bfi_mhdr_s mh; /* common msg header */
355 u8 lp_tag;
356 u8 alpa;
Maggie50444a32010-11-29 18:26:32 -0800357 __be16 pdu_size;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700358 wwn_t pwwn;
359 wwn_t nwwn;
360 u8 fdisc;
361 u8 auth_en;
362 u8 rsvd[2];
363};
364
365struct bfi_lps_login_rsp_s {
366 struct bfi_mhdr_s mh; /* common msg header */
367 u8 lp_tag;
368 u8 status;
369 u8 lsrjt_rsn;
370 u8 lsrjt_expl;
371 wwn_t port_name;
372 wwn_t node_name;
Maggie50444a32010-11-29 18:26:32 -0800373 __be16 bb_credit;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700374 u8 f_port;
375 u8 npiv_en;
376 u32 lp_pid:24;
377 u32 auth_req:8;
378 mac_t lp_mac;
379 mac_t fcf_mac;
380 u8 ext_status;
381 u8 brcd_switch; /* attached peer is brcd switch */
382};
383
384struct bfi_lps_logout_req_s {
385 struct bfi_mhdr_s mh; /* common msg header */
386 u8 lp_tag;
387 u8 rsvd[3];
388 wwn_t port_name;
389};
390
391struct bfi_lps_logout_rsp_s {
392 struct bfi_mhdr_s mh; /* common msg header */
393 u8 lp_tag;
394 u8 status;
395 u8 rsvd[2];
396};
397
398struct bfi_lps_cvl_event_s {
399 struct bfi_mhdr_s mh; /* common msg header */
400 u8 lp_tag;
401 u8 rsvd[3];
402};
403
404union bfi_lps_h2i_msg_u {
405 struct bfi_mhdr_s *msg;
406 struct bfi_lps_login_req_s *login_req;
407 struct bfi_lps_logout_req_s *logout_req;
408};
409
410union bfi_lps_i2h_msg_u {
411 struct bfi_msg_s *msg;
412 struct bfi_lps_login_rsp_s *login_rsp;
413 struct bfi_lps_logout_rsp_s *logout_rsp;
414 struct bfi_lps_cvl_event_s *cvl_event;
415};
416
417enum bfi_rport_h2i_msgs {
418 BFI_RPORT_H2I_CREATE_REQ = 1,
419 BFI_RPORT_H2I_DELETE_REQ = 2,
420 BFI_RPORT_H2I_SET_SPEED_REQ = 3,
421};
422
423enum bfi_rport_i2h_msgs {
424 BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
425 BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
426 BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3),
427};
428
429struct bfi_rport_create_req_s {
430 struct bfi_mhdr_s mh; /* common msg header */
431 u16 bfa_handle; /* host rport handle */
Maggie50444a32010-11-29 18:26:32 -0800432 __be16 max_frmsz; /* max rcv pdu size */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700433 u32 pid:24, /* remote port ID */
434 lp_tag:8; /* local port tag */
435 u32 local_pid:24, /* local port ID */
436 cisc:8;
437 u8 fc_class; /* supported FC classes */
438 u8 vf_en; /* virtual fabric enable */
439 u16 vf_id; /* virtual fabric ID */
440};
441
442struct bfi_rport_create_rsp_s {
443 struct bfi_mhdr_s mh; /* common msg header */
444 u8 status; /* rport creation status */
445 u8 rsvd[3];
446 u16 bfa_handle; /* host rport handle */
447 u16 fw_handle; /* firmware rport handle */
448 struct bfa_rport_qos_attr_s qos_attr; /* QoS Attributes */
449};
450
451struct bfa_rport_speed_req_s {
452 struct bfi_mhdr_s mh; /* common msg header */
453 u16 fw_handle; /* firmware rport handle */
454 u8 speed; /* rport's speed via RPSC */
455 u8 rsvd;
456};
457
458struct bfi_rport_delete_req_s {
459 struct bfi_mhdr_s mh; /* common msg header */
460 u16 fw_handle; /* firmware rport handle */
461 u16 rsvd;
462};
463
464struct bfi_rport_delete_rsp_s {
465 struct bfi_mhdr_s mh; /* common msg header */
466 u16 bfa_handle; /* host rport handle */
467 u8 status; /* rport deletion status */
468 u8 rsvd;
469};
470
471struct bfi_rport_qos_scn_s {
472 struct bfi_mhdr_s mh; /* common msg header */
473 u16 bfa_handle; /* host rport handle */
474 u16 rsvd;
475 struct bfa_rport_qos_attr_s old_qos_attr; /* Old QoS Attributes */
476 struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */
477};
478
479union bfi_rport_h2i_msg_u {
480 struct bfi_msg_s *msg;
481 struct bfi_rport_create_req_s *create_req;
482 struct bfi_rport_delete_req_s *delete_req;
483 struct bfi_rport_speed_req_s *speed_req;
484};
485
486union bfi_rport_i2h_msg_u {
487 struct bfi_msg_s *msg;
488 struct bfi_rport_create_rsp_s *create_rsp;
489 struct bfi_rport_delete_rsp_s *delete_rsp;
490 struct bfi_rport_qos_scn_s *qos_scn_evt;
491};
492
493/*
494 * Initiator mode I-T nexus interface defines.
495 */
496
497enum bfi_itnim_h2i {
498 BFI_ITNIM_H2I_CREATE_REQ = 1, /* i-t nexus creation */
499 BFI_ITNIM_H2I_DELETE_REQ = 2, /* i-t nexus deletion */
500};
501
502enum bfi_itnim_i2h {
503 BFI_ITNIM_I2H_CREATE_RSP = BFA_I2HM(1),
504 BFI_ITNIM_I2H_DELETE_RSP = BFA_I2HM(2),
505 BFI_ITNIM_I2H_SLER_EVENT = BFA_I2HM(3),
506};
507
508struct bfi_itnim_create_req_s {
509 struct bfi_mhdr_s mh; /* common msg header */
510 u16 fw_handle; /* f/w handle for itnim */
511 u8 class; /* FC class for IO */
512 u8 seq_rec; /* sequence recovery support */
513 u8 msg_no; /* seq id of the msg */
514};
515
516struct bfi_itnim_create_rsp_s {
517 struct bfi_mhdr_s mh; /* common msg header */
518 u16 bfa_handle; /* bfa handle for itnim */
519 u8 status; /* fcp request status */
520 u8 seq_id; /* seq id of the msg */
521};
522
523struct bfi_itnim_delete_req_s {
524 struct bfi_mhdr_s mh; /* common msg header */
525 u16 fw_handle; /* f/w itnim handle */
526 u8 seq_id; /* seq id of the msg */
527 u8 rsvd;
528};
529
530struct bfi_itnim_delete_rsp_s {
531 struct bfi_mhdr_s mh; /* common msg header */
532 u16 bfa_handle; /* bfa handle for itnim */
533 u8 status; /* fcp request status */
534 u8 seq_id; /* seq id of the msg */
535};
536
537struct bfi_itnim_sler_event_s {
538 struct bfi_mhdr_s mh; /* common msg header */
539 u16 bfa_handle; /* bfa handle for itnim */
540 u16 rsvd;
541};
542
543union bfi_itnim_h2i_msg_u {
544 struct bfi_itnim_create_req_s *create_req;
545 struct bfi_itnim_delete_req_s *delete_req;
546 struct bfi_msg_s *msg;
547};
548
549union bfi_itnim_i2h_msg_u {
550 struct bfi_itnim_create_rsp_s *create_rsp;
551 struct bfi_itnim_delete_rsp_s *delete_rsp;
552 struct bfi_itnim_sler_event_s *sler_event;
553 struct bfi_msg_s *msg;
554};
555
556/*
557 * Initiator mode IO interface defines.
558 */
559
560enum bfi_ioim_h2i {
561 BFI_IOIM_H2I_IOABORT_REQ = 1, /* IO abort request */
562 BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /* IO cleanup request */
563};
564
565enum bfi_ioim_i2h {
566 BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1), /* non-fp IO response */
567 BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /* ABORT rsp */
568};
569
Jing Huangacdc79a2010-10-18 17:15:55 -0700570/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700571 * IO command DIF info
572 */
573struct bfi_ioim_dif_s {
574 u32 dif_info[4];
575};
576
Jing Huangacdc79a2010-10-18 17:15:55 -0700577/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700578 * FCP IO messages overview
579 *
580 * @note
581 * - Max CDB length supported is 64 bytes.
582 * - SCSI Linked commands and SCSI bi-directional Commands not
583 * supported.
584 *
585 */
586struct bfi_ioim_req_s {
587 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800588 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700589 u16 rport_hdl; /* itnim/rport firmware handle */
590 struct fcp_cmnd_s cmnd; /* IO request info */
591
Jing Huangacdc79a2010-10-18 17:15:55 -0700592 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700593 * SG elements array within the IO request must be double word
594 * aligned. This aligment is required to optimize SGM setup for the IO.
595 */
596 struct bfi_sge_s sges[BFI_SGE_INLINE_MAX];
597 u8 io_timeout;
598 u8 dif_en;
599 u8 rsvd_a[2];
600 struct bfi_ioim_dif_s dif;
601};
602
Jing Huangacdc79a2010-10-18 17:15:55 -0700603/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700604 * This table shows various IO status codes from firmware and their
605 * meaning. Host driver can use these status codes to further process
606 * IO completions.
607 *
608 * BFI_IOIM_STS_OK : IO completed with error free SCSI &
609 * transport status.
610 * io-tag can be reused.
611 *
612 * BFA_IOIM_STS_SCSI_ERR : IO completed with scsi error.
613 * - io-tag can be reused.
614 *
615 * BFI_IOIM_STS_HOST_ABORTED : IO was aborted successfully due to
616 * host request.
617 * - io-tag cannot be reused yet.
618 *
619 * BFI_IOIM_STS_ABORTED : IO was aborted successfully
620 * internally by f/w.
621 * - io-tag cannot be reused yet.
622 *
623 * BFI_IOIM_STS_TIMEDOUT : IO timedout and ABTS/RRQ is happening
624 * in the firmware and
625 * - io-tag cannot be reused yet.
626 *
627 * BFI_IOIM_STS_SQER_NEEDED : Firmware could not recover the IO
628 * with sequence level error
629 * logic and hence host needs to retry
630 * this IO with a different IO tag
631 * - io-tag cannot be used yet.
632 *
633 * BFI_IOIM_STS_NEXUS_ABORT : Second Level Error Recovery from host
634 * is required because 2 consecutive ABTS
635 * timedout and host needs logout and
636 * re-login with the target
637 * - io-tag cannot be used yet.
638 *
639 * BFI_IOIM_STS_UNDERRUN : IO completed with SCSI status good,
640 * but the data tranferred is less than
641 * the fcp data length in the command.
642 * ex. SCSI INQUIRY where transferred
643 * data length and residue count in FCP
644 * response accounts for total fcp-dl
645 * - io-tag can be reused.
646 *
647 * BFI_IOIM_STS_OVERRUN : IO completed with SCSI status good,
648 * but the data transerred is more than
649 * fcp data length in the command. ex.
650 * TAPE IOs where blocks can of unequal
651 * lengths.
652 * - io-tag can be reused.
653 *
654 * BFI_IOIM_STS_RES_FREE : Firmware has completed using io-tag
655 * during abort process
656 * - io-tag can be reused.
657 *
658 * BFI_IOIM_STS_PROTO_ERR : Firmware detected a protocol error.
659 * ex target sent more data than
660 * requested, or there was data frame
661 * loss and other reasons
662 * - io-tag cannot be used yet.
663 *
664 * BFI_IOIM_STS_DIF_ERR : Firwmare detected DIF error. ex: DIF
665 * CRC err or Ref Tag err or App tag err.
666 * - io-tag can be reused.
667 *
668 * BFA_IOIM_STS_TSK_MGT_ABORT : IO was aborted because of Task
669 * Management command from the host
670 * - io-tag can be reused.
671 *
672 * BFI_IOIM_STS_UTAG : Firmware does not know about this
673 * io_tag.
674 * - io-tag can be reused.
675 */
676enum bfi_ioim_status {
677 BFI_IOIM_STS_OK = 0,
678 BFI_IOIM_STS_HOST_ABORTED = 1,
679 BFI_IOIM_STS_ABORTED = 2,
680 BFI_IOIM_STS_TIMEDOUT = 3,
681 BFI_IOIM_STS_RES_FREE = 4,
682 BFI_IOIM_STS_SQER_NEEDED = 5,
683 BFI_IOIM_STS_PROTO_ERR = 6,
684 BFI_IOIM_STS_UTAG = 7,
685 BFI_IOIM_STS_PATHTOV = 8,
686};
687
688#define BFI_IOIM_SNSLEN (256)
Jing Huangacdc79a2010-10-18 17:15:55 -0700689/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700690 * I/O response message
691 */
692struct bfi_ioim_rsp_s {
693 struct bfi_mhdr_s mh; /* common msg header */
Maggie50444a32010-11-29 18:26:32 -0800694 __be16 io_tag; /* completed IO tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700695 u16 bfa_rport_hndl; /* releated rport handle */
696 u8 io_status; /* IO completion status */
697 u8 reuse_io_tag; /* IO tag can be reused */
698 u16 abort_tag; /* host abort request tag */
699 u8 scsi_status; /* scsi status from target */
700 u8 sns_len; /* scsi sense length */
701 u8 resid_flags; /* IO residue flags */
702 u8 rsvd_a;
Maggie50444a32010-11-29 18:26:32 -0800703 __be32 residue; /* IO residual length in bytes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700704 u32 rsvd_b[3];
705};
706
707struct bfi_ioim_abort_req_s {
708 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800709 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700710 u16 abort_tag; /* unique request tag */
711};
712
713/*
714 * Initiator mode task management command interface defines.
715 */
716
717enum bfi_tskim_h2i {
718 BFI_TSKIM_H2I_TM_REQ = 1, /* task-mgmt command */
719 BFI_TSKIM_H2I_ABORT_REQ = 2, /* task-mgmt command */
720};
721
722enum bfi_tskim_i2h {
723 BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
724};
725
726struct bfi_tskim_req_s {
727 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800728 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700729 u16 itn_fhdl; /* itn firmware handle */
Maggie Zhangf3148782010-12-09 19:11:39 -0800730 struct scsi_lun lun; /* LU number */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700731 u8 tm_flags; /* see enum fcp_tm_cmnd */
732 u8 t_secs; /* Timeout value in seconds */
733 u8 rsvd[2];
734};
735
736struct bfi_tskim_abortreq_s {
737 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800738 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700739 u16 rsvd;
740};
741
742enum bfi_tskim_status {
743 /*
744 * Following are FCP-4 spec defined status codes,
745 * **DO NOT CHANGE THEM **
746 */
747 BFI_TSKIM_STS_OK = 0,
748 BFI_TSKIM_STS_NOT_SUPP = 4,
749 BFI_TSKIM_STS_FAILED = 5,
750
Jing Huangacdc79a2010-10-18 17:15:55 -0700751 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700752 * Defined by BFA
753 */
754 BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */
755 BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */
756};
757
758struct bfi_tskim_rsp_s {
759 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800760 __be16 tsk_tag; /* task mgmt cmnd tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700761 u8 tsk_status; /* @ref bfi_tskim_status */
762 u8 rsvd;
763};
764
765#pragma pack()
766
767#endif /* __BFI_MS_H__ */