blob: 8c19734564108635a32611bccd6207732f47ded3 [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];
91};
92
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070093struct bfi_iocfc_cfgrsp_s {
94 struct bfa_iocfc_fwcfg_s fwcfg;
95 struct bfa_iocfc_intr_attr_s intr_attr;
96 struct bfi_iocfc_bootwwns bootwwns;
97 struct bfi_pbc_s pbc_cfg;
Krishna Gudipati11189202011-06-13 15:50:35 -070098 struct bfi_iocfc_qreg_s qreg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070099};
100
Jing Huangacdc79a2010-10-18 17:15:55 -0700101/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700102 * BFI_IOCFC_H2I_CFG_REQ message
103 */
104struct bfi_iocfc_cfg_req_s {
105 struct bfi_mhdr_s mh;
106 union bfi_addr_u ioc_cfg_dma_addr;
107};
108
109
Jing Huangacdc79a2010-10-18 17:15:55 -0700110/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700111 * BFI_IOCFC_I2H_CFG_REPLY message
112 */
113struct bfi_iocfc_cfg_reply_s {
114 struct bfi_mhdr_s mh; /* Common msg header */
115 u8 cfg_success; /* cfg reply status */
116 u8 lpu_bm; /* LPUs assigned for this IOC */
117 u8 rsvd[2];
118};
119
120
Jing Huangacdc79a2010-10-18 17:15:55 -0700121/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700122 * BFI_IOCFC_H2I_SET_INTR_REQ message
123 */
124struct bfi_iocfc_set_intr_req_s {
125 struct bfi_mhdr_s mh; /* common msg header */
126 u8 coalesce; /* enable intr coalescing */
127 u8 rsvd[3];
Maggie50444a32010-11-29 18:26:32 -0800128 __be16 delay; /* delay timer 0..1125us */
129 __be16 latency; /* latency timer 0..225us */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700130};
131
132
Jing Huangacdc79a2010-10-18 17:15:55 -0700133/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700134 * BFI_IOCFC_H2I_UPDATEQ_REQ message
135 */
136struct bfi_iocfc_updateq_req_s {
137 struct bfi_mhdr_s mh; /* common msg header */
138 u32 reqq_ba; /* reqq base addr */
139 u32 rspq_ba; /* rspq base addr */
140 u32 reqq_sci; /* reqq shadow ci */
141 u32 rspq_spi; /* rspq shadow pi */
142};
143
144
Jing Huangacdc79a2010-10-18 17:15:55 -0700145/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700146 * BFI_IOCFC_I2H_UPDATEQ_RSP message
147 */
148struct bfi_iocfc_updateq_rsp_s {
149 struct bfi_mhdr_s mh; /* common msg header */
150 u8 status; /* updateq status */
151 u8 rsvd[3];
152};
153
154
Jing Huangacdc79a2010-10-18 17:15:55 -0700155/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700156 * H2I Messages
157 */
158union bfi_iocfc_h2i_msg_u {
159 struct bfi_mhdr_s mh;
160 struct bfi_iocfc_cfg_req_s cfg_req;
161 struct bfi_iocfc_updateq_req_s updateq_req;
162 u32 mboxmsg[BFI_IOC_MSGSZ];
163};
164
165
Jing Huangacdc79a2010-10-18 17:15:55 -0700166/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700167 * I2H Messages
168 */
169union bfi_iocfc_i2h_msg_u {
170 struct bfi_mhdr_s mh;
171 struct bfi_iocfc_cfg_reply_s cfg_reply;
172 struct bfi_iocfc_updateq_rsp_s updateq_rsp;
173 u32 mboxmsg[BFI_IOC_MSGSZ];
174};
175
Krishna Gudipatia7141342011-06-24 20:23:19 -0700176/*
177 * BFI_IOCFC_H2I_FAA_ENABLE_REQ BFI_IOCFC_H2I_FAA_DISABLE_REQ message
178 */
179struct bfi_faa_en_dis_s {
180 struct bfi_mhdr_s mh; /* common msg header */
181};
182
183/*
184 * BFI_IOCFC_H2I_FAA_QUERY_REQ message
185 */
186struct bfi_faa_query_s {
187 struct bfi_mhdr_s mh; /* common msg header */
188 u8 faa_status; /* FAA status */
189 u8 addr_source; /* PWWN source */
190 u8 rsvd[2];
191 wwn_t faa; /* Fabric acquired PWWN */
192};
193
194/*
195 * BFI_IOCFC_I2H_FAA_ENABLE_RSP, BFI_IOCFC_I2H_FAA_DISABLE_RSP message
196 */
197struct bfi_faa_en_dis_rsp_s {
198 struct bfi_mhdr_s mh; /* common msg header */
199 u8 status; /* updateq status */
200 u8 rsvd[3];
201};
202
203/*
204 * BFI_IOCFC_I2H_FAA_QUERY_RSP message
205 */
206#define bfi_faa_query_rsp_t struct bfi_faa_query_s
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700207
208enum bfi_fcport_h2i {
209 BFI_FCPORT_H2I_ENABLE_REQ = (1),
210 BFI_FCPORT_H2I_DISABLE_REQ = (2),
211 BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3),
212 BFI_FCPORT_H2I_STATS_GET_REQ = (4),
213 BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5),
214};
215
216
217enum bfi_fcport_i2h {
218 BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1),
219 BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2),
220 BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3),
221 BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4),
222 BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5),
223 BFI_FCPORT_I2H_EVENT = BFA_I2HM(6),
224 BFI_FCPORT_I2H_TRUNK_SCN = BFA_I2HM(7),
225 BFI_FCPORT_I2H_ENABLE_AEN = BFA_I2HM(8),
226 BFI_FCPORT_I2H_DISABLE_AEN = BFA_I2HM(9),
227};
228
229
Jing Huangacdc79a2010-10-18 17:15:55 -0700230/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700231 * Generic REQ type
232 */
233struct bfi_fcport_req_s {
234 struct bfi_mhdr_s mh; /* msg header */
235 u32 msgtag; /* msgtag for reply */
236};
237
Jing Huangacdc79a2010-10-18 17:15:55 -0700238/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700239 * Generic RSP type
240 */
241struct bfi_fcport_rsp_s {
242 struct bfi_mhdr_s mh; /* common msg header */
243 u8 status; /* port enable status */
244 u8 rsvd[3];
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800245 struct bfa_port_cfg_s port_cfg;/* port configuration */
246 u32 msgtag; /* msgtag for reply */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700247};
248
Jing Huangacdc79a2010-10-18 17:15:55 -0700249/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700250 * BFI_FCPORT_H2I_ENABLE_REQ
251 */
252struct bfi_fcport_enable_req_s {
253 struct bfi_mhdr_s mh; /* msg header */
254 u32 rsvd1;
255 wwn_t nwwn; /* node wwn of physical port */
256 wwn_t pwwn; /* port wwn of physical port */
257 struct bfa_port_cfg_s port_cfg; /* port configuration */
258 union bfi_addr_u stats_dma_addr; /* DMA address for stats */
259 u32 msgtag; /* msgtag for reply */
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800260 u8 use_flash_cfg; /* get prot cfg from flash */
261 u8 rsvd2[3];
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700262};
263
Jing Huangacdc79a2010-10-18 17:15:55 -0700264/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700265 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
266 */
267struct bfi_fcport_set_svc_params_req_s {
268 struct bfi_mhdr_s mh; /* msg header */
Maggie50444a32010-11-29 18:26:32 -0800269 __be16 tx_bbcredit; /* Tx credits */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700270 u8 bb_scn; /* BB_SC FC credit recovery */
271 u8 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700272};
273
Jing Huangacdc79a2010-10-18 17:15:55 -0700274/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700275 * BFI_FCPORT_I2H_EVENT
276 */
277struct bfi_fcport_event_s {
278 struct bfi_mhdr_s mh; /* common msg header */
279 struct bfa_port_link_s link_state;
280};
281
Jing Huangacdc79a2010-10-18 17:15:55 -0700282/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700283 * BFI_FCPORT_I2H_TRUNK_SCN
284 */
285struct bfi_fcport_trunk_link_s {
286 wwn_t trunk_wwn;
287 u8 fctl; /* bfa_trunk_link_fctl_t */
288 u8 state; /* bfa_trunk_link_state_t */
289 u8 speed; /* bfa_port_speed_t */
290 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800291 __be32 deskew;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700292};
293
294#define BFI_FCPORT_MAX_LINKS 2
295struct bfi_fcport_trunk_scn_s {
296 struct bfi_mhdr_s mh;
297 u8 trunk_state; /* bfa_trunk_state_t */
298 u8 trunk_speed; /* bfa_port_speed_t */
299 u8 rsvd_a[2];
300 struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
301};
302
Jing Huangacdc79a2010-10-18 17:15:55 -0700303/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700304 * fcport H2I message
305 */
306union bfi_fcport_h2i_msg_u {
307 struct bfi_mhdr_s *mhdr;
308 struct bfi_fcport_enable_req_s *penable;
309 struct bfi_fcport_req_s *pdisable;
310 struct bfi_fcport_set_svc_params_req_s *psetsvcparams;
311 struct bfi_fcport_req_s *pstatsget;
312 struct bfi_fcport_req_s *pstatsclear;
313};
314
Jing Huangacdc79a2010-10-18 17:15:55 -0700315/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700316 * fcport I2H message
317 */
318union bfi_fcport_i2h_msg_u {
319 struct bfi_msg_s *msg;
320 struct bfi_fcport_rsp_s *penable_rsp;
321 struct bfi_fcport_rsp_s *pdisable_rsp;
322 struct bfi_fcport_rsp_s *psetsvcparams_rsp;
323 struct bfi_fcport_rsp_s *pstatsget_rsp;
324 struct bfi_fcport_rsp_s *pstatsclear_rsp;
325 struct bfi_fcport_event_s *event;
326 struct bfi_fcport_trunk_scn_s *trunk_scn;
327};
328
329enum bfi_fcxp_h2i {
330 BFI_FCXP_H2I_SEND_REQ = 1,
331};
332
333enum bfi_fcxp_i2h {
334 BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
335};
336
337#define BFA_FCXP_MAX_SGES 2
338
Jing Huangacdc79a2010-10-18 17:15:55 -0700339/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700340 * FCXP send request structure
341 */
342struct bfi_fcxp_send_req_s {
343 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800344 __be16 fcxp_tag; /* driver request tag */
345 __be16 max_frmsz; /* max send frame size */
346 __be16 vf_id; /* vsan tag if applicable */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700347 u16 rport_fw_hndl; /* FW Handle for the remote port */
348 u8 class; /* FC class used for req/rsp */
349 u8 rsp_timeout; /* timeout in secs, 0-no response */
350 u8 cts; /* continue sequence */
351 u8 lp_tag; /* lport tag */
352 struct fchs_s fchs; /* request FC header structure */
Maggie50444a32010-11-29 18:26:32 -0800353 __be32 req_len; /* request payload length */
354 __be32 rsp_maxlen; /* max response length expected */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700355 struct bfi_alen_s req_alen; /* request buffer */
356 struct bfi_alen_s rsp_alen; /* response buffer */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700357};
358
Jing Huangacdc79a2010-10-18 17:15:55 -0700359/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700360 * FCXP send response structure
361 */
362struct bfi_fcxp_send_rsp_s {
363 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800364 __be16 fcxp_tag; /* send request tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700365 u8 req_status; /* request status */
366 u8 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800367 __be32 rsp_len; /* actual response length */
368 __be32 residue_len; /* residual response length */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700369 struct fchs_s fchs; /* response FC header structure */
370};
371
372enum bfi_uf_h2i {
373 BFI_UF_H2I_BUF_POST = 1,
374};
375
376enum bfi_uf_i2h {
377 BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
378};
379
380#define BFA_UF_MAX_SGES 2
381
382struct bfi_uf_buf_post_s {
383 struct bfi_mhdr_s mh; /* Common msg header */
384 u16 buf_tag; /* buffer tag */
Maggie50444a32010-11-29 18:26:32 -0800385 __be16 buf_len; /* total buffer length */
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700386 struct bfi_alen_s alen; /* buffer address/len pair */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700387};
388
389struct bfi_uf_frm_rcvd_s {
390 struct bfi_mhdr_s mh; /* Common msg header */
391 u16 buf_tag; /* buffer tag */
392 u16 rsvd;
393 u16 frm_len; /* received frame length */
394 u16 xfr_len; /* tranferred length */
395};
396
397enum bfi_lps_h2i_msgs {
398 BFI_LPS_H2I_LOGIN_REQ = 1,
399 BFI_LPS_H2I_LOGOUT_REQ = 2,
Krishna Gudipatib7044952010-12-13 16:17:42 -0800400 BFI_LPS_H2I_N2N_PID_REQ = 3,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700401};
402
403enum bfi_lps_i2h_msgs {
Krishna Gudipati43ffdf42011-06-13 15:46:21 -0700404 BFI_LPS_I2H_LOGIN_RSP = BFA_I2HM(1),
405 BFI_LPS_I2H_LOGOUT_RSP = BFA_I2HM(2),
406 BFI_LPS_I2H_CVL_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700407};
408
409struct bfi_lps_login_req_s {
410 struct bfi_mhdr_s mh; /* common msg header */
411 u8 lp_tag;
412 u8 alpa;
Maggie50444a32010-11-29 18:26:32 -0800413 __be16 pdu_size;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700414 wwn_t pwwn;
415 wwn_t nwwn;
416 u8 fdisc;
417 u8 auth_en;
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700418 u8 lps_role;
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700419 u8 bb_scn;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700420};
421
422struct bfi_lps_login_rsp_s {
423 struct bfi_mhdr_s mh; /* common msg header */
424 u8 lp_tag;
425 u8 status;
426 u8 lsrjt_rsn;
427 u8 lsrjt_expl;
428 wwn_t port_name;
429 wwn_t node_name;
Maggie50444a32010-11-29 18:26:32 -0800430 __be16 bb_credit;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700431 u8 f_port;
432 u8 npiv_en;
433 u32 lp_pid:24;
434 u32 auth_req:8;
435 mac_t lp_mac;
436 mac_t fcf_mac;
437 u8 ext_status;
438 u8 brcd_switch; /* attached peer is brcd switch */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700439 u8 bb_scn; /* atatched port's bb_scn */
440 u8 resvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700441};
442
443struct bfi_lps_logout_req_s {
444 struct bfi_mhdr_s mh; /* common msg header */
445 u8 lp_tag;
446 u8 rsvd[3];
447 wwn_t port_name;
448};
449
450struct bfi_lps_logout_rsp_s {
451 struct bfi_mhdr_s mh; /* common msg header */
452 u8 lp_tag;
453 u8 status;
454 u8 rsvd[2];
455};
456
457struct bfi_lps_cvl_event_s {
458 struct bfi_mhdr_s mh; /* common msg header */
459 u8 lp_tag;
460 u8 rsvd[3];
461};
462
Krishna Gudipatib7044952010-12-13 16:17:42 -0800463struct bfi_lps_n2n_pid_req_s {
464 struct bfi_mhdr_s mh; /* common msg header */
465 u8 lp_tag;
466 u32 lp_pid:24;
467};
468
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700469union bfi_lps_h2i_msg_u {
470 struct bfi_mhdr_s *msg;
471 struct bfi_lps_login_req_s *login_req;
472 struct bfi_lps_logout_req_s *logout_req;
Krishna Gudipatib7044952010-12-13 16:17:42 -0800473 struct bfi_lps_n2n_pid_req_s *n2n_pid_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700474};
475
476union bfi_lps_i2h_msg_u {
477 struct bfi_msg_s *msg;
478 struct bfi_lps_login_rsp_s *login_rsp;
479 struct bfi_lps_logout_rsp_s *logout_rsp;
480 struct bfi_lps_cvl_event_s *cvl_event;
481};
482
483enum bfi_rport_h2i_msgs {
484 BFI_RPORT_H2I_CREATE_REQ = 1,
485 BFI_RPORT_H2I_DELETE_REQ = 2,
486 BFI_RPORT_H2I_SET_SPEED_REQ = 3,
487};
488
489enum bfi_rport_i2h_msgs {
490 BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
491 BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
492 BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3),
493};
494
495struct bfi_rport_create_req_s {
496 struct bfi_mhdr_s mh; /* common msg header */
497 u16 bfa_handle; /* host rport handle */
Maggie50444a32010-11-29 18:26:32 -0800498 __be16 max_frmsz; /* max rcv pdu size */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700499 u32 pid:24, /* remote port ID */
500 lp_tag:8; /* local port tag */
501 u32 local_pid:24, /* local port ID */
502 cisc:8;
503 u8 fc_class; /* supported FC classes */
504 u8 vf_en; /* virtual fabric enable */
505 u16 vf_id; /* virtual fabric ID */
506};
507
508struct bfi_rport_create_rsp_s {
509 struct bfi_mhdr_s mh; /* common msg header */
510 u8 status; /* rport creation status */
511 u8 rsvd[3];
512 u16 bfa_handle; /* host rport handle */
513 u16 fw_handle; /* firmware rport handle */
514 struct bfa_rport_qos_attr_s qos_attr; /* QoS Attributes */
515};
516
517struct bfa_rport_speed_req_s {
518 struct bfi_mhdr_s mh; /* common msg header */
519 u16 fw_handle; /* firmware rport handle */
520 u8 speed; /* rport's speed via RPSC */
521 u8 rsvd;
522};
523
524struct bfi_rport_delete_req_s {
525 struct bfi_mhdr_s mh; /* common msg header */
526 u16 fw_handle; /* firmware rport handle */
527 u16 rsvd;
528};
529
530struct bfi_rport_delete_rsp_s {
531 struct bfi_mhdr_s mh; /* common msg header */
532 u16 bfa_handle; /* host rport handle */
533 u8 status; /* rport deletion status */
534 u8 rsvd;
535};
536
537struct bfi_rport_qos_scn_s {
538 struct bfi_mhdr_s mh; /* common msg header */
539 u16 bfa_handle; /* host rport handle */
540 u16 rsvd;
541 struct bfa_rport_qos_attr_s old_qos_attr; /* Old QoS Attributes */
542 struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */
543};
544
545union bfi_rport_h2i_msg_u {
546 struct bfi_msg_s *msg;
547 struct bfi_rport_create_req_s *create_req;
548 struct bfi_rport_delete_req_s *delete_req;
549 struct bfi_rport_speed_req_s *speed_req;
550};
551
552union bfi_rport_i2h_msg_u {
553 struct bfi_msg_s *msg;
554 struct bfi_rport_create_rsp_s *create_rsp;
555 struct bfi_rport_delete_rsp_s *delete_rsp;
556 struct bfi_rport_qos_scn_s *qos_scn_evt;
557};
558
559/*
560 * Initiator mode I-T nexus interface defines.
561 */
562
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700563enum bfi_itn_h2i {
564 BFI_ITN_H2I_CREATE_REQ = 1, /* i-t nexus creation */
565 BFI_ITN_H2I_DELETE_REQ = 2, /* i-t nexus deletion */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700566};
567
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700568enum bfi_itn_i2h {
569 BFI_ITN_I2H_CREATE_RSP = BFA_I2HM(1),
570 BFI_ITN_I2H_DELETE_RSP = BFA_I2HM(2),
571 BFI_ITN_I2H_SLER_EVENT = BFA_I2HM(3),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700572};
573
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700574struct bfi_itn_create_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700575 struct bfi_mhdr_s mh; /* common msg header */
576 u16 fw_handle; /* f/w handle for itnim */
577 u8 class; /* FC class for IO */
578 u8 seq_rec; /* sequence recovery support */
579 u8 msg_no; /* seq id of the msg */
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700580 u8 role;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700581};
582
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700583struct bfi_itn_create_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700584 struct bfi_mhdr_s mh; /* common msg header */
585 u16 bfa_handle; /* bfa handle for itnim */
586 u8 status; /* fcp request status */
587 u8 seq_id; /* seq id of the msg */
588};
589
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700590struct bfi_itn_delete_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700591 struct bfi_mhdr_s mh; /* common msg header */
592 u16 fw_handle; /* f/w itnim handle */
593 u8 seq_id; /* seq id of the msg */
594 u8 rsvd;
595};
596
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700597struct bfi_itn_delete_rsp_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700598 struct bfi_mhdr_s mh; /* common msg header */
599 u16 bfa_handle; /* bfa handle for itnim */
600 u8 status; /* fcp request status */
601 u8 seq_id; /* seq id of the msg */
602};
603
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700604struct bfi_itn_sler_event_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700605 struct bfi_mhdr_s mh; /* common msg header */
606 u16 bfa_handle; /* bfa handle for itnim */
607 u16 rsvd;
608};
609
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700610union bfi_itn_h2i_msg_u {
611 struct bfi_itn_create_req_s *create_req;
612 struct bfi_itn_delete_req_s *delete_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700613 struct bfi_msg_s *msg;
614};
615
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700616union bfi_itn_i2h_msg_u {
617 struct bfi_itn_create_rsp_s *create_rsp;
618 struct bfi_itn_delete_rsp_s *delete_rsp;
619 struct bfi_itn_sler_event_s *sler_event;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700620 struct bfi_msg_s *msg;
621};
622
623/*
624 * Initiator mode IO interface defines.
625 */
626
627enum bfi_ioim_h2i {
628 BFI_IOIM_H2I_IOABORT_REQ = 1, /* IO abort request */
629 BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /* IO cleanup request */
630};
631
632enum bfi_ioim_i2h {
633 BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1), /* non-fp IO response */
634 BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /* ABORT rsp */
635};
636
Jing Huangacdc79a2010-10-18 17:15:55 -0700637/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700638 * IO command DIF info
639 */
640struct bfi_ioim_dif_s {
641 u32 dif_info[4];
642};
643
Jing Huangacdc79a2010-10-18 17:15:55 -0700644/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700645 * FCP IO messages overview
646 *
647 * @note
648 * - Max CDB length supported is 64 bytes.
649 * - SCSI Linked commands and SCSI bi-directional Commands not
650 * supported.
651 *
652 */
653struct bfi_ioim_req_s {
654 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800655 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700656 u16 rport_hdl; /* itnim/rport firmware handle */
657 struct fcp_cmnd_s cmnd; /* IO request info */
658
Jing Huangacdc79a2010-10-18 17:15:55 -0700659 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700660 * SG elements array within the IO request must be double word
661 * aligned. This aligment is required to optimize SGM setup for the IO.
662 */
663 struct bfi_sge_s sges[BFI_SGE_INLINE_MAX];
664 u8 io_timeout;
665 u8 dif_en;
666 u8 rsvd_a[2];
667 struct bfi_ioim_dif_s dif;
668};
669
Jing Huangacdc79a2010-10-18 17:15:55 -0700670/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700671 * This table shows various IO status codes from firmware and their
672 * meaning. Host driver can use these status codes to further process
673 * IO completions.
674 *
675 * BFI_IOIM_STS_OK : IO completed with error free SCSI &
676 * transport status.
677 * io-tag can be reused.
678 *
679 * BFA_IOIM_STS_SCSI_ERR : IO completed with scsi error.
680 * - io-tag can be reused.
681 *
682 * BFI_IOIM_STS_HOST_ABORTED : IO was aborted successfully due to
683 * host request.
684 * - io-tag cannot be reused yet.
685 *
686 * BFI_IOIM_STS_ABORTED : IO was aborted successfully
687 * internally by f/w.
688 * - io-tag cannot be reused yet.
689 *
690 * BFI_IOIM_STS_TIMEDOUT : IO timedout and ABTS/RRQ is happening
691 * in the firmware and
692 * - io-tag cannot be reused yet.
693 *
694 * BFI_IOIM_STS_SQER_NEEDED : Firmware could not recover the IO
695 * with sequence level error
696 * logic and hence host needs to retry
697 * this IO with a different IO tag
698 * - io-tag cannot be used yet.
699 *
700 * BFI_IOIM_STS_NEXUS_ABORT : Second Level Error Recovery from host
701 * is required because 2 consecutive ABTS
702 * timedout and host needs logout and
703 * re-login with the target
704 * - io-tag cannot be used yet.
705 *
706 * BFI_IOIM_STS_UNDERRUN : IO completed with SCSI status good,
707 * but the data tranferred is less than
708 * the fcp data length in the command.
709 * ex. SCSI INQUIRY where transferred
710 * data length and residue count in FCP
711 * response accounts for total fcp-dl
712 * - io-tag can be reused.
713 *
714 * BFI_IOIM_STS_OVERRUN : IO completed with SCSI status good,
715 * but the data transerred is more than
716 * fcp data length in the command. ex.
717 * TAPE IOs where blocks can of unequal
718 * lengths.
719 * - io-tag can be reused.
720 *
721 * BFI_IOIM_STS_RES_FREE : Firmware has completed using io-tag
722 * during abort process
723 * - io-tag can be reused.
724 *
725 * BFI_IOIM_STS_PROTO_ERR : Firmware detected a protocol error.
726 * ex target sent more data than
727 * requested, or there was data frame
728 * loss and other reasons
729 * - io-tag cannot be used yet.
730 *
731 * BFI_IOIM_STS_DIF_ERR : Firwmare detected DIF error. ex: DIF
732 * CRC err or Ref Tag err or App tag err.
733 * - io-tag can be reused.
734 *
735 * BFA_IOIM_STS_TSK_MGT_ABORT : IO was aborted because of Task
736 * Management command from the host
737 * - io-tag can be reused.
738 *
739 * BFI_IOIM_STS_UTAG : Firmware does not know about this
740 * io_tag.
741 * - io-tag can be reused.
742 */
743enum bfi_ioim_status {
744 BFI_IOIM_STS_OK = 0,
745 BFI_IOIM_STS_HOST_ABORTED = 1,
746 BFI_IOIM_STS_ABORTED = 2,
747 BFI_IOIM_STS_TIMEDOUT = 3,
748 BFI_IOIM_STS_RES_FREE = 4,
749 BFI_IOIM_STS_SQER_NEEDED = 5,
750 BFI_IOIM_STS_PROTO_ERR = 6,
751 BFI_IOIM_STS_UTAG = 7,
752 BFI_IOIM_STS_PATHTOV = 8,
753};
754
755#define BFI_IOIM_SNSLEN (256)
Jing Huangacdc79a2010-10-18 17:15:55 -0700756/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700757 * I/O response message
758 */
759struct bfi_ioim_rsp_s {
760 struct bfi_mhdr_s mh; /* common msg header */
Maggie50444a32010-11-29 18:26:32 -0800761 __be16 io_tag; /* completed IO tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700762 u16 bfa_rport_hndl; /* releated rport handle */
763 u8 io_status; /* IO completion status */
764 u8 reuse_io_tag; /* IO tag can be reused */
765 u16 abort_tag; /* host abort request tag */
766 u8 scsi_status; /* scsi status from target */
767 u8 sns_len; /* scsi sense length */
768 u8 resid_flags; /* IO residue flags */
769 u8 rsvd_a;
Maggie50444a32010-11-29 18:26:32 -0800770 __be32 residue; /* IO residual length in bytes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700771 u32 rsvd_b[3];
772};
773
774struct bfi_ioim_abort_req_s {
775 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800776 __be16 io_tag; /* I/O tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700777 u16 abort_tag; /* unique request tag */
778};
779
780/*
781 * Initiator mode task management command interface defines.
782 */
783
784enum bfi_tskim_h2i {
785 BFI_TSKIM_H2I_TM_REQ = 1, /* task-mgmt command */
786 BFI_TSKIM_H2I_ABORT_REQ = 2, /* task-mgmt command */
787};
788
789enum bfi_tskim_i2h {
790 BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
791};
792
793struct bfi_tskim_req_s {
794 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800795 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700796 u16 itn_fhdl; /* itn firmware handle */
Maggie Zhangf3148782010-12-09 19:11:39 -0800797 struct scsi_lun lun; /* LU number */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700798 u8 tm_flags; /* see enum fcp_tm_cmnd */
799 u8 t_secs; /* Timeout value in seconds */
800 u8 rsvd[2];
801};
802
803struct bfi_tskim_abortreq_s {
804 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800805 __be16 tsk_tag; /* task management tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700806 u16 rsvd;
807};
808
809enum bfi_tskim_status {
810 /*
811 * Following are FCP-4 spec defined status codes,
812 * **DO NOT CHANGE THEM **
813 */
814 BFI_TSKIM_STS_OK = 0,
815 BFI_TSKIM_STS_NOT_SUPP = 4,
816 BFI_TSKIM_STS_FAILED = 5,
817
Jing Huangacdc79a2010-10-18 17:15:55 -0700818 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700819 * Defined by BFA
820 */
821 BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */
822 BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */
823};
824
825struct bfi_tskim_rsp_s {
826 struct bfi_mhdr_s mh; /* Common msg header */
Maggie50444a32010-11-29 18:26:32 -0800827 __be16 tsk_tag; /* task mgmt cmnd tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700828 u8 tsk_status; /* @ref bfi_tskim_status */
829 u8 rsvd;
830};
831
832#pragma pack()
833
Krishna Gudipati11189202011-06-13 15:50:35 -0700834/*
835 * Crossbow PCI MSI-X vector defines
836 */
837enum {
838 BFI_MSIX_CPE_QMIN_CB = 0,
839 BFI_MSIX_CPE_QMAX_CB = 7,
840 BFI_MSIX_RME_QMIN_CB = 8,
841 BFI_MSIX_RME_QMAX_CB = 15,
842 BFI_MSIX_CB_MAX = 22,
843};
844
845/*
846 * Catapult FC PCI MSI-X vector defines
847 */
848enum {
849 BFI_MSIX_LPU_ERR_CT = 0,
850 BFI_MSIX_CPE_QMIN_CT = 1,
851 BFI_MSIX_CPE_QMAX_CT = 4,
852 BFI_MSIX_RME_QMIN_CT = 5,
853 BFI_MSIX_RME_QMAX_CT = 8,
854 BFI_MSIX_CT_MAX = 9,
855};
856
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700857#endif /* __BFI_MS_H__ */