blob: edb92561dde9ed5a5426f4d43e7a374994512d51 [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
Krishna Gudipati11189202011-06-13 15:50:35 -070071/**
72 * Queue configuration response from firmware
73 */
74struct bfi_iocfc_qreg_s {
75 u32 cpe_q_ci_off[BFI_IOC_MAX_CQS];
76 u32 cpe_q_pi_off[BFI_IOC_MAX_CQS];
77 u32 cpe_qctl_off[BFI_IOC_MAX_CQS];
78 u32 rme_q_ci_off[BFI_IOC_MAX_CQS];
79 u32 rme_q_pi_off[BFI_IOC_MAX_CQS];
80 u32 rme_qctl_off[BFI_IOC_MAX_CQS];
81};
82
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070083struct bfi_iocfc_cfgrsp_s {
84 struct bfa_iocfc_fwcfg_s fwcfg;
85 struct bfa_iocfc_intr_attr_s intr_attr;
86 struct bfi_iocfc_bootwwns bootwwns;
87 struct bfi_pbc_s pbc_cfg;
Krishna Gudipati11189202011-06-13 15:50:35 -070088 struct bfi_iocfc_qreg_s qreg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070089};
90
Jing Huangacdc79a2010-10-18 17:15:55 -070091/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070092 * BFI_IOCFC_H2I_CFG_REQ message
93 */
94struct bfi_iocfc_cfg_req_s {
95 struct bfi_mhdr_s mh;
96 union bfi_addr_u ioc_cfg_dma_addr;
97};
98
99
Jing Huangacdc79a2010-10-18 17:15:55 -0700100/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700101 * BFI_IOCFC_I2H_CFG_REPLY message
102 */
103struct bfi_iocfc_cfg_reply_s {
104 struct bfi_mhdr_s mh; /* Common msg header */
105 u8 cfg_success; /* cfg reply status */
106 u8 lpu_bm; /* LPUs assigned for this IOC */
107 u8 rsvd[2];
108};
109
110
Jing Huangacdc79a2010-10-18 17:15:55 -0700111/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700112 * BFI_IOCFC_H2I_SET_INTR_REQ message
113 */
114struct bfi_iocfc_set_intr_req_s {
115 struct bfi_mhdr_s mh; /* common msg header */
116 u8 coalesce; /* enable intr coalescing */
117 u8 rsvd[3];
Maggie50444a32010-11-29 18:26:32 -0800118 __be16 delay; /* delay timer 0..1125us */
119 __be16 latency; /* latency timer 0..225us */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700120};
121
122
Jing Huangacdc79a2010-10-18 17:15:55 -0700123/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700124 * BFI_IOCFC_H2I_UPDATEQ_REQ message
125 */
126struct bfi_iocfc_updateq_req_s {
127 struct bfi_mhdr_s mh; /* common msg header */
128 u32 reqq_ba; /* reqq base addr */
129 u32 rspq_ba; /* rspq base addr */
130 u32 reqq_sci; /* reqq shadow ci */
131 u32 rspq_spi; /* rspq shadow pi */
132};
133
134
Jing Huangacdc79a2010-10-18 17:15:55 -0700135/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700136 * BFI_IOCFC_I2H_UPDATEQ_RSP message
137 */
138struct bfi_iocfc_updateq_rsp_s {
139 struct bfi_mhdr_s mh; /* common msg header */
140 u8 status; /* updateq status */
141 u8 rsvd[3];
142};
143
144
Jing Huangacdc79a2010-10-18 17:15:55 -0700145/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700146 * H2I Messages
147 */
148union bfi_iocfc_h2i_msg_u {
149 struct bfi_mhdr_s mh;
150 struct bfi_iocfc_cfg_req_s cfg_req;
151 struct bfi_iocfc_updateq_req_s updateq_req;
152 u32 mboxmsg[BFI_IOC_MSGSZ];
153};
154
155
Jing Huangacdc79a2010-10-18 17:15:55 -0700156/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700157 * I2H Messages
158 */
159union bfi_iocfc_i2h_msg_u {
160 struct bfi_mhdr_s mh;
161 struct bfi_iocfc_cfg_reply_s cfg_reply;
162 struct bfi_iocfc_updateq_rsp_s updateq_rsp;
163 u32 mboxmsg[BFI_IOC_MSGSZ];
164};
165
166
167enum bfi_fcport_h2i {
168 BFI_FCPORT_H2I_ENABLE_REQ = (1),
169 BFI_FCPORT_H2I_DISABLE_REQ = (2),
170 BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3),
171 BFI_FCPORT_H2I_STATS_GET_REQ = (4),
172 BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5),
173};
174
175
176enum bfi_fcport_i2h {
177 BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1),
178 BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2),
179 BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3),
180 BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4),
181 BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5),
182 BFI_FCPORT_I2H_EVENT = BFA_I2HM(6),
183 BFI_FCPORT_I2H_TRUNK_SCN = BFA_I2HM(7),
184 BFI_FCPORT_I2H_ENABLE_AEN = BFA_I2HM(8),
185 BFI_FCPORT_I2H_DISABLE_AEN = BFA_I2HM(9),
186};
187
188
Jing Huangacdc79a2010-10-18 17:15:55 -0700189/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700190 * Generic REQ type
191 */
192struct bfi_fcport_req_s {
193 struct bfi_mhdr_s mh; /* msg header */
194 u32 msgtag; /* msgtag for reply */
195};
196
Jing Huangacdc79a2010-10-18 17:15:55 -0700197/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700198 * Generic RSP type
199 */
200struct bfi_fcport_rsp_s {
201 struct bfi_mhdr_s mh; /* common msg header */
202 u8 status; /* port enable status */
203 u8 rsvd[3];
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800204 struct bfa_port_cfg_s port_cfg;/* port configuration */
205 u32 msgtag; /* msgtag for reply */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700206};
207
Jing Huangacdc79a2010-10-18 17:15:55 -0700208/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700209 * BFI_FCPORT_H2I_ENABLE_REQ
210 */
211struct bfi_fcport_enable_req_s {
212 struct bfi_mhdr_s mh; /* msg header */
213 u32 rsvd1;
214 wwn_t nwwn; /* node wwn of physical port */
215 wwn_t pwwn; /* port wwn of physical port */
216 struct bfa_port_cfg_s port_cfg; /* port configuration */
217 union bfi_addr_u stats_dma_addr; /* DMA address for stats */
218 u32 msgtag; /* msgtag for reply */
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800219 u8 use_flash_cfg; /* get prot cfg from flash */
220 u8 rsvd2[3];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700221};
222
Jing Huangacdc79a2010-10-18 17:15:55 -0700223/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700224 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
225 */
226struct bfi_fcport_set_svc_params_req_s {
227 struct bfi_mhdr_s mh; /* msg header */
Maggie50444a32010-11-29 18:26:32 -0800228 __be16 tx_bbcredit; /* Tx credits */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700229 u8 bb_scn; /* BB_SC FC credit recovery */
230 u8 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700231};
232
Jing Huangacdc79a2010-10-18 17:15:55 -0700233/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700234 * BFI_FCPORT_I2H_EVENT
235 */
236struct bfi_fcport_event_s {
237 struct bfi_mhdr_s mh; /* common msg header */
238 struct bfa_port_link_s link_state;
239};
240
Jing Huangacdc79a2010-10-18 17:15:55 -0700241/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700242 * BFI_FCPORT_I2H_TRUNK_SCN
243 */
244struct bfi_fcport_trunk_link_s {
245 wwn_t trunk_wwn;
246 u8 fctl; /* bfa_trunk_link_fctl_t */
247 u8 state; /* bfa_trunk_link_state_t */
248 u8 speed; /* bfa_port_speed_t */
249 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800250 __be32 deskew;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700251};
252
253#define BFI_FCPORT_MAX_LINKS 2
254struct bfi_fcport_trunk_scn_s {
255 struct bfi_mhdr_s mh;
256 u8 trunk_state; /* bfa_trunk_state_t */
257 u8 trunk_speed; /* bfa_port_speed_t */
258 u8 rsvd_a[2];
259 struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
260};
261
Jing Huangacdc79a2010-10-18 17:15:55 -0700262/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700263 * fcport H2I message
264 */
265union bfi_fcport_h2i_msg_u {
266 struct bfi_mhdr_s *mhdr;
267 struct bfi_fcport_enable_req_s *penable;
268 struct bfi_fcport_req_s *pdisable;
269 struct bfi_fcport_set_svc_params_req_s *psetsvcparams;
270 struct bfi_fcport_req_s *pstatsget;
271 struct bfi_fcport_req_s *pstatsclear;
272};
273
Jing Huangacdc79a2010-10-18 17:15:55 -0700274/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700275 * fcport I2H message
276 */
277union bfi_fcport_i2h_msg_u {
278 struct bfi_msg_s *msg;
279 struct bfi_fcport_rsp_s *penable_rsp;
280 struct bfi_fcport_rsp_s *pdisable_rsp;
281 struct bfi_fcport_rsp_s *psetsvcparams_rsp;
282 struct bfi_fcport_rsp_s *pstatsget_rsp;
283 struct bfi_fcport_rsp_s *pstatsclear_rsp;
284 struct bfi_fcport_event_s *event;
285 struct bfi_fcport_trunk_scn_s *trunk_scn;
286};
287
288enum bfi_fcxp_h2i {
289 BFI_FCXP_H2I_SEND_REQ = 1,
290};
291
292enum bfi_fcxp_i2h {
293 BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
294};
295
296#define BFA_FCXP_MAX_SGES 2
297
Jing Huangacdc79a2010-10-18 17:15:55 -0700298/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700299 * FCXP send request structure
300 */
301struct bfi_fcxp_send_req_s {
302 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800303 __be16 fcxp_tag; /* driver request tag */
304 __be16 max_frmsz; /* max send frame size */
305 __be16 vf_id; /* vsan tag if applicable */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700306 u16 rport_fw_hndl; /* FW Handle for the remote port */
307 u8 class; /* FC class used for req/rsp */
308 u8 rsp_timeout; /* timeout in secs, 0-no response */
309 u8 cts; /* continue sequence */
310 u8 lp_tag; /* lport tag */
311 struct fchs_s fchs; /* request FC header structure */
Maggie50444a32010-11-29 18:26:32 -0800312 __be32 req_len; /* request payload length */
313 __be32 rsp_maxlen; /* max response length expected */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700314 struct bfi_alen_s req_alen; /* request buffer */
315 struct bfi_alen_s rsp_alen; /* response buffer */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700316};
317
Jing Huangacdc79a2010-10-18 17:15:55 -0700318/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700319 * FCXP send response structure
320 */
321struct bfi_fcxp_send_rsp_s {
322 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800323 __be16 fcxp_tag; /* send request tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700324 u8 req_status; /* request status */
325 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800326 __be32 rsp_len; /* actual response length */
327 __be32 residue_len; /* residual response length */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700328 struct fchs_s fchs; /* response FC header structure */
329};
330
331enum bfi_uf_h2i {
332 BFI_UF_H2I_BUF_POST = 1,
333};
334
335enum bfi_uf_i2h {
336 BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
337};
338
339#define BFA_UF_MAX_SGES 2
340
341struct bfi_uf_buf_post_s {
342 struct bfi_mhdr_s mh; /* Common msg header */
343 u16 buf_tag; /* buffer tag */
Maggie50444a32010-11-29 18:26:32 -0800344 __be16 buf_len; /* total buffer length */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700345 struct bfi_alen_s alen; /* buffer address/len pair */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700346};
347
348struct bfi_uf_frm_rcvd_s {
349 struct bfi_mhdr_s mh; /* Common msg header */
350 u16 buf_tag; /* buffer tag */
351 u16 rsvd;
352 u16 frm_len; /* received frame length */
353 u16 xfr_len; /* tranferred length */
354};
355
356enum bfi_lps_h2i_msgs {
357 BFI_LPS_H2I_LOGIN_REQ = 1,
358 BFI_LPS_H2I_LOGOUT_REQ = 2,
Krishna Gudipatib7044952010-12-13 16:17:42 -0800359 BFI_LPS_H2I_N2N_PID_REQ = 3,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700360};
361
362enum bfi_lps_i2h_msgs {
Krishna Gudipati43ffdf42011-06-13 15:46:21 -0700363 BFI_LPS_I2H_LOGIN_RSP = BFA_I2HM(1),
364 BFI_LPS_I2H_LOGOUT_RSP = BFA_I2HM(2),
365 BFI_LPS_I2H_CVL_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700366};
367
368struct bfi_lps_login_req_s {
369 struct bfi_mhdr_s mh; /* common msg header */
370 u8 lp_tag;
371 u8 alpa;
Maggie50444a32010-11-29 18:26:32 -0800372 __be16 pdu_size;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700373 wwn_t pwwn;
374 wwn_t nwwn;
375 u8 fdisc;
376 u8 auth_en;
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700377 u8 lps_role;
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700378 u8 bb_scn;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700379};
380
381struct bfi_lps_login_rsp_s {
382 struct bfi_mhdr_s mh; /* common msg header */
383 u8 lp_tag;
384 u8 status;
385 u8 lsrjt_rsn;
386 u8 lsrjt_expl;
387 wwn_t port_name;
388 wwn_t node_name;
Maggie50444a32010-11-29 18:26:32 -0800389 __be16 bb_credit;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700390 u8 f_port;
391 u8 npiv_en;
392 u32 lp_pid:24;
393 u32 auth_req:8;
394 mac_t lp_mac;
395 mac_t fcf_mac;
396 u8 ext_status;
397 u8 brcd_switch; /* attached peer is brcd switch */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700398 u8 bb_scn; /* atatched port's bb_scn */
399 u8 resvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700400};
401
402struct bfi_lps_logout_req_s {
403 struct bfi_mhdr_s mh; /* common msg header */
404 u8 lp_tag;
405 u8 rsvd[3];
406 wwn_t port_name;
407};
408
409struct bfi_lps_logout_rsp_s {
410 struct bfi_mhdr_s mh; /* common msg header */
411 u8 lp_tag;
412 u8 status;
413 u8 rsvd[2];
414};
415
416struct bfi_lps_cvl_event_s {
417 struct bfi_mhdr_s mh; /* common msg header */
418 u8 lp_tag;
419 u8 rsvd[3];
420};
421
Krishna Gudipatib7044952010-12-13 16:17:42 -0800422struct bfi_lps_n2n_pid_req_s {
423 struct bfi_mhdr_s mh; /* common msg header */
424 u8 lp_tag;
425 u32 lp_pid:24;
426};
427
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700428union bfi_lps_h2i_msg_u {
429 struct bfi_mhdr_s *msg;
430 struct bfi_lps_login_req_s *login_req;
431 struct bfi_lps_logout_req_s *logout_req;
Krishna Gudipatib7044952010-12-13 16:17:42 -0800432 struct bfi_lps_n2n_pid_req_s *n2n_pid_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700433};
434
435union bfi_lps_i2h_msg_u {
436 struct bfi_msg_s *msg;
437 struct bfi_lps_login_rsp_s *login_rsp;
438 struct bfi_lps_logout_rsp_s *logout_rsp;
439 struct bfi_lps_cvl_event_s *cvl_event;
440};
441
442enum bfi_rport_h2i_msgs {
443 BFI_RPORT_H2I_CREATE_REQ = 1,
444 BFI_RPORT_H2I_DELETE_REQ = 2,
445 BFI_RPORT_H2I_SET_SPEED_REQ = 3,
446};
447
448enum bfi_rport_i2h_msgs {
449 BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
450 BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
451 BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3),
452};
453
454struct bfi_rport_create_req_s {
455 struct bfi_mhdr_s mh; /* common msg header */
456 u16 bfa_handle; /* host rport handle */
Maggie50444a32010-11-29 18:26:32 -0800457 __be16 max_frmsz; /* max rcv pdu size */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700458 u32 pid:24, /* remote port ID */
459 lp_tag:8; /* local port tag */
460 u32 local_pid:24, /* local port ID */
461 cisc:8;
462 u8 fc_class; /* supported FC classes */
463 u8 vf_en; /* virtual fabric enable */
464 u16 vf_id; /* virtual fabric ID */
465};
466
467struct bfi_rport_create_rsp_s {
468 struct bfi_mhdr_s mh; /* common msg header */
469 u8 status; /* rport creation status */
470 u8 rsvd[3];
471 u16 bfa_handle; /* host rport handle */
472 u16 fw_handle; /* firmware rport handle */
473 struct bfa_rport_qos_attr_s qos_attr; /* QoS Attributes */
474};
475
476struct bfa_rport_speed_req_s {
477 struct bfi_mhdr_s mh; /* common msg header */
478 u16 fw_handle; /* firmware rport handle */
479 u8 speed; /* rport's speed via RPSC */
480 u8 rsvd;
481};
482
483struct bfi_rport_delete_req_s {
484 struct bfi_mhdr_s mh; /* common msg header */
485 u16 fw_handle; /* firmware rport handle */
486 u16 rsvd;
487};
488
489struct bfi_rport_delete_rsp_s {
490 struct bfi_mhdr_s mh; /* common msg header */
491 u16 bfa_handle; /* host rport handle */
492 u8 status; /* rport deletion status */
493 u8 rsvd;
494};
495
496struct bfi_rport_qos_scn_s {
497 struct bfi_mhdr_s mh; /* common msg header */
498 u16 bfa_handle; /* host rport handle */
499 u16 rsvd;
500 struct bfa_rport_qos_attr_s old_qos_attr; /* Old QoS Attributes */
501 struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */
502};
503
504union bfi_rport_h2i_msg_u {
505 struct bfi_msg_s *msg;
506 struct bfi_rport_create_req_s *create_req;
507 struct bfi_rport_delete_req_s *delete_req;
508 struct bfi_rport_speed_req_s *speed_req;
509};
510
511union bfi_rport_i2h_msg_u {
512 struct bfi_msg_s *msg;
513 struct bfi_rport_create_rsp_s *create_rsp;
514 struct bfi_rport_delete_rsp_s *delete_rsp;
515 struct bfi_rport_qos_scn_s *qos_scn_evt;
516};
517
518/*
519 * Initiator mode I-T nexus interface defines.
520 */
521
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700522enum bfi_itn_h2i {
523 BFI_ITN_H2I_CREATE_REQ = 1, /* i-t nexus creation */
524 BFI_ITN_H2I_DELETE_REQ = 2, /* i-t nexus deletion */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700525};
526
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700527enum bfi_itn_i2h {
528 BFI_ITN_I2H_CREATE_RSP = BFA_I2HM(1),
529 BFI_ITN_I2H_DELETE_RSP = BFA_I2HM(2),
530 BFI_ITN_I2H_SLER_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700531};
532
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700533struct bfi_itn_create_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700534 struct bfi_mhdr_s mh; /* common msg header */
535 u16 fw_handle; /* f/w handle for itnim */
536 u8 class; /* FC class for IO */
537 u8 seq_rec; /* sequence recovery support */
538 u8 msg_no; /* seq id of the msg */
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700539 u8 role;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700540};
541
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700542struct bfi_itn_create_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700543 struct bfi_mhdr_s mh; /* common msg header */
544 u16 bfa_handle; /* bfa handle for itnim */
545 u8 status; /* fcp request status */
546 u8 seq_id; /* seq id of the msg */
547};
548
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700549struct bfi_itn_delete_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700550 struct bfi_mhdr_s mh; /* common msg header */
551 u16 fw_handle; /* f/w itnim handle */
552 u8 seq_id; /* seq id of the msg */
553 u8 rsvd;
554};
555
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700556struct bfi_itn_delete_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700557 struct bfi_mhdr_s mh; /* common msg header */
558 u16 bfa_handle; /* bfa handle for itnim */
559 u8 status; /* fcp request status */
560 u8 seq_id; /* seq id of the msg */
561};
562
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700563struct bfi_itn_sler_event_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700564 struct bfi_mhdr_s mh; /* common msg header */
565 u16 bfa_handle; /* bfa handle for itnim */
566 u16 rsvd;
567};
568
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700569union bfi_itn_h2i_msg_u {
570 struct bfi_itn_create_req_s *create_req;
571 struct bfi_itn_delete_req_s *delete_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700572 struct bfi_msg_s *msg;
573};
574
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700575union bfi_itn_i2h_msg_u {
576 struct bfi_itn_create_rsp_s *create_rsp;
577 struct bfi_itn_delete_rsp_s *delete_rsp;
578 struct bfi_itn_sler_event_s *sler_event;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700579 struct bfi_msg_s *msg;
580};
581
582/*
583 * Initiator mode IO interface defines.
584 */
585
586enum bfi_ioim_h2i {
587 BFI_IOIM_H2I_IOABORT_REQ = 1, /* IO abort request */
588 BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /* IO cleanup request */
589};
590
591enum bfi_ioim_i2h {
592 BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1), /* non-fp IO response */
593 BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /* ABORT rsp */
594};
595
Jing Huangacdc79a2010-10-18 17:15:55 -0700596/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700597 * IO command DIF info
598 */
599struct bfi_ioim_dif_s {
600 u32 dif_info[4];
601};
602
Jing Huangacdc79a2010-10-18 17:15:55 -0700603/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700604 * FCP IO messages overview
605 *
606 * @note
607 * - Max CDB length supported is 64 bytes.
608 * - SCSI Linked commands and SCSI bi-directional Commands not
609 * supported.
610 *
611 */
612struct bfi_ioim_req_s {
613 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800614 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700615 u16 rport_hdl; /* itnim/rport firmware handle */
616 struct fcp_cmnd_s cmnd; /* IO request info */
617
Jing Huangacdc79a2010-10-18 17:15:55 -0700618 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700619 * SG elements array within the IO request must be double word
620 * aligned. This aligment is required to optimize SGM setup for the IO.
621 */
622 struct bfi_sge_s sges[BFI_SGE_INLINE_MAX];
623 u8 io_timeout;
624 u8 dif_en;
625 u8 rsvd_a[2];
626 struct bfi_ioim_dif_s dif;
627};
628
Jing Huangacdc79a2010-10-18 17:15:55 -0700629/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700630 * This table shows various IO status codes from firmware and their
631 * meaning. Host driver can use these status codes to further process
632 * IO completions.
633 *
634 * BFI_IOIM_STS_OK : IO completed with error free SCSI &
635 * transport status.
636 * io-tag can be reused.
637 *
638 * BFA_IOIM_STS_SCSI_ERR : IO completed with scsi error.
639 * - io-tag can be reused.
640 *
641 * BFI_IOIM_STS_HOST_ABORTED : IO was aborted successfully due to
642 * host request.
643 * - io-tag cannot be reused yet.
644 *
645 * BFI_IOIM_STS_ABORTED : IO was aborted successfully
646 * internally by f/w.
647 * - io-tag cannot be reused yet.
648 *
649 * BFI_IOIM_STS_TIMEDOUT : IO timedout and ABTS/RRQ is happening
650 * in the firmware and
651 * - io-tag cannot be reused yet.
652 *
653 * BFI_IOIM_STS_SQER_NEEDED : Firmware could not recover the IO
654 * with sequence level error
655 * logic and hence host needs to retry
656 * this IO with a different IO tag
657 * - io-tag cannot be used yet.
658 *
659 * BFI_IOIM_STS_NEXUS_ABORT : Second Level Error Recovery from host
660 * is required because 2 consecutive ABTS
661 * timedout and host needs logout and
662 * re-login with the target
663 * - io-tag cannot be used yet.
664 *
665 * BFI_IOIM_STS_UNDERRUN : IO completed with SCSI status good,
666 * but the data tranferred is less than
667 * the fcp data length in the command.
668 * ex. SCSI INQUIRY where transferred
669 * data length and residue count in FCP
670 * response accounts for total fcp-dl
671 * - io-tag can be reused.
672 *
673 * BFI_IOIM_STS_OVERRUN : IO completed with SCSI status good,
674 * but the data transerred is more than
675 * fcp data length in the command. ex.
676 * TAPE IOs where blocks can of unequal
677 * lengths.
678 * - io-tag can be reused.
679 *
680 * BFI_IOIM_STS_RES_FREE : Firmware has completed using io-tag
681 * during abort process
682 * - io-tag can be reused.
683 *
684 * BFI_IOIM_STS_PROTO_ERR : Firmware detected a protocol error.
685 * ex target sent more data than
686 * requested, or there was data frame
687 * loss and other reasons
688 * - io-tag cannot be used yet.
689 *
690 * BFI_IOIM_STS_DIF_ERR : Firwmare detected DIF error. ex: DIF
691 * CRC err or Ref Tag err or App tag err.
692 * - io-tag can be reused.
693 *
694 * BFA_IOIM_STS_TSK_MGT_ABORT : IO was aborted because of Task
695 * Management command from the host
696 * - io-tag can be reused.
697 *
698 * BFI_IOIM_STS_UTAG : Firmware does not know about this
699 * io_tag.
700 * - io-tag can be reused.
701 */
702enum bfi_ioim_status {
703 BFI_IOIM_STS_OK = 0,
704 BFI_IOIM_STS_HOST_ABORTED = 1,
705 BFI_IOIM_STS_ABORTED = 2,
706 BFI_IOIM_STS_TIMEDOUT = 3,
707 BFI_IOIM_STS_RES_FREE = 4,
708 BFI_IOIM_STS_SQER_NEEDED = 5,
709 BFI_IOIM_STS_PROTO_ERR = 6,
710 BFI_IOIM_STS_UTAG = 7,
711 BFI_IOIM_STS_PATHTOV = 8,
712};
713
714#define BFI_IOIM_SNSLEN (256)
Jing Huangacdc79a2010-10-18 17:15:55 -0700715/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700716 * I/O response message
717 */
718struct bfi_ioim_rsp_s {
719 struct bfi_mhdr_s mh; /* common msg header */
Maggie50444a32010-11-29 18:26:32 -0800720 __be16 io_tag; /* completed IO tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700721 u16 bfa_rport_hndl; /* releated rport handle */
722 u8 io_status; /* IO completion status */
723 u8 reuse_io_tag; /* IO tag can be reused */
724 u16 abort_tag; /* host abort request tag */
725 u8 scsi_status; /* scsi status from target */
726 u8 sns_len; /* scsi sense length */
727 u8 resid_flags; /* IO residue flags */
728 u8 rsvd_a;
Maggie50444a32010-11-29 18:26:32 -0800729 __be32 residue; /* IO residual length in bytes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700730 u32 rsvd_b[3];
731};
732
733struct bfi_ioim_abort_req_s {
734 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800735 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700736 u16 abort_tag; /* unique request tag */
737};
738
739/*
740 * Initiator mode task management command interface defines.
741 */
742
743enum bfi_tskim_h2i {
744 BFI_TSKIM_H2I_TM_REQ = 1, /* task-mgmt command */
745 BFI_TSKIM_H2I_ABORT_REQ = 2, /* task-mgmt command */
746};
747
748enum bfi_tskim_i2h {
749 BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
750};
751
752struct bfi_tskim_req_s {
753 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800754 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700755 u16 itn_fhdl; /* itn firmware handle */
Maggie Zhangf3148782010-12-09 19:11:39 -0800756 struct scsi_lun lun; /* LU number */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700757 u8 tm_flags; /* see enum fcp_tm_cmnd */
758 u8 t_secs; /* Timeout value in seconds */
759 u8 rsvd[2];
760};
761
762struct bfi_tskim_abortreq_s {
763 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800764 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700765 u16 rsvd;
766};
767
768enum bfi_tskim_status {
769 /*
770 * Following are FCP-4 spec defined status codes,
771 * **DO NOT CHANGE THEM **
772 */
773 BFI_TSKIM_STS_OK = 0,
774 BFI_TSKIM_STS_NOT_SUPP = 4,
775 BFI_TSKIM_STS_FAILED = 5,
776
Jing Huangacdc79a2010-10-18 17:15:55 -0700777 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700778 * Defined by BFA
779 */
780 BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */
781 BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */
782};
783
784struct bfi_tskim_rsp_s {
785 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800786 __be16 tsk_tag; /* task mgmt cmnd tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700787 u8 tsk_status; /* @ref bfi_tskim_status */
788 u8 rsvd;
789};
790
791#pragma pack()
792
Krishna Gudipati11189202011-06-13 15:50:35 -0700793/*
794 * Crossbow PCI MSI-X vector defines
795 */
796enum {
797 BFI_MSIX_CPE_QMIN_CB = 0,
798 BFI_MSIX_CPE_QMAX_CB = 7,
799 BFI_MSIX_RME_QMIN_CB = 8,
800 BFI_MSIX_RME_QMAX_CB = 15,
801 BFI_MSIX_CB_MAX = 22,
802};
803
804/*
805 * Catapult FC PCI MSI-X vector defines
806 */
807enum {
808 BFI_MSIX_LPU_ERR_CT = 0,
809 BFI_MSIX_CPE_QMIN_CT = 1,
810 BFI_MSIX_CPE_QMAX_CT = 4,
811 BFI_MSIX_RME_QMIN_CT = 5,
812 BFI_MSIX_RME_QMAX_CT = 8,
813 BFI_MSIX_CT_MAX = 9,
814};
815
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700816#endif /* __BFI_MS_H__ */