blob: d4220e13cafa09a4d8e90193e75514f691f596be [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 Gudipatidb9d8a72012-03-13 17:39:36 -070031 BFI_IOCFC_H2I_FAA_QUERY_REQ = 4,
32 BFI_IOCFC_H2I_ADDR_REQ = 5,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070033};
34
35enum bfi_iocfc_i2h_msgs {
36 BFI_IOCFC_I2H_CFG_REPLY = BFA_I2HM(1),
37 BFI_IOCFC_I2H_UPDATEQ_RSP = BFA_I2HM(3),
Krishna Gudipatidb9d8a72012-03-13 17:39:36 -070038 BFI_IOCFC_I2H_FAA_QUERY_RSP = BFA_I2HM(4),
39 BFI_IOCFC_I2H_ADDR_MSG = BFA_I2HM(5),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070040};
41
42struct bfi_iocfc_cfg_s {
43 u8 num_cqs; /* Number of CQs to be used */
44 u8 sense_buf_len; /* SCSI sense length */
45 u16 rsvd_1;
46 u32 endian_sig; /* endian signature of host */
Krishna Gudipati45070252011-06-24 20:24:29 -070047 u8 rsvd_2;
48 u8 single_msix_vec;
49 u8 rsvd[2];
Krishna Gudipatie2187d72011-06-13 15:53:58 -070050 __be16 num_ioim_reqs;
51 __be16 num_fwtio_reqs;
Krishna Gudipati45070252011-06-24 20:24:29 -070052
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 */
Krishna Gudipati45070252011-06-24 20:24:29 -070067 union bfi_addr_u ioim_snsbase[BFI_IOIM_SNSBUF_SEGS];
68 /* IO sense buf base addr segments */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070069 struct bfa_iocfc_intr_attr_s intr_attr; /* IOC interrupt attributes */
70};
71
Jing Huangacdc79a2010-10-18 17:15:55 -070072/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070073 * Boot target wwn information for this port. This contains either the stored
74 * or discovered boot target port wwns for the port.
75 */
76struct bfi_iocfc_bootwwns {
77 wwn_t wwn[BFA_BOOT_BOOTLUN_MAX];
78 u8 nwwns;
79 u8 rsvd[7];
80};
81
Krishna Gudipati11189202011-06-13 15:50:35 -070082/**
83 * Queue configuration response from firmware
84 */
85struct bfi_iocfc_qreg_s {
86 u32 cpe_q_ci_off[BFI_IOC_MAX_CQS];
87 u32 cpe_q_pi_off[BFI_IOC_MAX_CQS];
88 u32 cpe_qctl_off[BFI_IOC_MAX_CQS];
89 u32 rme_q_ci_off[BFI_IOC_MAX_CQS];
90 u32 rme_q_pi_off[BFI_IOC_MAX_CQS];
91 u32 rme_qctl_off[BFI_IOC_MAX_CQS];
Krishna Gudipati3fd45982011-06-24 20:24:08 -070092 u8 hw_qid[BFI_IOC_MAX_CQS];
Krishna Gudipati11189202011-06-13 15:50:35 -070093};
94
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070095struct bfi_iocfc_cfgrsp_s {
96 struct bfa_iocfc_fwcfg_s fwcfg;
97 struct bfa_iocfc_intr_attr_s intr_attr;
98 struct bfi_iocfc_bootwwns bootwwns;
99 struct bfi_pbc_s pbc_cfg;
Krishna Gudipati11189202011-06-13 15:50:35 -0700100 struct bfi_iocfc_qreg_s qreg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700101};
102
Jing Huangacdc79a2010-10-18 17:15:55 -0700103/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700104 * BFI_IOCFC_H2I_CFG_REQ message
105 */
106struct bfi_iocfc_cfg_req_s {
107 struct bfi_mhdr_s mh;
108 union bfi_addr_u ioc_cfg_dma_addr;
109};
110
111
Jing Huangacdc79a2010-10-18 17:15:55 -0700112/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700113 * BFI_IOCFC_I2H_CFG_REPLY message
114 */
115struct bfi_iocfc_cfg_reply_s {
116 struct bfi_mhdr_s mh; /* Common msg header */
117 u8 cfg_success; /* cfg reply status */
118 u8 lpu_bm; /* LPUs assigned for this IOC */
119 u8 rsvd[2];
120};
121
122
Jing Huangacdc79a2010-10-18 17:15:55 -0700123/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700124 * BFI_IOCFC_H2I_SET_INTR_REQ message
125 */
126struct bfi_iocfc_set_intr_req_s {
127 struct bfi_mhdr_s mh; /* common msg header */
128 u8 coalesce; /* enable intr coalescing */
129 u8 rsvd[3];
Maggie50444a32010-11-29 18:26:32 -0800130 __be16 delay; /* delay timer 0..1125us */
131 __be16 latency; /* latency timer 0..225us */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700132};
133
134
Jing Huangacdc79a2010-10-18 17:15:55 -0700135/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700136 * BFI_IOCFC_H2I_UPDATEQ_REQ message
137 */
138struct bfi_iocfc_updateq_req_s {
139 struct bfi_mhdr_s mh; /* common msg header */
140 u32 reqq_ba; /* reqq base addr */
141 u32 rspq_ba; /* rspq base addr */
142 u32 reqq_sci; /* reqq shadow ci */
143 u32 rspq_spi; /* rspq shadow pi */
144};
145
146
Jing Huangacdc79a2010-10-18 17:15:55 -0700147/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700148 * BFI_IOCFC_I2H_UPDATEQ_RSP message
149 */
150struct bfi_iocfc_updateq_rsp_s {
151 struct bfi_mhdr_s mh; /* common msg header */
152 u8 status; /* updateq status */
153 u8 rsvd[3];
154};
155
156
Jing Huangacdc79a2010-10-18 17:15:55 -0700157/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700158 * H2I Messages
159 */
160union bfi_iocfc_h2i_msg_u {
161 struct bfi_mhdr_s mh;
162 struct bfi_iocfc_cfg_req_s cfg_req;
163 struct bfi_iocfc_updateq_req_s updateq_req;
164 u32 mboxmsg[BFI_IOC_MSGSZ];
165};
166
167
Jing Huangacdc79a2010-10-18 17:15:55 -0700168/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700169 * I2H Messages
170 */
171union bfi_iocfc_i2h_msg_u {
172 struct bfi_mhdr_s mh;
173 struct bfi_iocfc_cfg_reply_s cfg_reply;
174 struct bfi_iocfc_updateq_rsp_s updateq_rsp;
175 u32 mboxmsg[BFI_IOC_MSGSZ];
176};
177
Krishna Gudipatia7141342011-06-24 20:23:19 -0700178/*
179 * BFI_IOCFC_H2I_FAA_ENABLE_REQ BFI_IOCFC_H2I_FAA_DISABLE_REQ message
180 */
181struct bfi_faa_en_dis_s {
182 struct bfi_mhdr_s mh; /* common msg header */
183};
184
Krishna Gudipatidb9d8a72012-03-13 17:39:36 -0700185struct bfi_faa_addr_msg_s {
186 struct bfi_mhdr_s mh; /* common msg header */
187 u8 rsvd[4];
188 wwn_t pwwn; /* Fabric acquired PWWN */
189 wwn_t nwwn; /* Fabric acquired PWWN */
190};
191
Krishna Gudipatia7141342011-06-24 20:23:19 -0700192/*
193 * BFI_IOCFC_H2I_FAA_QUERY_REQ message
194 */
195struct bfi_faa_query_s {
196 struct bfi_mhdr_s mh; /* common msg header */
197 u8 faa_status; /* FAA status */
198 u8 addr_source; /* PWWN source */
199 u8 rsvd[2];
200 wwn_t faa; /* Fabric acquired PWWN */
201};
202
203/*
204 * BFI_IOCFC_I2H_FAA_ENABLE_RSP, BFI_IOCFC_I2H_FAA_DISABLE_RSP message
205 */
206struct bfi_faa_en_dis_rsp_s {
207 struct bfi_mhdr_s mh; /* common msg header */
208 u8 status; /* updateq status */
209 u8 rsvd[3];
210};
211
212/*
213 * BFI_IOCFC_I2H_FAA_QUERY_RSP message
214 */
215#define bfi_faa_query_rsp_t struct bfi_faa_query_s
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700216
217enum bfi_fcport_h2i {
218 BFI_FCPORT_H2I_ENABLE_REQ = (1),
219 BFI_FCPORT_H2I_DISABLE_REQ = (2),
220 BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3),
221 BFI_FCPORT_H2I_STATS_GET_REQ = (4),
222 BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5),
223};
224
225
226enum bfi_fcport_i2h {
227 BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1),
228 BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2),
229 BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3),
230 BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4),
231 BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5),
232 BFI_FCPORT_I2H_EVENT = BFA_I2HM(6),
233 BFI_FCPORT_I2H_TRUNK_SCN = BFA_I2HM(7),
234 BFI_FCPORT_I2H_ENABLE_AEN = BFA_I2HM(8),
235 BFI_FCPORT_I2H_DISABLE_AEN = BFA_I2HM(9),
236};
237
238
Jing Huangacdc79a2010-10-18 17:15:55 -0700239/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700240 * Generic REQ type
241 */
242struct bfi_fcport_req_s {
243 struct bfi_mhdr_s mh; /* msg header */
244 u32 msgtag; /* msgtag for reply */
245};
246
Jing Huangacdc79a2010-10-18 17:15:55 -0700247/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700248 * Generic RSP type
249 */
250struct bfi_fcport_rsp_s {
251 struct bfi_mhdr_s mh; /* common msg header */
252 u8 status; /* port enable status */
253 u8 rsvd[3];
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800254 struct bfa_port_cfg_s port_cfg;/* port configuration */
255 u32 msgtag; /* msgtag for reply */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700256};
257
Jing Huangacdc79a2010-10-18 17:15:55 -0700258/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700259 * BFI_FCPORT_H2I_ENABLE_REQ
260 */
261struct bfi_fcport_enable_req_s {
262 struct bfi_mhdr_s mh; /* msg header */
263 u32 rsvd1;
264 wwn_t nwwn; /* node wwn of physical port */
265 wwn_t pwwn; /* port wwn of physical port */
266 struct bfa_port_cfg_s port_cfg; /* port configuration */
267 union bfi_addr_u stats_dma_addr; /* DMA address for stats */
268 u32 msgtag; /* msgtag for reply */
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800269 u8 use_flash_cfg; /* get prot cfg from flash */
270 u8 rsvd2[3];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700271};
272
Jing Huangacdc79a2010-10-18 17:15:55 -0700273/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700274 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
275 */
276struct bfi_fcport_set_svc_params_req_s {
277 struct bfi_mhdr_s mh; /* msg header */
Maggie50444a32010-11-29 18:26:32 -0800278 __be16 tx_bbcredit; /* Tx credits */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700279 u8 bb_scn; /* BB_SC FC credit recovery */
280 u8 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700281};
282
Jing Huangacdc79a2010-10-18 17:15:55 -0700283/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700284 * BFI_FCPORT_I2H_EVENT
285 */
286struct bfi_fcport_event_s {
287 struct bfi_mhdr_s mh; /* common msg header */
288 struct bfa_port_link_s link_state;
289};
290
Jing Huangacdc79a2010-10-18 17:15:55 -0700291/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700292 * BFI_FCPORT_I2H_TRUNK_SCN
293 */
294struct bfi_fcport_trunk_link_s {
295 wwn_t trunk_wwn;
296 u8 fctl; /* bfa_trunk_link_fctl_t */
297 u8 state; /* bfa_trunk_link_state_t */
298 u8 speed; /* bfa_port_speed_t */
299 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800300 __be32 deskew;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700301};
302
303#define BFI_FCPORT_MAX_LINKS 2
304struct bfi_fcport_trunk_scn_s {
305 struct bfi_mhdr_s mh;
306 u8 trunk_state; /* bfa_trunk_state_t */
307 u8 trunk_speed; /* bfa_port_speed_t */
308 u8 rsvd_a[2];
309 struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
310};
311
Jing Huangacdc79a2010-10-18 17:15:55 -0700312/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700313 * fcport H2I message
314 */
315union bfi_fcport_h2i_msg_u {
316 struct bfi_mhdr_s *mhdr;
317 struct bfi_fcport_enable_req_s *penable;
318 struct bfi_fcport_req_s *pdisable;
319 struct bfi_fcport_set_svc_params_req_s *psetsvcparams;
320 struct bfi_fcport_req_s *pstatsget;
321 struct bfi_fcport_req_s *pstatsclear;
322};
323
Jing Huangacdc79a2010-10-18 17:15:55 -0700324/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700325 * fcport I2H message
326 */
327union bfi_fcport_i2h_msg_u {
328 struct bfi_msg_s *msg;
329 struct bfi_fcport_rsp_s *penable_rsp;
330 struct bfi_fcport_rsp_s *pdisable_rsp;
331 struct bfi_fcport_rsp_s *psetsvcparams_rsp;
332 struct bfi_fcport_rsp_s *pstatsget_rsp;
333 struct bfi_fcport_rsp_s *pstatsclear_rsp;
334 struct bfi_fcport_event_s *event;
335 struct bfi_fcport_trunk_scn_s *trunk_scn;
336};
337
338enum bfi_fcxp_h2i {
339 BFI_FCXP_H2I_SEND_REQ = 1,
340};
341
342enum bfi_fcxp_i2h {
343 BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
344};
345
346#define BFA_FCXP_MAX_SGES 2
347
Jing Huangacdc79a2010-10-18 17:15:55 -0700348/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700349 * FCXP send request structure
350 */
351struct bfi_fcxp_send_req_s {
352 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800353 __be16 fcxp_tag; /* driver request tag */
354 __be16 max_frmsz; /* max send frame size */
355 __be16 vf_id; /* vsan tag if applicable */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700356 u16 rport_fw_hndl; /* FW Handle for the remote port */
357 u8 class; /* FC class used for req/rsp */
358 u8 rsp_timeout; /* timeout in secs, 0-no response */
359 u8 cts; /* continue sequence */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700360 u8 lp_fwtag; /* lport tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700361 struct fchs_s fchs; /* request FC header structure */
Maggie50444a32010-11-29 18:26:32 -0800362 __be32 req_len; /* request payload length */
363 __be32 rsp_maxlen; /* max response length expected */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700364 struct bfi_alen_s req_alen; /* request buffer */
365 struct bfi_alen_s rsp_alen; /* response buffer */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700366};
367
Jing Huangacdc79a2010-10-18 17:15:55 -0700368/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700369 * FCXP send response structure
370 */
371struct bfi_fcxp_send_rsp_s {
372 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800373 __be16 fcxp_tag; /* send request tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700374 u8 req_status; /* request status */
375 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800376 __be32 rsp_len; /* actual response length */
377 __be32 residue_len; /* residual response length */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700378 struct fchs_s fchs; /* response FC header structure */
379};
380
381enum bfi_uf_h2i {
382 BFI_UF_H2I_BUF_POST = 1,
383};
384
385enum bfi_uf_i2h {
386 BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
387};
388
389#define BFA_UF_MAX_SGES 2
390
391struct bfi_uf_buf_post_s {
392 struct bfi_mhdr_s mh; /* Common msg header */
393 u16 buf_tag; /* buffer tag */
Maggie50444a32010-11-29 18:26:32 -0800394 __be16 buf_len; /* total buffer length */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700395 struct bfi_alen_s alen; /* buffer address/len pair */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700396};
397
398struct bfi_uf_frm_rcvd_s {
399 struct bfi_mhdr_s mh; /* Common msg header */
400 u16 buf_tag; /* buffer tag */
401 u16 rsvd;
402 u16 frm_len; /* received frame length */
403 u16 xfr_len; /* tranferred length */
404};
405
406enum bfi_lps_h2i_msgs {
407 BFI_LPS_H2I_LOGIN_REQ = 1,
408 BFI_LPS_H2I_LOGOUT_REQ = 2,
Krishna Gudipatib7044952010-12-13 16:17:42 -0800409 BFI_LPS_H2I_N2N_PID_REQ = 3,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700410};
411
412enum bfi_lps_i2h_msgs {
Krishna Gudipati43ffdf42011-06-13 15:46:21 -0700413 BFI_LPS_I2H_LOGIN_RSP = BFA_I2HM(1),
414 BFI_LPS_I2H_LOGOUT_RSP = BFA_I2HM(2),
415 BFI_LPS_I2H_CVL_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700416};
417
418struct bfi_lps_login_req_s {
419 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700420 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700421 u8 alpa;
Maggie50444a32010-11-29 18:26:32 -0800422 __be16 pdu_size;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700423 wwn_t pwwn;
424 wwn_t nwwn;
425 u8 fdisc;
426 u8 auth_en;
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700427 u8 lps_role;
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700428 u8 bb_scn;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700429};
430
431struct bfi_lps_login_rsp_s {
432 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700433 u8 fw_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700434 u8 status;
435 u8 lsrjt_rsn;
436 u8 lsrjt_expl;
437 wwn_t port_name;
438 wwn_t node_name;
Maggie50444a32010-11-29 18:26:32 -0800439 __be16 bb_credit;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700440 u8 f_port;
441 u8 npiv_en;
442 u32 lp_pid:24;
443 u32 auth_req:8;
444 mac_t lp_mac;
445 mac_t fcf_mac;
446 u8 ext_status;
447 u8 brcd_switch; /* attached peer is brcd switch */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700448 u8 bb_scn; /* atatched port's bb_scn */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700449 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700450};
451
452struct bfi_lps_logout_req_s {
453 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700454 u8 fw_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700455 u8 rsvd[3];
456 wwn_t port_name;
457};
458
459struct bfi_lps_logout_rsp_s {
460 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700461 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700462 u8 status;
463 u8 rsvd[2];
464};
465
466struct bfi_lps_cvl_event_s {
467 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700468 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700469 u8 rsvd[3];
470};
471
Krishna Gudipatib7044952010-12-13 16:17:42 -0800472struct bfi_lps_n2n_pid_req_s {
473 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700474 u8 fw_tag;
Krishna Gudipatib7044952010-12-13 16:17:42 -0800475 u32 lp_pid:24;
476};
477
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700478union bfi_lps_h2i_msg_u {
479 struct bfi_mhdr_s *msg;
480 struct bfi_lps_login_req_s *login_req;
481 struct bfi_lps_logout_req_s *logout_req;
Krishna Gudipatib7044952010-12-13 16:17:42 -0800482 struct bfi_lps_n2n_pid_req_s *n2n_pid_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700483};
484
485union bfi_lps_i2h_msg_u {
486 struct bfi_msg_s *msg;
487 struct bfi_lps_login_rsp_s *login_rsp;
488 struct bfi_lps_logout_rsp_s *logout_rsp;
489 struct bfi_lps_cvl_event_s *cvl_event;
490};
491
492enum bfi_rport_h2i_msgs {
493 BFI_RPORT_H2I_CREATE_REQ = 1,
494 BFI_RPORT_H2I_DELETE_REQ = 2,
495 BFI_RPORT_H2I_SET_SPEED_REQ = 3,
496};
497
498enum bfi_rport_i2h_msgs {
499 BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
500 BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
501 BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3),
502};
503
504struct bfi_rport_create_req_s {
505 struct bfi_mhdr_s mh; /* common msg header */
506 u16 bfa_handle; /* host rport handle */
Maggie50444a32010-11-29 18:26:32 -0800507 __be16 max_frmsz; /* max rcv pdu size */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700508 u32 pid:24, /* remote port ID */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700509 lp_fwtag:8; /* local port tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700510 u32 local_pid:24, /* local port ID */
511 cisc:8;
512 u8 fc_class; /* supported FC classes */
513 u8 vf_en; /* virtual fabric enable */
514 u16 vf_id; /* virtual fabric ID */
515};
516
517struct bfi_rport_create_rsp_s {
518 struct bfi_mhdr_s mh; /* common msg header */
519 u8 status; /* rport creation status */
520 u8 rsvd[3];
521 u16 bfa_handle; /* host rport handle */
522 u16 fw_handle; /* firmware rport handle */
523 struct bfa_rport_qos_attr_s qos_attr; /* QoS Attributes */
524};
525
526struct bfa_rport_speed_req_s {
527 struct bfi_mhdr_s mh; /* common msg header */
528 u16 fw_handle; /* firmware rport handle */
529 u8 speed; /* rport's speed via RPSC */
530 u8 rsvd;
531};
532
533struct bfi_rport_delete_req_s {
534 struct bfi_mhdr_s mh; /* common msg header */
535 u16 fw_handle; /* firmware rport handle */
536 u16 rsvd;
537};
538
539struct bfi_rport_delete_rsp_s {
540 struct bfi_mhdr_s mh; /* common msg header */
541 u16 bfa_handle; /* host rport handle */
542 u8 status; /* rport deletion status */
543 u8 rsvd;
544};
545
546struct bfi_rport_qos_scn_s {
547 struct bfi_mhdr_s mh; /* common msg header */
548 u16 bfa_handle; /* host rport handle */
549 u16 rsvd;
550 struct bfa_rport_qos_attr_s old_qos_attr; /* Old QoS Attributes */
551 struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */
552};
553
554union bfi_rport_h2i_msg_u {
555 struct bfi_msg_s *msg;
556 struct bfi_rport_create_req_s *create_req;
557 struct bfi_rport_delete_req_s *delete_req;
558 struct bfi_rport_speed_req_s *speed_req;
559};
560
561union bfi_rport_i2h_msg_u {
562 struct bfi_msg_s *msg;
563 struct bfi_rport_create_rsp_s *create_rsp;
564 struct bfi_rport_delete_rsp_s *delete_rsp;
565 struct bfi_rport_qos_scn_s *qos_scn_evt;
566};
567
568/*
569 * Initiator mode I-T nexus interface defines.
570 */
571
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700572enum bfi_itn_h2i {
573 BFI_ITN_H2I_CREATE_REQ = 1, /* i-t nexus creation */
574 BFI_ITN_H2I_DELETE_REQ = 2, /* i-t nexus deletion */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700575};
576
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700577enum bfi_itn_i2h {
578 BFI_ITN_I2H_CREATE_RSP = BFA_I2HM(1),
579 BFI_ITN_I2H_DELETE_RSP = BFA_I2HM(2),
580 BFI_ITN_I2H_SLER_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700581};
582
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700583struct bfi_itn_create_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700584 struct bfi_mhdr_s mh; /* common msg header */
585 u16 fw_handle; /* f/w handle for itnim */
586 u8 class; /* FC class for IO */
587 u8 seq_rec; /* sequence recovery support */
588 u8 msg_no; /* seq id of the msg */
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700589 u8 role;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700590};
591
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700592struct bfi_itn_create_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700593 struct bfi_mhdr_s mh; /* common msg header */
594 u16 bfa_handle; /* bfa handle for itnim */
595 u8 status; /* fcp request status */
596 u8 seq_id; /* seq id of the msg */
597};
598
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700599struct bfi_itn_delete_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700600 struct bfi_mhdr_s mh; /* common msg header */
601 u16 fw_handle; /* f/w itnim handle */
602 u8 seq_id; /* seq id of the msg */
603 u8 rsvd;
604};
605
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700606struct bfi_itn_delete_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700607 struct bfi_mhdr_s mh; /* common msg header */
608 u16 bfa_handle; /* bfa handle for itnim */
609 u8 status; /* fcp request status */
610 u8 seq_id; /* seq id of the msg */
611};
612
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700613struct bfi_itn_sler_event_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700614 struct bfi_mhdr_s mh; /* common msg header */
615 u16 bfa_handle; /* bfa handle for itnim */
616 u16 rsvd;
617};
618
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700619union bfi_itn_h2i_msg_u {
620 struct bfi_itn_create_req_s *create_req;
621 struct bfi_itn_delete_req_s *delete_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700622 struct bfi_msg_s *msg;
623};
624
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700625union bfi_itn_i2h_msg_u {
626 struct bfi_itn_create_rsp_s *create_rsp;
627 struct bfi_itn_delete_rsp_s *delete_rsp;
628 struct bfi_itn_sler_event_s *sler_event;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700629 struct bfi_msg_s *msg;
630};
631
632/*
633 * Initiator mode IO interface defines.
634 */
635
636enum bfi_ioim_h2i {
637 BFI_IOIM_H2I_IOABORT_REQ = 1, /* IO abort request */
638 BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /* IO cleanup request */
639};
640
641enum bfi_ioim_i2h {
642 BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1), /* non-fp IO response */
643 BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /* ABORT rsp */
644};
645
Jing Huangacdc79a2010-10-18 17:15:55 -0700646/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700647 * IO command DIF info
648 */
649struct bfi_ioim_dif_s {
650 u32 dif_info[4];
651};
652
Jing Huangacdc79a2010-10-18 17:15:55 -0700653/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700654 * FCP IO messages overview
655 *
656 * @note
657 * - Max CDB length supported is 64 bytes.
658 * - SCSI Linked commands and SCSI bi-directional Commands not
659 * supported.
660 *
661 */
662struct bfi_ioim_req_s {
663 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800664 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700665 u16 rport_hdl; /* itnim/rport firmware handle */
666 struct fcp_cmnd_s cmnd; /* IO request info */
667
Jing Huangacdc79a2010-10-18 17:15:55 -0700668 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700669 * SG elements array within the IO request must be double word
670 * aligned. This aligment is required to optimize SGM setup for the IO.
671 */
672 struct bfi_sge_s sges[BFI_SGE_INLINE_MAX];
673 u8 io_timeout;
674 u8 dif_en;
675 u8 rsvd_a[2];
676 struct bfi_ioim_dif_s dif;
677};
678
Jing Huangacdc79a2010-10-18 17:15:55 -0700679/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700680 * This table shows various IO status codes from firmware and their
681 * meaning. Host driver can use these status codes to further process
682 * IO completions.
683 *
684 * BFI_IOIM_STS_OK : IO completed with error free SCSI &
685 * transport status.
686 * io-tag can be reused.
687 *
688 * BFA_IOIM_STS_SCSI_ERR : IO completed with scsi error.
689 * - io-tag can be reused.
690 *
691 * BFI_IOIM_STS_HOST_ABORTED : IO was aborted successfully due to
692 * host request.
693 * - io-tag cannot be reused yet.
694 *
695 * BFI_IOIM_STS_ABORTED : IO was aborted successfully
696 * internally by f/w.
697 * - io-tag cannot be reused yet.
698 *
699 * BFI_IOIM_STS_TIMEDOUT : IO timedout and ABTS/RRQ is happening
700 * in the firmware and
701 * - io-tag cannot be reused yet.
702 *
703 * BFI_IOIM_STS_SQER_NEEDED : Firmware could not recover the IO
704 * with sequence level error
705 * logic and hence host needs to retry
706 * this IO with a different IO tag
707 * - io-tag cannot be used yet.
708 *
709 * BFI_IOIM_STS_NEXUS_ABORT : Second Level Error Recovery from host
710 * is required because 2 consecutive ABTS
711 * timedout and host needs logout and
712 * re-login with the target
713 * - io-tag cannot be used yet.
714 *
715 * BFI_IOIM_STS_UNDERRUN : IO completed with SCSI status good,
716 * but the data tranferred is less than
717 * the fcp data length in the command.
718 * ex. SCSI INQUIRY where transferred
719 * data length and residue count in FCP
720 * response accounts for total fcp-dl
721 * - io-tag can be reused.
722 *
723 * BFI_IOIM_STS_OVERRUN : IO completed with SCSI status good,
724 * but the data transerred is more than
725 * fcp data length in the command. ex.
726 * TAPE IOs where blocks can of unequal
727 * lengths.
728 * - io-tag can be reused.
729 *
730 * BFI_IOIM_STS_RES_FREE : Firmware has completed using io-tag
731 * during abort process
732 * - io-tag can be reused.
733 *
734 * BFI_IOIM_STS_PROTO_ERR : Firmware detected a protocol error.
735 * ex target sent more data than
736 * requested, or there was data frame
737 * loss and other reasons
738 * - io-tag cannot be used yet.
739 *
740 * BFI_IOIM_STS_DIF_ERR : Firwmare detected DIF error. ex: DIF
741 * CRC err or Ref Tag err or App tag err.
742 * - io-tag can be reused.
743 *
744 * BFA_IOIM_STS_TSK_MGT_ABORT : IO was aborted because of Task
745 * Management command from the host
746 * - io-tag can be reused.
747 *
748 * BFI_IOIM_STS_UTAG : Firmware does not know about this
749 * io_tag.
750 * - io-tag can be reused.
751 */
752enum bfi_ioim_status {
753 BFI_IOIM_STS_OK = 0,
754 BFI_IOIM_STS_HOST_ABORTED = 1,
755 BFI_IOIM_STS_ABORTED = 2,
756 BFI_IOIM_STS_TIMEDOUT = 3,
757 BFI_IOIM_STS_RES_FREE = 4,
758 BFI_IOIM_STS_SQER_NEEDED = 5,
759 BFI_IOIM_STS_PROTO_ERR = 6,
760 BFI_IOIM_STS_UTAG = 7,
761 BFI_IOIM_STS_PATHTOV = 8,
762};
763
Jing Huangacdc79a2010-10-18 17:15:55 -0700764/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700765 * I/O response message
766 */
767struct bfi_ioim_rsp_s {
768 struct bfi_mhdr_s mh; /* common msg header */
Maggie50444a32010-11-29 18:26:32 -0800769 __be16 io_tag; /* completed IO tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700770 u16 bfa_rport_hndl; /* releated rport handle */
771 u8 io_status; /* IO completion status */
772 u8 reuse_io_tag; /* IO tag can be reused */
773 u16 abort_tag; /* host abort request tag */
774 u8 scsi_status; /* scsi status from target */
775 u8 sns_len; /* scsi sense length */
776 u8 resid_flags; /* IO residue flags */
777 u8 rsvd_a;
Maggie50444a32010-11-29 18:26:32 -0800778 __be32 residue; /* IO residual length in bytes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700779 u32 rsvd_b[3];
780};
781
782struct bfi_ioim_abort_req_s {
783 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800784 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700785 u16 abort_tag; /* unique request tag */
786};
787
788/*
789 * Initiator mode task management command interface defines.
790 */
791
792enum bfi_tskim_h2i {
793 BFI_TSKIM_H2I_TM_REQ = 1, /* task-mgmt command */
794 BFI_TSKIM_H2I_ABORT_REQ = 2, /* task-mgmt command */
795};
796
797enum bfi_tskim_i2h {
798 BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
799};
800
801struct bfi_tskim_req_s {
802 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800803 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700804 u16 itn_fhdl; /* itn firmware handle */
Maggie Zhangf3148782010-12-09 19:11:39 -0800805 struct scsi_lun lun; /* LU number */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700806 u8 tm_flags; /* see enum fcp_tm_cmnd */
807 u8 t_secs; /* Timeout value in seconds */
808 u8 rsvd[2];
809};
810
811struct bfi_tskim_abortreq_s {
812 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800813 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700814 u16 rsvd;
815};
816
817enum bfi_tskim_status {
818 /*
819 * Following are FCP-4 spec defined status codes,
820 * **DO NOT CHANGE THEM **
821 */
822 BFI_TSKIM_STS_OK = 0,
823 BFI_TSKIM_STS_NOT_SUPP = 4,
824 BFI_TSKIM_STS_FAILED = 5,
825
Jing Huangacdc79a2010-10-18 17:15:55 -0700826 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700827 * Defined by BFA
828 */
829 BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */
830 BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */
831};
832
833struct bfi_tskim_rsp_s {
834 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800835 __be16 tsk_tag; /* task mgmt cmnd tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700836 u8 tsk_status; /* @ref bfi_tskim_status */
837 u8 rsvd;
838};
839
840#pragma pack()
841
Krishna Gudipati11189202011-06-13 15:50:35 -0700842/*
843 * Crossbow PCI MSI-X vector defines
844 */
845enum {
846 BFI_MSIX_CPE_QMIN_CB = 0,
847 BFI_MSIX_CPE_QMAX_CB = 7,
848 BFI_MSIX_RME_QMIN_CB = 8,
849 BFI_MSIX_RME_QMAX_CB = 15,
850 BFI_MSIX_CB_MAX = 22,
851};
852
853/*
854 * Catapult FC PCI MSI-X vector defines
855 */
856enum {
857 BFI_MSIX_LPU_ERR_CT = 0,
858 BFI_MSIX_CPE_QMIN_CT = 1,
859 BFI_MSIX_CPE_QMAX_CT = 4,
860 BFI_MSIX_RME_QMIN_CT = 5,
861 BFI_MSIX_RME_QMAX_CT = 8,
862 BFI_MSIX_CT_MAX = 9,
863};
864
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700865#endif /* __BFI_MS_H__ */