bfi_ms.h 21.4 KB
Newer Older
K
Krishna Gudipati 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/*
 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
 * All rights reserved
 * www.brocade.com
 *
 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License (GPL) Version 2 as
 * published by the Free Software Foundation
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 */

#ifndef __BFI_MS_H__
#define __BFI_MS_H__

#include "bfi.h"
#include "bfa_fc.h"
#include "bfa_defs_svc.h"

#pragma pack(1)

enum bfi_iocfc_h2i_msgs {
	BFI_IOCFC_H2I_CFG_REQ		= 1,
	BFI_IOCFC_H2I_SET_INTR_REQ	= 2,
	BFI_IOCFC_H2I_UPDATEQ_REQ	= 3,
31 32 33
	BFI_IOCFC_H2I_FAA_ENABLE_REQ	= 4,
	BFI_IOCFC_H2I_FAA_DISABLE_REQ	= 5,
	BFI_IOCFC_H2I_FAA_QUERY_REQ	= 6,
K
Krishna Gudipati 已提交
34 35 36 37 38
};

enum bfi_iocfc_i2h_msgs {
	BFI_IOCFC_I2H_CFG_REPLY		= BFA_I2HM(1),
	BFI_IOCFC_I2H_UPDATEQ_RSP	= BFA_I2HM(3),
39 40 41
	BFI_IOCFC_I2H_FAA_ENABLE_RSP	= BFA_I2HM(4),
	BFI_IOCFC_I2H_FAA_DISABLE_RSP	= BFA_I2HM(5),
	BFI_IOCFC_I2H_FAA_QUERY_RSP	= BFA_I2HM(6),
K
Krishna Gudipati 已提交
42 43 44 45 46 47 48
};

struct bfi_iocfc_cfg_s {
	u8	num_cqs;	/*  Number of CQs to be used	*/
	u8	 sense_buf_len;	/*  SCSI sense length	    */
	u16	rsvd_1;
	u32	endian_sig;	/*  endian signature of host     */
49 50
	__be16	num_ioim_reqs;
	__be16	num_fwtio_reqs;
51 52
	u8	single_msix_vec;
	u8	rsvd[3];
K
Krishna Gudipati 已提交
53

54
	/*
K
Krishna Gudipati 已提交
55 56 57 58 59
	 * Request and response circular queue base addresses, size and
	 * shadow index pointers.
	 */
	union bfi_addr_u  req_cq_ba[BFI_IOC_MAX_CQS];
	union bfi_addr_u  req_shadow_ci[BFI_IOC_MAX_CQS];
60
	__be16    req_cq_elems[BFI_IOC_MAX_CQS];
K
Krishna Gudipati 已提交
61 62
	union bfi_addr_u  rsp_cq_ba[BFI_IOC_MAX_CQS];
	union bfi_addr_u  rsp_shadow_pi[BFI_IOC_MAX_CQS];
63
	__be16    rsp_cq_elems[BFI_IOC_MAX_CQS];
K
Krishna Gudipati 已提交
64 65 66 67 68 69 70

	union bfi_addr_u  stats_addr;	/*  DMA-able address for stats	  */
	union bfi_addr_u  cfgrsp_addr;	/*  config response dma address  */
	union bfi_addr_u  ioim_snsbase;  /*  IO sense buffer base address */
	struct bfa_iocfc_intr_attr_s intr_attr; /*  IOC interrupt attributes */
};

71
/*
K
Krishna Gudipati 已提交
72 73 74 75 76 77 78 79 80
 * Boot target wwn information for this port. This contains either the stored
 * or discovered boot target port wwns for the port.
 */
struct bfi_iocfc_bootwwns {
	wwn_t		wwn[BFA_BOOT_BOOTLUN_MAX];
	u8		nwwns;
	u8		rsvd[7];
};

81 82 83 84 85 86 87 88 89 90 91 92
/**
 * Queue configuration response from firmware
 */
struct bfi_iocfc_qreg_s {
	u32	cpe_q_ci_off[BFI_IOC_MAX_CQS];
	u32	cpe_q_pi_off[BFI_IOC_MAX_CQS];
	u32	cpe_qctl_off[BFI_IOC_MAX_CQS];
	u32	rme_q_ci_off[BFI_IOC_MAX_CQS];
	u32	rme_q_pi_off[BFI_IOC_MAX_CQS];
	u32	rme_qctl_off[BFI_IOC_MAX_CQS];
};

K
Krishna Gudipati 已提交
93 94 95 96 97
struct bfi_iocfc_cfgrsp_s {
	struct bfa_iocfc_fwcfg_s	fwcfg;
	struct bfa_iocfc_intr_attr_s	intr_attr;
	struct bfi_iocfc_bootwwns	bootwwns;
	struct bfi_pbc_s		pbc_cfg;
98
	struct bfi_iocfc_qreg_s		qreg;
K
Krishna Gudipati 已提交
99 100
};

101
/*
K
Krishna Gudipati 已提交
102 103 104 105 106 107 108 109
 * BFI_IOCFC_H2I_CFG_REQ message
 */
struct bfi_iocfc_cfg_req_s {
	struct bfi_mhdr_s      mh;
	union bfi_addr_u      ioc_cfg_dma_addr;
};


110
/*
K
Krishna Gudipati 已提交
111 112 113 114 115 116 117 118 119 120
 * BFI_IOCFC_I2H_CFG_REPLY message
 */
struct bfi_iocfc_cfg_reply_s {
	struct bfi_mhdr_s  mh;		/*  Common msg header	  */
	u8	 cfg_success;	/*  cfg reply status	   */
	u8	 lpu_bm;		/*  LPUs assigned for this IOC */
	u8	 rsvd[2];
};


121
/*
K
Krishna Gudipati 已提交
122 123 124 125 126 127
 * BFI_IOCFC_H2I_SET_INTR_REQ message
 */
struct bfi_iocfc_set_intr_req_s {
	struct bfi_mhdr_s mh;		/*  common msg header		*/
	u8		coalesce;	/*  enable intr coalescing	*/
	u8		rsvd[3];
128 129
	__be16	delay;		/*  delay timer 0..1125us	*/
	__be16	latency;	/*  latency timer 0..225us	*/
K
Krishna Gudipati 已提交
130 131 132
};


133
/*
K
Krishna Gudipati 已提交
134 135 136 137 138 139 140 141 142 143 144
 * BFI_IOCFC_H2I_UPDATEQ_REQ message
 */
struct bfi_iocfc_updateq_req_s {
	struct bfi_mhdr_s mh;		/*  common msg header		*/
	u32 reqq_ba;		/*  reqq base addr		*/
	u32 rspq_ba;		/*  rspq base addr		*/
	u32 reqq_sci;		/*  reqq shadow ci		*/
	u32 rspq_spi;		/*  rspq shadow pi		*/
};


145
/*
K
Krishna Gudipati 已提交
146 147 148 149 150 151 152 153 154
 * BFI_IOCFC_I2H_UPDATEQ_RSP message
 */
struct bfi_iocfc_updateq_rsp_s {
	struct bfi_mhdr_s mh;		/*  common msg header	*/
	u8	status;			/*  updateq  status	*/
	u8	rsvd[3];
};


155
/*
K
Krishna Gudipati 已提交
156 157 158 159 160 161 162 163 164 165
 * H2I Messages
 */
union bfi_iocfc_h2i_msg_u {
	struct bfi_mhdr_s		mh;
	struct bfi_iocfc_cfg_req_s	cfg_req;
	struct bfi_iocfc_updateq_req_s updateq_req;
	u32 mboxmsg[BFI_IOC_MSGSZ];
};


166
/*
K
Krishna Gudipati 已提交
167 168 169 170 171 172 173 174 175
 * I2H Messages
 */
union bfi_iocfc_i2h_msg_u {
	struct bfi_mhdr_s		mh;
	struct bfi_iocfc_cfg_reply_s	cfg_reply;
	struct bfi_iocfc_updateq_rsp_s updateq_rsp;
	u32 mboxmsg[BFI_IOC_MSGSZ];
};

176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
/*
 * BFI_IOCFC_H2I_FAA_ENABLE_REQ BFI_IOCFC_H2I_FAA_DISABLE_REQ message
 */
struct bfi_faa_en_dis_s {
	struct bfi_mhdr_s mh;	/* common msg header    */
};

/*
 * BFI_IOCFC_H2I_FAA_QUERY_REQ message
 */
struct bfi_faa_query_s {
	struct bfi_mhdr_s mh;	/* common msg header    */
	u8	faa_status;	/* FAA status           */
	u8	addr_source;	/* PWWN source          */
	u8	rsvd[2];
	wwn_t	faa;		/* Fabric acquired PWWN	*/
};

/*
 * BFI_IOCFC_I2H_FAA_ENABLE_RSP, BFI_IOCFC_I2H_FAA_DISABLE_RSP message
 */
struct bfi_faa_en_dis_rsp_s {
	struct bfi_mhdr_s mh;	/* common msg header    */
	u8	status;		/* updateq  status      */
	u8	rsvd[3];
};

/*
 * BFI_IOCFC_I2H_FAA_QUERY_RSP message
 */
#define bfi_faa_query_rsp_t struct bfi_faa_query_s
K
Krishna Gudipati 已提交
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229

enum bfi_fcport_h2i {
	BFI_FCPORT_H2I_ENABLE_REQ		= (1),
	BFI_FCPORT_H2I_DISABLE_REQ		= (2),
	BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ	= (3),
	BFI_FCPORT_H2I_STATS_GET_REQ		= (4),
	BFI_FCPORT_H2I_STATS_CLEAR_REQ		= (5),
};


enum bfi_fcport_i2h {
	BFI_FCPORT_I2H_ENABLE_RSP		= BFA_I2HM(1),
	BFI_FCPORT_I2H_DISABLE_RSP		= BFA_I2HM(2),
	BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP	= BFA_I2HM(3),
	BFI_FCPORT_I2H_STATS_GET_RSP		= BFA_I2HM(4),
	BFI_FCPORT_I2H_STATS_CLEAR_RSP		= BFA_I2HM(5),
	BFI_FCPORT_I2H_EVENT			= BFA_I2HM(6),
	BFI_FCPORT_I2H_TRUNK_SCN		= BFA_I2HM(7),
	BFI_FCPORT_I2H_ENABLE_AEN		= BFA_I2HM(8),
	BFI_FCPORT_I2H_DISABLE_AEN		= BFA_I2HM(9),
};


230
/*
K
Krishna Gudipati 已提交
231 232 233 234 235 236 237
 * Generic REQ type
 */
struct bfi_fcport_req_s {
	struct bfi_mhdr_s  mh;		/*  msg header			    */
	u32	   msgtag;	/*  msgtag for reply		    */
};

238
/*
K
Krishna Gudipati 已提交
239 240 241 242 243 244
 * Generic RSP type
 */
struct bfi_fcport_rsp_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		    */
	u8		   status;	/*  port enable status		    */
	u8		   rsvd[3];
245 246
	struct	bfa_port_cfg_s port_cfg;/* port configuration	*/
	u32	msgtag;			/* msgtag for reply	*/
K
Krishna Gudipati 已提交
247 248
};

249
/*
K
Krishna Gudipati 已提交
250 251 252 253 254 255 256 257 258 259
 * BFI_FCPORT_H2I_ENABLE_REQ
 */
struct bfi_fcport_enable_req_s {
	struct bfi_mhdr_s  mh;		/*  msg header			    */
	u32	   rsvd1;
	wwn_t		   nwwn;	/*  node wwn of physical port	    */
	wwn_t		   pwwn;	/*  port wwn of physical port	    */
	struct bfa_port_cfg_s port_cfg; /*  port configuration	    */
	union bfi_addr_u   stats_dma_addr; /*  DMA address for stats	    */
	u32	   msgtag;	/*  msgtag for reply		    */
260 261
	u8	use_flash_cfg;	/* get prot cfg from flash */
	u8	rsvd2[3];
K
Krishna Gudipati 已提交
262 263
};

264
/*
K
Krishna Gudipati 已提交
265 266 267 268
 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
 */
struct bfi_fcport_set_svc_params_req_s {
	struct bfi_mhdr_s  mh;		/*  msg header */
269
	__be16	   tx_bbcredit;	/*  Tx credits */
270 271
	u8	bb_scn;		/* BB_SC FC credit recovery */
	u8	rsvd;
K
Krishna Gudipati 已提交
272 273
};

274
/*
K
Krishna Gudipati 已提交
275 276 277 278 279 280 281
 * BFI_FCPORT_I2H_EVENT
 */
struct bfi_fcport_event_s {
	struct bfi_mhdr_s	mh;	/*  common msg header */
	struct bfa_port_link_s	link_state;
};

282
/*
K
Krishna Gudipati 已提交
283 284 285 286 287 288 289 290
 * BFI_FCPORT_I2H_TRUNK_SCN
 */
struct bfi_fcport_trunk_link_s {
	wwn_t			trunk_wwn;
	u8			fctl;		/* bfa_trunk_link_fctl_t */
	u8			state;		/* bfa_trunk_link_state_t */
	u8			speed;		/* bfa_port_speed_t */
	u8			rsvd;
291
	__be32		deskew;
K
Krishna Gudipati 已提交
292 293 294 295 296 297 298 299 300 301 302
};

#define BFI_FCPORT_MAX_LINKS	2
struct bfi_fcport_trunk_scn_s {
	struct bfi_mhdr_s	mh;
	u8			trunk_state;	/* bfa_trunk_state_t */
	u8			trunk_speed;	/* bfa_port_speed_t */
	u8			rsvd_a[2];
	struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
};

303
/*
K
Krishna Gudipati 已提交
304 305 306 307 308 309 310 311 312 313 314
 * fcport H2I message
 */
union bfi_fcport_h2i_msg_u {
	struct bfi_mhdr_s			*mhdr;
	struct bfi_fcport_enable_req_s		*penable;
	struct bfi_fcport_req_s			*pdisable;
	struct bfi_fcport_set_svc_params_req_s	*psetsvcparams;
	struct bfi_fcport_req_s			*pstatsget;
	struct bfi_fcport_req_s			*pstatsclear;
};

315
/*
K
Krishna Gudipati 已提交
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
 * fcport I2H message
 */
union bfi_fcport_i2h_msg_u {
	struct bfi_msg_s			*msg;
	struct bfi_fcport_rsp_s			*penable_rsp;
	struct bfi_fcport_rsp_s			*pdisable_rsp;
	struct bfi_fcport_rsp_s			*psetsvcparams_rsp;
	struct bfi_fcport_rsp_s			*pstatsget_rsp;
	struct bfi_fcport_rsp_s			*pstatsclear_rsp;
	struct bfi_fcport_event_s		*event;
	struct bfi_fcport_trunk_scn_s		*trunk_scn;
};

enum bfi_fcxp_h2i {
	BFI_FCXP_H2I_SEND_REQ = 1,
};

enum bfi_fcxp_i2h {
	BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
};

#define BFA_FCXP_MAX_SGES	2

339
/*
K
Krishna Gudipati 已提交
340 341 342 343
 * FCXP send request structure
 */
struct bfi_fcxp_send_req_s {
	struct bfi_mhdr_s  mh;		/*  Common msg header		    */
344 345 346
	__be16	fcxp_tag;	/*  driver request tag		    */
	__be16	max_frmsz;	/*  max send frame size	    */
	__be16	vf_id;		/*  vsan tag if applicable	    */
K
Krishna Gudipati 已提交
347 348 349 350 351 352
	u16	rport_fw_hndl;	/*  FW Handle for the remote port  */
	u8	 class;		/*  FC class used for req/rsp	    */
	u8	 rsp_timeout;	/*  timeout in secs, 0-no response */
	u8	 cts;		/*  continue sequence		    */
	u8	 lp_tag;	/*  lport tag			    */
	struct fchs_s	fchs;	/*  request FC header structure    */
353 354
	__be32	req_len;	/*  request payload length	    */
	__be32	rsp_maxlen;	/*  max response length expected   */
355 356
	struct bfi_alen_s req_alen;	/* request buffer	*/
	struct bfi_alen_s rsp_alen;	/* response buffer	*/
K
Krishna Gudipati 已提交
357 358
};

359
/*
K
Krishna Gudipati 已提交
360 361 362 363
 * FCXP send response structure
 */
struct bfi_fcxp_send_rsp_s {
	struct bfi_mhdr_s  mh;		/*  Common msg header		    */
364
	__be16	fcxp_tag;	/*  send request tag		    */
K
Krishna Gudipati 已提交
365 366
	u8	 req_status;	/*  request status		    */
	u8	 rsvd;
367 368
	__be32	rsp_len;	/*  actual response length	    */
	__be32	residue_len;	/*  residual response length	    */
K
Krishna Gudipati 已提交
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
	struct fchs_s	fchs;	/*  response FC header structure   */
};

enum bfi_uf_h2i {
	BFI_UF_H2I_BUF_POST = 1,
};

enum bfi_uf_i2h {
	BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
};

#define BFA_UF_MAX_SGES	2

struct bfi_uf_buf_post_s {
	struct bfi_mhdr_s  mh;		/*  Common msg header		*/
	u16	buf_tag;	/*  buffer tag			*/
385
	__be16	buf_len;	/*  total buffer length	*/
386
	struct bfi_alen_s alen;	/* buffer address/len pair	*/
K
Krishna Gudipati 已提交
387 388 389 390 391 392 393 394 395 396 397 398 399
};

struct bfi_uf_frm_rcvd_s {
	struct bfi_mhdr_s  mh;		/*  Common msg header		*/
	u16	buf_tag;	/*  buffer tag			*/
	u16	rsvd;
	u16	frm_len;	/*  received frame length	*/
	u16	xfr_len;	/*  tranferred length		*/
};

enum bfi_lps_h2i_msgs {
	BFI_LPS_H2I_LOGIN_REQ	= 1,
	BFI_LPS_H2I_LOGOUT_REQ	= 2,
400
	BFI_LPS_H2I_N2N_PID_REQ = 3,
K
Krishna Gudipati 已提交
401 402 403
};

enum bfi_lps_i2h_msgs {
404 405 406
	BFI_LPS_I2H_LOGIN_RSP	= BFA_I2HM(1),
	BFI_LPS_I2H_LOGOUT_RSP	= BFA_I2HM(2),
	BFI_LPS_I2H_CVL_EVENT	= BFA_I2HM(3),
K
Krishna Gudipati 已提交
407 408 409 410 411 412
};

struct bfi_lps_login_req_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u8		lp_tag;
	u8		alpa;
413
	__be16		pdu_size;
K
Krishna Gudipati 已提交
414 415 416 417
	wwn_t		pwwn;
	wwn_t		nwwn;
	u8		fdisc;
	u8		auth_en;
418
	u8		lps_role;
419
	u8		bb_scn;
K
Krishna Gudipati 已提交
420 421 422 423 424 425 426 427 428 429
};

struct bfi_lps_login_rsp_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u8		lp_tag;
	u8		status;
	u8		lsrjt_rsn;
	u8		lsrjt_expl;
	wwn_t		port_name;
	wwn_t		node_name;
430
	__be16		bb_credit;
K
Krishna Gudipati 已提交
431 432 433 434 435 436 437 438
	u8		f_port;
	u8		npiv_en;
	u32	lp_pid:24;
	u32	auth_req:8;
	mac_t		lp_mac;
	mac_t		fcf_mac;
	u8		ext_status;
	u8		brcd_switch;	/*  attached peer is brcd switch */
439 440
	u8		bb_scn;		/* atatched port's bb_scn */
	u8		resvd;
K
Krishna Gudipati 已提交
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
};

struct bfi_lps_logout_req_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u8		lp_tag;
	u8		rsvd[3];
	wwn_t		port_name;
};

struct bfi_lps_logout_rsp_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u8		lp_tag;
	u8		status;
	u8		rsvd[2];
};

struct bfi_lps_cvl_event_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u8		lp_tag;
	u8		rsvd[3];
};

463 464 465 466 467 468
struct bfi_lps_n2n_pid_req_s {
	struct bfi_mhdr_s	mh;	/*  common msg header		*/
	u8	lp_tag;
	u32	lp_pid:24;
};

K
Krishna Gudipati 已提交
469 470 471 472
union bfi_lps_h2i_msg_u {
	struct bfi_mhdr_s		*msg;
	struct bfi_lps_login_req_s	*login_req;
	struct bfi_lps_logout_req_s	*logout_req;
473
	struct bfi_lps_n2n_pid_req_s	*n2n_pid_req;
K
Krishna Gudipati 已提交
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
};

union bfi_lps_i2h_msg_u {
	struct bfi_msg_s		*msg;
	struct bfi_lps_login_rsp_s	*login_rsp;
	struct bfi_lps_logout_rsp_s	*logout_rsp;
	struct bfi_lps_cvl_event_s	*cvl_event;
};

enum bfi_rport_h2i_msgs {
	BFI_RPORT_H2I_CREATE_REQ = 1,
	BFI_RPORT_H2I_DELETE_REQ = 2,
	BFI_RPORT_H2I_SET_SPEED_REQ  = 3,
};

enum bfi_rport_i2h_msgs {
	BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
	BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
	BFI_RPORT_I2H_QOS_SCN    = BFA_I2HM(3),
};

struct bfi_rport_create_req_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u16	bfa_handle;	/*  host rport handle		*/
498
	__be16	max_frmsz;	/*  max rcv pdu size		*/
K
Krishna Gudipati 已提交
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
	u32	pid:24,	/*  remote port ID		*/
		lp_tag:8;	/*  local port tag		*/
	u32	local_pid:24,	/*  local port ID		*/
		cisc:8;
	u8	fc_class;	/*  supported FC classes	*/
	u8	vf_en;		/*  virtual fabric enable	*/
	u16	vf_id;		/*  virtual fabric ID		*/
};

struct bfi_rport_create_rsp_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u8		status;		/*  rport creation status	*/
	u8		rsvd[3];
	u16	bfa_handle;	/*  host rport handle		*/
	u16	fw_handle;	/*  firmware rport handle	*/
	struct bfa_rport_qos_attr_s qos_attr;  /* QoS Attributes */
};

struct bfa_rport_speed_req_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u16	fw_handle;	/*  firmware rport handle	*/
	u8		speed;		/*  rport's speed via RPSC	*/
	u8		rsvd;
};

struct bfi_rport_delete_req_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u16	fw_handle;	/*  firmware rport handle	*/
	u16	rsvd;
};

struct bfi_rport_delete_rsp_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u16	bfa_handle;	/*  host rport handle		*/
	u8		status;		/*  rport deletion status	*/
	u8		rsvd;
};

struct bfi_rport_qos_scn_s {
	struct bfi_mhdr_s  mh;		/*  common msg header		*/
	u16	bfa_handle;	/*  host rport handle		*/
	u16	rsvd;
	struct bfa_rport_qos_attr_s old_qos_attr;  /* Old QoS Attributes */
	struct bfa_rport_qos_attr_s new_qos_attr;  /* New QoS Attributes */
};

union bfi_rport_h2i_msg_u {
	struct bfi_msg_s		*msg;
	struct bfi_rport_create_req_s	*create_req;
	struct bfi_rport_delete_req_s	*delete_req;
	struct bfi_rport_speed_req_s	*speed_req;
};

union bfi_rport_i2h_msg_u {
	struct bfi_msg_s		*msg;
	struct bfi_rport_create_rsp_s	*create_rsp;
	struct bfi_rport_delete_rsp_s	*delete_rsp;
	struct bfi_rport_qos_scn_s	*qos_scn_evt;
};

/*
 * Initiator mode I-T nexus interface defines.
 */

563 564 565
enum bfi_itn_h2i {
	BFI_ITN_H2I_CREATE_REQ = 1,	/*  i-t nexus creation */
	BFI_ITN_H2I_DELETE_REQ = 2,	/*  i-t nexus deletion */
K
Krishna Gudipati 已提交
566 567
};

568 569 570 571
enum bfi_itn_i2h {
	BFI_ITN_I2H_CREATE_RSP = BFA_I2HM(1),
	BFI_ITN_I2H_DELETE_RSP = BFA_I2HM(2),
	BFI_ITN_I2H_SLER_EVENT = BFA_I2HM(3),
K
Krishna Gudipati 已提交
572 573
};

574
struct bfi_itn_create_req_s {
K
Krishna Gudipati 已提交
575 576 577 578 579
	struct bfi_mhdr_s  mh;		/*  common msg header		 */
	u16	fw_handle;	/*  f/w handle for itnim	 */
	u8	class;		/*  FC class for IO		 */
	u8	seq_rec;	/*  sequence recovery support	 */
	u8	msg_no;		/*  seq id of the msg		 */
580
	u8	role;
K
Krishna Gudipati 已提交
581 582
};

583
struct bfi_itn_create_rsp_s {
K
Krishna Gudipati 已提交
584 585 586 587 588 589
	struct bfi_mhdr_s  mh;		/*  common msg header		 */
	u16	bfa_handle;	/*  bfa handle for itnim	 */
	u8	status;		/*  fcp request status		 */
	u8	seq_id;		/*  seq id of the msg		 */
};

590
struct bfi_itn_delete_req_s {
K
Krishna Gudipati 已提交
591 592 593 594 595 596
	struct bfi_mhdr_s  mh;		/*  common msg header		 */
	u16	fw_handle;	/*  f/w itnim handle		 */
	u8	seq_id;		/*  seq id of the msg		 */
	u8	rsvd;
};

597
struct bfi_itn_delete_rsp_s {
K
Krishna Gudipati 已提交
598 599 600 601 602 603
	struct bfi_mhdr_s  mh;		/*  common msg header		 */
	u16	bfa_handle;	/*  bfa handle for itnim	 */
	u8	status;		/*  fcp request status		 */
	u8	seq_id;		/*  seq id of the msg		 */
};

604
struct bfi_itn_sler_event_s {
K
Krishna Gudipati 已提交
605 606 607 608 609
	struct bfi_mhdr_s  mh;		/*  common msg header		 */
	u16	bfa_handle;	/*  bfa handle for itnim	 */
	u16	rsvd;
};

610 611 612
union bfi_itn_h2i_msg_u {
	struct bfi_itn_create_req_s *create_req;
	struct bfi_itn_delete_req_s *delete_req;
K
Krishna Gudipati 已提交
613 614 615
	struct bfi_msg_s	*msg;
};

616 617 618 619
union bfi_itn_i2h_msg_u {
	struct bfi_itn_create_rsp_s *create_rsp;
	struct bfi_itn_delete_rsp_s *delete_rsp;
	struct bfi_itn_sler_event_s *sler_event;
K
Krishna Gudipati 已提交
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
	struct bfi_msg_s	*msg;
};

/*
 * Initiator mode IO interface defines.
 */

enum bfi_ioim_h2i {
	BFI_IOIM_H2I_IOABORT_REQ = 1,	/*  IO abort request	 */
	BFI_IOIM_H2I_IOCLEANUP_REQ = 2,	/*  IO cleanup request	 */
};

enum bfi_ioim_i2h {
	BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1),	/*  non-fp IO response	 */
	BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2),	/*  ABORT rsp	 */
};

637
/*
K
Krishna Gudipati 已提交
638 639 640 641 642 643
 * IO command DIF info
 */
struct bfi_ioim_dif_s {
	u32	dif_info[4];
};

644
/*
K
Krishna Gudipati 已提交
645 646 647 648 649 650 651 652 653 654
 * FCP IO messages overview
 *
 * @note
 * - Max CDB length supported is 64 bytes.
 * - SCSI Linked commands and SCSI bi-directional Commands not
 *	supported.
 *
 */
struct bfi_ioim_req_s {
	struct bfi_mhdr_s  mh;		/*  Common msg header		 */
655
	__be16	io_tag;		/*  I/O tag			 */
K
Krishna Gudipati 已提交
656 657 658
	u16	rport_hdl;	/*  itnim/rport firmware handle */
	struct fcp_cmnd_s	cmnd;	/*  IO request info	*/

659
	/*
K
Krishna Gudipati 已提交
660 661 662 663 664 665 666 667 668 669
	 * SG elements array within the IO request must be double word
	 * aligned. This aligment is required to optimize SGM setup for the IO.
	 */
	struct bfi_sge_s	sges[BFI_SGE_INLINE_MAX];
	u8	io_timeout;
	u8	dif_en;
	u8	rsvd_a[2];
	struct bfi_ioim_dif_s  dif;
};

670
/*
K
Krishna Gudipati 已提交
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755
 *	This table shows various IO status codes from firmware and their
 *	meaning. Host driver can use these status codes to further process
 *	IO completions.
 *
 *	BFI_IOIM_STS_OK		: IO completed with error free SCSI &
 *					transport status.
 *					 io-tag can be reused.
 *
 *	BFA_IOIM_STS_SCSI_ERR		: IO completed with scsi error.
 *	- io-tag can be reused.
 *
 *	BFI_IOIM_STS_HOST_ABORTED	: IO was aborted successfully due to
 *						host request.
 *					- io-tag cannot be reused yet.
 *
 *	BFI_IOIM_STS_ABORTED		: IO was aborted successfully
 *						internally by f/w.
 *					- io-tag cannot be reused yet.
 *
 *	BFI_IOIM_STS_TIMEDOUT	: IO timedout and ABTS/RRQ is happening
 *					in the firmware and
 *					- io-tag cannot be reused yet.
 *
 *	BFI_IOIM_STS_SQER_NEEDED	: Firmware could not recover the IO
 *					  with sequence level error
 *	logic and hence host needs to retry
 *					  this IO with a different IO tag
 *					- io-tag cannot be used yet.
 *
 *	BFI_IOIM_STS_NEXUS_ABORT	: Second Level Error Recovery from host
 *					  is required because 2 consecutive ABTS
 *					  timedout and host needs logout and
 *					  re-login with the target
 *					- io-tag cannot be used yet.
 *
 *	BFI_IOIM_STS_UNDERRUN	: IO completed with SCSI status good,
 *					  but the data tranferred is less than
 *					  the fcp data length in the command.
 *					  ex. SCSI INQUIRY where transferred
 *					  data length and residue count in FCP
 *					  response accounts for total fcp-dl
 *					  - io-tag can be reused.
 *
 *	BFI_IOIM_STS_OVERRUN	: IO completed with SCSI status good,
 *					  but the data transerred is more than
 *					  fcp data length in the command. ex.
 *					  TAPE IOs where blocks can of unequal
 *					  lengths.
 *					- io-tag can be reused.
 *
 *	BFI_IOIM_STS_RES_FREE	: Firmware has completed using io-tag
 *					  during abort process
 *					- io-tag can be reused.
 *
 *	BFI_IOIM_STS_PROTO_ERR	: Firmware detected a protocol error.
 *					  ex target sent more data than
 *					  requested, or there was data frame
 *					  loss and other reasons
 *					- io-tag cannot be used yet.
 *
 *	BFI_IOIM_STS_DIF_ERR	: Firwmare detected DIF error. ex: DIF
 *					CRC err or Ref Tag err or App tag err.
 *					- io-tag can be reused.
 *
 *	BFA_IOIM_STS_TSK_MGT_ABORT	: IO was aborted because of Task
 *					  Management command from the host
 *					  - io-tag can be reused.
 *
 *	BFI_IOIM_STS_UTAG		: Firmware does not know about this
 *					  io_tag.
 *					- io-tag can be reused.
 */
enum bfi_ioim_status {
	BFI_IOIM_STS_OK = 0,
	BFI_IOIM_STS_HOST_ABORTED = 1,
	BFI_IOIM_STS_ABORTED = 2,
	BFI_IOIM_STS_TIMEDOUT = 3,
	BFI_IOIM_STS_RES_FREE = 4,
	BFI_IOIM_STS_SQER_NEEDED = 5,
	BFI_IOIM_STS_PROTO_ERR = 6,
	BFI_IOIM_STS_UTAG = 7,
	BFI_IOIM_STS_PATHTOV = 8,
};

#define BFI_IOIM_SNSLEN	(256)
756
/*
K
Krishna Gudipati 已提交
757 758 759 760
 * I/O response message
 */
struct bfi_ioim_rsp_s {
	struct bfi_mhdr_s	mh;	/*  common msg header		*/
761
	__be16	io_tag;		/*  completed IO tag		 */
K
Krishna Gudipati 已提交
762 763 764 765 766 767 768 769
	u16	bfa_rport_hndl;	/*  releated rport handle	 */
	u8	io_status;	/*  IO completion status	 */
	u8	reuse_io_tag;	/*  IO tag can be reused	*/
	u16	abort_tag;	/*  host abort request tag	*/
	u8		scsi_status;	/*  scsi status from target	 */
	u8		sns_len;	/*  scsi sense length		 */
	u8		resid_flags;	/*  IO residue flags		 */
	u8		rsvd_a;
770
	__be32	residue;	/*  IO residual length in bytes */
K
Krishna Gudipati 已提交
771 772 773 774 775
	u32	rsvd_b[3];
};

struct bfi_ioim_abort_req_s {
	struct bfi_mhdr_s  mh;	/*  Common msg header  */
776
	__be16	io_tag;	/*  I/O tag	*/
K
Krishna Gudipati 已提交
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794
	u16	abort_tag;	/*  unique request tag */
};

/*
 * Initiator mode task management command interface defines.
 */

enum bfi_tskim_h2i {
	BFI_TSKIM_H2I_TM_REQ	= 1, /*  task-mgmt command	*/
	BFI_TSKIM_H2I_ABORT_REQ = 2, /*  task-mgmt command	*/
};

enum bfi_tskim_i2h {
	BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
};

struct bfi_tskim_req_s {
	struct bfi_mhdr_s  mh;	/*  Common msg header	*/
795
	__be16	tsk_tag;	/*  task management tag	*/
K
Krishna Gudipati 已提交
796
	u16	itn_fhdl;	/*  itn firmware handle	*/
797
	struct 	scsi_lun lun;	/*  LU number	*/
K
Krishna Gudipati 已提交
798 799 800 801 802 803 804
	u8	tm_flags;	/*  see enum fcp_tm_cmnd	*/
	u8	t_secs;	/*  Timeout value in seconds	*/
	u8	rsvd[2];
};

struct bfi_tskim_abortreq_s {
	struct bfi_mhdr_s  mh;	/*  Common msg header	*/
805
	__be16	tsk_tag;	/*  task management tag	*/
K
Krishna Gudipati 已提交
806 807 808 809 810 811 812 813 814 815 816 817
	u16	rsvd;
};

enum bfi_tskim_status {
	/*
	 * Following are FCP-4 spec defined status codes,
	 * **DO NOT CHANGE THEM **
	 */
	BFI_TSKIM_STS_OK	= 0,
	BFI_TSKIM_STS_NOT_SUPP = 4,
	BFI_TSKIM_STS_FAILED	= 5,

818
	/*
K
Krishna Gudipati 已提交
819 820 821 822 823 824 825 826
	 * Defined by BFA
	 */
	BFI_TSKIM_STS_TIMEOUT  = 10,	/*  TM request timedout	*/
	BFI_TSKIM_STS_ABORTED  = 11,	/*  Aborted on host request */
};

struct bfi_tskim_rsp_s {
	struct bfi_mhdr_s  mh;		/*  Common msg header		 */
827
	__be16	tsk_tag;	/*  task mgmt cmnd tag		 */
K
Krishna Gudipati 已提交
828 829 830 831 832 833
	u8	tsk_status;	/*  @ref bfi_tskim_status */
	u8	rsvd;
};

#pragma pack()

834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856
/*
 * Crossbow PCI MSI-X vector defines
 */
enum {
	BFI_MSIX_CPE_QMIN_CB = 0,
	BFI_MSIX_CPE_QMAX_CB = 7,
	BFI_MSIX_RME_QMIN_CB = 8,
	BFI_MSIX_RME_QMAX_CB = 15,
	BFI_MSIX_CB_MAX = 22,
};

/*
 * Catapult FC PCI MSI-X vector defines
 */
enum {
	BFI_MSIX_LPU_ERR_CT = 0,
	BFI_MSIX_CPE_QMIN_CT = 1,
	BFI_MSIX_CPE_QMAX_CT = 4,
	BFI_MSIX_RME_QMIN_CT = 5,
	BFI_MSIX_RME_QMAX_CT = 8,
	BFI_MSIX_CT_MAX = 9,
};

K
Krishna Gudipati 已提交
857
#endif /* __BFI_MS_H__ */