blob: 0d9f1fb50db0c0ae74ea3e5e7a529b0594f436a9 [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 Gudipati45070252011-06-24 20:24:29 -070049 u8 rsvd_2;
50 u8 single_msix_vec;
51 u8 rsvd[2];
Krishna Gudipatie2187d72011-06-13 15:53:58 -070052 __be16 num_ioim_reqs;
53 __be16 num_fwtio_reqs;
Krishna Gudipati45070252011-06-24 20:24:29 -070054
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070055
Jing Huangacdc79a2010-10-18 17:15:55 -070056 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070057 * Request and response circular queue base addresses, size and
58 * shadow index pointers.
59 */
60 union bfi_addr_u req_cq_ba[BFI_IOC_MAX_CQS];
61 union bfi_addr_u req_shadow_ci[BFI_IOC_MAX_CQS];
Maggie50444a32010-11-29 18:26:32 -080062 __be16 req_cq_elems[BFI_IOC_MAX_CQS];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070063 union bfi_addr_u rsp_cq_ba[BFI_IOC_MAX_CQS];
64 union bfi_addr_u rsp_shadow_pi[BFI_IOC_MAX_CQS];
Maggie50444a32010-11-29 18:26:32 -080065 __be16 rsp_cq_elems[BFI_IOC_MAX_CQS];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070066
67 union bfi_addr_u stats_addr; /* DMA-able address for stats */
68 union bfi_addr_u cfgrsp_addr; /* config response dma address */
Krishna Gudipati45070252011-06-24 20:24:29 -070069 union bfi_addr_u ioim_snsbase[BFI_IOIM_SNSBUF_SEGS];
70 /* IO sense buf base addr segments */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070071 struct bfa_iocfc_intr_attr_s intr_attr; /* IOC interrupt attributes */
72};
73
Jing Huangacdc79a2010-10-18 17:15:55 -070074/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070075 * Boot target wwn information for this port. This contains either the stored
76 * or discovered boot target port wwns for the port.
77 */
78struct bfi_iocfc_bootwwns {
79 wwn_t wwn[BFA_BOOT_BOOTLUN_MAX];
80 u8 nwwns;
81 u8 rsvd[7];
82};
83
Krishna Gudipati11189202011-06-13 15:50:35 -070084/**
85 * Queue configuration response from firmware
86 */
87struct bfi_iocfc_qreg_s {
88 u32 cpe_q_ci_off[BFI_IOC_MAX_CQS];
89 u32 cpe_q_pi_off[BFI_IOC_MAX_CQS];
90 u32 cpe_qctl_off[BFI_IOC_MAX_CQS];
91 u32 rme_q_ci_off[BFI_IOC_MAX_CQS];
92 u32 rme_q_pi_off[BFI_IOC_MAX_CQS];
93 u32 rme_qctl_off[BFI_IOC_MAX_CQS];
Krishna Gudipati3fd45982011-06-24 20:24:08 -070094 u8 hw_qid[BFI_IOC_MAX_CQS];
Krishna Gudipati11189202011-06-13 15:50:35 -070095};
96
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070097struct bfi_iocfc_cfgrsp_s {
98 struct bfa_iocfc_fwcfg_s fwcfg;
99 struct bfa_iocfc_intr_attr_s intr_attr;
100 struct bfi_iocfc_bootwwns bootwwns;
101 struct bfi_pbc_s pbc_cfg;
Krishna Gudipati11189202011-06-13 15:50:35 -0700102 struct bfi_iocfc_qreg_s qreg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700103};
104
Jing Huangacdc79a2010-10-18 17:15:55 -0700105/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700106 * BFI_IOCFC_H2I_CFG_REQ message
107 */
108struct bfi_iocfc_cfg_req_s {
109 struct bfi_mhdr_s mh;
110 union bfi_addr_u ioc_cfg_dma_addr;
111};
112
113
Jing Huangacdc79a2010-10-18 17:15:55 -0700114/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700115 * BFI_IOCFC_I2H_CFG_REPLY message
116 */
117struct bfi_iocfc_cfg_reply_s {
118 struct bfi_mhdr_s mh; /* Common msg header */
119 u8 cfg_success; /* cfg reply status */
120 u8 lpu_bm; /* LPUs assigned for this IOC */
121 u8 rsvd[2];
122};
123
124
Jing Huangacdc79a2010-10-18 17:15:55 -0700125/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700126 * BFI_IOCFC_H2I_SET_INTR_REQ message
127 */
128struct bfi_iocfc_set_intr_req_s {
129 struct bfi_mhdr_s mh; /* common msg header */
130 u8 coalesce; /* enable intr coalescing */
131 u8 rsvd[3];
Maggie50444a32010-11-29 18:26:32 -0800132 __be16 delay; /* delay timer 0..1125us */
133 __be16 latency; /* latency timer 0..225us */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700134};
135
136
Jing Huangacdc79a2010-10-18 17:15:55 -0700137/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700138 * BFI_IOCFC_H2I_UPDATEQ_REQ message
139 */
140struct bfi_iocfc_updateq_req_s {
141 struct bfi_mhdr_s mh; /* common msg header */
142 u32 reqq_ba; /* reqq base addr */
143 u32 rspq_ba; /* rspq base addr */
144 u32 reqq_sci; /* reqq shadow ci */
145 u32 rspq_spi; /* rspq shadow pi */
146};
147
148
Jing Huangacdc79a2010-10-18 17:15:55 -0700149/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700150 * BFI_IOCFC_I2H_UPDATEQ_RSP message
151 */
152struct bfi_iocfc_updateq_rsp_s {
153 struct bfi_mhdr_s mh; /* common msg header */
154 u8 status; /* updateq status */
155 u8 rsvd[3];
156};
157
158
Jing Huangacdc79a2010-10-18 17:15:55 -0700159/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700160 * H2I Messages
161 */
162union bfi_iocfc_h2i_msg_u {
163 struct bfi_mhdr_s mh;
164 struct bfi_iocfc_cfg_req_s cfg_req;
165 struct bfi_iocfc_updateq_req_s updateq_req;
166 u32 mboxmsg[BFI_IOC_MSGSZ];
167};
168
169
Jing Huangacdc79a2010-10-18 17:15:55 -0700170/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700171 * I2H Messages
172 */
173union bfi_iocfc_i2h_msg_u {
174 struct bfi_mhdr_s mh;
175 struct bfi_iocfc_cfg_reply_s cfg_reply;
176 struct bfi_iocfc_updateq_rsp_s updateq_rsp;
177 u32 mboxmsg[BFI_IOC_MSGSZ];
178};
179
Krishna Gudipatia7141342011-06-24 20:23:19 -0700180/*
181 * BFI_IOCFC_H2I_FAA_ENABLE_REQ BFI_IOCFC_H2I_FAA_DISABLE_REQ message
182 */
183struct bfi_faa_en_dis_s {
184 struct bfi_mhdr_s mh; /* common msg header */
185};
186
187/*
188 * BFI_IOCFC_H2I_FAA_QUERY_REQ message
189 */
190struct bfi_faa_query_s {
191 struct bfi_mhdr_s mh; /* common msg header */
192 u8 faa_status; /* FAA status */
193 u8 addr_source; /* PWWN source */
194 u8 rsvd[2];
195 wwn_t faa; /* Fabric acquired PWWN */
196};
197
198/*
199 * BFI_IOCFC_I2H_FAA_ENABLE_RSP, BFI_IOCFC_I2H_FAA_DISABLE_RSP message
200 */
201struct bfi_faa_en_dis_rsp_s {
202 struct bfi_mhdr_s mh; /* common msg header */
203 u8 status; /* updateq status */
204 u8 rsvd[3];
205};
206
207/*
208 * BFI_IOCFC_I2H_FAA_QUERY_RSP message
209 */
210#define bfi_faa_query_rsp_t struct bfi_faa_query_s
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700211
212enum bfi_fcport_h2i {
213 BFI_FCPORT_H2I_ENABLE_REQ = (1),
214 BFI_FCPORT_H2I_DISABLE_REQ = (2),
215 BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3),
216 BFI_FCPORT_H2I_STATS_GET_REQ = (4),
217 BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5),
218};
219
220
221enum bfi_fcport_i2h {
222 BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1),
223 BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2),
224 BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3),
225 BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4),
226 BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5),
227 BFI_FCPORT_I2H_EVENT = BFA_I2HM(6),
228 BFI_FCPORT_I2H_TRUNK_SCN = BFA_I2HM(7),
229 BFI_FCPORT_I2H_ENABLE_AEN = BFA_I2HM(8),
230 BFI_FCPORT_I2H_DISABLE_AEN = BFA_I2HM(9),
231};
232
233
Jing Huangacdc79a2010-10-18 17:15:55 -0700234/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700235 * Generic REQ type
236 */
237struct bfi_fcport_req_s {
238 struct bfi_mhdr_s mh; /* msg header */
239 u32 msgtag; /* msgtag for reply */
240};
241
Jing Huangacdc79a2010-10-18 17:15:55 -0700242/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700243 * Generic RSP type
244 */
245struct bfi_fcport_rsp_s {
246 struct bfi_mhdr_s mh; /* common msg header */
247 u8 status; /* port enable status */
248 u8 rsvd[3];
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800249 struct bfa_port_cfg_s port_cfg;/* port configuration */
250 u32 msgtag; /* msgtag for reply */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700251};
252
Jing Huangacdc79a2010-10-18 17:15:55 -0700253/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700254 * BFI_FCPORT_H2I_ENABLE_REQ
255 */
256struct bfi_fcport_enable_req_s {
257 struct bfi_mhdr_s mh; /* msg header */
258 u32 rsvd1;
259 wwn_t nwwn; /* node wwn of physical port */
260 wwn_t pwwn; /* port wwn of physical port */
261 struct bfa_port_cfg_s port_cfg; /* port configuration */
262 union bfi_addr_u stats_dma_addr; /* DMA address for stats */
263 u32 msgtag; /* msgtag for reply */
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800264 u8 use_flash_cfg; /* get prot cfg from flash */
265 u8 rsvd2[3];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700266};
267
Jing Huangacdc79a2010-10-18 17:15:55 -0700268/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700269 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
270 */
271struct bfi_fcport_set_svc_params_req_s {
272 struct bfi_mhdr_s mh; /* msg header */
Maggie50444a32010-11-29 18:26:32 -0800273 __be16 tx_bbcredit; /* Tx credits */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700274 u8 bb_scn; /* BB_SC FC credit recovery */
275 u8 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700276};
277
Jing Huangacdc79a2010-10-18 17:15:55 -0700278/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700279 * BFI_FCPORT_I2H_EVENT
280 */
281struct bfi_fcport_event_s {
282 struct bfi_mhdr_s mh; /* common msg header */
283 struct bfa_port_link_s link_state;
284};
285
Jing Huangacdc79a2010-10-18 17:15:55 -0700286/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700287 * BFI_FCPORT_I2H_TRUNK_SCN
288 */
289struct bfi_fcport_trunk_link_s {
290 wwn_t trunk_wwn;
291 u8 fctl; /* bfa_trunk_link_fctl_t */
292 u8 state; /* bfa_trunk_link_state_t */
293 u8 speed; /* bfa_port_speed_t */
294 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800295 __be32 deskew;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700296};
297
298#define BFI_FCPORT_MAX_LINKS 2
299struct bfi_fcport_trunk_scn_s {
300 struct bfi_mhdr_s mh;
301 u8 trunk_state; /* bfa_trunk_state_t */
302 u8 trunk_speed; /* bfa_port_speed_t */
303 u8 rsvd_a[2];
304 struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
305};
306
Jing Huangacdc79a2010-10-18 17:15:55 -0700307/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700308 * fcport H2I message
309 */
310union bfi_fcport_h2i_msg_u {
311 struct bfi_mhdr_s *mhdr;
312 struct bfi_fcport_enable_req_s *penable;
313 struct bfi_fcport_req_s *pdisable;
314 struct bfi_fcport_set_svc_params_req_s *psetsvcparams;
315 struct bfi_fcport_req_s *pstatsget;
316 struct bfi_fcport_req_s *pstatsclear;
317};
318
Jing Huangacdc79a2010-10-18 17:15:55 -0700319/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700320 * fcport I2H message
321 */
322union bfi_fcport_i2h_msg_u {
323 struct bfi_msg_s *msg;
324 struct bfi_fcport_rsp_s *penable_rsp;
325 struct bfi_fcport_rsp_s *pdisable_rsp;
326 struct bfi_fcport_rsp_s *psetsvcparams_rsp;
327 struct bfi_fcport_rsp_s *pstatsget_rsp;
328 struct bfi_fcport_rsp_s *pstatsclear_rsp;
329 struct bfi_fcport_event_s *event;
330 struct bfi_fcport_trunk_scn_s *trunk_scn;
331};
332
333enum bfi_fcxp_h2i {
334 BFI_FCXP_H2I_SEND_REQ = 1,
335};
336
337enum bfi_fcxp_i2h {
338 BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
339};
340
341#define BFA_FCXP_MAX_SGES 2
342
Jing Huangacdc79a2010-10-18 17:15:55 -0700343/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700344 * FCXP send request structure
345 */
346struct bfi_fcxp_send_req_s {
347 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800348 __be16 fcxp_tag; /* driver request tag */
349 __be16 max_frmsz; /* max send frame size */
350 __be16 vf_id; /* vsan tag if applicable */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700351 u16 rport_fw_hndl; /* FW Handle for the remote port */
352 u8 class; /* FC class used for req/rsp */
353 u8 rsp_timeout; /* timeout in secs, 0-no response */
354 u8 cts; /* continue sequence */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700355 u8 lp_fwtag; /* lport tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700356 struct fchs_s fchs; /* request FC header structure */
Maggie50444a32010-11-29 18:26:32 -0800357 __be32 req_len; /* request payload length */
358 __be32 rsp_maxlen; /* max response length expected */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700359 struct bfi_alen_s req_alen; /* request buffer */
360 struct bfi_alen_s rsp_alen; /* response buffer */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700361};
362
Jing Huangacdc79a2010-10-18 17:15:55 -0700363/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700364 * FCXP send response structure
365 */
366struct bfi_fcxp_send_rsp_s {
367 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800368 __be16 fcxp_tag; /* send request tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700369 u8 req_status; /* request status */
370 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800371 __be32 rsp_len; /* actual response length */
372 __be32 residue_len; /* residual response length */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700373 struct fchs_s fchs; /* response FC header structure */
374};
375
376enum bfi_uf_h2i {
377 BFI_UF_H2I_BUF_POST = 1,
378};
379
380enum bfi_uf_i2h {
381 BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
382};
383
384#define BFA_UF_MAX_SGES 2
385
386struct bfi_uf_buf_post_s {
387 struct bfi_mhdr_s mh; /* Common msg header */
388 u16 buf_tag; /* buffer tag */
Maggie50444a32010-11-29 18:26:32 -0800389 __be16 buf_len; /* total buffer length */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700390 struct bfi_alen_s alen; /* buffer address/len pair */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700391};
392
393struct bfi_uf_frm_rcvd_s {
394 struct bfi_mhdr_s mh; /* Common msg header */
395 u16 buf_tag; /* buffer tag */
396 u16 rsvd;
397 u16 frm_len; /* received frame length */
398 u16 xfr_len; /* tranferred length */
399};
400
401enum bfi_lps_h2i_msgs {
402 BFI_LPS_H2I_LOGIN_REQ = 1,
403 BFI_LPS_H2I_LOGOUT_REQ = 2,
Krishna Gudipatib7044952010-12-13 16:17:42 -0800404 BFI_LPS_H2I_N2N_PID_REQ = 3,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700405};
406
407enum bfi_lps_i2h_msgs {
Krishna Gudipati43ffdf42011-06-13 15:46:21 -0700408 BFI_LPS_I2H_LOGIN_RSP = BFA_I2HM(1),
409 BFI_LPS_I2H_LOGOUT_RSP = BFA_I2HM(2),
410 BFI_LPS_I2H_CVL_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700411};
412
413struct bfi_lps_login_req_s {
414 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700415 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700416 u8 alpa;
Maggie50444a32010-11-29 18:26:32 -0800417 __be16 pdu_size;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700418 wwn_t pwwn;
419 wwn_t nwwn;
420 u8 fdisc;
421 u8 auth_en;
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700422 u8 lps_role;
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700423 u8 bb_scn;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700424};
425
426struct bfi_lps_login_rsp_s {
427 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700428 u8 fw_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700429 u8 status;
430 u8 lsrjt_rsn;
431 u8 lsrjt_expl;
432 wwn_t port_name;
433 wwn_t node_name;
Maggie50444a32010-11-29 18:26:32 -0800434 __be16 bb_credit;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700435 u8 f_port;
436 u8 npiv_en;
437 u32 lp_pid:24;
438 u32 auth_req:8;
439 mac_t lp_mac;
440 mac_t fcf_mac;
441 u8 ext_status;
442 u8 brcd_switch; /* attached peer is brcd switch */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700443 u8 bb_scn; /* atatched port's bb_scn */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700444 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700445};
446
447struct bfi_lps_logout_req_s {
448 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700449 u8 fw_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700450 u8 rsvd[3];
451 wwn_t port_name;
452};
453
454struct bfi_lps_logout_rsp_s {
455 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700456 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700457 u8 status;
458 u8 rsvd[2];
459};
460
461struct bfi_lps_cvl_event_s {
462 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700463 u8 bfa_tag;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700464 u8 rsvd[3];
465};
466
Krishna Gudipatib7044952010-12-13 16:17:42 -0800467struct bfi_lps_n2n_pid_req_s {
468 struct bfi_mhdr_s mh; /* common msg header */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700469 u8 fw_tag;
Krishna Gudipatib7044952010-12-13 16:17:42 -0800470 u32 lp_pid:24;
471};
472
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700473union bfi_lps_h2i_msg_u {
474 struct bfi_mhdr_s *msg;
475 struct bfi_lps_login_req_s *login_req;
476 struct bfi_lps_logout_req_s *logout_req;
Krishna Gudipatib7044952010-12-13 16:17:42 -0800477 struct bfi_lps_n2n_pid_req_s *n2n_pid_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700478};
479
480union bfi_lps_i2h_msg_u {
481 struct bfi_msg_s *msg;
482 struct bfi_lps_login_rsp_s *login_rsp;
483 struct bfi_lps_logout_rsp_s *logout_rsp;
484 struct bfi_lps_cvl_event_s *cvl_event;
485};
486
487enum bfi_rport_h2i_msgs {
488 BFI_RPORT_H2I_CREATE_REQ = 1,
489 BFI_RPORT_H2I_DELETE_REQ = 2,
490 BFI_RPORT_H2I_SET_SPEED_REQ = 3,
491};
492
493enum bfi_rport_i2h_msgs {
494 BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
495 BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
496 BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3),
497};
498
499struct bfi_rport_create_req_s {
500 struct bfi_mhdr_s mh; /* common msg header */
501 u16 bfa_handle; /* host rport handle */
Maggie50444a32010-11-29 18:26:32 -0800502 __be16 max_frmsz; /* max rcv pdu size */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700503 u32 pid:24, /* remote port ID */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700504 lp_fwtag:8; /* local port tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700505 u32 local_pid:24, /* local port ID */
506 cisc:8;
507 u8 fc_class; /* supported FC classes */
508 u8 vf_en; /* virtual fabric enable */
509 u16 vf_id; /* virtual fabric ID */
510};
511
512struct bfi_rport_create_rsp_s {
513 struct bfi_mhdr_s mh; /* common msg header */
514 u8 status; /* rport creation status */
515 u8 rsvd[3];
516 u16 bfa_handle; /* host rport handle */
517 u16 fw_handle; /* firmware rport handle */
518 struct bfa_rport_qos_attr_s qos_attr; /* QoS Attributes */
519};
520
521struct bfa_rport_speed_req_s {
522 struct bfi_mhdr_s mh; /* common msg header */
523 u16 fw_handle; /* firmware rport handle */
524 u8 speed; /* rport's speed via RPSC */
525 u8 rsvd;
526};
527
528struct bfi_rport_delete_req_s {
529 struct bfi_mhdr_s mh; /* common msg header */
530 u16 fw_handle; /* firmware rport handle */
531 u16 rsvd;
532};
533
534struct bfi_rport_delete_rsp_s {
535 struct bfi_mhdr_s mh; /* common msg header */
536 u16 bfa_handle; /* host rport handle */
537 u8 status; /* rport deletion status */
538 u8 rsvd;
539};
540
541struct bfi_rport_qos_scn_s {
542 struct bfi_mhdr_s mh; /* common msg header */
543 u16 bfa_handle; /* host rport handle */
544 u16 rsvd;
545 struct bfa_rport_qos_attr_s old_qos_attr; /* Old QoS Attributes */
546 struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */
547};
548
549union bfi_rport_h2i_msg_u {
550 struct bfi_msg_s *msg;
551 struct bfi_rport_create_req_s *create_req;
552 struct bfi_rport_delete_req_s *delete_req;
553 struct bfi_rport_speed_req_s *speed_req;
554};
555
556union bfi_rport_i2h_msg_u {
557 struct bfi_msg_s *msg;
558 struct bfi_rport_create_rsp_s *create_rsp;
559 struct bfi_rport_delete_rsp_s *delete_rsp;
560 struct bfi_rport_qos_scn_s *qos_scn_evt;
561};
562
563/*
564 * Initiator mode I-T nexus interface defines.
565 */
566
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700567enum bfi_itn_h2i {
568 BFI_ITN_H2I_CREATE_REQ = 1, /* i-t nexus creation */
569 BFI_ITN_H2I_DELETE_REQ = 2, /* i-t nexus deletion */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700570};
571
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700572enum bfi_itn_i2h {
573 BFI_ITN_I2H_CREATE_RSP = BFA_I2HM(1),
574 BFI_ITN_I2H_DELETE_RSP = BFA_I2HM(2),
575 BFI_ITN_I2H_SLER_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700576};
577
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700578struct bfi_itn_create_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700579 struct bfi_mhdr_s mh; /* common msg header */
580 u16 fw_handle; /* f/w handle for itnim */
581 u8 class; /* FC class for IO */
582 u8 seq_rec; /* sequence recovery support */
583 u8 msg_no; /* seq id of the msg */
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700584 u8 role;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700585};
586
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700587struct bfi_itn_create_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700588 struct bfi_mhdr_s mh; /* common msg header */
589 u16 bfa_handle; /* bfa handle for itnim */
590 u8 status; /* fcp request status */
591 u8 seq_id; /* seq id of the msg */
592};
593
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700594struct bfi_itn_delete_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700595 struct bfi_mhdr_s mh; /* common msg header */
596 u16 fw_handle; /* f/w itnim handle */
597 u8 seq_id; /* seq id of the msg */
598 u8 rsvd;
599};
600
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700601struct bfi_itn_delete_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700602 struct bfi_mhdr_s mh; /* common msg header */
603 u16 bfa_handle; /* bfa handle for itnim */
604 u8 status; /* fcp request status */
605 u8 seq_id; /* seq id of the msg */
606};
607
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700608struct bfi_itn_sler_event_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700609 struct bfi_mhdr_s mh; /* common msg header */
610 u16 bfa_handle; /* bfa handle for itnim */
611 u16 rsvd;
612};
613
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700614union bfi_itn_h2i_msg_u {
615 struct bfi_itn_create_req_s *create_req;
616 struct bfi_itn_delete_req_s *delete_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700617 struct bfi_msg_s *msg;
618};
619
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700620union bfi_itn_i2h_msg_u {
621 struct bfi_itn_create_rsp_s *create_rsp;
622 struct bfi_itn_delete_rsp_s *delete_rsp;
623 struct bfi_itn_sler_event_s *sler_event;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700624 struct bfi_msg_s *msg;
625};
626
627/*
628 * Initiator mode IO interface defines.
629 */
630
631enum bfi_ioim_h2i {
632 BFI_IOIM_H2I_IOABORT_REQ = 1, /* IO abort request */
633 BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /* IO cleanup request */
634};
635
636enum bfi_ioim_i2h {
637 BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1), /* non-fp IO response */
638 BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /* ABORT rsp */
639};
640
Jing Huangacdc79a2010-10-18 17:15:55 -0700641/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700642 * IO command DIF info
643 */
644struct bfi_ioim_dif_s {
645 u32 dif_info[4];
646};
647
Jing Huangacdc79a2010-10-18 17:15:55 -0700648/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700649 * FCP IO messages overview
650 *
651 * @note
652 * - Max CDB length supported is 64 bytes.
653 * - SCSI Linked commands and SCSI bi-directional Commands not
654 * supported.
655 *
656 */
657struct bfi_ioim_req_s {
658 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800659 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700660 u16 rport_hdl; /* itnim/rport firmware handle */
661 struct fcp_cmnd_s cmnd; /* IO request info */
662
Jing Huangacdc79a2010-10-18 17:15:55 -0700663 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700664 * SG elements array within the IO request must be double word
665 * aligned. This aligment is required to optimize SGM setup for the IO.
666 */
667 struct bfi_sge_s sges[BFI_SGE_INLINE_MAX];
668 u8 io_timeout;
669 u8 dif_en;
670 u8 rsvd_a[2];
671 struct bfi_ioim_dif_s dif;
672};
673
Jing Huangacdc79a2010-10-18 17:15:55 -0700674/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700675 * This table shows various IO status codes from firmware and their
676 * meaning. Host driver can use these status codes to further process
677 * IO completions.
678 *
679 * BFI_IOIM_STS_OK : IO completed with error free SCSI &
680 * transport status.
681 * io-tag can be reused.
682 *
683 * BFA_IOIM_STS_SCSI_ERR : IO completed with scsi error.
684 * - io-tag can be reused.
685 *
686 * BFI_IOIM_STS_HOST_ABORTED : IO was aborted successfully due to
687 * host request.
688 * - io-tag cannot be reused yet.
689 *
690 * BFI_IOIM_STS_ABORTED : IO was aborted successfully
691 * internally by f/w.
692 * - io-tag cannot be reused yet.
693 *
694 * BFI_IOIM_STS_TIMEDOUT : IO timedout and ABTS/RRQ is happening
695 * in the firmware and
696 * - io-tag cannot be reused yet.
697 *
698 * BFI_IOIM_STS_SQER_NEEDED : Firmware could not recover the IO
699 * with sequence level error
700 * logic and hence host needs to retry
701 * this IO with a different IO tag
702 * - io-tag cannot be used yet.
703 *
704 * BFI_IOIM_STS_NEXUS_ABORT : Second Level Error Recovery from host
705 * is required because 2 consecutive ABTS
706 * timedout and host needs logout and
707 * re-login with the target
708 * - io-tag cannot be used yet.
709 *
710 * BFI_IOIM_STS_UNDERRUN : IO completed with SCSI status good,
711 * but the data tranferred is less than
712 * the fcp data length in the command.
713 * ex. SCSI INQUIRY where transferred
714 * data length and residue count in FCP
715 * response accounts for total fcp-dl
716 * - io-tag can be reused.
717 *
718 * BFI_IOIM_STS_OVERRUN : IO completed with SCSI status good,
719 * but the data transerred is more than
720 * fcp data length in the command. ex.
721 * TAPE IOs where blocks can of unequal
722 * lengths.
723 * - io-tag can be reused.
724 *
725 * BFI_IOIM_STS_RES_FREE : Firmware has completed using io-tag
726 * during abort process
727 * - io-tag can be reused.
728 *
729 * BFI_IOIM_STS_PROTO_ERR : Firmware detected a protocol error.
730 * ex target sent more data than
731 * requested, or there was data frame
732 * loss and other reasons
733 * - io-tag cannot be used yet.
734 *
735 * BFI_IOIM_STS_DIF_ERR : Firwmare detected DIF error. ex: DIF
736 * CRC err or Ref Tag err or App tag err.
737 * - io-tag can be reused.
738 *
739 * BFA_IOIM_STS_TSK_MGT_ABORT : IO was aborted because of Task
740 * Management command from the host
741 * - io-tag can be reused.
742 *
743 * BFI_IOIM_STS_UTAG : Firmware does not know about this
744 * io_tag.
745 * - io-tag can be reused.
746 */
747enum bfi_ioim_status {
748 BFI_IOIM_STS_OK = 0,
749 BFI_IOIM_STS_HOST_ABORTED = 1,
750 BFI_IOIM_STS_ABORTED = 2,
751 BFI_IOIM_STS_TIMEDOUT = 3,
752 BFI_IOIM_STS_RES_FREE = 4,
753 BFI_IOIM_STS_SQER_NEEDED = 5,
754 BFI_IOIM_STS_PROTO_ERR = 6,
755 BFI_IOIM_STS_UTAG = 7,
756 BFI_IOIM_STS_PATHTOV = 8,
757};
758
Jing Huangacdc79a2010-10-18 17:15:55 -0700759/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700760 * I/O response message
761 */
762struct bfi_ioim_rsp_s {
763 struct bfi_mhdr_s mh; /* common msg header */
Maggie50444a32010-11-29 18:26:32 -0800764 __be16 io_tag; /* completed IO tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700765 u16 bfa_rport_hndl; /* releated rport handle */
766 u8 io_status; /* IO completion status */
767 u8 reuse_io_tag; /* IO tag can be reused */
768 u16 abort_tag; /* host abort request tag */
769 u8 scsi_status; /* scsi status from target */
770 u8 sns_len; /* scsi sense length */
771 u8 resid_flags; /* IO residue flags */
772 u8 rsvd_a;
Maggie50444a32010-11-29 18:26:32 -0800773 __be32 residue; /* IO residual length in bytes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700774 u32 rsvd_b[3];
775};
776
777struct bfi_ioim_abort_req_s {
778 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800779 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700780 u16 abort_tag; /* unique request tag */
781};
782
783/*
784 * Initiator mode task management command interface defines.
785 */
786
787enum bfi_tskim_h2i {
788 BFI_TSKIM_H2I_TM_REQ = 1, /* task-mgmt command */
789 BFI_TSKIM_H2I_ABORT_REQ = 2, /* task-mgmt command */
790};
791
792enum bfi_tskim_i2h {
793 BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
794};
795
796struct bfi_tskim_req_s {
797 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800798 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700799 u16 itn_fhdl; /* itn firmware handle */
Maggie Zhangf3148782010-12-09 19:11:39 -0800800 struct scsi_lun lun; /* LU number */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700801 u8 tm_flags; /* see enum fcp_tm_cmnd */
802 u8 t_secs; /* Timeout value in seconds */
803 u8 rsvd[2];
804};
805
806struct bfi_tskim_abortreq_s {
807 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800808 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700809 u16 rsvd;
810};
811
812enum bfi_tskim_status {
813 /*
814 * Following are FCP-4 spec defined status codes,
815 * **DO NOT CHANGE THEM **
816 */
817 BFI_TSKIM_STS_OK = 0,
818 BFI_TSKIM_STS_NOT_SUPP = 4,
819 BFI_TSKIM_STS_FAILED = 5,
820
Jing Huangacdc79a2010-10-18 17:15:55 -0700821 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700822 * Defined by BFA
823 */
824 BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */
825 BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */
826};
827
828struct bfi_tskim_rsp_s {
829 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800830 __be16 tsk_tag; /* task mgmt cmnd tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700831 u8 tsk_status; /* @ref bfi_tskim_status */
832 u8 rsvd;
833};
834
835#pragma pack()
836
Krishna Gudipati11189202011-06-13 15:50:35 -0700837/*
838 * Crossbow PCI MSI-X vector defines
839 */
840enum {
841 BFI_MSIX_CPE_QMIN_CB = 0,
842 BFI_MSIX_CPE_QMAX_CB = 7,
843 BFI_MSIX_RME_QMIN_CB = 8,
844 BFI_MSIX_RME_QMAX_CB = 15,
845 BFI_MSIX_CB_MAX = 22,
846};
847
848/*
849 * Catapult FC PCI MSI-X vector defines
850 */
851enum {
852 BFI_MSIX_LPU_ERR_CT = 0,
853 BFI_MSIX_CPE_QMIN_CT = 1,
854 BFI_MSIX_CPE_QMAX_CT = 4,
855 BFI_MSIX_RME_QMIN_CT = 5,
856 BFI_MSIX_RME_QMAX_CT = 8,
857 BFI_MSIX_CT_MAX = 9,
858};
859
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700860#endif /* __BFI_MS_H__ */