blob: 0727c7595b1d6bb953218479eca7c379819e96b1 [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,
Krishna Gudipatia7141342011-06-24 20:23:19 -070031 BFI_IOCFC_H2I_FAA_ENABLE_REQ = 4,
32 BFI_IOCFC_H2I_FAA_DISABLE_REQ = 5,
33 BFI_IOCFC_H2I_FAA_QUERY_REQ = 6,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070034};
35
36enum bfi_iocfc_i2h_msgs {
37 BFI_IOCFC_I2H_CFG_REPLY = BFA_I2HM(1),
38 BFI_IOCFC_I2H_UPDATEQ_RSP = BFA_I2HM(3),
Krishna Gudipatia7141342011-06-24 20:23:19 -070039 BFI_IOCFC_I2H_FAA_ENABLE_RSP = BFA_I2HM(4),
40 BFI_IOCFC_I2H_FAA_DISABLE_RSP = BFA_I2HM(5),
41 BFI_IOCFC_I2H_FAA_QUERY_RSP = BFA_I2HM(6),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070042};
43
44struct bfi_iocfc_cfg_s {
45 u8 num_cqs; /* Number of CQs to be used */
46 u8 sense_buf_len; /* SCSI sense length */
47 u16 rsvd_1;
48 u32 endian_sig; /* endian signature of host */
Krishna Gudipatie2187d72011-06-13 15:53:58 -070049 __be16 num_ioim_reqs;
50 __be16 num_fwtio_reqs;
Krishna Gudipati10a07372011-06-24 20:23:38 -070051 u8 single_msix_vec;
52 u8 rsvd[3];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070053
Jing Huangacdc79a2010-10-18 17:15:55 -070054 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070055 * Request and response circular queue base addresses, size and
56 * shadow index pointers.
57 */
58 union bfi_addr_u req_cq_ba[BFI_IOC_MAX_CQS];
59 union bfi_addr_u req_shadow_ci[BFI_IOC_MAX_CQS];
Maggie50444a32010-11-29 18:26:32 -080060 __be16 req_cq_elems[BFI_IOC_MAX_CQS];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070061 union bfi_addr_u rsp_cq_ba[BFI_IOC_MAX_CQS];
62 union bfi_addr_u rsp_shadow_pi[BFI_IOC_MAX_CQS];
Maggie50444a32010-11-29 18:26:32 -080063 __be16 rsp_cq_elems[BFI_IOC_MAX_CQS];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070064
65 union bfi_addr_u stats_addr; /* DMA-able address for stats */
66 union bfi_addr_u cfgrsp_addr; /* config response dma address */
67 union bfi_addr_u ioim_snsbase; /* IO sense buffer base address */
68 struct bfa_iocfc_intr_attr_s intr_attr; /* IOC interrupt attributes */
69};
70
Jing Huangacdc79a2010-10-18 17:15:55 -070071/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070072 * Boot target wwn information for this port. This contains either the stored
73 * or discovered boot target port wwns for the port.
74 */
75struct bfi_iocfc_bootwwns {
76 wwn_t wwn[BFA_BOOT_BOOTLUN_MAX];
77 u8 nwwns;
78 u8 rsvd[7];
79};
80
Krishna Gudipati11189202011-06-13 15:50:35 -070081/**
82 * Queue configuration response from firmware
83 */
84struct bfi_iocfc_qreg_s {
85 u32 cpe_q_ci_off[BFI_IOC_MAX_CQS];
86 u32 cpe_q_pi_off[BFI_IOC_MAX_CQS];
87 u32 cpe_qctl_off[BFI_IOC_MAX_CQS];
88 u32 rme_q_ci_off[BFI_IOC_MAX_CQS];
89 u32 rme_q_pi_off[BFI_IOC_MAX_CQS];
90 u32 rme_qctl_off[BFI_IOC_MAX_CQS];
Krishna Gudipati3fd45982011-06-24 20:24:08 -070091 u8 hw_qid[BFI_IOC_MAX_CQS];
Krishna Gudipati11189202011-06-13 15:50:35 -070092};
93
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070094struct bfi_iocfc_cfgrsp_s {
95 struct bfa_iocfc_fwcfg_s fwcfg;
96 struct bfa_iocfc_intr_attr_s intr_attr;
97 struct bfi_iocfc_bootwwns bootwwns;
98 struct bfi_pbc_s pbc_cfg;
Krishna Gudipati11189202011-06-13 15:50:35 -070099 struct bfi_iocfc_qreg_s qreg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700100};
101
Jing Huangacdc79a2010-10-18 17:15:55 -0700102/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700103 * BFI_IOCFC_H2I_CFG_REQ message
104 */
105struct bfi_iocfc_cfg_req_s {
106 struct bfi_mhdr_s mh;
107 union bfi_addr_u ioc_cfg_dma_addr;
108};
109
110
Jing Huangacdc79a2010-10-18 17:15:55 -0700111/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700112 * BFI_IOCFC_I2H_CFG_REPLY message
113 */
114struct bfi_iocfc_cfg_reply_s {
115 struct bfi_mhdr_s mh; /* Common msg header */
116 u8 cfg_success; /* cfg reply status */
117 u8 lpu_bm; /* LPUs assigned for this IOC */
118 u8 rsvd[2];
119};
120
121
Jing Huangacdc79a2010-10-18 17:15:55 -0700122/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700123 * BFI_IOCFC_H2I_SET_INTR_REQ message
124 */
125struct bfi_iocfc_set_intr_req_s {
126 struct bfi_mhdr_s mh; /* common msg header */
127 u8 coalesce; /* enable intr coalescing */
128 u8 rsvd[3];
Maggie50444a32010-11-29 18:26:32 -0800129 __be16 delay; /* delay timer 0..1125us */
130 __be16 latency; /* latency timer 0..225us */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700131};
132
133
Jing Huangacdc79a2010-10-18 17:15:55 -0700134/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700135 * BFI_IOCFC_H2I_UPDATEQ_REQ message
136 */
137struct bfi_iocfc_updateq_req_s {
138 struct bfi_mhdr_s mh; /* common msg header */
139 u32 reqq_ba; /* reqq base addr */
140 u32 rspq_ba; /* rspq base addr */
141 u32 reqq_sci; /* reqq shadow ci */
142 u32 rspq_spi; /* rspq shadow pi */
143};
144
145
Jing Huangacdc79a2010-10-18 17:15:55 -0700146/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700147 * BFI_IOCFC_I2H_UPDATEQ_RSP message
148 */
149struct bfi_iocfc_updateq_rsp_s {
150 struct bfi_mhdr_s mh; /* common msg header */
151 u8 status; /* updateq status */
152 u8 rsvd[3];
153};
154
155
Jing Huangacdc79a2010-10-18 17:15:55 -0700156/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700157 * H2I Messages
158 */
159union bfi_iocfc_h2i_msg_u {
160 struct bfi_mhdr_s mh;
161 struct bfi_iocfc_cfg_req_s cfg_req;
162 struct bfi_iocfc_updateq_req_s updateq_req;
163 u32 mboxmsg[BFI_IOC_MSGSZ];
164};
165
166
Jing Huangacdc79a2010-10-18 17:15:55 -0700167/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700168 * I2H Messages
169 */
170union bfi_iocfc_i2h_msg_u {
171 struct bfi_mhdr_s mh;
172 struct bfi_iocfc_cfg_reply_s cfg_reply;
173 struct bfi_iocfc_updateq_rsp_s updateq_rsp;
174 u32 mboxmsg[BFI_IOC_MSGSZ];
175};
176
Krishna Gudipatia7141342011-06-24 20:23:19 -0700177/*
178 * BFI_IOCFC_H2I_FAA_ENABLE_REQ BFI_IOCFC_H2I_FAA_DISABLE_REQ message
179 */
180struct bfi_faa_en_dis_s {
181 struct bfi_mhdr_s mh; /* common msg header */
182};
183
184/*
185 * BFI_IOCFC_H2I_FAA_QUERY_REQ message
186 */
187struct bfi_faa_query_s {
188 struct bfi_mhdr_s mh; /* common msg header */
189 u8 faa_status; /* FAA status */
190 u8 addr_source; /* PWWN source */
191 u8 rsvd[2];
192 wwn_t faa; /* Fabric acquired PWWN */
193};
194
195/*
196 * BFI_IOCFC_I2H_FAA_ENABLE_RSP, BFI_IOCFC_I2H_FAA_DISABLE_RSP message
197 */
198struct bfi_faa_en_dis_rsp_s {
199 struct bfi_mhdr_s mh; /* common msg header */
200 u8 status; /* updateq status */
201 u8 rsvd[3];
202};
203
204/*
205 * BFI_IOCFC_I2H_FAA_QUERY_RSP message
206 */
207#define bfi_faa_query_rsp_t struct bfi_faa_query_s
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700208
209enum bfi_fcport_h2i {
210 BFI_FCPORT_H2I_ENABLE_REQ = (1),
211 BFI_FCPORT_H2I_DISABLE_REQ = (2),
212 BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3),
213 BFI_FCPORT_H2I_STATS_GET_REQ = (4),
214 BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5),
215};
216
217
218enum bfi_fcport_i2h {
219 BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1),
220 BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2),
221 BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3),
222 BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4),
223 BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5),
224 BFI_FCPORT_I2H_EVENT = BFA_I2HM(6),
225 BFI_FCPORT_I2H_TRUNK_SCN = BFA_I2HM(7),
226 BFI_FCPORT_I2H_ENABLE_AEN = BFA_I2HM(8),
227 BFI_FCPORT_I2H_DISABLE_AEN = BFA_I2HM(9),
228};
229
230
Jing Huangacdc79a2010-10-18 17:15:55 -0700231/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700232 * Generic REQ type
233 */
234struct bfi_fcport_req_s {
235 struct bfi_mhdr_s mh; /* msg header */
236 u32 msgtag; /* msgtag for reply */
237};
238
Jing Huangacdc79a2010-10-18 17:15:55 -0700239/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700240 * Generic RSP type
241 */
242struct bfi_fcport_rsp_s {
243 struct bfi_mhdr_s mh; /* common msg header */
244 u8 status; /* port enable status */
245 u8 rsvd[3];
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800246 struct bfa_port_cfg_s port_cfg;/* port configuration */
247 u32 msgtag; /* msgtag for reply */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700248};
249
Jing Huangacdc79a2010-10-18 17:15:55 -0700250/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700251 * BFI_FCPORT_H2I_ENABLE_REQ
252 */
253struct bfi_fcport_enable_req_s {
254 struct bfi_mhdr_s mh; /* msg header */
255 u32 rsvd1;
256 wwn_t nwwn; /* node wwn of physical port */
257 wwn_t pwwn; /* port wwn of physical port */
258 struct bfa_port_cfg_s port_cfg; /* port configuration */
259 union bfi_addr_u stats_dma_addr; /* DMA address for stats */
260 u32 msgtag; /* msgtag for reply */
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800261 u8 use_flash_cfg; /* get prot cfg from flash */
262 u8 rsvd2[3];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700263};
264
Jing Huangacdc79a2010-10-18 17:15:55 -0700265/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700266 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
267 */
268struct bfi_fcport_set_svc_params_req_s {
269 struct bfi_mhdr_s mh; /* msg header */
Maggie50444a32010-11-29 18:26:32 -0800270 __be16 tx_bbcredit; /* Tx credits */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700271 u8 bb_scn; /* BB_SC FC credit recovery */
272 u8 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700273};
274
Jing Huangacdc79a2010-10-18 17:15:55 -0700275/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700276 * BFI_FCPORT_I2H_EVENT
277 */
278struct bfi_fcport_event_s {
279 struct bfi_mhdr_s mh; /* common msg header */
280 struct bfa_port_link_s link_state;
281};
282
Jing Huangacdc79a2010-10-18 17:15:55 -0700283/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700284 * BFI_FCPORT_I2H_TRUNK_SCN
285 */
286struct bfi_fcport_trunk_link_s {
287 wwn_t trunk_wwn;
288 u8 fctl; /* bfa_trunk_link_fctl_t */
289 u8 state; /* bfa_trunk_link_state_t */
290 u8 speed; /* bfa_port_speed_t */
291 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800292 __be32 deskew;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700293};
294
295#define BFI_FCPORT_MAX_LINKS 2
296struct bfi_fcport_trunk_scn_s {
297 struct bfi_mhdr_s mh;
298 u8 trunk_state; /* bfa_trunk_state_t */
299 u8 trunk_speed; /* bfa_port_speed_t */
300 u8 rsvd_a[2];
301 struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
302};
303
Jing Huangacdc79a2010-10-18 17:15:55 -0700304/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700305 * fcport H2I message
306 */
307union bfi_fcport_h2i_msg_u {
308 struct bfi_mhdr_s *mhdr;
309 struct bfi_fcport_enable_req_s *penable;
310 struct bfi_fcport_req_s *pdisable;
311 struct bfi_fcport_set_svc_params_req_s *psetsvcparams;
312 struct bfi_fcport_req_s *pstatsget;
313 struct bfi_fcport_req_s *pstatsclear;
314};
315
Jing Huangacdc79a2010-10-18 17:15:55 -0700316/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700317 * fcport I2H message
318 */
319union bfi_fcport_i2h_msg_u {
320 struct bfi_msg_s *msg;
321 struct bfi_fcport_rsp_s *penable_rsp;
322 struct bfi_fcport_rsp_s *pdisable_rsp;
323 struct bfi_fcport_rsp_s *psetsvcparams_rsp;
324 struct bfi_fcport_rsp_s *pstatsget_rsp;
325 struct bfi_fcport_rsp_s *pstatsclear_rsp;
326 struct bfi_fcport_event_s *event;
327 struct bfi_fcport_trunk_scn_s *trunk_scn;
328};
329
330enum bfi_fcxp_h2i {
331 BFI_FCXP_H2I_SEND_REQ = 1,
332};
333
334enum bfi_fcxp_i2h {
335 BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
336};
337
338#define BFA_FCXP_MAX_SGES 2
339
Jing Huangacdc79a2010-10-18 17:15:55 -0700340/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700341 * FCXP send request structure
342 */
343struct bfi_fcxp_send_req_s {
344 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800345 __be16 fcxp_tag; /* driver request tag */
346 __be16 max_frmsz; /* max send frame size */
347 __be16 vf_id; /* vsan tag if applicable */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700348 u16 rport_fw_hndl; /* FW Handle for the remote port */
349 u8 class; /* FC class used for req/rsp */
350 u8 rsp_timeout; /* timeout in secs, 0-no response */
351 u8 cts; /* continue sequence */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700352 u8 lp_fwtag; /* lport tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700353 struct fchs_s fchs; /* request FC header structure */
Maggie50444a32010-11-29 18:26:32 -0800354 __be32 req_len; /* request payload length */
355 __be32 rsp_maxlen; /* max response length expected */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700356 struct bfi_alen_s req_alen; /* request buffer */
357 struct bfi_alen_s rsp_alen; /* response buffer */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700358};
359
Jing Huangacdc79a2010-10-18 17:15:55 -0700360/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700361 * FCXP send response structure
362 */
363struct bfi_fcxp_send_rsp_s {
364 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800365 __be16 fcxp_tag; /* send request tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700366 u8 req_status; /* request status */
367 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800368 __be32 rsp_len; /* actual response length */
369 __be32 residue_len; /* residual response length */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700370 struct fchs_s fchs; /* response FC header structure */
371};
372
373enum bfi_uf_h2i {
374 BFI_UF_H2I_BUF_POST = 1,
375};
376
377enum bfi_uf_i2h {
378 BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
379};
380
381#define BFA_UF_MAX_SGES 2
382
383struct bfi_uf_buf_post_s {
384 struct bfi_mhdr_s mh; /* Common msg header */
385 u16 buf_tag; /* buffer tag */
Maggie50444a32010-11-29 18:26:32 -0800386 __be16 buf_len; /* total buffer length */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700387 struct bfi_alen_s alen; /* buffer address/len pair */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700388};
389
390struct bfi_uf_frm_rcvd_s {
391 struct bfi_mhdr_s mh; /* Common msg header */
392 u16 buf_tag; /* buffer tag */
393 u16 rsvd;
394 u16 frm_len; /* received frame length */
395 u16 xfr_len; /* tranferred length */
396};
397
398enum bfi_lps_h2i_msgs {
399 BFI_LPS_H2I_LOGIN_REQ = 1,
400 BFI_LPS_H2I_LOGOUT_REQ = 2,
Krishna Gudipatib7044952010-12-13 16:17:42 -0800401 BFI_LPS_H2I_N2N_PID_REQ = 3,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700402};
403
404enum bfi_lps_i2h_msgs {
Krishna Gudipati43ffdf42011-06-13 15:46:21 -0700405 BFI_LPS_I2H_LOGIN_RSP = BFA_I2HM(1),
406 BFI_LPS_I2H_LOGOUT_RSP = BFA_I2HM(2),
407 BFI_LPS_I2H_CVL_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700408};
409
410struct bfi_lps_login_req_s {
411 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700412 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700413 u8 alpa;
Maggie50444a32010-11-29 18:26:32 -0800414 __be16 pdu_size;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700415 wwn_t pwwn;
416 wwn_t nwwn;
417 u8 fdisc;
418 u8 auth_en;
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700419 u8 lps_role;
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700420 u8 bb_scn;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700421};
422
423struct bfi_lps_login_rsp_s {
424 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700425 u8 fw_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700426 u8 status;
427 u8 lsrjt_rsn;
428 u8 lsrjt_expl;
429 wwn_t port_name;
430 wwn_t node_name;
Maggie50444a32010-11-29 18:26:32 -0800431 __be16 bb_credit;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700432 u8 f_port;
433 u8 npiv_en;
434 u32 lp_pid:24;
435 u32 auth_req:8;
436 mac_t lp_mac;
437 mac_t fcf_mac;
438 u8 ext_status;
439 u8 brcd_switch; /* attached peer is brcd switch */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700440 u8 bb_scn; /* atatched port's bb_scn */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700441 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700442};
443
444struct bfi_lps_logout_req_s {
445 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700446 u8 fw_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700447 u8 rsvd[3];
448 wwn_t port_name;
449};
450
451struct bfi_lps_logout_rsp_s {
452 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700453 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700454 u8 status;
455 u8 rsvd[2];
456};
457
458struct bfi_lps_cvl_event_s {
459 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700460 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700461 u8 rsvd[3];
462};
463
Krishna Gudipatib7044952010-12-13 16:17:42 -0800464struct bfi_lps_n2n_pid_req_s {
465 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700466 u8 fw_tag;
Krishna Gudipatib7044952010-12-13 16:17:42 -0800467 u32 lp_pid:24;
468};
469
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700470union bfi_lps_h2i_msg_u {
471 struct bfi_mhdr_s *msg;
472 struct bfi_lps_login_req_s *login_req;
473 struct bfi_lps_logout_req_s *logout_req;
Krishna Gudipatib7044952010-12-13 16:17:42 -0800474 struct bfi_lps_n2n_pid_req_s *n2n_pid_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700475};
476
477union bfi_lps_i2h_msg_u {
478 struct bfi_msg_s *msg;
479 struct bfi_lps_login_rsp_s *login_rsp;
480 struct bfi_lps_logout_rsp_s *logout_rsp;
481 struct bfi_lps_cvl_event_s *cvl_event;
482};
483
484enum bfi_rport_h2i_msgs {
485 BFI_RPORT_H2I_CREATE_REQ = 1,
486 BFI_RPORT_H2I_DELETE_REQ = 2,
487 BFI_RPORT_H2I_SET_SPEED_REQ = 3,
488};
489
490enum bfi_rport_i2h_msgs {
491 BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
492 BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
493 BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3),
494};
495
496struct bfi_rport_create_req_s {
497 struct bfi_mhdr_s mh; /* common msg header */
498 u16 bfa_handle; /* host rport handle */
Maggie50444a32010-11-29 18:26:32 -0800499 __be16 max_frmsz; /* max rcv pdu size */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700500 u32 pid:24, /* remote port ID */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700501 lp_fwtag:8; /* local port tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700502 u32 local_pid:24, /* local port ID */
503 cisc:8;
504 u8 fc_class; /* supported FC classes */
505 u8 vf_en; /* virtual fabric enable */
506 u16 vf_id; /* virtual fabric ID */
507};
508
509struct bfi_rport_create_rsp_s {
510 struct bfi_mhdr_s mh; /* common msg header */
511 u8 status; /* rport creation status */
512 u8 rsvd[3];
513 u16 bfa_handle; /* host rport handle */
514 u16 fw_handle; /* firmware rport handle */
515 struct bfa_rport_qos_attr_s qos_attr; /* QoS Attributes */
516};
517
518struct bfa_rport_speed_req_s {
519 struct bfi_mhdr_s mh; /* common msg header */
520 u16 fw_handle; /* firmware rport handle */
521 u8 speed; /* rport's speed via RPSC */
522 u8 rsvd;
523};
524
525struct bfi_rport_delete_req_s {
526 struct bfi_mhdr_s mh; /* common msg header */
527 u16 fw_handle; /* firmware rport handle */
528 u16 rsvd;
529};
530
531struct bfi_rport_delete_rsp_s {
532 struct bfi_mhdr_s mh; /* common msg header */
533 u16 bfa_handle; /* host rport handle */
534 u8 status; /* rport deletion status */
535 u8 rsvd;
536};
537
538struct bfi_rport_qos_scn_s {
539 struct bfi_mhdr_s mh; /* common msg header */
540 u16 bfa_handle; /* host rport handle */
541 u16 rsvd;
542 struct bfa_rport_qos_attr_s old_qos_attr; /* Old QoS Attributes */
543 struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */
544};
545
546union bfi_rport_h2i_msg_u {
547 struct bfi_msg_s *msg;
548 struct bfi_rport_create_req_s *create_req;
549 struct bfi_rport_delete_req_s *delete_req;
550 struct bfi_rport_speed_req_s *speed_req;
551};
552
553union bfi_rport_i2h_msg_u {
554 struct bfi_msg_s *msg;
555 struct bfi_rport_create_rsp_s *create_rsp;
556 struct bfi_rport_delete_rsp_s *delete_rsp;
557 struct bfi_rport_qos_scn_s *qos_scn_evt;
558};
559
560/*
561 * Initiator mode I-T nexus interface defines.
562 */
563
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700564enum bfi_itn_h2i {
565 BFI_ITN_H2I_CREATE_REQ = 1, /* i-t nexus creation */
566 BFI_ITN_H2I_DELETE_REQ = 2, /* i-t nexus deletion */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700567};
568
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700569enum bfi_itn_i2h {
570 BFI_ITN_I2H_CREATE_RSP = BFA_I2HM(1),
571 BFI_ITN_I2H_DELETE_RSP = BFA_I2HM(2),
572 BFI_ITN_I2H_SLER_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700573};
574
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700575struct bfi_itn_create_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700576 struct bfi_mhdr_s mh; /* common msg header */
577 u16 fw_handle; /* f/w handle for itnim */
578 u8 class; /* FC class for IO */
579 u8 seq_rec; /* sequence recovery support */
580 u8 msg_no; /* seq id of the msg */
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700581 u8 role;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700582};
583
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700584struct bfi_itn_create_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700585 struct bfi_mhdr_s mh; /* common msg header */
586 u16 bfa_handle; /* bfa handle for itnim */
587 u8 status; /* fcp request status */
588 u8 seq_id; /* seq id of the msg */
589};
590
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700591struct bfi_itn_delete_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700592 struct bfi_mhdr_s mh; /* common msg header */
593 u16 fw_handle; /* f/w itnim handle */
594 u8 seq_id; /* seq id of the msg */
595 u8 rsvd;
596};
597
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700598struct bfi_itn_delete_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700599 struct bfi_mhdr_s mh; /* common msg header */
600 u16 bfa_handle; /* bfa handle for itnim */
601 u8 status; /* fcp request status */
602 u8 seq_id; /* seq id of the msg */
603};
604
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700605struct bfi_itn_sler_event_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700606 struct bfi_mhdr_s mh; /* common msg header */
607 u16 bfa_handle; /* bfa handle for itnim */
608 u16 rsvd;
609};
610
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700611union bfi_itn_h2i_msg_u {
612 struct bfi_itn_create_req_s *create_req;
613 struct bfi_itn_delete_req_s *delete_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700614 struct bfi_msg_s *msg;
615};
616
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700617union bfi_itn_i2h_msg_u {
618 struct bfi_itn_create_rsp_s *create_rsp;
619 struct bfi_itn_delete_rsp_s *delete_rsp;
620 struct bfi_itn_sler_event_s *sler_event;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700621 struct bfi_msg_s *msg;
622};
623
624/*
625 * Initiator mode IO interface defines.
626 */
627
628enum bfi_ioim_h2i {
629 BFI_IOIM_H2I_IOABORT_REQ = 1, /* IO abort request */
630 BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /* IO cleanup request */
631};
632
633enum bfi_ioim_i2h {
634 BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1), /* non-fp IO response */
635 BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /* ABORT rsp */
636};
637
Jing Huangacdc79a2010-10-18 17:15:55 -0700638/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700639 * IO command DIF info
640 */
641struct bfi_ioim_dif_s {
642 u32 dif_info[4];
643};
644
Jing Huangacdc79a2010-10-18 17:15:55 -0700645/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700646 * FCP IO messages overview
647 *
648 * @note
649 * - Max CDB length supported is 64 bytes.
650 * - SCSI Linked commands and SCSI bi-directional Commands not
651 * supported.
652 *
653 */
654struct bfi_ioim_req_s {
655 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800656 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700657 u16 rport_hdl; /* itnim/rport firmware handle */
658 struct fcp_cmnd_s cmnd; /* IO request info */
659
Jing Huangacdc79a2010-10-18 17:15:55 -0700660 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700661 * SG elements array within the IO request must be double word
662 * aligned. This aligment is required to optimize SGM setup for the IO.
663 */
664 struct bfi_sge_s sges[BFI_SGE_INLINE_MAX];
665 u8 io_timeout;
666 u8 dif_en;
667 u8 rsvd_a[2];
668 struct bfi_ioim_dif_s dif;
669};
670
Jing Huangacdc79a2010-10-18 17:15:55 -0700671/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700672 * This table shows various IO status codes from firmware and their
673 * meaning. Host driver can use these status codes to further process
674 * IO completions.
675 *
676 * BFI_IOIM_STS_OK : IO completed with error free SCSI &
677 * transport status.
678 * io-tag can be reused.
679 *
680 * BFA_IOIM_STS_SCSI_ERR : IO completed with scsi error.
681 * - io-tag can be reused.
682 *
683 * BFI_IOIM_STS_HOST_ABORTED : IO was aborted successfully due to
684 * host request.
685 * - io-tag cannot be reused yet.
686 *
687 * BFI_IOIM_STS_ABORTED : IO was aborted successfully
688 * internally by f/w.
689 * - io-tag cannot be reused yet.
690 *
691 * BFI_IOIM_STS_TIMEDOUT : IO timedout and ABTS/RRQ is happening
692 * in the firmware and
693 * - io-tag cannot be reused yet.
694 *
695 * BFI_IOIM_STS_SQER_NEEDED : Firmware could not recover the IO
696 * with sequence level error
697 * logic and hence host needs to retry
698 * this IO with a different IO tag
699 * - io-tag cannot be used yet.
700 *
701 * BFI_IOIM_STS_NEXUS_ABORT : Second Level Error Recovery from host
702 * is required because 2 consecutive ABTS
703 * timedout and host needs logout and
704 * re-login with the target
705 * - io-tag cannot be used yet.
706 *
707 * BFI_IOIM_STS_UNDERRUN : IO completed with SCSI status good,
708 * but the data tranferred is less than
709 * the fcp data length in the command.
710 * ex. SCSI INQUIRY where transferred
711 * data length and residue count in FCP
712 * response accounts for total fcp-dl
713 * - io-tag can be reused.
714 *
715 * BFI_IOIM_STS_OVERRUN : IO completed with SCSI status good,
716 * but the data transerred is more than
717 * fcp data length in the command. ex.
718 * TAPE IOs where blocks can of unequal
719 * lengths.
720 * - io-tag can be reused.
721 *
722 * BFI_IOIM_STS_RES_FREE : Firmware has completed using io-tag
723 * during abort process
724 * - io-tag can be reused.
725 *
726 * BFI_IOIM_STS_PROTO_ERR : Firmware detected a protocol error.
727 * ex target sent more data than
728 * requested, or there was data frame
729 * loss and other reasons
730 * - io-tag cannot be used yet.
731 *
732 * BFI_IOIM_STS_DIF_ERR : Firwmare detected DIF error. ex: DIF
733 * CRC err or Ref Tag err or App tag err.
734 * - io-tag can be reused.
735 *
736 * BFA_IOIM_STS_TSK_MGT_ABORT : IO was aborted because of Task
737 * Management command from the host
738 * - io-tag can be reused.
739 *
740 * BFI_IOIM_STS_UTAG : Firmware does not know about this
741 * io_tag.
742 * - io-tag can be reused.
743 */
744enum bfi_ioim_status {
745 BFI_IOIM_STS_OK = 0,
746 BFI_IOIM_STS_HOST_ABORTED = 1,
747 BFI_IOIM_STS_ABORTED = 2,
748 BFI_IOIM_STS_TIMEDOUT = 3,
749 BFI_IOIM_STS_RES_FREE = 4,
750 BFI_IOIM_STS_SQER_NEEDED = 5,
751 BFI_IOIM_STS_PROTO_ERR = 6,
752 BFI_IOIM_STS_UTAG = 7,
753 BFI_IOIM_STS_PATHTOV = 8,
754};
755
756#define BFI_IOIM_SNSLEN (256)
Jing Huangacdc79a2010-10-18 17:15:55 -0700757/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700758 * I/O response message
759 */
760struct bfi_ioim_rsp_s {
761 struct bfi_mhdr_s mh; /* common msg header */
Maggie50444a32010-11-29 18:26:32 -0800762 __be16 io_tag; /* completed IO tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700763 u16 bfa_rport_hndl; /* releated rport handle */
764 u8 io_status; /* IO completion status */
765 u8 reuse_io_tag; /* IO tag can be reused */
766 u16 abort_tag; /* host abort request tag */
767 u8 scsi_status; /* scsi status from target */
768 u8 sns_len; /* scsi sense length */
769 u8 resid_flags; /* IO residue flags */
770 u8 rsvd_a;
Maggie50444a32010-11-29 18:26:32 -0800771 __be32 residue; /* IO residual length in bytes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700772 u32 rsvd_b[3];
773};
774
775struct bfi_ioim_abort_req_s {
776 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800777 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700778 u16 abort_tag; /* unique request tag */
779};
780
781/*
782 * Initiator mode task management command interface defines.
783 */
784
785enum bfi_tskim_h2i {
786 BFI_TSKIM_H2I_TM_REQ = 1, /* task-mgmt command */
787 BFI_TSKIM_H2I_ABORT_REQ = 2, /* task-mgmt command */
788};
789
790enum bfi_tskim_i2h {
791 BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
792};
793
794struct bfi_tskim_req_s {
795 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800796 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700797 u16 itn_fhdl; /* itn firmware handle */
Maggie Zhangf3148782010-12-09 19:11:39 -0800798 struct scsi_lun lun; /* LU number */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700799 u8 tm_flags; /* see enum fcp_tm_cmnd */
800 u8 t_secs; /* Timeout value in seconds */
801 u8 rsvd[2];
802};
803
804struct bfi_tskim_abortreq_s {
805 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800806 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700807 u16 rsvd;
808};
809
810enum bfi_tskim_status {
811 /*
812 * Following are FCP-4 spec defined status codes,
813 * **DO NOT CHANGE THEM **
814 */
815 BFI_TSKIM_STS_OK = 0,
816 BFI_TSKIM_STS_NOT_SUPP = 4,
817 BFI_TSKIM_STS_FAILED = 5,
818
Jing Huangacdc79a2010-10-18 17:15:55 -0700819 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700820 * Defined by BFA
821 */
822 BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */
823 BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */
824};
825
826struct bfi_tskim_rsp_s {
827 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800828 __be16 tsk_tag; /* task mgmt cmnd tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700829 u8 tsk_status; /* @ref bfi_tskim_status */
830 u8 rsvd;
831};
832
833#pragma pack()
834
Krishna Gudipati11189202011-06-13 15:50:35 -0700835/*
836 * Crossbow PCI MSI-X vector defines
837 */
838enum {
839 BFI_MSIX_CPE_QMIN_CB = 0,
840 BFI_MSIX_CPE_QMAX_CB = 7,
841 BFI_MSIX_RME_QMIN_CB = 8,
842 BFI_MSIX_RME_QMAX_CB = 15,
843 BFI_MSIX_CB_MAX = 22,
844};
845
846/*
847 * Catapult FC PCI MSI-X vector defines
848 */
849enum {
850 BFI_MSIX_LPU_ERR_CT = 0,
851 BFI_MSIX_CPE_QMIN_CT = 1,
852 BFI_MSIX_CPE_QMAX_CT = 4,
853 BFI_MSIX_RME_QMIN_CT = 5,
854 BFI_MSIX_RME_QMAX_CT = 8,
855 BFI_MSIX_CT_MAX = 9,
856};
857
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700858#endif /* __BFI_MS_H__ */