Linux Audio

Check our new training course

Loading...
v3.1
 
   1/*
   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_H__
  19#define __BFI_H__
  20
  21#include "bfa_defs.h"
  22#include "bfa_defs_svc.h"
  23
  24#pragma pack(1)
  25
  26/* Per dma segment max size */
  27#define BFI_MEM_DMA_SEG_SZ	(131072)
  28
  29/* Get number of dma segments required */
  30#define BFI_MEM_DMA_NSEGS(_num_reqs, _req_sz)				\
  31	((u16)(((((_num_reqs) * (_req_sz)) + BFI_MEM_DMA_SEG_SZ - 1) &	\
  32	 ~(BFI_MEM_DMA_SEG_SZ - 1)) / BFI_MEM_DMA_SEG_SZ))
  33
  34/* Get num dma reqs - that fit in a segment */
  35#define BFI_MEM_NREQS_SEG(_rqsz) (BFI_MEM_DMA_SEG_SZ / (_rqsz))
  36
  37/* Get segment num from tag */
  38#define BFI_MEM_SEG_FROM_TAG(_tag, _rqsz) ((_tag) / BFI_MEM_NREQS_SEG(_rqsz))
  39
  40/* Get dma req offset in a segment */
  41#define BFI_MEM_SEG_REQ_OFFSET(_tag, _sz)	\
  42	((_tag) - (BFI_MEM_SEG_FROM_TAG(_tag, _sz) * BFI_MEM_NREQS_SEG(_sz)))
  43
  44/*
  45 * BFI FW image type
  46 */
  47#define	BFI_FLASH_CHUNK_SZ			256	/*  Flash chunk size */
  48#define	BFI_FLASH_CHUNK_SZ_WORDS	(BFI_FLASH_CHUNK_SZ/sizeof(u32))
 
  49
  50/*
  51 * Msg header common to all msgs
  52 */
  53struct bfi_mhdr_s {
  54	u8		msg_class;	/*  @ref bfi_mclass_t		    */
  55	u8		msg_id;		/*  msg opcode with in the class   */
  56	union {
  57		struct {
  58			u8	qid;
  59			u8	fn_lpu;	/*  msg destination		    */
  60		} h2i;
  61		u16	i2htok;	/*  token in msgs to host	    */
  62	} mtag;
  63};
  64
  65#define bfi_fn_lpu(__fn, __lpu)	((__fn) << 1 | (__lpu))
  66#define bfi_mhdr_2_fn(_mh)	((_mh)->mtag.h2i.fn_lpu >> 1)
  67
  68#define bfi_h2i_set(_mh, _mc, _op, _fn_lpu) do {		\
  69	(_mh).msg_class		= (_mc);      \
  70	(_mh).msg_id		= (_op);      \
  71	(_mh).mtag.h2i.fn_lpu	= (_fn_lpu);      \
  72} while (0)
  73
  74#define bfi_i2h_set(_mh, _mc, _op, _i2htok) do {		\
  75	(_mh).msg_class		= (_mc);      \
  76	(_mh).msg_id		= (_op);      \
  77	(_mh).mtag.i2htok	= (_i2htok);      \
  78} while (0)
  79
  80/*
  81 * Message opcodes: 0-127 to firmware, 128-255 to host
  82 */
  83#define BFI_I2H_OPCODE_BASE	128
  84#define BFA_I2HM(_x)		((_x) + BFI_I2H_OPCODE_BASE)
  85
  86/*
  87 ****************************************************************************
  88 *
  89 * Scatter Gather Element and Page definition
  90 *
  91 ****************************************************************************
  92 */
  93
  94#define BFI_SGE_INLINE	1
  95#define BFI_SGE_INLINE_MAX	(BFI_SGE_INLINE + 1)
  96
  97/*
  98 * SG Flags
  99 */
 100enum {
 101	BFI_SGE_DATA		= 0,	/*  data address, not last	     */
 102	BFI_SGE_DATA_CPL	= 1,	/*  data addr, last in current page */
 103	BFI_SGE_DATA_LAST	= 3,	/*  data address, last		     */
 104	BFI_SGE_LINK		= 2,	/*  link address		     */
 105	BFI_SGE_PGDLEN		= 2,	/*  cumulative data length for page */
 106};
 107
 108/*
 109 * DMA addresses
 110 */
 111union bfi_addr_u {
 112	struct {
 113		__be32	addr_lo;
 114		__be32	addr_hi;
 115	} a32;
 116};
 117
 118/*
 119 * Scatter Gather Element used for fast-path IO requests
 120 */
 121struct bfi_sge_s {
 122#ifdef __BIG_ENDIAN
 123	u32	flags:2,
 124			rsvd:2,
 125			sg_len:28;
 126#else
 127	u32	sg_len:28,
 128			rsvd:2,
 129			flags:2;
 130#endif
 131	union bfi_addr_u sga;
 132};
 133
 134/**
 135 * Generic DMA addr-len pair.
 136 */
 137struct bfi_alen_s {
 138	union bfi_addr_u	al_addr;	/* DMA addr of buffer	*/
 139	u32			al_len;		/* length of buffer	*/
 140};
 141
 142/*
 143 * Scatter Gather Page
 144 */
 145#define BFI_SGPG_DATA_SGES		7
 146#define BFI_SGPG_SGES_MAX		(BFI_SGPG_DATA_SGES + 1)
 147#define BFI_SGPG_RSVD_WD_LEN	8
 148struct bfi_sgpg_s {
 149	struct bfi_sge_s sges[BFI_SGPG_SGES_MAX];
 150	u32	rsvd[BFI_SGPG_RSVD_WD_LEN];
 151};
 152
 153/* FCP module definitions */
 154#define BFI_IO_MAX	(2000)
 155#define BFI_IOIM_SNSLEN	(256)
 156#define BFI_IOIM_SNSBUF_SEGS	\
 157	BFI_MEM_DMA_NSEGS(BFI_IO_MAX, BFI_IOIM_SNSLEN)
 158
 159/*
 160 * Large Message structure - 128 Bytes size Msgs
 161 */
 162#define BFI_LMSG_SZ		128
 163#define BFI_LMSG_PL_WSZ	\
 164			((BFI_LMSG_SZ - sizeof(struct bfi_mhdr_s)) / 4)
 165
 166struct bfi_msg_s {
 167	struct bfi_mhdr_s mhdr;
 168	u32	pl[BFI_LMSG_PL_WSZ];
 169};
 170
 171/*
 172 * Mailbox message structure
 173 */
 174#define BFI_MBMSG_SZ		7
 175struct bfi_mbmsg_s {
 176	struct bfi_mhdr_s	mh;
 177	u32		pl[BFI_MBMSG_SZ];
 178};
 179
 180/*
 181 * Supported PCI function class codes (personality)
 182 */
 183enum bfi_pcifn_class {
 184	BFI_PCIFN_CLASS_FC  = 0x0c04,
 185	BFI_PCIFN_CLASS_ETH = 0x0200,
 186};
 187
 188/*
 189 * Message Classes
 190 */
 191enum bfi_mclass {
 192	BFI_MC_IOC		= 1,	/*  IO Controller (IOC)	    */
 193	BFI_MC_DIAG		= 2,    /*  Diagnostic Msgs            */
 194	BFI_MC_FLASH		= 3,	/*  Flash message class	*/
 195	BFI_MC_CEE		= 4,	/*  CEE	*/
 196	BFI_MC_FCPORT		= 5,	/*  FC port			    */
 197	BFI_MC_IOCFC		= 6,	/*  FC - IO Controller (IOC)	    */
 198	BFI_MC_ABLK		= 7,	/*  ASIC block configuration	    */
 199	BFI_MC_UF		= 8,	/*  Unsolicited frame receive	    */
 200	BFI_MC_FCXP		= 9,	/*  FC Transport		    */
 201	BFI_MC_LPS		= 10,	/*  lport fc login services	    */
 202	BFI_MC_RPORT		= 11,	/*  Remote port		    */
 203	BFI_MC_ITN		= 12,	/*  I-T nexus (Initiator mode)	    */
 204	BFI_MC_IOIM_READ	= 13,	/*  read IO (Initiator mode)	    */
 205	BFI_MC_IOIM_WRITE	= 14,	/*  write IO (Initiator mode)	    */
 206	BFI_MC_IOIM_IO		= 15,	/*  IO (Initiator mode)	    */
 207	BFI_MC_IOIM		= 16,	/*  IO (Initiator mode)	    */
 208	BFI_MC_IOIM_IOCOM	= 17,	/*  good IO completion		    */
 209	BFI_MC_TSKIM		= 18,	/*  Initiator Task management	    */
 210	BFI_MC_PORT		= 21,	/*  Physical port		    */
 211	BFI_MC_SFP		= 22,	/*  SFP module	*/
 212	BFI_MC_PHY		= 25,   /*  External PHY message class	*/
 213	BFI_MC_MAX		= 32
 
 214};
 215
 216#define BFI_IOC_MAX_CQS		4
 217#define BFI_IOC_MAX_CQS_ASIC	8
 218#define BFI_IOC_MSGLEN_MAX	32	/* 32 bytes */
 219
 220/*
 221 *----------------------------------------------------------------------
 222 *				IOC
 223 *----------------------------------------------------------------------
 224 */
 225
 226/*
 227 * Different asic generations
 228 */
 229enum bfi_asic_gen {
 230	BFI_ASIC_GEN_CB		= 1,	/* crossbow 8G FC		*/
 231	BFI_ASIC_GEN_CT		= 2,	/* catapult 8G FC or 10G CNA	*/
 232	BFI_ASIC_GEN_CT2	= 3,	/* catapult-2 16G FC or 10G CNA	*/
 233};
 234
 235enum bfi_asic_mode {
 236	BFI_ASIC_MODE_FC	= 1,	/* FC upto 8G speed		*/
 237	BFI_ASIC_MODE_FC16	= 2,	/* FC upto 16G speed		*/
 238	BFI_ASIC_MODE_ETH	= 3,	/* Ethernet ports		*/
 239	BFI_ASIC_MODE_COMBO	= 4,	/* FC 16G and Ethernet 10G port	*/
 240};
 241
 242enum bfi_ioc_h2i_msgs {
 243	BFI_IOC_H2I_ENABLE_REQ		= 1,
 244	BFI_IOC_H2I_DISABLE_REQ		= 2,
 245	BFI_IOC_H2I_GETATTR_REQ		= 3,
 246	BFI_IOC_H2I_DBG_SYNC		= 4,
 247	BFI_IOC_H2I_DBG_DUMP		= 5,
 248};
 249
 250enum bfi_ioc_i2h_msgs {
 251	BFI_IOC_I2H_ENABLE_REPLY	= BFA_I2HM(1),
 252	BFI_IOC_I2H_DISABLE_REPLY	= BFA_I2HM(2),
 253	BFI_IOC_I2H_GETATTR_REPLY	= BFA_I2HM(3),
 254	BFI_IOC_I2H_HBEAT		= BFA_I2HM(4),
 255	BFI_IOC_I2H_ACQ_ADDR_REPLY	= BFA_I2HM(5),
 256};
 257
 258/*
 259 * BFI_IOC_H2I_GETATTR_REQ message
 260 */
 261struct bfi_ioc_getattr_req_s {
 262	struct bfi_mhdr_s	mh;
 263	union bfi_addr_u	attr_addr;
 264};
 265
 
 266struct bfi_ioc_attr_s {
 267	wwn_t		mfg_pwwn;	/*  Mfg port wwn	   */
 268	wwn_t		mfg_nwwn;	/*  Mfg node wwn	   */
 269	mac_t		mfg_mac;	/*  Mfg mac		   */
 270	u8		port_mode;	/* bfi_port_mode	   */
 271	u8		rsvd_a;
 272	wwn_t		pwwn;
 273	wwn_t		nwwn;
 274	mac_t		mac;		/*  PBC or Mfg mac	   */
 275	u16	rsvd_b;
 276	mac_t		fcoe_mac;
 277	u16	rsvd_c;
 278	char		brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
 279	u8		pcie_gen;
 280	u8		pcie_lanes_orig;
 281	u8		pcie_lanes;
 282	u8		rx_bbcredit;	/*  receive buffer credits */
 283	u32	adapter_prop;	/*  adapter properties     */
 284	u16	maxfrsize;	/*  max receive frame size */
 285	char		asic_rev;
 286	u8		rsvd_d;
 287	char		fw_version[BFA_VERSION_LEN];
 288	char		optrom_version[BFA_VERSION_LEN];
 289	struct		bfa_mfg_vpd_s	vpd;
 290	u32	card_type;	/*  card type			*/
 
 
 
 
 291};
 292
 293/*
 294 * BFI_IOC_I2H_GETATTR_REPLY message
 295 */
 296struct bfi_ioc_getattr_reply_s {
 297	struct	bfi_mhdr_s	mh;	/*  Common msg header		*/
 298	u8			status;	/*  cfg reply status		*/
 299	u8			rsvd[3];
 300};
 301
 302/*
 303 * Firmware memory page offsets
 304 */
 305#define BFI_IOC_SMEM_PG0_CB	(0x40)
 306#define BFI_IOC_SMEM_PG0_CT	(0x180)
 307
 308/*
 309 * Firmware statistic offset
 310 */
 311#define BFI_IOC_FWSTATS_OFF	(0x6B40)
 312#define BFI_IOC_FWSTATS_SZ	(4096)
 313
 314/*
 315 * Firmware trace offset
 316 */
 317#define BFI_IOC_TRC_OFF		(0x4b00)
 318#define BFI_IOC_TRC_ENTS	256
 319
 320#define BFI_IOC_FW_SIGNATURE	(0xbfadbfad)
 
 321#define BFI_IOC_MD5SUM_SZ	4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 322struct bfi_ioc_image_hdr_s {
 323	u32	signature;	/* constant signature		*/
 324	u8	asic_gen;	/* asic generation		*/
 325	u8	asic_mode;
 326	u8	port0_mode;	/* device mode for port 0	*/
 327	u8	port1_mode;	/* device mode for port 1	*/
 328	u32	exec;		/* exec vector			*/
 329	u32	bootenv;	/* fimware boot env		*/
 330	u32	rsvd_b[4];
 
 331	u32	md5sum[BFI_IOC_MD5SUM_SZ];
 332};
 333
 
 
 
 
 
 
 
 334#define BFI_FWBOOT_DEVMODE_OFF		4
 335#define BFI_FWBOOT_TYPE_OFF		8
 336#define BFI_FWBOOT_ENV_OFF		12
 337#define BFI_FWBOOT_DEVMODE(__asic_gen, __asic_mode, __p0_mode, __p1_mode) \
 338	(((u32)(__asic_gen)) << 24 |		\
 339	 ((u32)(__asic_mode)) << 16 |		\
 340	 ((u32)(__p0_mode)) << 8 |		\
 341	 ((u32)(__p1_mode)))
 342
 
 
 
 
 
 
 343#define BFI_FWBOOT_TYPE_NORMAL	0
 344#define BFI_FWBOOT_TYPE_MEMTEST	2
 345#define BFI_FWBOOT_ENV_OS       0
 346
 347enum bfi_port_mode {
 348	BFI_PORT_MODE_FC	= 1,
 349	BFI_PORT_MODE_ETH	= 2,
 350};
 351
 352struct bfi_ioc_hbeat_s {
 353	struct bfi_mhdr_s  mh;		/*  common msg header		*/
 354	u32	   hb_count;	/*  current heart beat count	*/
 355};
 356
 357/*
 358 * IOC hardware/firmware state
 359 */
 360enum bfi_ioc_state {
 361	BFI_IOC_UNINIT		= 0,	/*  not initialized		     */
 362	BFI_IOC_INITING		= 1,	/*  h/w is being initialized	     */
 363	BFI_IOC_HWINIT		= 2,	/*  h/w is initialized		     */
 364	BFI_IOC_CFG		= 3,	/*  IOC configuration in progress   */
 365	BFI_IOC_OP		= 4,	/*  IOC is operational		     */
 366	BFI_IOC_DISABLING	= 5,	/*  IOC is being disabled	     */
 367	BFI_IOC_DISABLED	= 6,	/*  IOC is disabled		     */
 368	BFI_IOC_CFG_DISABLED	= 7,	/*  IOC is being disabled;transient */
 369	BFI_IOC_FAIL		= 8,	/*  IOC heart-beat failure	     */
 370	BFI_IOC_MEMTEST		= 9,	/*  IOC is doing memtest	     */
 371};
 372
 
 
 
 
 373#define BFI_IOC_ENDIAN_SIG  0x12345678
 374
 375enum {
 376	BFI_ADAPTER_TYPE_FC	= 0x01,		/*  FC adapters	   */
 377	BFI_ADAPTER_TYPE_MK	= 0x0f0000,	/*  adapter type mask     */
 378	BFI_ADAPTER_TYPE_SH	= 16,	        /*  adapter type shift    */
 379	BFI_ADAPTER_NPORTS_MK	= 0xff00,	/*  number of ports mask  */
 380	BFI_ADAPTER_NPORTS_SH	= 8,	        /*  number of ports shift */
 381	BFI_ADAPTER_SPEED_MK	= 0xff,		/*  adapter speed mask    */
 382	BFI_ADAPTER_SPEED_SH	= 0,	        /*  adapter speed shift   */
 383	BFI_ADAPTER_PROTO	= 0x100000,	/*  prototype adapaters   */
 384	BFI_ADAPTER_TTV		= 0x200000,	/*  TTV debug capable     */
 385	BFI_ADAPTER_UNSUPP	= 0x400000,	/*  unknown adapter type  */
 386};
 387
 388#define BFI_ADAPTER_GETP(__prop, __adap_prop)			\
 389	(((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >>	\
 390		BFI_ADAPTER_ ## __prop ## _SH)
 391#define BFI_ADAPTER_SETP(__prop, __val)				\
 392	((__val) << BFI_ADAPTER_ ## __prop ## _SH)
 393#define BFI_ADAPTER_IS_PROTO(__adap_type)			\
 394	((__adap_type) & BFI_ADAPTER_PROTO)
 395#define BFI_ADAPTER_IS_TTV(__adap_type)				\
 396	((__adap_type) & BFI_ADAPTER_TTV)
 397#define BFI_ADAPTER_IS_UNSUPP(__adap_type)			\
 398	((__adap_type) & BFI_ADAPTER_UNSUPP)
 399#define BFI_ADAPTER_IS_SPECIAL(__adap_type)			\
 400	((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO |	\
 401			BFI_ADAPTER_UNSUPP))
 402
 403/*
 404 * BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
 405 */
 406struct bfi_ioc_ctrl_req_s {
 407	struct bfi_mhdr_s	mh;
 408	u16			clscode;
 409	u16			rsvd;
 410	u32		tv_sec;
 411};
 412#define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
 413#define bfi_ioc_disable_req_t struct bfi_ioc_ctrl_req_s;
 414
 415/*
 416 * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
 417 */
 418struct bfi_ioc_ctrl_reply_s {
 419	struct bfi_mhdr_s	mh;		/*  Common msg header     */
 420	u8			status;		/*  enable/disable status */
 421	u8			port_mode;	/*  bfa_mode_s	*/
 422	u8			cap_bm;		/*  capability bit mask */
 423	u8			rsvd;
 424};
 425#define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
 426#define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
 427
 428#define BFI_IOC_MSGSZ   8
 429/*
 430 * H2I Messages
 431 */
 432union bfi_ioc_h2i_msg_u {
 433	struct bfi_mhdr_s		mh;
 434	struct bfi_ioc_ctrl_req_s	enable_req;
 435	struct bfi_ioc_ctrl_req_s	disable_req;
 436	struct bfi_ioc_getattr_req_s	getattr_req;
 437	u32			mboxmsg[BFI_IOC_MSGSZ];
 438};
 439
 440/*
 441 * I2H Messages
 442 */
 443union bfi_ioc_i2h_msg_u {
 444	struct bfi_mhdr_s		mh;
 445	struct bfi_ioc_ctrl_reply_s	fw_event;
 446	u32			mboxmsg[BFI_IOC_MSGSZ];
 447};
 448
 449
 450/*
 451 *----------------------------------------------------------------------
 452 *				PBC
 453 *----------------------------------------------------------------------
 454 */
 455
 456#define BFI_PBC_MAX_BLUNS	8
 457#define BFI_PBC_MAX_VPORTS	16
 458#define BFI_PBC_PORT_DISABLED	2
 459
 460/*
 461 * PBC boot lun configuration
 462 */
 463struct bfi_pbc_blun_s {
 464	wwn_t		tgt_pwwn;
 465	struct scsi_lun	tgt_lun;
 466};
 467
 468/*
 469 * PBC virtual port configuration
 470 */
 471struct bfi_pbc_vport_s {
 472	wwn_t		vp_pwwn;
 473	wwn_t		vp_nwwn;
 474};
 475
 476/*
 477 * BFI pre-boot configuration information
 478 */
 479struct bfi_pbc_s {
 480	u8		port_enabled;
 481	u8		boot_enabled;
 482	u8		nbluns;
 483	u8		nvports;
 484	u8		port_speed;
 485	u8		rsvd_a;
 486	u16	hss;
 487	wwn_t		pbc_pwwn;
 488	wwn_t		pbc_nwwn;
 489	struct bfi_pbc_blun_s blun[BFI_PBC_MAX_BLUNS];
 490	struct bfi_pbc_vport_s vport[BFI_PBC_MAX_VPORTS];
 491};
 492
 493/*
 494 *----------------------------------------------------------------------
 495 *				MSGQ
 496 *----------------------------------------------------------------------
 497 */
 498#define BFI_MSGQ_FULL(_q)	(((_q->pi + 1) % _q->q_depth) == _q->ci)
 499#define BFI_MSGQ_EMPTY(_q)	(_q->pi == _q->ci)
 500#define BFI_MSGQ_UPDATE_CI(_q)	(_q->ci = (_q->ci + 1) % _q->q_depth)
 501#define BFI_MSGQ_UPDATE_PI(_q)	(_q->pi = (_q->pi + 1) % _q->q_depth)
 502
 503/* q_depth must be power of 2 */
 504#define BFI_MSGQ_FREE_CNT(_q)	((_q->ci - _q->pi - 1) & (_q->q_depth - 1))
 505
 506enum bfi_msgq_h2i_msgs_e {
 507	BFI_MSGQ_H2I_INIT_REQ	= 1,
 508	BFI_MSGQ_H2I_DOORBELL	= 2,
 509	BFI_MSGQ_H2I_SHUTDOWN	= 3,
 510};
 511
 512enum bfi_msgq_i2h_msgs_e {
 513	BFI_MSGQ_I2H_INIT_RSP	= 1,
 514	BFI_MSGQ_I2H_DOORBELL	= 2,
 515};
 516
 517
 518/* Messages(commands/responsed/AENS will have the following header */
 519struct bfi_msgq_mhdr_s {
 520	u8		msg_class;
 521	u8		msg_id;
 522	u16	msg_token;
 523	u16	num_entries;
 524	u8		enet_id;
 525	u8		rsvd[1];
 526};
 527
 528#define bfi_msgq_mhdr_set(_mh, _mc, _mid, _tok, _enet_id) do {        \
 529	(_mh).msg_class		= (_mc);      \
 530	(_mh).msg_id		= (_mid);      \
 531	(_mh).msg_token		= (_tok);      \
 532	(_mh).enet_id		= (_enet_id);      \
 533} while (0)
 534
 535/*
 536 * Mailbox  for messaging interface
 537 *
 538*/
 539#define BFI_MSGQ_CMD_ENTRY_SIZE		(64)    /* TBD */
 540#define BFI_MSGQ_RSP_ENTRY_SIZE		(64)    /* TBD */
 541#define BFI_MSGQ_MSG_SIZE_MAX		(2048)  /* TBD */
 542
 543struct bfi_msgq_s {
 544	union bfi_addr_u addr;
 545	u16 q_depth;     /* Total num of entries in the queue */
 546	u8 rsvd[2];
 547};
 548
 549/* BFI_ENET_MSGQ_CFG_REQ TBD init or cfg? */
 550struct bfi_msgq_cfg_req_s {
 551	struct bfi_mhdr_s mh;
 552	struct bfi_msgq_s cmdq;
 553	struct bfi_msgq_s rspq;
 554};
 555
 556/* BFI_ENET_MSGQ_CFG_RSP */
 557struct bfi_msgq_cfg_rsp_s {
 558	struct bfi_mhdr_s mh;
 559	u8 cmd_status;
 560	u8 rsvd[3];
 561};
 562
 563
 564/* BFI_MSGQ_H2I_DOORBELL */
 565struct bfi_msgq_h2i_db_s {
 566	struct bfi_mhdr_s mh;
 567	u16 cmdq_pi;
 568	u16 rspq_ci;
 569};
 570
 571/* BFI_MSGQ_I2H_DOORBELL */
 572struct bfi_msgq_i2h_db_s {
 573	struct bfi_mhdr_s mh;
 574	u16 rspq_pi;
 575	u16 cmdq_ci;
 576};
 577
 578#pragma pack()
 579
 580/* BFI port specific */
 581#pragma pack(1)
 582
 583enum bfi_port_h2i {
 584	BFI_PORT_H2I_ENABLE_REQ         = (1),
 585	BFI_PORT_H2I_DISABLE_REQ        = (2),
 586	BFI_PORT_H2I_GET_STATS_REQ      = (3),
 587	BFI_PORT_H2I_CLEAR_STATS_REQ    = (4),
 588};
 589
 590enum bfi_port_i2h {
 591	BFI_PORT_I2H_ENABLE_RSP         = BFA_I2HM(1),
 592	BFI_PORT_I2H_DISABLE_RSP        = BFA_I2HM(2),
 593	BFI_PORT_I2H_GET_STATS_RSP      = BFA_I2HM(3),
 594	BFI_PORT_I2H_CLEAR_STATS_RSP    = BFA_I2HM(4),
 595};
 596
 597/*
 598 * Generic REQ type
 599 */
 600struct bfi_port_generic_req_s {
 601	struct bfi_mhdr_s  mh;          /*  msg header		*/
 602	u32     msgtag;         /*  msgtag for reply                */
 603	u32     rsvd;
 604};
 605
 606/*
 607 * Generic RSP type
 608 */
 609struct bfi_port_generic_rsp_s {
 610	struct bfi_mhdr_s  mh;          /*  common msg header               */
 611	u8              status;         /*  port enable status              */
 612	u8              rsvd[3];
 613	u32     msgtag;         /*  msgtag for reply                */
 614};
 615
 616/*
 617 * BFI_PORT_H2I_GET_STATS_REQ
 618 */
 619struct bfi_port_get_stats_req_s {
 620	struct bfi_mhdr_s  mh;          /*  common msg header               */
 621	union bfi_addr_u   dma_addr;
 622};
 623
 624union bfi_port_h2i_msg_u {
 625	struct bfi_mhdr_s               mh;
 626	struct bfi_port_generic_req_s   enable_req;
 627	struct bfi_port_generic_req_s   disable_req;
 628	struct bfi_port_get_stats_req_s getstats_req;
 629	struct bfi_port_generic_req_s   clearstats_req;
 630};
 631
 632union bfi_port_i2h_msg_u {
 633	struct bfi_mhdr_s               mh;
 634	struct bfi_port_generic_rsp_s   enable_rsp;
 635	struct bfi_port_generic_rsp_s   disable_rsp;
 636	struct bfi_port_generic_rsp_s   getstats_rsp;
 637	struct bfi_port_generic_rsp_s   clearstats_rsp;
 638};
 639
 640/*
 641 *----------------------------------------------------------------------
 642 *				ABLK
 643 *----------------------------------------------------------------------
 644 */
 645enum bfi_ablk_h2i_msgs_e {
 646	BFI_ABLK_H2I_QUERY		= 1,
 647	BFI_ABLK_H2I_ADPT_CONFIG	= 2,
 648	BFI_ABLK_H2I_PORT_CONFIG	= 3,
 649	BFI_ABLK_H2I_PF_CREATE		= 4,
 650	BFI_ABLK_H2I_PF_DELETE		= 5,
 651	BFI_ABLK_H2I_PF_UPDATE		= 6,
 652	BFI_ABLK_H2I_OPTROM_ENABLE	= 7,
 653	BFI_ABLK_H2I_OPTROM_DISABLE	= 8,
 654};
 655
 656enum bfi_ablk_i2h_msgs_e {
 657	BFI_ABLK_I2H_QUERY		= BFA_I2HM(BFI_ABLK_H2I_QUERY),
 658	BFI_ABLK_I2H_ADPT_CONFIG	= BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG),
 659	BFI_ABLK_I2H_PORT_CONFIG	= BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG),
 660	BFI_ABLK_I2H_PF_CREATE		= BFA_I2HM(BFI_ABLK_H2I_PF_CREATE),
 661	BFI_ABLK_I2H_PF_DELETE		= BFA_I2HM(BFI_ABLK_H2I_PF_DELETE),
 662	BFI_ABLK_I2H_PF_UPDATE		= BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE),
 663	BFI_ABLK_I2H_OPTROM_ENABLE	= BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE),
 664	BFI_ABLK_I2H_OPTROM_DISABLE	= BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE),
 665};
 666
 667/* BFI_ABLK_H2I_QUERY */
 668struct bfi_ablk_h2i_query_s {
 669	struct bfi_mhdr_s	mh;
 670	union bfi_addr_u	addr;
 671};
 672
 673/* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */
 674struct bfi_ablk_h2i_cfg_req_s {
 675	struct bfi_mhdr_s	mh;
 676	u8			mode;
 677	u8			port;
 678	u8			max_pf;
 679	u8			max_vf;
 680};
 681
 682/*
 683 * BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE,
 684 */
 685struct bfi_ablk_h2i_pf_req_s {
 686	struct bfi_mhdr_s	mh;
 687	u8			pcifn;
 688	u8			port;
 689	u16			pers;
 690	u32			bw;
 
 691};
 692
 693/* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */
 694struct bfi_ablk_h2i_optrom_s {
 695	struct bfi_mhdr_s	mh;
 696};
 697
 698/*
 699 * BFI_ABLK_I2H_QUERY
 700 * BFI_ABLK_I2H_PORT_CONFIG
 701 * BFI_ABLK_I2H_PF_CREATE
 702 * BFI_ABLK_I2H_PF_DELETE
 703 * BFI_ABLK_I2H_PF_UPDATE
 704 * BFI_ABLK_I2H_OPTROM_ENABLE
 705 * BFI_ABLK_I2H_OPTROM_DISABLE
 706 */
 707struct bfi_ablk_i2h_rsp_s {
 708	struct bfi_mhdr_s	mh;
 709	u8			status;
 710	u8			pcifn;
 711	u8			port_mode;
 712};
 713
 714
 715/*
 716 *	CEE module specific messages
 717 */
 718
 719/* Mailbox commands from host to firmware */
 720enum bfi_cee_h2i_msgs_e {
 721	BFI_CEE_H2I_GET_CFG_REQ = 1,
 722	BFI_CEE_H2I_RESET_STATS = 2,
 723	BFI_CEE_H2I_GET_STATS_REQ = 3,
 724};
 725
 726enum bfi_cee_i2h_msgs_e {
 727	BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
 728	BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
 729	BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
 730};
 731
 732/*
 733 * H2I command structure for resetting the stats
 734 */
 735struct bfi_cee_reset_stats_s {
 736	struct bfi_mhdr_s  mh;
 737};
 738
 739/*
 740 * Get configuration  command from host
 741 */
 742struct bfi_cee_get_req_s {
 743	struct bfi_mhdr_s	mh;
 744	union bfi_addr_u	dma_addr;
 745};
 746
 747/*
 748 * Reply message from firmware
 749 */
 750struct bfi_cee_get_rsp_s {
 751	struct bfi_mhdr_s	mh;
 752	u8			cmd_status;
 753	u8			rsvd[3];
 754};
 755
 756/*
 757 * Reply message from firmware
 758 */
 759struct bfi_cee_stats_rsp_s {
 760	struct bfi_mhdr_s	mh;
 761	u8			cmd_status;
 762	u8			rsvd[3];
 763};
 764
 765/* Mailbox message structures from firmware to host	*/
 766union bfi_cee_i2h_msg_u {
 767	struct bfi_mhdr_s		mh;
 768	struct bfi_cee_get_rsp_s	get_rsp;
 769	struct bfi_cee_stats_rsp_s	stats_rsp;
 770};
 771
 772/*
 773 * SFP related
 774 */
 775
 776enum bfi_sfp_h2i_e {
 777	BFI_SFP_H2I_SHOW	= 1,
 778	BFI_SFP_H2I_SCN		= 2,
 779};
 780
 781enum bfi_sfp_i2h_e {
 782	BFI_SFP_I2H_SHOW = BFA_I2HM(BFI_SFP_H2I_SHOW),
 783	BFI_SFP_I2H_SCN	 = BFA_I2HM(BFI_SFP_H2I_SCN),
 784};
 785
 786/*
 787 *	SFP state change notification
 788 */
 789struct bfi_sfp_scn_s {
 790	struct bfi_mhdr_s mhr;	/* host msg header        */
 791	u8	event;
 792	u8	sfpid;
 793	u8	pomlvl;	/* pom level: normal/warning/alarm */
 794	u8	is_elb;	/* e-loopback */
 795};
 796
 797/*
 798 *	SFP state
 799 */
 800enum bfa_sfp_stat_e {
 801	BFA_SFP_STATE_INIT	= 0,	/* SFP state is uninit	*/
 802	BFA_SFP_STATE_REMOVED	= 1,	/* SFP is removed	*/
 803	BFA_SFP_STATE_INSERTED	= 2,	/* SFP is inserted	*/
 804	BFA_SFP_STATE_VALID	= 3,	/* SFP is valid		*/
 805	BFA_SFP_STATE_UNSUPPORT	= 4,	/* SFP is unsupport	*/
 806	BFA_SFP_STATE_FAILED	= 5,	/* SFP i2c read fail	*/
 807};
 808
 809/*
 810 *  SFP memory access type
 811 */
 812enum bfi_sfp_mem_e {
 813	BFI_SFP_MEM_ALL		= 0x1,  /* access all data field */
 814	BFI_SFP_MEM_DIAGEXT	= 0x2,  /* access diag ext data field only */
 815};
 816
 817struct bfi_sfp_req_s {
 818	struct bfi_mhdr_s	mh;
 819	u8			memtype;
 820	u8			rsvd[3];
 821	struct bfi_alen_s	alen;
 822};
 823
 824struct bfi_sfp_rsp_s {
 825	struct bfi_mhdr_s	mh;
 826	u8			status;
 827	u8			state;
 828	u8			rsvd[2];
 829};
 830
 831/*
 832 *	FLASH module specific
 833 */
 834enum bfi_flash_h2i_msgs {
 835	BFI_FLASH_H2I_QUERY_REQ = 1,
 836	BFI_FLASH_H2I_ERASE_REQ = 2,
 837	BFI_FLASH_H2I_WRITE_REQ = 3,
 838	BFI_FLASH_H2I_READ_REQ = 4,
 839	BFI_FLASH_H2I_BOOT_VER_REQ = 5,
 840};
 841
 842enum bfi_flash_i2h_msgs {
 843	BFI_FLASH_I2H_QUERY_RSP = BFA_I2HM(1),
 844	BFI_FLASH_I2H_ERASE_RSP = BFA_I2HM(2),
 845	BFI_FLASH_I2H_WRITE_RSP = BFA_I2HM(3),
 846	BFI_FLASH_I2H_READ_RSP = BFA_I2HM(4),
 847	BFI_FLASH_I2H_BOOT_VER_RSP = BFA_I2HM(5),
 848	BFI_FLASH_I2H_EVENT = BFA_I2HM(127),
 849};
 850
 851/*
 852 * Flash query request
 853 */
 854struct bfi_flash_query_req_s {
 855	struct bfi_mhdr_s mh;	/* Common msg header */
 856	struct bfi_alen_s alen;
 857};
 858
 859/*
 860 * Flash erase request
 861 */
 862struct bfi_flash_erase_req_s {
 863	struct bfi_mhdr_s	mh;	/* Common msg header */
 864	u32	type;	/* partition type */
 865	u8	instance; /* partition instance */
 866	u8	rsv[3];
 867};
 868
 869/*
 870 * Flash write request
 871 */
 872struct bfi_flash_write_req_s {
 873	struct bfi_mhdr_s mh;	/* Common msg header */
 874	struct bfi_alen_s alen;
 875	u32	type;	/* partition type */
 876	u8	instance; /* partition instance */
 877	u8	last;
 878	u8	rsv[2];
 879	u32	offset;
 880	u32	length;
 881};
 882
 883/*
 884 * Flash read request
 885 */
 886struct bfi_flash_read_req_s {
 887	struct bfi_mhdr_s mh;	/* Common msg header */
 888	u32	type;		/* partition type */
 889	u8	instance;	/* partition instance */
 890	u8	rsv[3];
 891	u32	offset;
 892	u32	length;
 893	struct bfi_alen_s alen;
 894};
 895
 896/*
 897 * Flash query response
 898 */
 899struct bfi_flash_query_rsp_s {
 900	struct bfi_mhdr_s mh;	/* Common msg header */
 901	u32	status;
 902};
 903
 904/*
 905 * Flash read response
 906 */
 907struct bfi_flash_read_rsp_s {
 908	struct bfi_mhdr_s mh;	/* Common msg header */
 909	u32	type;       /* partition type */
 910	u8	instance;   /* partition instance */
 911	u8	rsv[3];
 912	u32	status;
 913	u32	length;
 914};
 915
 916/*
 917 * Flash write response
 918 */
 919struct bfi_flash_write_rsp_s {
 920	struct bfi_mhdr_s mh;	/* Common msg header */
 921	u32	type;       /* partition type */
 922	u8	instance;   /* partition instance */
 923	u8	rsv[3];
 924	u32	status;
 925	u32	length;
 926};
 927
 928/*
 929 * Flash erase response
 930 */
 931struct bfi_flash_erase_rsp_s {
 932	struct bfi_mhdr_s mh;	/* Common msg header */
 933	u32	type;		/* partition type */
 934	u8	instance;	/* partition instance */
 935	u8	rsv[3];
 936	u32	status;
 937};
 938
 939/*
 940 * Flash event notification
 941 */
 942struct bfi_flash_event_s {
 943	struct bfi_mhdr_s	mh;	/* Common msg header */
 944	bfa_status_t		status;
 945	u32			param;
 946};
 947
 948/*
 949 *----------------------------------------------------------------------
 950 *				DIAG
 951 *----------------------------------------------------------------------
 952 */
 953enum bfi_diag_h2i {
 954	BFI_DIAG_H2I_PORTBEACON = 1,
 955	BFI_DIAG_H2I_LOOPBACK = 2,
 956	BFI_DIAG_H2I_FWPING = 3,
 957	BFI_DIAG_H2I_TEMPSENSOR = 4,
 958	BFI_DIAG_H2I_LEDTEST = 5,
 959	BFI_DIAG_H2I_QTEST      = 6,
 
 960};
 961
 962enum bfi_diag_i2h {
 963	BFI_DIAG_I2H_PORTBEACON = BFA_I2HM(BFI_DIAG_H2I_PORTBEACON),
 964	BFI_DIAG_I2H_LOOPBACK = BFA_I2HM(BFI_DIAG_H2I_LOOPBACK),
 965	BFI_DIAG_I2H_FWPING = BFA_I2HM(BFI_DIAG_H2I_FWPING),
 966	BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR),
 967	BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST),
 968	BFI_DIAG_I2H_QTEST      = BFA_I2HM(BFI_DIAG_H2I_QTEST),
 
 
 969};
 970
 971#define BFI_DIAG_MAX_SGES	2
 972#define BFI_DIAG_DMA_BUF_SZ	(2 * 1024)
 973#define BFI_BOOT_MEMTEST_RES_ADDR 0x900
 974#define BFI_BOOT_MEMTEST_RES_SIG  0xA0A1A2A3
 975
 976struct bfi_diag_lb_req_s {
 977	struct bfi_mhdr_s mh;
 978	u32	loopcnt;
 979	u32	pattern;
 980	u8	lb_mode;        /*!< bfa_port_opmode_t */
 981	u8	speed;          /*!< bfa_port_speed_t */
 982	u8	rsvd[2];
 983};
 984
 985struct bfi_diag_lb_rsp_s {
 986	struct bfi_mhdr_s  mh;          /* 4 bytes */
 987	struct bfa_diag_loopback_result_s res; /* 16 bytes */
 988};
 989
 990struct bfi_diag_fwping_req_s {
 991	struct bfi_mhdr_s mh;	/* 4 bytes */
 992	struct bfi_alen_s alen; /* 12 bytes */
 993	u32	data;           /* user input data pattern */
 994	u32	count;          /* user input dma count */
 995	u8	qtag;           /* track CPE vc */
 996	u8	rsv[3];
 997};
 998
 999struct bfi_diag_fwping_rsp_s {
1000	struct bfi_mhdr_s  mh;          /* 4 bytes */
1001	u32	data;           /* user input data pattern    */
1002	u8	qtag;           /* track CPE vc               */
1003	u8	dma_status;     /* dma status                 */
1004	u8	rsv[2];
1005};
1006
1007/*
1008 * Temperature Sensor
1009 */
1010struct bfi_diag_ts_req_s {
1011	struct bfi_mhdr_s mh;	/* 4 bytes */
1012	u16	temp;           /* 10-bit A/D value */
1013	u16	brd_temp;       /* 9-bit board temp */
1014	u8	status;
1015	u8	ts_junc;        /* show junction tempsensor   */
1016	u8	ts_brd;         /* show board tempsensor      */
1017	u8	rsv;
1018};
1019#define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
1020
1021struct bfi_diag_ledtest_req_s {
1022	struct bfi_mhdr_s  mh;  /* 4 bytes */
1023	u8	cmd;
1024	u8	color;
1025	u8	portid;
1026	u8	led;    /* bitmap of LEDs to be tested */
1027	u16	freq;   /* no. of blinks every 10 secs */
1028	u8	rsv[2];
1029};
1030
1031/* notify host led operation is done */
1032struct bfi_diag_ledtest_rsp_s {
1033	struct bfi_mhdr_s  mh;  /* 4 bytes */
1034};
1035
1036struct bfi_diag_portbeacon_req_s {
1037	struct bfi_mhdr_s  mh;  /* 4 bytes */
1038	u32	period; /* beaconing period */
1039	u8	beacon; /* 1: beacon on */
1040	u8	rsvd[3];
1041};
1042
1043/* notify host the beacon is off */
1044struct bfi_diag_portbeacon_rsp_s {
1045	struct bfi_mhdr_s  mh;  /* 4 bytes */
1046};
1047
1048struct bfi_diag_qtest_req_s {
1049	struct bfi_mhdr_s	mh;             /* 4 bytes */
1050	u32	data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
1051};
1052#define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
1053
1054/*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1055 *	PHY module specific
1056 */
1057enum bfi_phy_h2i_msgs_e {
1058	BFI_PHY_H2I_QUERY_REQ = 1,
1059	BFI_PHY_H2I_STATS_REQ = 2,
1060	BFI_PHY_H2I_WRITE_REQ = 3,
1061	BFI_PHY_H2I_READ_REQ = 4,
1062};
1063
1064enum bfi_phy_i2h_msgs_e {
1065	BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
1066	BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
1067	BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
1068	BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
1069};
1070
1071/*
1072 * External PHY query request
1073 */
1074struct bfi_phy_query_req_s {
1075	struct bfi_mhdr_s	mh;             /* Common msg header */
1076	u8			instance;
1077	u8			rsv[3];
1078	struct bfi_alen_s	alen;
1079};
1080
1081/*
1082 * External PHY stats request
1083 */
1084struct bfi_phy_stats_req_s {
1085	struct bfi_mhdr_s	mh;             /* Common msg header */
1086	u8			instance;
1087	u8			rsv[3];
1088	struct bfi_alen_s	alen;
1089};
1090
1091/*
1092 * External PHY write request
1093 */
1094struct bfi_phy_write_req_s {
1095	struct bfi_mhdr_s	mh;             /* Common msg header */
1096	u8		instance;
1097	u8		last;
1098	u8		rsv[2];
1099	u32		offset;
1100	u32		length;
1101	struct bfi_alen_s	alen;
1102};
1103
1104/*
1105 * External PHY read request
1106 */
1107struct bfi_phy_read_req_s {
1108	struct bfi_mhdr_s	mh;	/* Common msg header */
1109	u8		instance;
1110	u8		rsv[3];
1111	u32		offset;
1112	u32		length;
1113	struct bfi_alen_s	alen;
1114};
1115
1116/*
1117 * External PHY query response
1118 */
1119struct bfi_phy_query_rsp_s {
1120	struct bfi_mhdr_s	mh;	/* Common msg header */
1121	u32			status;
1122};
1123
1124/*
1125 * External PHY stats response
1126 */
1127struct bfi_phy_stats_rsp_s {
1128	struct bfi_mhdr_s	mh;	/* Common msg header */
1129	u32			status;
1130};
1131
1132/*
1133 * External PHY read response
1134 */
1135struct bfi_phy_read_rsp_s {
1136	struct bfi_mhdr_s	mh;	/* Common msg header */
1137	u32			status;
1138	u32		length;
1139};
1140
1141/*
1142 * External PHY write response
1143 */
1144struct bfi_phy_write_rsp_s {
1145	struct bfi_mhdr_s	mh;	/* Common msg header */
1146	u32			status;
1147	u32			length;
1148};
1149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1150#pragma pack()
1151
1152#endif /* __BFI_H__ */
v5.14.15
   1/* SPDX-License-Identifier: GPL-2.0-only */
   2/*
   3 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
   4 * Copyright (c) 2014- QLogic Corporation.
   5 * All rights reserved
   6 * www.qlogic.com
   7 *
   8 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
 
 
 
 
 
 
 
 
 
   9 */
  10
  11#ifndef __BFI_H__
  12#define __BFI_H__
  13
  14#include "bfa_defs.h"
  15#include "bfa_defs_svc.h"
  16
  17#pragma pack(1)
  18
  19/* Per dma segment max size */
  20#define BFI_MEM_DMA_SEG_SZ	(131072)
  21
  22/* Get number of dma segments required */
  23#define BFI_MEM_DMA_NSEGS(_num_reqs, _req_sz)				\
  24	((u16)(((((_num_reqs) * (_req_sz)) + BFI_MEM_DMA_SEG_SZ - 1) &	\
  25	 ~(BFI_MEM_DMA_SEG_SZ - 1)) / BFI_MEM_DMA_SEG_SZ))
  26
  27/* Get num dma reqs - that fit in a segment */
  28#define BFI_MEM_NREQS_SEG(_rqsz) (BFI_MEM_DMA_SEG_SZ / (_rqsz))
  29
  30/* Get segment num from tag */
  31#define BFI_MEM_SEG_FROM_TAG(_tag, _rqsz) ((_tag) / BFI_MEM_NREQS_SEG(_rqsz))
  32
  33/* Get dma req offset in a segment */
  34#define BFI_MEM_SEG_REQ_OFFSET(_tag, _sz)	\
  35	((_tag) - (BFI_MEM_SEG_FROM_TAG(_tag, _sz) * BFI_MEM_NREQS_SEG(_sz)))
  36
  37/*
  38 * BFI FW image type
  39 */
  40#define	BFI_FLASH_CHUNK_SZ			256	/*  Flash chunk size */
  41#define	BFI_FLASH_CHUNK_SZ_WORDS	(BFI_FLASH_CHUNK_SZ/sizeof(u32))
  42#define BFI_FLASH_IMAGE_SZ		0x100000
  43
  44/*
  45 * Msg header common to all msgs
  46 */
  47struct bfi_mhdr_s {
  48	u8		msg_class;	/*  @ref bfi_mclass_t		    */
  49	u8		msg_id;		/*  msg opcode with in the class   */
  50	union {
  51		struct {
  52			u8	qid;
  53			u8	fn_lpu;	/*  msg destination		    */
  54		} h2i;
  55		u16	i2htok;	/*  token in msgs to host	    */
  56	} mtag;
  57};
  58
  59#define bfi_fn_lpu(__fn, __lpu)	((__fn) << 1 | (__lpu))
  60#define bfi_mhdr_2_fn(_mh)	((_mh)->mtag.h2i.fn_lpu >> 1)
  61
  62#define bfi_h2i_set(_mh, _mc, _op, _fn_lpu) do {		\
  63	(_mh).msg_class		= (_mc);      \
  64	(_mh).msg_id		= (_op);      \
  65	(_mh).mtag.h2i.fn_lpu	= (_fn_lpu);      \
  66} while (0)
  67
  68#define bfi_i2h_set(_mh, _mc, _op, _i2htok) do {		\
  69	(_mh).msg_class		= (_mc);      \
  70	(_mh).msg_id		= (_op);      \
  71	(_mh).mtag.i2htok	= (_i2htok);      \
  72} while (0)
  73
  74/*
  75 * Message opcodes: 0-127 to firmware, 128-255 to host
  76 */
  77#define BFI_I2H_OPCODE_BASE	128
  78#define BFA_I2HM(_x)		((_x) + BFI_I2H_OPCODE_BASE)
  79
  80/*
  81 ****************************************************************************
  82 *
  83 * Scatter Gather Element and Page definition
  84 *
  85 ****************************************************************************
  86 */
  87
  88#define BFI_SGE_INLINE	1
  89#define BFI_SGE_INLINE_MAX	(BFI_SGE_INLINE + 1)
  90
  91/*
  92 * SG Flags
  93 */
  94enum {
  95	BFI_SGE_DATA		= 0,	/*  data address, not last	     */
  96	BFI_SGE_DATA_CPL	= 1,	/*  data addr, last in current page */
  97	BFI_SGE_DATA_LAST	= 3,	/*  data address, last		     */
  98	BFI_SGE_LINK		= 2,	/*  link address		     */
  99	BFI_SGE_PGDLEN		= 2,	/*  cumulative data length for page */
 100};
 101
 102/*
 103 * DMA addresses
 104 */
 105union bfi_addr_u {
 106	struct {
 107		__be32	addr_lo;
 108		__be32	addr_hi;
 109	} a32;
 110};
 111
 112/*
 113 * Scatter Gather Element used for fast-path IO requests
 114 */
 115struct bfi_sge_s {
 116#ifdef __BIG_ENDIAN
 117	u32	flags:2,
 118			rsvd:2,
 119			sg_len:28;
 120#else
 121	u32	sg_len:28,
 122			rsvd:2,
 123			flags:2;
 124#endif
 125	union bfi_addr_u sga;
 126};
 127
 128/**
 129 * Generic DMA addr-len pair.
 130 */
 131struct bfi_alen_s {
 132	union bfi_addr_u	al_addr;	/* DMA addr of buffer	*/
 133	u32			al_len;		/* length of buffer	*/
 134};
 135
 136/*
 137 * Scatter Gather Page
 138 */
 139#define BFI_SGPG_DATA_SGES		7
 140#define BFI_SGPG_SGES_MAX		(BFI_SGPG_DATA_SGES + 1)
 141#define BFI_SGPG_RSVD_WD_LEN	8
 142struct bfi_sgpg_s {
 143	struct bfi_sge_s sges[BFI_SGPG_SGES_MAX];
 144	u32	rsvd[BFI_SGPG_RSVD_WD_LEN];
 145};
 146
 147/* FCP module definitions */
 148#define BFI_IO_MAX	(2000)
 149#define BFI_IOIM_SNSLEN	(256)
 150#define BFI_IOIM_SNSBUF_SEGS	\
 151	BFI_MEM_DMA_NSEGS(BFI_IO_MAX, BFI_IOIM_SNSLEN)
 152
 153/*
 154 * Large Message structure - 128 Bytes size Msgs
 155 */
 156#define BFI_LMSG_SZ		128
 157#define BFI_LMSG_PL_WSZ	\
 158			((BFI_LMSG_SZ - sizeof(struct bfi_mhdr_s)) / 4)
 159
 160struct bfi_msg_s {
 161	struct bfi_mhdr_s mhdr;
 162	u32	pl[BFI_LMSG_PL_WSZ];
 163};
 164
 165/*
 166 * Mailbox message structure
 167 */
 168#define BFI_MBMSG_SZ		7
 169struct bfi_mbmsg_s {
 170	struct bfi_mhdr_s	mh;
 171	u32		pl[BFI_MBMSG_SZ];
 172};
 173
 174/*
 175 * Supported PCI function class codes (personality)
 176 */
 177enum bfi_pcifn_class {
 178	BFI_PCIFN_CLASS_FC  = 0x0c04,
 179	BFI_PCIFN_CLASS_ETH = 0x0200,
 180};
 181
 182/*
 183 * Message Classes
 184 */
 185enum bfi_mclass {
 186	BFI_MC_IOC		= 1,	/*  IO Controller (IOC)	    */
 187	BFI_MC_DIAG		= 2,    /*  Diagnostic Msgs            */
 188	BFI_MC_FLASH		= 3,	/*  Flash message class	*/
 189	BFI_MC_CEE		= 4,	/*  CEE	*/
 190	BFI_MC_FCPORT		= 5,	/*  FC port			    */
 191	BFI_MC_IOCFC		= 6,	/*  FC - IO Controller (IOC)	    */
 192	BFI_MC_ABLK		= 7,	/*  ASIC block configuration	    */
 193	BFI_MC_UF		= 8,	/*  Unsolicited frame receive	    */
 194	BFI_MC_FCXP		= 9,	/*  FC Transport		    */
 195	BFI_MC_LPS		= 10,	/*  lport fc login services	    */
 196	BFI_MC_RPORT		= 11,	/*  Remote port		    */
 197	BFI_MC_ITN		= 12,	/*  I-T nexus (Initiator mode)	    */
 198	BFI_MC_IOIM_READ	= 13,	/*  read IO (Initiator mode)	    */
 199	BFI_MC_IOIM_WRITE	= 14,	/*  write IO (Initiator mode)	    */
 200	BFI_MC_IOIM_IO		= 15,	/*  IO (Initiator mode)	    */
 201	BFI_MC_IOIM		= 16,	/*  IO (Initiator mode)	    */
 202	BFI_MC_IOIM_IOCOM	= 17,	/*  good IO completion		    */
 203	BFI_MC_TSKIM		= 18,	/*  Initiator Task management	    */
 204	BFI_MC_PORT		= 21,	/*  Physical port		    */
 205	BFI_MC_SFP		= 22,	/*  SFP module	*/
 206	BFI_MC_PHY		= 25,   /*  External PHY message class	*/
 207	BFI_MC_FRU		= 34,
 208	BFI_MC_MAX		= 35
 209};
 210
 211#define BFI_IOC_MAX_CQS		4
 212#define BFI_IOC_MAX_CQS_ASIC	8
 213#define BFI_IOC_MSGLEN_MAX	32	/* 32 bytes */
 214
 215/*
 216 *----------------------------------------------------------------------
 217 *				IOC
 218 *----------------------------------------------------------------------
 219 */
 220
 221/*
 222 * Different asic generations
 223 */
 224enum bfi_asic_gen {
 225	BFI_ASIC_GEN_CB		= 1,	/* crossbow 8G FC		*/
 226	BFI_ASIC_GEN_CT		= 2,	/* catapult 8G FC or 10G CNA	*/
 227	BFI_ASIC_GEN_CT2	= 3,	/* catapult-2 16G FC or 10G CNA	*/
 228};
 229
 230enum bfi_asic_mode {
 231	BFI_ASIC_MODE_FC	= 1,	/* FC upto 8G speed		*/
 232	BFI_ASIC_MODE_FC16	= 2,	/* FC upto 16G speed		*/
 233	BFI_ASIC_MODE_ETH	= 3,	/* Ethernet ports		*/
 234	BFI_ASIC_MODE_COMBO	= 4,	/* FC 16G and Ethernet 10G port	*/
 235};
 236
 237enum bfi_ioc_h2i_msgs {
 238	BFI_IOC_H2I_ENABLE_REQ		= 1,
 239	BFI_IOC_H2I_DISABLE_REQ		= 2,
 240	BFI_IOC_H2I_GETATTR_REQ		= 3,
 241	BFI_IOC_H2I_DBG_SYNC		= 4,
 242	BFI_IOC_H2I_DBG_DUMP		= 5,
 243};
 244
 245enum bfi_ioc_i2h_msgs {
 246	BFI_IOC_I2H_ENABLE_REPLY	= BFA_I2HM(1),
 247	BFI_IOC_I2H_DISABLE_REPLY	= BFA_I2HM(2),
 248	BFI_IOC_I2H_GETATTR_REPLY	= BFA_I2HM(3),
 249	BFI_IOC_I2H_HBEAT		= BFA_I2HM(4),
 250	BFI_IOC_I2H_ACQ_ADDR_REPLY	= BFA_I2HM(5),
 251};
 252
 253/*
 254 * BFI_IOC_H2I_GETATTR_REQ message
 255 */
 256struct bfi_ioc_getattr_req_s {
 257	struct bfi_mhdr_s	mh;
 258	union bfi_addr_u	attr_addr;
 259};
 260
 261#define BFI_IOC_ATTR_UUID_SZ	16
 262struct bfi_ioc_attr_s {
 263	wwn_t		mfg_pwwn;	/*  Mfg port wwn	   */
 264	wwn_t		mfg_nwwn;	/*  Mfg node wwn	   */
 265	mac_t		mfg_mac;	/*  Mfg mac		   */
 266	u8		port_mode;	/* bfi_port_mode	   */
 267	u8		rsvd_a;
 268	wwn_t		pwwn;
 269	wwn_t		nwwn;
 270	mac_t		mac;		/*  PBC or Mfg mac	   */
 271	u16	rsvd_b;
 272	mac_t		fcoe_mac;
 273	u16	rsvd_c;
 274	char		brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
 275	u8		pcie_gen;
 276	u8		pcie_lanes_orig;
 277	u8		pcie_lanes;
 278	u8		rx_bbcredit;	/*  receive buffer credits */
 279	u32	adapter_prop;	/*  adapter properties     */
 280	u16	maxfrsize;	/*  max receive frame size */
 281	char		asic_rev;
 282	u8		rsvd_d;
 283	char		fw_version[BFA_VERSION_LEN];
 284	char		optrom_version[BFA_VERSION_LEN];
 285	struct		bfa_mfg_vpd_s	vpd;
 286	u32	card_type;	/*  card type			*/
 287	u8	mfg_day;	/* manufacturing day */
 288	u8	mfg_month;	/* manufacturing month */
 289	u16	mfg_year;	/* manufacturing year */
 290	u8	uuid[BFI_IOC_ATTR_UUID_SZ];	/*!< chinook uuid */
 291};
 292
 293/*
 294 * BFI_IOC_I2H_GETATTR_REPLY message
 295 */
 296struct bfi_ioc_getattr_reply_s {
 297	struct	bfi_mhdr_s	mh;	/*  Common msg header		*/
 298	u8			status;	/*  cfg reply status		*/
 299	u8			rsvd[3];
 300};
 301
 302/*
 303 * Firmware memory page offsets
 304 */
 305#define BFI_IOC_SMEM_PG0_CB	(0x40)
 306#define BFI_IOC_SMEM_PG0_CT	(0x180)
 307
 308/*
 309 * Firmware statistic offset
 310 */
 311#define BFI_IOC_FWSTATS_OFF	(0x6B40)
 312#define BFI_IOC_FWSTATS_SZ	(4096)
 313
 314/*
 315 * Firmware trace offset
 316 */
 317#define BFI_IOC_TRC_OFF		(0x4b00)
 318#define BFI_IOC_TRC_ENTS	256
 319
 320#define BFI_IOC_FW_SIGNATURE	(0xbfadbfad)
 321#define BFA_IOC_FW_INV_SIGN	(0xdeaddead)
 322#define BFI_IOC_MD5SUM_SZ	4
 323
 324struct bfi_ioc_fwver_s {
 325#ifdef __BIG_ENDIAN
 326	uint8_t patch;
 327	uint8_t maint;
 328	uint8_t minor;
 329	uint8_t major;
 330	uint8_t rsvd[2];
 331	uint8_t build;
 332	uint8_t phase;
 333#else
 334	uint8_t major;
 335	uint8_t minor;
 336	uint8_t maint;
 337	uint8_t patch;
 338	uint8_t phase;
 339	uint8_t build;
 340	uint8_t rsvd[2];
 341#endif
 342};
 343
 344struct bfi_ioc_image_hdr_s {
 345	u32	signature;	/* constant signature		*/
 346	u8	asic_gen;	/* asic generation		*/
 347	u8	asic_mode;
 348	u8	port0_mode;	/* device mode for port 0	*/
 349	u8	port1_mode;	/* device mode for port 1	*/
 350	u32	exec;		/* exec vector			*/
 351	u32	bootenv;	/* firmware boot env		*/
 352	u32	rsvd_b[2];
 353	struct bfi_ioc_fwver_s	fwver;
 354	u32	md5sum[BFI_IOC_MD5SUM_SZ];
 355};
 356
 357enum bfi_ioc_img_ver_cmp_e {
 358	BFI_IOC_IMG_VER_INCOMP,
 359	BFI_IOC_IMG_VER_OLD,
 360	BFI_IOC_IMG_VER_SAME,
 361	BFI_IOC_IMG_VER_BETTER
 362};
 363
 364#define BFI_FWBOOT_DEVMODE_OFF		4
 365#define BFI_FWBOOT_TYPE_OFF		8
 366#define BFI_FWBOOT_ENV_OFF		12
 367#define BFI_FWBOOT_DEVMODE(__asic_gen, __asic_mode, __p0_mode, __p1_mode) \
 368	(((u32)(__asic_gen)) << 24 |		\
 369	 ((u32)(__asic_mode)) << 16 |		\
 370	 ((u32)(__p0_mode)) << 8 |		\
 371	 ((u32)(__p1_mode)))
 372
 373enum bfi_fwboot_type {
 374	BFI_FWBOOT_TYPE_NORMAL  = 0,
 375	BFI_FWBOOT_TYPE_FLASH   = 1,
 376	BFI_FWBOOT_TYPE_MEMTEST = 2,
 377};
 378
 379#define BFI_FWBOOT_TYPE_NORMAL	0
 380#define BFI_FWBOOT_TYPE_MEMTEST	2
 381#define BFI_FWBOOT_ENV_OS       0
 382
 383enum bfi_port_mode {
 384	BFI_PORT_MODE_FC	= 1,
 385	BFI_PORT_MODE_ETH	= 2,
 386};
 387
 388struct bfi_ioc_hbeat_s {
 389	struct bfi_mhdr_s  mh;		/*  common msg header		*/
 390	u32	   hb_count;	/*  current heart beat count	*/
 391};
 392
 393/*
 394 * IOC hardware/firmware state
 395 */
 396enum bfi_ioc_state {
 397	BFI_IOC_UNINIT		= 0,	/*  not initialized		     */
 398	BFI_IOC_INITING		= 1,	/*  h/w is being initialized	     */
 399	BFI_IOC_HWINIT		= 2,	/*  h/w is initialized		     */
 400	BFI_IOC_CFG		= 3,	/*  IOC configuration in progress   */
 401	BFI_IOC_OP		= 4,	/*  IOC is operational		     */
 402	BFI_IOC_DISABLING	= 5,	/*  IOC is being disabled	     */
 403	BFI_IOC_DISABLED	= 6,	/*  IOC is disabled		     */
 404	BFI_IOC_CFG_DISABLED	= 7,	/*  IOC is being disabled;transient */
 405	BFI_IOC_FAIL		= 8,	/*  IOC heart-beat failure	     */
 406	BFI_IOC_MEMTEST		= 9,	/*  IOC is doing memtest	     */
 407};
 408
 409#define BFA_IOC_CB_JOIN_SH	16
 410#define BFA_IOC_CB_FWSTATE_MASK	0x0000ffff
 411#define BFA_IOC_CB_JOIN_MASK	0xffff0000
 412
 413#define BFI_IOC_ENDIAN_SIG  0x12345678
 414
 415enum {
 416	BFI_ADAPTER_TYPE_FC	= 0x01,		/*  FC adapters	   */
 417	BFI_ADAPTER_TYPE_MK	= 0x0f0000,	/*  adapter type mask     */
 418	BFI_ADAPTER_TYPE_SH	= 16,	        /*  adapter type shift    */
 419	BFI_ADAPTER_NPORTS_MK	= 0xff00,	/*  number of ports mask  */
 420	BFI_ADAPTER_NPORTS_SH	= 8,	        /*  number of ports shift */
 421	BFI_ADAPTER_SPEED_MK	= 0xff,		/*  adapter speed mask    */
 422	BFI_ADAPTER_SPEED_SH	= 0,	        /*  adapter speed shift   */
 423	BFI_ADAPTER_PROTO	= 0x100000,	/*  prototype adapaters   */
 424	BFI_ADAPTER_TTV		= 0x200000,	/*  TTV debug capable     */
 425	BFI_ADAPTER_UNSUPP	= 0x400000,	/*  unknown adapter type  */
 426};
 427
 428#define BFI_ADAPTER_GETP(__prop, __adap_prop)			\
 429	(((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >>	\
 430		BFI_ADAPTER_ ## __prop ## _SH)
 431#define BFI_ADAPTER_SETP(__prop, __val)				\
 432	((__val) << BFI_ADAPTER_ ## __prop ## _SH)
 433#define BFI_ADAPTER_IS_PROTO(__adap_type)			\
 434	((__adap_type) & BFI_ADAPTER_PROTO)
 435#define BFI_ADAPTER_IS_TTV(__adap_type)				\
 436	((__adap_type) & BFI_ADAPTER_TTV)
 437#define BFI_ADAPTER_IS_UNSUPP(__adap_type)			\
 438	((__adap_type) & BFI_ADAPTER_UNSUPP)
 439#define BFI_ADAPTER_IS_SPECIAL(__adap_type)			\
 440	((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO |	\
 441			BFI_ADAPTER_UNSUPP))
 442
 443/*
 444 * BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
 445 */
 446struct bfi_ioc_ctrl_req_s {
 447	struct bfi_mhdr_s	mh;
 448	u16			clscode;
 449	u16			rsvd;
 450	u32		tv_sec;
 451};
 452#define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
 453#define bfi_ioc_disable_req_t struct bfi_ioc_ctrl_req_s;
 454
 455/*
 456 * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
 457 */
 458struct bfi_ioc_ctrl_reply_s {
 459	struct bfi_mhdr_s	mh;		/*  Common msg header     */
 460	u8			status;		/*  enable/disable status */
 461	u8			port_mode;	/*  bfa_mode_s	*/
 462	u8			cap_bm;		/*  capability bit mask */
 463	u8			rsvd;
 464};
 465#define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
 466#define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
 467
 468#define BFI_IOC_MSGSZ   8
 469/*
 470 * H2I Messages
 471 */
 472union bfi_ioc_h2i_msg_u {
 473	struct bfi_mhdr_s		mh;
 474	struct bfi_ioc_ctrl_req_s	enable_req;
 475	struct bfi_ioc_ctrl_req_s	disable_req;
 476	struct bfi_ioc_getattr_req_s	getattr_req;
 477	u32			mboxmsg[BFI_IOC_MSGSZ];
 478};
 479
 480/*
 481 * I2H Messages
 482 */
 483union bfi_ioc_i2h_msg_u {
 484	struct bfi_mhdr_s		mh;
 485	struct bfi_ioc_ctrl_reply_s	fw_event;
 486	u32			mboxmsg[BFI_IOC_MSGSZ];
 487};
 488
 489
 490/*
 491 *----------------------------------------------------------------------
 492 *				PBC
 493 *----------------------------------------------------------------------
 494 */
 495
 496#define BFI_PBC_MAX_BLUNS	8
 497#define BFI_PBC_MAX_VPORTS	16
 498#define BFI_PBC_PORT_DISABLED	2
 499
 500/*
 501 * PBC boot lun configuration
 502 */
 503struct bfi_pbc_blun_s {
 504	wwn_t		tgt_pwwn;
 505	struct scsi_lun	tgt_lun;
 506};
 507
 508/*
 509 * PBC virtual port configuration
 510 */
 511struct bfi_pbc_vport_s {
 512	wwn_t		vp_pwwn;
 513	wwn_t		vp_nwwn;
 514};
 515
 516/*
 517 * BFI pre-boot configuration information
 518 */
 519struct bfi_pbc_s {
 520	u8		port_enabled;
 521	u8		boot_enabled;
 522	u8		nbluns;
 523	u8		nvports;
 524	u8		port_speed;
 525	u8		rsvd_a;
 526	u16	hss;
 527	wwn_t		pbc_pwwn;
 528	wwn_t		pbc_nwwn;
 529	struct bfi_pbc_blun_s blun[BFI_PBC_MAX_BLUNS];
 530	struct bfi_pbc_vport_s vport[BFI_PBC_MAX_VPORTS];
 531};
 532
 533/*
 534 *----------------------------------------------------------------------
 535 *				MSGQ
 536 *----------------------------------------------------------------------
 537 */
 538#define BFI_MSGQ_FULL(_q)	(((_q->pi + 1) % _q->q_depth) == _q->ci)
 539#define BFI_MSGQ_EMPTY(_q)	(_q->pi == _q->ci)
 540#define BFI_MSGQ_UPDATE_CI(_q)	(_q->ci = (_q->ci + 1) % _q->q_depth)
 541#define BFI_MSGQ_UPDATE_PI(_q)	(_q->pi = (_q->pi + 1) % _q->q_depth)
 542
 543/* q_depth must be power of 2 */
 544#define BFI_MSGQ_FREE_CNT(_q)	((_q->ci - _q->pi - 1) & (_q->q_depth - 1))
 545
 546enum bfi_msgq_h2i_msgs_e {
 547	BFI_MSGQ_H2I_INIT_REQ	= 1,
 548	BFI_MSGQ_H2I_DOORBELL	= 2,
 549	BFI_MSGQ_H2I_SHUTDOWN	= 3,
 550};
 551
 552enum bfi_msgq_i2h_msgs_e {
 553	BFI_MSGQ_I2H_INIT_RSP	= 1,
 554	BFI_MSGQ_I2H_DOORBELL	= 2,
 555};
 556
 557
 558/* Messages(commands/responsed/AENS will have the following header */
 559struct bfi_msgq_mhdr_s {
 560	u8		msg_class;
 561	u8		msg_id;
 562	u16	msg_token;
 563	u16	num_entries;
 564	u8		enet_id;
 565	u8		rsvd[1];
 566};
 567
 568#define bfi_msgq_mhdr_set(_mh, _mc, _mid, _tok, _enet_id) do {        \
 569	(_mh).msg_class		= (_mc);      \
 570	(_mh).msg_id		= (_mid);      \
 571	(_mh).msg_token		= (_tok);      \
 572	(_mh).enet_id		= (_enet_id);      \
 573} while (0)
 574
 575/*
 576 * Mailbox  for messaging interface
 577 *
 578*/
 579#define BFI_MSGQ_CMD_ENTRY_SIZE		(64)    /* TBD */
 580#define BFI_MSGQ_RSP_ENTRY_SIZE		(64)    /* TBD */
 581#define BFI_MSGQ_MSG_SIZE_MAX		(2048)  /* TBD */
 582
 583struct bfi_msgq_s {
 584	union bfi_addr_u addr;
 585	u16 q_depth;     /* Total num of entries in the queue */
 586	u8 rsvd[2];
 587};
 588
 589/* BFI_ENET_MSGQ_CFG_REQ TBD init or cfg? */
 590struct bfi_msgq_cfg_req_s {
 591	struct bfi_mhdr_s mh;
 592	struct bfi_msgq_s cmdq;
 593	struct bfi_msgq_s rspq;
 594};
 595
 596/* BFI_ENET_MSGQ_CFG_RSP */
 597struct bfi_msgq_cfg_rsp_s {
 598	struct bfi_mhdr_s mh;
 599	u8 cmd_status;
 600	u8 rsvd[3];
 601};
 602
 603
 604/* BFI_MSGQ_H2I_DOORBELL */
 605struct bfi_msgq_h2i_db_s {
 606	struct bfi_mhdr_s mh;
 607	u16 cmdq_pi;
 608	u16 rspq_ci;
 609};
 610
 611/* BFI_MSGQ_I2H_DOORBELL */
 612struct bfi_msgq_i2h_db_s {
 613	struct bfi_mhdr_s mh;
 614	u16 rspq_pi;
 615	u16 cmdq_ci;
 616};
 617
 618#pragma pack()
 619
 620/* BFI port specific */
 621#pragma pack(1)
 622
 623enum bfi_port_h2i {
 624	BFI_PORT_H2I_ENABLE_REQ         = (1),
 625	BFI_PORT_H2I_DISABLE_REQ        = (2),
 626	BFI_PORT_H2I_GET_STATS_REQ      = (3),
 627	BFI_PORT_H2I_CLEAR_STATS_REQ    = (4),
 628};
 629
 630enum bfi_port_i2h {
 631	BFI_PORT_I2H_ENABLE_RSP         = BFA_I2HM(1),
 632	BFI_PORT_I2H_DISABLE_RSP        = BFA_I2HM(2),
 633	BFI_PORT_I2H_GET_STATS_RSP      = BFA_I2HM(3),
 634	BFI_PORT_I2H_CLEAR_STATS_RSP    = BFA_I2HM(4),
 635};
 636
 637/*
 638 * Generic REQ type
 639 */
 640struct bfi_port_generic_req_s {
 641	struct bfi_mhdr_s  mh;          /*  msg header		*/
 642	u32     msgtag;         /*  msgtag for reply                */
 643	u32     rsvd;
 644};
 645
 646/*
 647 * Generic RSP type
 648 */
 649struct bfi_port_generic_rsp_s {
 650	struct bfi_mhdr_s  mh;          /*  common msg header               */
 651	u8              status;         /*  port enable status              */
 652	u8              rsvd[3];
 653	u32     msgtag;         /*  msgtag for reply                */
 654};
 655
 656/*
 657 * BFI_PORT_H2I_GET_STATS_REQ
 658 */
 659struct bfi_port_get_stats_req_s {
 660	struct bfi_mhdr_s  mh;          /*  common msg header               */
 661	union bfi_addr_u   dma_addr;
 662};
 663
 664union bfi_port_h2i_msg_u {
 665	struct bfi_mhdr_s               mh;
 666	struct bfi_port_generic_req_s   enable_req;
 667	struct bfi_port_generic_req_s   disable_req;
 668	struct bfi_port_get_stats_req_s getstats_req;
 669	struct bfi_port_generic_req_s   clearstats_req;
 670};
 671
 672union bfi_port_i2h_msg_u {
 673	struct bfi_mhdr_s               mh;
 674	struct bfi_port_generic_rsp_s   enable_rsp;
 675	struct bfi_port_generic_rsp_s   disable_rsp;
 676	struct bfi_port_generic_rsp_s   getstats_rsp;
 677	struct bfi_port_generic_rsp_s   clearstats_rsp;
 678};
 679
 680/*
 681 *----------------------------------------------------------------------
 682 *				ABLK
 683 *----------------------------------------------------------------------
 684 */
 685enum bfi_ablk_h2i_msgs_e {
 686	BFI_ABLK_H2I_QUERY		= 1,
 687	BFI_ABLK_H2I_ADPT_CONFIG	= 2,
 688	BFI_ABLK_H2I_PORT_CONFIG	= 3,
 689	BFI_ABLK_H2I_PF_CREATE		= 4,
 690	BFI_ABLK_H2I_PF_DELETE		= 5,
 691	BFI_ABLK_H2I_PF_UPDATE		= 6,
 692	BFI_ABLK_H2I_OPTROM_ENABLE	= 7,
 693	BFI_ABLK_H2I_OPTROM_DISABLE	= 8,
 694};
 695
 696enum bfi_ablk_i2h_msgs_e {
 697	BFI_ABLK_I2H_QUERY		= BFA_I2HM(BFI_ABLK_H2I_QUERY),
 698	BFI_ABLK_I2H_ADPT_CONFIG	= BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG),
 699	BFI_ABLK_I2H_PORT_CONFIG	= BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG),
 700	BFI_ABLK_I2H_PF_CREATE		= BFA_I2HM(BFI_ABLK_H2I_PF_CREATE),
 701	BFI_ABLK_I2H_PF_DELETE		= BFA_I2HM(BFI_ABLK_H2I_PF_DELETE),
 702	BFI_ABLK_I2H_PF_UPDATE		= BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE),
 703	BFI_ABLK_I2H_OPTROM_ENABLE	= BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE),
 704	BFI_ABLK_I2H_OPTROM_DISABLE	= BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE),
 705};
 706
 707/* BFI_ABLK_H2I_QUERY */
 708struct bfi_ablk_h2i_query_s {
 709	struct bfi_mhdr_s	mh;
 710	union bfi_addr_u	addr;
 711};
 712
 713/* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */
 714struct bfi_ablk_h2i_cfg_req_s {
 715	struct bfi_mhdr_s	mh;
 716	u8			mode;
 717	u8			port;
 718	u8			max_pf;
 719	u8			max_vf;
 720};
 721
 722/*
 723 * BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE,
 724 */
 725struct bfi_ablk_h2i_pf_req_s {
 726	struct bfi_mhdr_s	mh;
 727	u8			pcifn;
 728	u8			port;
 729	u16			pers;
 730	u16			bw_min; /* percent BW @ max speed */
 731	u16			bw_max; /* percent BW @ max speed */
 732};
 733
 734/* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */
 735struct bfi_ablk_h2i_optrom_s {
 736	struct bfi_mhdr_s	mh;
 737};
 738
 739/*
 740 * BFI_ABLK_I2H_QUERY
 741 * BFI_ABLK_I2H_PORT_CONFIG
 742 * BFI_ABLK_I2H_PF_CREATE
 743 * BFI_ABLK_I2H_PF_DELETE
 744 * BFI_ABLK_I2H_PF_UPDATE
 745 * BFI_ABLK_I2H_OPTROM_ENABLE
 746 * BFI_ABLK_I2H_OPTROM_DISABLE
 747 */
 748struct bfi_ablk_i2h_rsp_s {
 749	struct bfi_mhdr_s	mh;
 750	u8			status;
 751	u8			pcifn;
 752	u8			port_mode;
 753};
 754
 755
 756/*
 757 *	CEE module specific messages
 758 */
 759
 760/* Mailbox commands from host to firmware */
 761enum bfi_cee_h2i_msgs_e {
 762	BFI_CEE_H2I_GET_CFG_REQ = 1,
 763	BFI_CEE_H2I_RESET_STATS = 2,
 764	BFI_CEE_H2I_GET_STATS_REQ = 3,
 765};
 766
 767enum bfi_cee_i2h_msgs_e {
 768	BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
 769	BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
 770	BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
 771};
 772
 773/*
 774 * H2I command structure for resetting the stats
 775 */
 776struct bfi_cee_reset_stats_s {
 777	struct bfi_mhdr_s  mh;
 778};
 779
 780/*
 781 * Get configuration  command from host
 782 */
 783struct bfi_cee_get_req_s {
 784	struct bfi_mhdr_s	mh;
 785	union bfi_addr_u	dma_addr;
 786};
 787
 788/*
 789 * Reply message from firmware
 790 */
 791struct bfi_cee_get_rsp_s {
 792	struct bfi_mhdr_s	mh;
 793	u8			cmd_status;
 794	u8			rsvd[3];
 795};
 796
 797/*
 798 * Reply message from firmware
 799 */
 800struct bfi_cee_stats_rsp_s {
 801	struct bfi_mhdr_s	mh;
 802	u8			cmd_status;
 803	u8			rsvd[3];
 804};
 805
 806/* Mailbox message structures from firmware to host	*/
 807union bfi_cee_i2h_msg_u {
 808	struct bfi_mhdr_s		mh;
 809	struct bfi_cee_get_rsp_s	get_rsp;
 810	struct bfi_cee_stats_rsp_s	stats_rsp;
 811};
 812
 813/*
 814 * SFP related
 815 */
 816
 817enum bfi_sfp_h2i_e {
 818	BFI_SFP_H2I_SHOW	= 1,
 819	BFI_SFP_H2I_SCN		= 2,
 820};
 821
 822enum bfi_sfp_i2h_e {
 823	BFI_SFP_I2H_SHOW = BFA_I2HM(BFI_SFP_H2I_SHOW),
 824	BFI_SFP_I2H_SCN	 = BFA_I2HM(BFI_SFP_H2I_SCN),
 825};
 826
 827/*
 828 *	SFP state change notification
 829 */
 830struct bfi_sfp_scn_s {
 831	struct bfi_mhdr_s mhr;	/* host msg header        */
 832	u8	event;
 833	u8	sfpid;
 834	u8	pomlvl;	/* pom level: normal/warning/alarm */
 835	u8	is_elb;	/* e-loopback */
 836};
 837
 838/*
 839 *	SFP state
 840 */
 841enum bfa_sfp_stat_e {
 842	BFA_SFP_STATE_INIT	= 0,	/* SFP state is uninit	*/
 843	BFA_SFP_STATE_REMOVED	= 1,	/* SFP is removed	*/
 844	BFA_SFP_STATE_INSERTED	= 2,	/* SFP is inserted	*/
 845	BFA_SFP_STATE_VALID	= 3,	/* SFP is valid		*/
 846	BFA_SFP_STATE_UNSUPPORT	= 4,	/* SFP is unsupport	*/
 847	BFA_SFP_STATE_FAILED	= 5,	/* SFP i2c read fail	*/
 848};
 849
 850/*
 851 *  SFP memory access type
 852 */
 853enum bfi_sfp_mem_e {
 854	BFI_SFP_MEM_ALL		= 0x1,  /* access all data field */
 855	BFI_SFP_MEM_DIAGEXT	= 0x2,  /* access diag ext data field only */
 856};
 857
 858struct bfi_sfp_req_s {
 859	struct bfi_mhdr_s	mh;
 860	u8			memtype;
 861	u8			rsvd[3];
 862	struct bfi_alen_s	alen;
 863};
 864
 865struct bfi_sfp_rsp_s {
 866	struct bfi_mhdr_s	mh;
 867	u8			status;
 868	u8			state;
 869	u8			rsvd[2];
 870};
 871
 872/*
 873 *	FLASH module specific
 874 */
 875enum bfi_flash_h2i_msgs {
 876	BFI_FLASH_H2I_QUERY_REQ = 1,
 877	BFI_FLASH_H2I_ERASE_REQ = 2,
 878	BFI_FLASH_H2I_WRITE_REQ = 3,
 879	BFI_FLASH_H2I_READ_REQ = 4,
 880	BFI_FLASH_H2I_BOOT_VER_REQ = 5,
 881};
 882
 883enum bfi_flash_i2h_msgs {
 884	BFI_FLASH_I2H_QUERY_RSP = BFA_I2HM(1),
 885	BFI_FLASH_I2H_ERASE_RSP = BFA_I2HM(2),
 886	BFI_FLASH_I2H_WRITE_RSP = BFA_I2HM(3),
 887	BFI_FLASH_I2H_READ_RSP = BFA_I2HM(4),
 888	BFI_FLASH_I2H_BOOT_VER_RSP = BFA_I2HM(5),
 889	BFI_FLASH_I2H_EVENT = BFA_I2HM(127),
 890};
 891
 892/*
 893 * Flash query request
 894 */
 895struct bfi_flash_query_req_s {
 896	struct bfi_mhdr_s mh;	/* Common msg header */
 897	struct bfi_alen_s alen;
 898};
 899
 900/*
 901 * Flash erase request
 902 */
 903struct bfi_flash_erase_req_s {
 904	struct bfi_mhdr_s	mh;	/* Common msg header */
 905	u32	type;	/* partition type */
 906	u8	instance; /* partition instance */
 907	u8	rsv[3];
 908};
 909
 910/*
 911 * Flash write request
 912 */
 913struct bfi_flash_write_req_s {
 914	struct bfi_mhdr_s mh;	/* Common msg header */
 915	struct bfi_alen_s alen;
 916	u32	type;	/* partition type */
 917	u8	instance; /* partition instance */
 918	u8	last;
 919	u8	rsv[2];
 920	u32	offset;
 921	u32	length;
 922};
 923
 924/*
 925 * Flash read request
 926 */
 927struct bfi_flash_read_req_s {
 928	struct bfi_mhdr_s mh;	/* Common msg header */
 929	u32	type;		/* partition type */
 930	u8	instance;	/* partition instance */
 931	u8	rsv[3];
 932	u32	offset;
 933	u32	length;
 934	struct bfi_alen_s alen;
 935};
 936
 937/*
 938 * Flash query response
 939 */
 940struct bfi_flash_query_rsp_s {
 941	struct bfi_mhdr_s mh;	/* Common msg header */
 942	u32	status;
 943};
 944
 945/*
 946 * Flash read response
 947 */
 948struct bfi_flash_read_rsp_s {
 949	struct bfi_mhdr_s mh;	/* Common msg header */
 950	u32	type;       /* partition type */
 951	u8	instance;   /* partition instance */
 952	u8	rsv[3];
 953	u32	status;
 954	u32	length;
 955};
 956
 957/*
 958 * Flash write response
 959 */
 960struct bfi_flash_write_rsp_s {
 961	struct bfi_mhdr_s mh;	/* Common msg header */
 962	u32	type;       /* partition type */
 963	u8	instance;   /* partition instance */
 964	u8	rsv[3];
 965	u32	status;
 966	u32	length;
 967};
 968
 969/*
 970 * Flash erase response
 971 */
 972struct bfi_flash_erase_rsp_s {
 973	struct bfi_mhdr_s mh;	/* Common msg header */
 974	u32	type;		/* partition type */
 975	u8	instance;	/* partition instance */
 976	u8	rsv[3];
 977	u32	status;
 978};
 979
 980/*
 981 * Flash event notification
 982 */
 983struct bfi_flash_event_s {
 984	struct bfi_mhdr_s	mh;	/* Common msg header */
 985	bfa_status_t		status;
 986	u32			param;
 987};
 988
 989/*
 990 *----------------------------------------------------------------------
 991 *				DIAG
 992 *----------------------------------------------------------------------
 993 */
 994enum bfi_diag_h2i {
 995	BFI_DIAG_H2I_PORTBEACON = 1,
 996	BFI_DIAG_H2I_LOOPBACK = 2,
 997	BFI_DIAG_H2I_FWPING = 3,
 998	BFI_DIAG_H2I_TEMPSENSOR = 4,
 999	BFI_DIAG_H2I_LEDTEST = 5,
1000	BFI_DIAG_H2I_QTEST      = 6,
1001	BFI_DIAG_H2I_DPORT	= 7,
1002};
1003
1004enum bfi_diag_i2h {
1005	BFI_DIAG_I2H_PORTBEACON = BFA_I2HM(BFI_DIAG_H2I_PORTBEACON),
1006	BFI_DIAG_I2H_LOOPBACK = BFA_I2HM(BFI_DIAG_H2I_LOOPBACK),
1007	BFI_DIAG_I2H_FWPING = BFA_I2HM(BFI_DIAG_H2I_FWPING),
1008	BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR),
1009	BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST),
1010	BFI_DIAG_I2H_QTEST      = BFA_I2HM(BFI_DIAG_H2I_QTEST),
1011	BFI_DIAG_I2H_DPORT	= BFA_I2HM(BFI_DIAG_H2I_DPORT),
1012	BFI_DIAG_I2H_DPORT_SCN	= BFA_I2HM(8),
1013};
1014
1015#define BFI_DIAG_MAX_SGES	2
1016#define BFI_DIAG_DMA_BUF_SZ	(2 * 1024)
1017#define BFI_BOOT_MEMTEST_RES_ADDR 0x900
1018#define BFI_BOOT_MEMTEST_RES_SIG  0xA0A1A2A3
1019
1020struct bfi_diag_lb_req_s {
1021	struct bfi_mhdr_s mh;
1022	u32	loopcnt;
1023	u32	pattern;
1024	u8	lb_mode;        /*!< bfa_port_opmode_t */
1025	u8	speed;          /*!< bfa_port_speed_t */
1026	u8	rsvd[2];
1027};
1028
1029struct bfi_diag_lb_rsp_s {
1030	struct bfi_mhdr_s  mh;          /* 4 bytes */
1031	struct bfa_diag_loopback_result_s res; /* 16 bytes */
1032};
1033
1034struct bfi_diag_fwping_req_s {
1035	struct bfi_mhdr_s mh;	/* 4 bytes */
1036	struct bfi_alen_s alen; /* 12 bytes */
1037	u32	data;           /* user input data pattern */
1038	u32	count;          /* user input dma count */
1039	u8	qtag;           /* track CPE vc */
1040	u8	rsv[3];
1041};
1042
1043struct bfi_diag_fwping_rsp_s {
1044	struct bfi_mhdr_s  mh;          /* 4 bytes */
1045	u32	data;           /* user input data pattern    */
1046	u8	qtag;           /* track CPE vc               */
1047	u8	dma_status;     /* dma status                 */
1048	u8	rsv[2];
1049};
1050
1051/*
1052 * Temperature Sensor
1053 */
1054struct bfi_diag_ts_req_s {
1055	struct bfi_mhdr_s mh;	/* 4 bytes */
1056	u16	temp;           /* 10-bit A/D value */
1057	u16	brd_temp;       /* 9-bit board temp */
1058	u8	status;
1059	u8	ts_junc;        /* show junction tempsensor   */
1060	u8	ts_brd;         /* show board tempsensor      */
1061	u8	rsv;
1062};
1063#define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
1064
1065struct bfi_diag_ledtest_req_s {
1066	struct bfi_mhdr_s  mh;  /* 4 bytes */
1067	u8	cmd;
1068	u8	color;
1069	u8	portid;
1070	u8	led;    /* bitmap of LEDs to be tested */
1071	u16	freq;   /* no. of blinks every 10 secs */
1072	u8	rsv[2];
1073};
1074
1075/* notify host led operation is done */
1076struct bfi_diag_ledtest_rsp_s {
1077	struct bfi_mhdr_s  mh;  /* 4 bytes */
1078};
1079
1080struct bfi_diag_portbeacon_req_s {
1081	struct bfi_mhdr_s  mh;  /* 4 bytes */
1082	u32	period; /* beaconing period */
1083	u8	beacon; /* 1: beacon on */
1084	u8	rsvd[3];
1085};
1086
1087/* notify host the beacon is off */
1088struct bfi_diag_portbeacon_rsp_s {
1089	struct bfi_mhdr_s  mh;  /* 4 bytes */
1090};
1091
1092struct bfi_diag_qtest_req_s {
1093	struct bfi_mhdr_s	mh;             /* 4 bytes */
1094	u32	data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
1095};
1096#define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
1097
1098/*
1099 *	D-port test
1100 */
1101enum bfi_dport_req {
1102	BFI_DPORT_DISABLE	= 0,	/* disable dport request	*/
1103	BFI_DPORT_ENABLE	= 1,	/* enable dport request		*/
1104	BFI_DPORT_START		= 2,	/* start dport request	*/
1105	BFI_DPORT_SHOW		= 3,	/* show dport request	*/
1106	BFI_DPORT_DYN_DISABLE	= 4,	/* disable dynamic dport request */
1107};
1108
1109enum bfi_dport_scn {
1110	BFI_DPORT_SCN_TESTSTART		= 1,
1111	BFI_DPORT_SCN_TESTCOMP		= 2,
1112	BFI_DPORT_SCN_SFP_REMOVED	= 3,
1113	BFI_DPORT_SCN_DDPORT_ENABLE	= 4,
1114	BFI_DPORT_SCN_DDPORT_DISABLE	= 5,
1115	BFI_DPORT_SCN_FCPORT_DISABLE	= 6,
1116	BFI_DPORT_SCN_SUBTESTSTART	= 7,
1117	BFI_DPORT_SCN_TESTSKIP		= 8,
1118	BFI_DPORT_SCN_DDPORT_DISABLED	= 9,
1119};
1120
1121struct bfi_diag_dport_req_s {
1122	struct bfi_mhdr_s	mh;	/* 4 bytes                      */
1123	u8			req;	/* request 1: enable 0: disable	*/
1124	u8			rsvd[3];
1125	u32			lpcnt;
1126	u32			payload;
1127};
1128
1129struct bfi_diag_dport_rsp_s {
1130	struct bfi_mhdr_s	mh;	/* header 4 bytes		*/
1131	bfa_status_t		status;	/* reply status			*/
1132	wwn_t			pwwn;	/* switch port wwn. 8 bytes	*/
1133	wwn_t			nwwn;	/* switch node wwn. 8 bytes	*/
1134};
1135
1136struct bfi_diag_dport_scn_teststart_s {
1137	wwn_t	pwwn;	/* switch port wwn. 8 bytes */
1138	wwn_t	nwwn;	/* switch node wwn. 8 bytes */
1139	u8	type;	/* bfa_diag_dport_test_type_e */
1140	u8	mode;	/* bfa_diag_dport_test_opmode */
1141	u8	rsvd[2];
1142	u32	numfrm; /* from switch uint in 1M */
1143};
1144
1145struct bfi_diag_dport_scn_testcomp_s {
1146	u8	status; /* bfa_diag_dport_test_status_e */
1147	u8	speed;  /* bfa_port_speed_t  */
1148	u16	numbuffer; /* from switch  */
1149	u8	subtest_status[DPORT_TEST_MAX];  /* 4 bytes */
1150	u32	latency;   /* from switch  */
1151	u32	distance;  /* from swtich unit in meters  */
1152			/* Buffers required to saturate the link */
1153	u16	frm_sz;	/* from switch for buf_reqd */
1154	u8	rsvd[2];
1155};
1156
1157struct bfi_diag_dport_scn_s {		/* max size == RDS_RMESZ	*/
1158	struct bfi_mhdr_s	mh;	/* header 4 bytes		*/
1159	u8			state;  /* new state			*/
1160	u8			rsvd[3];
1161	union {
1162		struct bfi_diag_dport_scn_teststart_s teststart;
1163		struct bfi_diag_dport_scn_testcomp_s testcomp;
1164	} info;
1165};
1166
1167union bfi_diag_dport_msg_u {
1168	struct bfi_diag_dport_req_s	req;
1169	struct bfi_diag_dport_rsp_s	rsp;
1170	struct bfi_diag_dport_scn_s	scn;
1171};
1172
1173/*
1174 *	PHY module specific
1175 */
1176enum bfi_phy_h2i_msgs_e {
1177	BFI_PHY_H2I_QUERY_REQ = 1,
1178	BFI_PHY_H2I_STATS_REQ = 2,
1179	BFI_PHY_H2I_WRITE_REQ = 3,
1180	BFI_PHY_H2I_READ_REQ = 4,
1181};
1182
1183enum bfi_phy_i2h_msgs_e {
1184	BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
1185	BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
1186	BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
1187	BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
1188};
1189
1190/*
1191 * External PHY query request
1192 */
1193struct bfi_phy_query_req_s {
1194	struct bfi_mhdr_s	mh;             /* Common msg header */
1195	u8			instance;
1196	u8			rsv[3];
1197	struct bfi_alen_s	alen;
1198};
1199
1200/*
1201 * External PHY stats request
1202 */
1203struct bfi_phy_stats_req_s {
1204	struct bfi_mhdr_s	mh;             /* Common msg header */
1205	u8			instance;
1206	u8			rsv[3];
1207	struct bfi_alen_s	alen;
1208};
1209
1210/*
1211 * External PHY write request
1212 */
1213struct bfi_phy_write_req_s {
1214	struct bfi_mhdr_s	mh;             /* Common msg header */
1215	u8		instance;
1216	u8		last;
1217	u8		rsv[2];
1218	u32		offset;
1219	u32		length;
1220	struct bfi_alen_s	alen;
1221};
1222
1223/*
1224 * External PHY read request
1225 */
1226struct bfi_phy_read_req_s {
1227	struct bfi_mhdr_s	mh;	/* Common msg header */
1228	u8		instance;
1229	u8		rsv[3];
1230	u32		offset;
1231	u32		length;
1232	struct bfi_alen_s	alen;
1233};
1234
1235/*
1236 * External PHY query response
1237 */
1238struct bfi_phy_query_rsp_s {
1239	struct bfi_mhdr_s	mh;	/* Common msg header */
1240	u32			status;
1241};
1242
1243/*
1244 * External PHY stats response
1245 */
1246struct bfi_phy_stats_rsp_s {
1247	struct bfi_mhdr_s	mh;	/* Common msg header */
1248	u32			status;
1249};
1250
1251/*
1252 * External PHY read response
1253 */
1254struct bfi_phy_read_rsp_s {
1255	struct bfi_mhdr_s	mh;	/* Common msg header */
1256	u32			status;
1257	u32		length;
1258};
1259
1260/*
1261 * External PHY write response
1262 */
1263struct bfi_phy_write_rsp_s {
1264	struct bfi_mhdr_s	mh;	/* Common msg header */
1265	u32			status;
1266	u32			length;
1267};
1268
1269enum bfi_fru_h2i_msgs {
1270	BFI_FRUVPD_H2I_WRITE_REQ = 1,
1271	BFI_FRUVPD_H2I_READ_REQ = 2,
1272	BFI_TFRU_H2I_WRITE_REQ = 3,
1273	BFI_TFRU_H2I_READ_REQ = 4,
1274};
1275
1276enum bfi_fru_i2h_msgs {
1277	BFI_FRUVPD_I2H_WRITE_RSP = BFA_I2HM(1),
1278	BFI_FRUVPD_I2H_READ_RSP = BFA_I2HM(2),
1279	BFI_TFRU_I2H_WRITE_RSP = BFA_I2HM(3),
1280	BFI_TFRU_I2H_READ_RSP = BFA_I2HM(4),
1281};
1282
1283/*
1284 * FRU write request
1285 */
1286struct bfi_fru_write_req_s {
1287	struct bfi_mhdr_s	mh;	/* Common msg header */
1288	u8			last;
1289	u8			rsv_1[3];
1290	u8			trfr_cmpl;
1291	u8			rsv_2[3];
1292	u32			offset;
1293	u32			length;
1294	struct bfi_alen_s	alen;
1295};
1296
1297/*
1298 * FRU read request
1299 */
1300struct bfi_fru_read_req_s {
1301	struct bfi_mhdr_s	mh;	/* Common msg header */
1302	u32			offset;
1303	u32			length;
1304	struct bfi_alen_s	alen;
1305};
1306
1307/*
1308 * FRU response
1309 */
1310struct bfi_fru_rsp_s {
1311	struct bfi_mhdr_s	mh;	/* Common msg header */
1312	u32			status;
1313	u32			length;
1314};
1315#pragma pack()
1316
1317#endif /* __BFI_H__ */