blob: bf0a58d03be8de989f8ba92bf4f2ac428d085282 [file] [log] [blame]
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001/*
2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef __BFI_H__
19#define __BFI_H__
20
21#include "bfa_defs.h"
22#include "bfa_defs_svc.h"
23
24#pragma pack(1)
25
Krishna Gudipati45070252011-06-24 20:24:29 -070026/* 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
Jing Huangacdc79a2010-10-18 17:15:55 -070044/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070045 * 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))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070049
Jing Huangacdc79a2010-10-18 17:15:55 -070050/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070051 * 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 {
Krishna Gudipatid37779f2011-06-13 15:42:10 -070058 u8 qid;
Krishna Gudipati3fd45982011-06-24 20:24:08 -070059 u8 fn_lpu; /* msg destination */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070060 } h2i;
61 u16 i2htok; /* token in msgs to host */
62 } mtag;
63};
64
Krishna Gudipati3fd45982011-06-24 20:24:08 -070065#define bfi_fn_lpu(__fn, __lpu) ((__fn) << 1 | (__lpu))
66#define bfi_mhdr_2_fn(_mh) ((_mh)->mtag.h2i.fn_lpu >> 1)
Krishna Gudipatid37779f2011-06-13 15:42:10 -070067
Krishna Gudipati3fd45982011-06-24 20:24:08 -070068#define bfi_h2i_set(_mh, _mc, _op, _fn_lpu) do { \
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070069 (_mh).msg_class = (_mc); \
70 (_mh).msg_id = (_op); \
Krishna Gudipati3fd45982011-06-24 20:24:08 -070071 (_mh).mtag.h2i.fn_lpu = (_fn_lpu); \
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070072} 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
Jing Huangacdc79a2010-10-18 17:15:55 -070086/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070087 ****************************************************************************
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
Jing Huangacdc79a2010-10-18 17:15:55 -070097/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070098 * 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
Jing Huangacdc79a2010-10-18 17:15:55 -0700108/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700109 * DMA addresses
110 */
111union bfi_addr_u {
112 struct {
Maggie50444a32010-11-29 18:26:32 -0800113 __be32 addr_lo;
114 __be32 addr_hi;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700115 } a32;
116};
117
Jing Huangacdc79a2010-10-18 17:15:55 -0700118/*
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700119 * Scatter Gather Element used for fast-path IO requests
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700120 */
121struct bfi_sge_s {
Maggie Zhangf16a1752010-12-09 19:12:32 -0800122#ifdef __BIG_ENDIAN
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700123 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
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700134/**
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
Jing Huangacdc79a2010-10-18 17:15:55 -0700142/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700143 * 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
Krishna Gudipati45070252011-06-24 20:24:29 -0700153/* 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
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700159/*
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
Jing Huangacdc79a2010-10-18 17:15:55 -0700171/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700172 * 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
Jing Huangacdc79a2010-10-18 17:15:55 -0700180/*
Krishna Gudipatid37779f2011-06-13 15:42:10 -0700181 * 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/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700189 * Message Classes
190 */
191enum bfi_mclass {
192 BFI_MC_IOC = 1, /* IO Controller (IOC) */
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700193 BFI_MC_DIAG = 2, /* Diagnostic Msgs */
Krishna Gudipati5a54b1d2011-06-24 20:27:13 -0700194 BFI_MC_FLASH = 3, /* Flash message class */
Krishna Gudipati148d6102011-06-24 20:25:36 -0700195 BFI_MC_CEE = 4, /* CEE */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700196 BFI_MC_FCPORT = 5, /* FC port */
197 BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -0700198 BFI_MC_ABLK = 7, /* ASIC block configuration */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700199 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 */
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700203 BFI_MC_ITN = 12, /* I-T nexus (Initiator mode) */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700204 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 */
Krishna Gudipati51e569a2011-06-24 20:26:25 -0700211 BFI_MC_SFP = 22, /* SFP module */
Krishna Gudipati3350d982011-06-24 20:28:37 -0700212 BFI_MC_PHY = 25, /* External PHY message class */
Krishna Gudipatie6826c92012-09-21 17:27:14 -0700213 BFI_MC_FRU = 34,
214 BFI_MC_MAX = 35
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700215};
216
217#define BFI_IOC_MAX_CQS 4
218#define BFI_IOC_MAX_CQS_ASIC 8
219#define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */
220
Jing Huangacdc79a2010-10-18 17:15:55 -0700221/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700222 *----------------------------------------------------------------------
223 * IOC
224 *----------------------------------------------------------------------
225 */
226
Krishna Gudipati11189202011-06-13 15:50:35 -0700227/*
228 * Different asic generations
229 */
230enum bfi_asic_gen {
231 BFI_ASIC_GEN_CB = 1, /* crossbow 8G FC */
232 BFI_ASIC_GEN_CT = 2, /* catapult 8G FC or 10G CNA */
233 BFI_ASIC_GEN_CT2 = 3, /* catapult-2 16G FC or 10G CNA */
234};
235
236enum bfi_asic_mode {
237 BFI_ASIC_MODE_FC = 1, /* FC upto 8G speed */
238 BFI_ASIC_MODE_FC16 = 2, /* FC upto 16G speed */
239 BFI_ASIC_MODE_ETH = 3, /* Ethernet ports */
240 BFI_ASIC_MODE_COMBO = 4, /* FC 16G and Ethernet 10G port */
241};
242
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700243enum bfi_ioc_h2i_msgs {
244 BFI_IOC_H2I_ENABLE_REQ = 1,
245 BFI_IOC_H2I_DISABLE_REQ = 2,
246 BFI_IOC_H2I_GETATTR_REQ = 3,
247 BFI_IOC_H2I_DBG_SYNC = 4,
248 BFI_IOC_H2I_DBG_DUMP = 5,
249};
250
251enum bfi_ioc_i2h_msgs {
252 BFI_IOC_I2H_ENABLE_REPLY = BFA_I2HM(1),
253 BFI_IOC_I2H_DISABLE_REPLY = BFA_I2HM(2),
254 BFI_IOC_I2H_GETATTR_REPLY = BFA_I2HM(3),
Krishna Gudipati775c7742011-06-13 15:52:12 -0700255 BFI_IOC_I2H_HBEAT = BFA_I2HM(4),
Krishna Gudipatia7141342011-06-24 20:23:19 -0700256 BFI_IOC_I2H_ACQ_ADDR_REPLY = BFA_I2HM(5),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700257};
258
Jing Huangacdc79a2010-10-18 17:15:55 -0700259/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700260 * BFI_IOC_H2I_GETATTR_REQ message
261 */
262struct bfi_ioc_getattr_req_s {
263 struct bfi_mhdr_s mh;
264 union bfi_addr_u attr_addr;
265};
266
267struct bfi_ioc_attr_s {
268 wwn_t mfg_pwwn; /* Mfg port wwn */
269 wwn_t mfg_nwwn; /* Mfg node wwn */
270 mac_t mfg_mac; /* Mfg mac */
Krishna Gudipati5a0adae2011-06-24 20:22:56 -0700271 u8 port_mode; /* bfi_port_mode */
272 u8 rsvd_a;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700273 wwn_t pwwn;
274 wwn_t nwwn;
275 mac_t mac; /* PBC or Mfg mac */
276 u16 rsvd_b;
277 mac_t fcoe_mac;
278 u16 rsvd_c;
279 char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
280 u8 pcie_gen;
281 u8 pcie_lanes_orig;
282 u8 pcie_lanes;
283 u8 rx_bbcredit; /* receive buffer credits */
284 u32 adapter_prop; /* adapter properties */
285 u16 maxfrsize; /* max receive frame size */
286 char asic_rev;
Krishna Gudipati10a07372011-06-24 20:23:38 -0700287 u8 rsvd_d;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700288 char fw_version[BFA_VERSION_LEN];
289 char optrom_version[BFA_VERSION_LEN];
290 struct bfa_mfg_vpd_s vpd;
291 u32 card_type; /* card type */
Krishna Gudipatiea5d7c92012-09-21 17:25:02 -0700292 u8 mfg_day; /* manufacturing day */
293 u8 mfg_month; /* manufacturing month */
294 u16 mfg_year; /* manufacturing year */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700295};
296
Jing Huangacdc79a2010-10-18 17:15:55 -0700297/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700298 * BFI_IOC_I2H_GETATTR_REPLY message
299 */
300struct bfi_ioc_getattr_reply_s {
301 struct bfi_mhdr_s mh; /* Common msg header */
302 u8 status; /* cfg reply status */
303 u8 rsvd[3];
304};
305
Jing Huangacdc79a2010-10-18 17:15:55 -0700306/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700307 * Firmware memory page offsets
308 */
309#define BFI_IOC_SMEM_PG0_CB (0x40)
310#define BFI_IOC_SMEM_PG0_CT (0x180)
311
Jing Huangacdc79a2010-10-18 17:15:55 -0700312/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700313 * Firmware statistic offset
314 */
315#define BFI_IOC_FWSTATS_OFF (0x6B40)
316#define BFI_IOC_FWSTATS_SZ (4096)
317
Jing Huangacdc79a2010-10-18 17:15:55 -0700318/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700319 * Firmware trace offset
320 */
321#define BFI_IOC_TRC_OFF (0x4b00)
322#define BFI_IOC_TRC_ENTS 256
323
324#define BFI_IOC_FW_SIGNATURE (0xbfadbfad)
325#define BFI_IOC_MD5SUM_SZ 4
326struct bfi_ioc_image_hdr_s {
Krishna Gudipati11189202011-06-13 15:50:35 -0700327 u32 signature; /* constant signature */
328 u8 asic_gen; /* asic generation */
329 u8 asic_mode;
330 u8 port0_mode; /* device mode for port 0 */
331 u8 port1_mode; /* device mode for port 1 */
332 u32 exec; /* exec vector */
333 u32 bootenv; /* fimware boot env */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700334 u32 rsvd_b[4];
335 u32 md5sum[BFI_IOC_MD5SUM_SZ];
336};
337
Krishna Gudipati11189202011-06-13 15:50:35 -0700338#define BFI_FWBOOT_DEVMODE_OFF 4
339#define BFI_FWBOOT_TYPE_OFF 8
340#define BFI_FWBOOT_ENV_OFF 12
341#define BFI_FWBOOT_DEVMODE(__asic_gen, __asic_mode, __p0_mode, __p1_mode) \
342 (((u32)(__asic_gen)) << 24 | \
343 ((u32)(__asic_mode)) << 16 | \
344 ((u32)(__p0_mode)) << 8 | \
345 ((u32)(__p1_mode)))
346
347#define BFI_FWBOOT_TYPE_NORMAL 0
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700348#define BFI_FWBOOT_TYPE_MEMTEST 2
Krishna Gudipati11189202011-06-13 15:50:35 -0700349#define BFI_FWBOOT_ENV_OS 0
350
351enum bfi_port_mode {
352 BFI_PORT_MODE_FC = 1,
353 BFI_PORT_MODE_ETH = 2,
354};
355
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700356struct bfi_ioc_hbeat_s {
357 struct bfi_mhdr_s mh; /* common msg header */
358 u32 hb_count; /* current heart beat count */
359};
360
Jing Huangacdc79a2010-10-18 17:15:55 -0700361/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700362 * IOC hardware/firmware state
363 */
364enum bfi_ioc_state {
365 BFI_IOC_UNINIT = 0, /* not initialized */
366 BFI_IOC_INITING = 1, /* h/w is being initialized */
367 BFI_IOC_HWINIT = 2, /* h/w is initialized */
368 BFI_IOC_CFG = 3, /* IOC configuration in progress */
369 BFI_IOC_OP = 4, /* IOC is operational */
370 BFI_IOC_DISABLING = 5, /* IOC is being disabled */
371 BFI_IOC_DISABLED = 6, /* IOC is disabled */
372 BFI_IOC_CFG_DISABLED = 7, /* IOC is being disabled;transient */
373 BFI_IOC_FAIL = 8, /* IOC heart-beat failure */
374 BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */
375};
376
Vijaya Mohan Guvvac679b592013-05-13 02:33:26 -0700377#define BFA_IOC_CB_JOIN_SH 16
378#define BFA_IOC_CB_FWSTATE_MASK 0x0000ffff
379#define BFA_IOC_CB_JOIN_MASK 0xffff0000
380
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700381#define BFI_IOC_ENDIAN_SIG 0x12345678
382
383enum {
384 BFI_ADAPTER_TYPE_FC = 0x01, /* FC adapters */
385 BFI_ADAPTER_TYPE_MK = 0x0f0000, /* adapter type mask */
386 BFI_ADAPTER_TYPE_SH = 16, /* adapter type shift */
387 BFI_ADAPTER_NPORTS_MK = 0xff00, /* number of ports mask */
388 BFI_ADAPTER_NPORTS_SH = 8, /* number of ports shift */
389 BFI_ADAPTER_SPEED_MK = 0xff, /* adapter speed mask */
390 BFI_ADAPTER_SPEED_SH = 0, /* adapter speed shift */
391 BFI_ADAPTER_PROTO = 0x100000, /* prototype adapaters */
392 BFI_ADAPTER_TTV = 0x200000, /* TTV debug capable */
393 BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */
394};
395
396#define BFI_ADAPTER_GETP(__prop, __adap_prop) \
397 (((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \
398 BFI_ADAPTER_ ## __prop ## _SH)
399#define BFI_ADAPTER_SETP(__prop, __val) \
400 ((__val) << BFI_ADAPTER_ ## __prop ## _SH)
401#define BFI_ADAPTER_IS_PROTO(__adap_type) \
402 ((__adap_type) & BFI_ADAPTER_PROTO)
403#define BFI_ADAPTER_IS_TTV(__adap_type) \
404 ((__adap_type) & BFI_ADAPTER_TTV)
405#define BFI_ADAPTER_IS_UNSUPP(__adap_type) \
406 ((__adap_type) & BFI_ADAPTER_UNSUPP)
407#define BFI_ADAPTER_IS_SPECIAL(__adap_type) \
408 ((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO | \
409 BFI_ADAPTER_UNSUPP))
410
Jing Huangacdc79a2010-10-18 17:15:55 -0700411/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700412 * BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
413 */
414struct bfi_ioc_ctrl_req_s {
415 struct bfi_mhdr_s mh;
Krishna Gudipatid37779f2011-06-13 15:42:10 -0700416 u16 clscode;
417 u16 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700418 u32 tv_sec;
419};
420#define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
421#define bfi_ioc_disable_req_t struct bfi_ioc_ctrl_req_s;
422
Jing Huangacdc79a2010-10-18 17:15:55 -0700423/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700424 * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
425 */
426struct bfi_ioc_ctrl_reply_s {
427 struct bfi_mhdr_s mh; /* Common msg header */
428 u8 status; /* enable/disable status */
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -0700429 u8 port_mode; /* bfa_mode_s */
430 u8 cap_bm; /* capability bit mask */
431 u8 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700432};
433#define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
434#define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
435
436#define BFI_IOC_MSGSZ 8
Jing Huangacdc79a2010-10-18 17:15:55 -0700437/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700438 * H2I Messages
439 */
440union bfi_ioc_h2i_msg_u {
441 struct bfi_mhdr_s mh;
442 struct bfi_ioc_ctrl_req_s enable_req;
443 struct bfi_ioc_ctrl_req_s disable_req;
444 struct bfi_ioc_getattr_req_s getattr_req;
445 u32 mboxmsg[BFI_IOC_MSGSZ];
446};
447
Jing Huangacdc79a2010-10-18 17:15:55 -0700448/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700449 * I2H Messages
450 */
451union bfi_ioc_i2h_msg_u {
452 struct bfi_mhdr_s mh;
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -0700453 struct bfi_ioc_ctrl_reply_s fw_event;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700454 u32 mboxmsg[BFI_IOC_MSGSZ];
455};
456
457
Jing Huangacdc79a2010-10-18 17:15:55 -0700458/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700459 *----------------------------------------------------------------------
460 * PBC
461 *----------------------------------------------------------------------
462 */
463
464#define BFI_PBC_MAX_BLUNS 8
465#define BFI_PBC_MAX_VPORTS 16
Krishna Gudipati43ffdf42011-06-13 15:46:21 -0700466#define BFI_PBC_PORT_DISABLED 2
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700467
Jing Huangacdc79a2010-10-18 17:15:55 -0700468/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700469 * PBC boot lun configuration
470 */
471struct bfi_pbc_blun_s {
472 wwn_t tgt_pwwn;
Maggie Zhangf3148782010-12-09 19:11:39 -0800473 struct scsi_lun tgt_lun;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700474};
475
Jing Huangacdc79a2010-10-18 17:15:55 -0700476/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700477 * PBC virtual port configuration
478 */
479struct bfi_pbc_vport_s {
480 wwn_t vp_pwwn;
481 wwn_t vp_nwwn;
482};
483
Jing Huangacdc79a2010-10-18 17:15:55 -0700484/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700485 * BFI pre-boot configuration information
486 */
487struct bfi_pbc_s {
488 u8 port_enabled;
489 u8 boot_enabled;
490 u8 nbluns;
491 u8 nvports;
492 u8 port_speed;
493 u8 rsvd_a;
494 u16 hss;
495 wwn_t pbc_pwwn;
496 wwn_t pbc_nwwn;
497 struct bfi_pbc_blun_s blun[BFI_PBC_MAX_BLUNS];
498 struct bfi_pbc_vport_s vport[BFI_PBC_MAX_VPORTS];
499};
500
Jing Huangacdc79a2010-10-18 17:15:55 -0700501/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700502 *----------------------------------------------------------------------
503 * MSGQ
504 *----------------------------------------------------------------------
505 */
506#define BFI_MSGQ_FULL(_q) (((_q->pi + 1) % _q->q_depth) == _q->ci)
507#define BFI_MSGQ_EMPTY(_q) (_q->pi == _q->ci)
508#define BFI_MSGQ_UPDATE_CI(_q) (_q->ci = (_q->ci + 1) % _q->q_depth)
509#define BFI_MSGQ_UPDATE_PI(_q) (_q->pi = (_q->pi + 1) % _q->q_depth)
510
511/* q_depth must be power of 2 */
512#define BFI_MSGQ_FREE_CNT(_q) ((_q->ci - _q->pi - 1) & (_q->q_depth - 1))
513
514enum bfi_msgq_h2i_msgs_e {
515 BFI_MSGQ_H2I_INIT_REQ = 1,
516 BFI_MSGQ_H2I_DOORBELL = 2,
517 BFI_MSGQ_H2I_SHUTDOWN = 3,
518};
519
520enum bfi_msgq_i2h_msgs_e {
521 BFI_MSGQ_I2H_INIT_RSP = 1,
522 BFI_MSGQ_I2H_DOORBELL = 2,
523};
524
525
526/* Messages(commands/responsed/AENS will have the following header */
527struct bfi_msgq_mhdr_s {
528 u8 msg_class;
529 u8 msg_id;
530 u16 msg_token;
531 u16 num_entries;
532 u8 enet_id;
533 u8 rsvd[1];
534};
535
536#define bfi_msgq_mhdr_set(_mh, _mc, _mid, _tok, _enet_id) do { \
537 (_mh).msg_class = (_mc); \
538 (_mh).msg_id = (_mid); \
539 (_mh).msg_token = (_tok); \
540 (_mh).enet_id = (_enet_id); \
541} while (0)
542
543/*
544 * Mailbox for messaging interface
545 *
546*/
547#define BFI_MSGQ_CMD_ENTRY_SIZE (64) /* TBD */
548#define BFI_MSGQ_RSP_ENTRY_SIZE (64) /* TBD */
549#define BFI_MSGQ_MSG_SIZE_MAX (2048) /* TBD */
550
551struct bfi_msgq_s {
552 union bfi_addr_u addr;
553 u16 q_depth; /* Total num of entries in the queue */
554 u8 rsvd[2];
555};
556
557/* BFI_ENET_MSGQ_CFG_REQ TBD init or cfg? */
558struct bfi_msgq_cfg_req_s {
559 struct bfi_mhdr_s mh;
560 struct bfi_msgq_s cmdq;
561 struct bfi_msgq_s rspq;
562};
563
564/* BFI_ENET_MSGQ_CFG_RSP */
565struct bfi_msgq_cfg_rsp_s {
566 struct bfi_mhdr_s mh;
567 u8 cmd_status;
568 u8 rsvd[3];
569};
570
571
572/* BFI_MSGQ_H2I_DOORBELL */
573struct bfi_msgq_h2i_db_s {
574 struct bfi_mhdr_s mh;
575 u16 cmdq_pi;
576 u16 rspq_ci;
577};
578
579/* BFI_MSGQ_I2H_DOORBELL */
580struct bfi_msgq_i2h_db_s {
581 struct bfi_mhdr_s mh;
582 u16 rspq_pi;
583 u16 cmdq_ci;
584};
585
586#pragma pack()
587
588/* BFI port specific */
589#pragma pack(1)
590
591enum bfi_port_h2i {
592 BFI_PORT_H2I_ENABLE_REQ = (1),
593 BFI_PORT_H2I_DISABLE_REQ = (2),
594 BFI_PORT_H2I_GET_STATS_REQ = (3),
595 BFI_PORT_H2I_CLEAR_STATS_REQ = (4),
596};
597
598enum bfi_port_i2h {
599 BFI_PORT_I2H_ENABLE_RSP = BFA_I2HM(1),
600 BFI_PORT_I2H_DISABLE_RSP = BFA_I2HM(2),
601 BFI_PORT_I2H_GET_STATS_RSP = BFA_I2HM(3),
602 BFI_PORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(4),
603};
604
Jing Huangacdc79a2010-10-18 17:15:55 -0700605/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700606 * Generic REQ type
607 */
608struct bfi_port_generic_req_s {
609 struct bfi_mhdr_s mh; /* msg header */
610 u32 msgtag; /* msgtag for reply */
611 u32 rsvd;
612};
613
Jing Huangacdc79a2010-10-18 17:15:55 -0700614/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700615 * Generic RSP type
616 */
617struct bfi_port_generic_rsp_s {
618 struct bfi_mhdr_s mh; /* common msg header */
619 u8 status; /* port enable status */
620 u8 rsvd[3];
621 u32 msgtag; /* msgtag for reply */
622};
623
Jing Huangacdc79a2010-10-18 17:15:55 -0700624/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700625 * BFI_PORT_H2I_GET_STATS_REQ
626 */
627struct bfi_port_get_stats_req_s {
628 struct bfi_mhdr_s mh; /* common msg header */
629 union bfi_addr_u dma_addr;
630};
631
632union bfi_port_h2i_msg_u {
633 struct bfi_mhdr_s mh;
634 struct bfi_port_generic_req_s enable_req;
635 struct bfi_port_generic_req_s disable_req;
636 struct bfi_port_get_stats_req_s getstats_req;
637 struct bfi_port_generic_req_s clearstats_req;
638};
639
640union bfi_port_i2h_msg_u {
641 struct bfi_mhdr_s mh;
642 struct bfi_port_generic_rsp_s enable_rsp;
643 struct bfi_port_generic_rsp_s disable_rsp;
644 struct bfi_port_generic_rsp_s getstats_rsp;
645 struct bfi_port_generic_rsp_s clearstats_rsp;
646};
647
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -0700648/*
649 *----------------------------------------------------------------------
650 * ABLK
651 *----------------------------------------------------------------------
652 */
653enum bfi_ablk_h2i_msgs_e {
654 BFI_ABLK_H2I_QUERY = 1,
655 BFI_ABLK_H2I_ADPT_CONFIG = 2,
656 BFI_ABLK_H2I_PORT_CONFIG = 3,
657 BFI_ABLK_H2I_PF_CREATE = 4,
658 BFI_ABLK_H2I_PF_DELETE = 5,
659 BFI_ABLK_H2I_PF_UPDATE = 6,
660 BFI_ABLK_H2I_OPTROM_ENABLE = 7,
661 BFI_ABLK_H2I_OPTROM_DISABLE = 8,
662};
663
664enum bfi_ablk_i2h_msgs_e {
665 BFI_ABLK_I2H_QUERY = BFA_I2HM(BFI_ABLK_H2I_QUERY),
666 BFI_ABLK_I2H_ADPT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG),
667 BFI_ABLK_I2H_PORT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG),
668 BFI_ABLK_I2H_PF_CREATE = BFA_I2HM(BFI_ABLK_H2I_PF_CREATE),
669 BFI_ABLK_I2H_PF_DELETE = BFA_I2HM(BFI_ABLK_H2I_PF_DELETE),
670 BFI_ABLK_I2H_PF_UPDATE = BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE),
671 BFI_ABLK_I2H_OPTROM_ENABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE),
672 BFI_ABLK_I2H_OPTROM_DISABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE),
673};
674
675/* BFI_ABLK_H2I_QUERY */
676struct bfi_ablk_h2i_query_s {
677 struct bfi_mhdr_s mh;
678 union bfi_addr_u addr;
679};
680
681/* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */
682struct bfi_ablk_h2i_cfg_req_s {
683 struct bfi_mhdr_s mh;
684 u8 mode;
685 u8 port;
686 u8 max_pf;
687 u8 max_vf;
688};
689
690/*
691 * BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE,
692 */
693struct bfi_ablk_h2i_pf_req_s {
694 struct bfi_mhdr_s mh;
695 u8 pcifn;
696 u8 port;
697 u16 pers;
Krishna Gudipati1a1297c2012-09-21 17:26:50 -0700698 u16 bw_min; /* percent BW @ max speed */
699 u16 bw_max; /* percent BW @ max speed */
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -0700700};
701
702/* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */
703struct bfi_ablk_h2i_optrom_s {
704 struct bfi_mhdr_s mh;
705};
706
707/*
708 * BFI_ABLK_I2H_QUERY
709 * BFI_ABLK_I2H_PORT_CONFIG
710 * BFI_ABLK_I2H_PF_CREATE
711 * BFI_ABLK_I2H_PF_DELETE
712 * BFI_ABLK_I2H_PF_UPDATE
713 * BFI_ABLK_I2H_OPTROM_ENABLE
714 * BFI_ABLK_I2H_OPTROM_DISABLE
715 */
716struct bfi_ablk_i2h_rsp_s {
717 struct bfi_mhdr_s mh;
718 u8 status;
719 u8 pcifn;
720 u8 port_mode;
721};
722
Krishna Gudipati148d6102011-06-24 20:25:36 -0700723
724/*
725 * CEE module specific messages
726 */
727
728/* Mailbox commands from host to firmware */
729enum bfi_cee_h2i_msgs_e {
730 BFI_CEE_H2I_GET_CFG_REQ = 1,
731 BFI_CEE_H2I_RESET_STATS = 2,
732 BFI_CEE_H2I_GET_STATS_REQ = 3,
733};
734
735enum bfi_cee_i2h_msgs_e {
736 BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
737 BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
738 BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
739};
740
741/*
742 * H2I command structure for resetting the stats
743 */
744struct bfi_cee_reset_stats_s {
745 struct bfi_mhdr_s mh;
746};
747
748/*
749 * Get configuration command from host
750 */
751struct bfi_cee_get_req_s {
752 struct bfi_mhdr_s mh;
753 union bfi_addr_u dma_addr;
754};
755
756/*
757 * Reply message from firmware
758 */
759struct bfi_cee_get_rsp_s {
760 struct bfi_mhdr_s mh;
761 u8 cmd_status;
762 u8 rsvd[3];
763};
764
765/*
766 * Reply message from firmware
767 */
768struct bfi_cee_stats_rsp_s {
769 struct bfi_mhdr_s mh;
770 u8 cmd_status;
771 u8 rsvd[3];
772};
773
774/* Mailbox message structures from firmware to host */
775union bfi_cee_i2h_msg_u {
776 struct bfi_mhdr_s mh;
777 struct bfi_cee_get_rsp_s get_rsp;
778 struct bfi_cee_stats_rsp_s stats_rsp;
779};
780
Krishna Gudipati51e569a2011-06-24 20:26:25 -0700781/*
782 * SFP related
783 */
784
785enum bfi_sfp_h2i_e {
786 BFI_SFP_H2I_SHOW = 1,
787 BFI_SFP_H2I_SCN = 2,
788};
789
790enum bfi_sfp_i2h_e {
791 BFI_SFP_I2H_SHOW = BFA_I2HM(BFI_SFP_H2I_SHOW),
792 BFI_SFP_I2H_SCN = BFA_I2HM(BFI_SFP_H2I_SCN),
793};
794
795/*
Krishna Gudipati7826f302011-07-20 16:59:13 -0700796 * SFP state change notification
797 */
798struct bfi_sfp_scn_s {
799 struct bfi_mhdr_s mhr; /* host msg header */
800 u8 event;
801 u8 sfpid;
802 u8 pomlvl; /* pom level: normal/warning/alarm */
803 u8 is_elb; /* e-loopback */
804};
805
806/*
Krishna Gudipati51e569a2011-06-24 20:26:25 -0700807 * SFP state
808 */
809enum bfa_sfp_stat_e {
810 BFA_SFP_STATE_INIT = 0, /* SFP state is uninit */
811 BFA_SFP_STATE_REMOVED = 1, /* SFP is removed */
812 BFA_SFP_STATE_INSERTED = 2, /* SFP is inserted */
813 BFA_SFP_STATE_VALID = 3, /* SFP is valid */
814 BFA_SFP_STATE_UNSUPPORT = 4, /* SFP is unsupport */
815 BFA_SFP_STATE_FAILED = 5, /* SFP i2c read fail */
816};
817
818/*
819 * SFP memory access type
820 */
821enum bfi_sfp_mem_e {
822 BFI_SFP_MEM_ALL = 0x1, /* access all data field */
823 BFI_SFP_MEM_DIAGEXT = 0x2, /* access diag ext data field only */
824};
825
826struct bfi_sfp_req_s {
827 struct bfi_mhdr_s mh;
828 u8 memtype;
829 u8 rsvd[3];
830 struct bfi_alen_s alen;
831};
832
833struct bfi_sfp_rsp_s {
834 struct bfi_mhdr_s mh;
835 u8 status;
836 u8 state;
837 u8 rsvd[2];
838};
839
Krishna Gudipati5a54b1d2011-06-24 20:27:13 -0700840/*
841 * FLASH module specific
842 */
843enum bfi_flash_h2i_msgs {
844 BFI_FLASH_H2I_QUERY_REQ = 1,
845 BFI_FLASH_H2I_ERASE_REQ = 2,
846 BFI_FLASH_H2I_WRITE_REQ = 3,
847 BFI_FLASH_H2I_READ_REQ = 4,
848 BFI_FLASH_H2I_BOOT_VER_REQ = 5,
849};
850
851enum bfi_flash_i2h_msgs {
852 BFI_FLASH_I2H_QUERY_RSP = BFA_I2HM(1),
853 BFI_FLASH_I2H_ERASE_RSP = BFA_I2HM(2),
854 BFI_FLASH_I2H_WRITE_RSP = BFA_I2HM(3),
855 BFI_FLASH_I2H_READ_RSP = BFA_I2HM(4),
856 BFI_FLASH_I2H_BOOT_VER_RSP = BFA_I2HM(5),
857 BFI_FLASH_I2H_EVENT = BFA_I2HM(127),
858};
859
860/*
861 * Flash query request
862 */
863struct bfi_flash_query_req_s {
864 struct bfi_mhdr_s mh; /* Common msg header */
865 struct bfi_alen_s alen;
866};
867
868/*
869 * Flash erase request
870 */
871struct bfi_flash_erase_req_s {
872 struct bfi_mhdr_s mh; /* Common msg header */
873 u32 type; /* partition type */
874 u8 instance; /* partition instance */
875 u8 rsv[3];
876};
877
878/*
879 * Flash write request
880 */
881struct bfi_flash_write_req_s {
882 struct bfi_mhdr_s mh; /* Common msg header */
883 struct bfi_alen_s alen;
884 u32 type; /* partition type */
885 u8 instance; /* partition instance */
886 u8 last;
887 u8 rsv[2];
888 u32 offset;
889 u32 length;
890};
891
892/*
893 * Flash read request
894 */
895struct bfi_flash_read_req_s {
896 struct bfi_mhdr_s mh; /* Common msg header */
897 u32 type; /* partition type */
898 u8 instance; /* partition instance */
899 u8 rsv[3];
900 u32 offset;
901 u32 length;
902 struct bfi_alen_s alen;
903};
904
905/*
906 * Flash query response
907 */
908struct bfi_flash_query_rsp_s {
909 struct bfi_mhdr_s mh; /* Common msg header */
910 u32 status;
911};
912
913/*
914 * Flash read response
915 */
916struct bfi_flash_read_rsp_s {
917 struct bfi_mhdr_s mh; /* Common msg header */
918 u32 type; /* partition type */
919 u8 instance; /* partition instance */
920 u8 rsv[3];
921 u32 status;
922 u32 length;
923};
924
925/*
926 * Flash write response
927 */
928struct bfi_flash_write_rsp_s {
929 struct bfi_mhdr_s mh; /* Common msg header */
930 u32 type; /* partition type */
931 u8 instance; /* partition instance */
932 u8 rsv[3];
933 u32 status;
934 u32 length;
935};
936
937/*
938 * Flash erase response
939 */
940struct bfi_flash_erase_rsp_s {
941 struct bfi_mhdr_s mh; /* Common msg header */
942 u32 type; /* partition type */
943 u8 instance; /* partition instance */
944 u8 rsv[3];
945 u32 status;
946};
947
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700948/*
Krishna Gudipati7826f302011-07-20 16:59:13 -0700949 * Flash event notification
950 */
951struct bfi_flash_event_s {
952 struct bfi_mhdr_s mh; /* Common msg header */
953 bfa_status_t status;
954 u32 param;
955};
956
957/*
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700958 *----------------------------------------------------------------------
959 * DIAG
960 *----------------------------------------------------------------------
961 */
962enum bfi_diag_h2i {
963 BFI_DIAG_H2I_PORTBEACON = 1,
964 BFI_DIAG_H2I_LOOPBACK = 2,
965 BFI_DIAG_H2I_FWPING = 3,
966 BFI_DIAG_H2I_TEMPSENSOR = 4,
967 BFI_DIAG_H2I_LEDTEST = 5,
968 BFI_DIAG_H2I_QTEST = 6,
Krishna Gudipatie3535462012-09-21 17:26:07 -0700969 BFI_DIAG_H2I_DPORT = 7,
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700970};
971
972enum bfi_diag_i2h {
973 BFI_DIAG_I2H_PORTBEACON = BFA_I2HM(BFI_DIAG_H2I_PORTBEACON),
974 BFI_DIAG_I2H_LOOPBACK = BFA_I2HM(BFI_DIAG_H2I_LOOPBACK),
975 BFI_DIAG_I2H_FWPING = BFA_I2HM(BFI_DIAG_H2I_FWPING),
976 BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR),
977 BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST),
978 BFI_DIAG_I2H_QTEST = BFA_I2HM(BFI_DIAG_H2I_QTEST),
Krishna Gudipatie3535462012-09-21 17:26:07 -0700979 BFI_DIAG_I2H_DPORT = BFA_I2HM(BFI_DIAG_H2I_DPORT),
Vijaya Mohan Guvva1a898a72013-05-13 02:33:21 -0700980 BFI_DIAG_I2H_DPORT_SCN = BFA_I2HM(8),
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700981};
982
983#define BFI_DIAG_MAX_SGES 2
984#define BFI_DIAG_DMA_BUF_SZ (2 * 1024)
985#define BFI_BOOT_MEMTEST_RES_ADDR 0x900
986#define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3
987
988struct bfi_diag_lb_req_s {
989 struct bfi_mhdr_s mh;
990 u32 loopcnt;
991 u32 pattern;
992 u8 lb_mode; /*!< bfa_port_opmode_t */
993 u8 speed; /*!< bfa_port_speed_t */
994 u8 rsvd[2];
995};
996
997struct bfi_diag_lb_rsp_s {
998 struct bfi_mhdr_s mh; /* 4 bytes */
999 struct bfa_diag_loopback_result_s res; /* 16 bytes */
1000};
1001
1002struct bfi_diag_fwping_req_s {
1003 struct bfi_mhdr_s mh; /* 4 bytes */
1004 struct bfi_alen_s alen; /* 12 bytes */
1005 u32 data; /* user input data pattern */
1006 u32 count; /* user input dma count */
1007 u8 qtag; /* track CPE vc */
1008 u8 rsv[3];
1009};
1010
1011struct bfi_diag_fwping_rsp_s {
1012 struct bfi_mhdr_s mh; /* 4 bytes */
1013 u32 data; /* user input data pattern */
1014 u8 qtag; /* track CPE vc */
1015 u8 dma_status; /* dma status */
1016 u8 rsv[2];
1017};
1018
1019/*
1020 * Temperature Sensor
1021 */
1022struct bfi_diag_ts_req_s {
1023 struct bfi_mhdr_s mh; /* 4 bytes */
1024 u16 temp; /* 10-bit A/D value */
1025 u16 brd_temp; /* 9-bit board temp */
1026 u8 status;
1027 u8 ts_junc; /* show junction tempsensor */
1028 u8 ts_brd; /* show board tempsensor */
1029 u8 rsv;
1030};
1031#define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
1032
1033struct bfi_diag_ledtest_req_s {
1034 struct bfi_mhdr_s mh; /* 4 bytes */
1035 u8 cmd;
1036 u8 color;
1037 u8 portid;
1038 u8 led; /* bitmap of LEDs to be tested */
1039 u16 freq; /* no. of blinks every 10 secs */
1040 u8 rsv[2];
1041};
1042
1043/* notify host led operation is done */
1044struct bfi_diag_ledtest_rsp_s {
1045 struct bfi_mhdr_s mh; /* 4 bytes */
1046};
1047
1048struct bfi_diag_portbeacon_req_s {
1049 struct bfi_mhdr_s mh; /* 4 bytes */
1050 u32 period; /* beaconing period */
1051 u8 beacon; /* 1: beacon on */
1052 u8 rsvd[3];
1053};
1054
1055/* notify host the beacon is off */
1056struct bfi_diag_portbeacon_rsp_s {
1057 struct bfi_mhdr_s mh; /* 4 bytes */
1058};
1059
1060struct bfi_diag_qtest_req_s {
1061 struct bfi_mhdr_s mh; /* 4 bytes */
1062 u32 data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
1063};
1064#define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
1065
Krishna Gudipati3350d982011-06-24 20:28:37 -07001066/*
Krishna Gudipatie3535462012-09-21 17:26:07 -07001067 * D-port test
1068 */
1069enum bfi_dport_req {
1070 BFI_DPORT_DISABLE = 0, /* disable dport request */
1071 BFI_DPORT_ENABLE = 1, /* enable dport request */
Vijaya Mohan Guvva1a898a72013-05-13 02:33:21 -07001072 BFI_DPORT_START = 2, /* start dport request */
1073 BFI_DPORT_SHOW = 3, /* show dport request */
1074 BFI_DPORT_DYN_DISABLE = 4, /* disable dynamic dport request */
1075};
1076
1077enum bfi_dport_scn {
1078 BFI_DPORT_SCN_TESTSTART = 1,
1079 BFI_DPORT_SCN_TESTCOMP = 2,
1080 BFI_DPORT_SCN_SFP_REMOVED = 3,
1081 BFI_DPORT_SCN_DDPORT_ENABLE = 4,
1082 BFI_DPORT_SCN_DDPORT_DISABLE = 5,
1083 BFI_DPORT_SCN_FCPORT_DISABLE = 6,
1084 BFI_DPORT_SCN_SUBTESTSTART = 7,
1085 BFI_DPORT_SCN_TESTSKIP = 8,
1086 BFI_DPORT_SCN_DDPORT_DISABLED = 9,
Krishna Gudipatie3535462012-09-21 17:26:07 -07001087};
1088
1089struct bfi_diag_dport_req_s {
1090 struct bfi_mhdr_s mh; /* 4 bytes */
Vijaya Mohan Guvva1a898a72013-05-13 02:33:21 -07001091 u8 req; /* request 1: enable 0: disable */
1092 u8 rsvd[3];
1093 u32 lpcnt;
1094 u32 payload;
Krishna Gudipatie3535462012-09-21 17:26:07 -07001095};
Vijaya Mohan Guvva1a898a72013-05-13 02:33:21 -07001096
1097struct bfi_diag_dport_rsp_s {
1098 struct bfi_mhdr_s mh; /* header 4 bytes */
1099 bfa_status_t status; /* reply status */
1100 wwn_t pwwn; /* switch port wwn. 8 bytes */
1101 wwn_t nwwn; /* switch node wwn. 8 bytes */
1102};
1103
1104struct bfi_diag_dport_scn_teststart_s {
1105 wwn_t pwwn; /* switch port wwn. 8 bytes */
1106 wwn_t nwwn; /* switch node wwn. 8 bytes */
1107 u8 type; /* bfa_diag_dport_test_type_e */
1108 u8 rsvd[3];
1109 u32 numfrm; /* from switch uint in 1M */
1110};
1111
1112struct bfi_diag_dport_scn_testcomp_s {
1113 u8 status; /* bfa_diag_dport_test_status_e */
1114 u8 speed; /* bfa_port_speed_t */
1115 u16 numbuffer; /* from switch */
1116 u8 subtest_status[DPORT_TEST_MAX]; /* 4 bytes */
1117 u32 latency; /* from switch */
1118 u32 distance; /* from swtich unit in meters */
1119 /* Buffers required to saturate the link */
1120 u16 frm_sz; /* from switch for buf_reqd */
1121 u8 rsvd[2];
1122};
1123
1124struct bfi_diag_dport_scn_s { /* max size == RDS_RMESZ */
1125 struct bfi_mhdr_s mh; /* header 4 bytes */
1126 u8 state; /* new state */
1127 u8 rsvd[3];
1128 union {
1129 struct bfi_diag_dport_scn_teststart_s teststart;
1130 struct bfi_diag_dport_scn_testcomp_s testcomp;
1131 } info;
1132};
1133
1134union bfi_diag_dport_msg_u {
1135 struct bfi_diag_dport_req_s req;
1136 struct bfi_diag_dport_rsp_s rsp;
1137 struct bfi_diag_dport_scn_s scn;
1138};
Krishna Gudipatie3535462012-09-21 17:26:07 -07001139
1140/*
Krishna Gudipati3350d982011-06-24 20:28:37 -07001141 * PHY module specific
1142 */
1143enum bfi_phy_h2i_msgs_e {
1144 BFI_PHY_H2I_QUERY_REQ = 1,
1145 BFI_PHY_H2I_STATS_REQ = 2,
1146 BFI_PHY_H2I_WRITE_REQ = 3,
1147 BFI_PHY_H2I_READ_REQ = 4,
1148};
1149
1150enum bfi_phy_i2h_msgs_e {
1151 BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
1152 BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
1153 BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
1154 BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
1155};
1156
1157/*
1158 * External PHY query request
1159 */
1160struct bfi_phy_query_req_s {
1161 struct bfi_mhdr_s mh; /* Common msg header */
1162 u8 instance;
1163 u8 rsv[3];
1164 struct bfi_alen_s alen;
1165};
1166
1167/*
1168 * External PHY stats request
1169 */
1170struct bfi_phy_stats_req_s {
1171 struct bfi_mhdr_s mh; /* Common msg header */
1172 u8 instance;
1173 u8 rsv[3];
1174 struct bfi_alen_s alen;
1175};
1176
1177/*
1178 * External PHY write request
1179 */
1180struct bfi_phy_write_req_s {
1181 struct bfi_mhdr_s mh; /* Common msg header */
1182 u8 instance;
1183 u8 last;
1184 u8 rsv[2];
1185 u32 offset;
1186 u32 length;
1187 struct bfi_alen_s alen;
1188};
1189
1190/*
1191 * External PHY read request
1192 */
1193struct bfi_phy_read_req_s {
1194 struct bfi_mhdr_s mh; /* Common msg header */
1195 u8 instance;
1196 u8 rsv[3];
1197 u32 offset;
1198 u32 length;
1199 struct bfi_alen_s alen;
1200};
1201
1202/*
1203 * External PHY query response
1204 */
1205struct bfi_phy_query_rsp_s {
1206 struct bfi_mhdr_s mh; /* Common msg header */
1207 u32 status;
1208};
1209
1210/*
1211 * External PHY stats response
1212 */
1213struct bfi_phy_stats_rsp_s {
1214 struct bfi_mhdr_s mh; /* Common msg header */
1215 u32 status;
1216};
1217
1218/*
1219 * External PHY read response
1220 */
1221struct bfi_phy_read_rsp_s {
1222 struct bfi_mhdr_s mh; /* Common msg header */
1223 u32 status;
1224 u32 length;
1225};
1226
1227/*
1228 * External PHY write response
1229 */
1230struct bfi_phy_write_rsp_s {
1231 struct bfi_mhdr_s mh; /* Common msg header */
1232 u32 status;
1233 u32 length;
1234};
1235
Krishna Gudipatie6826c92012-09-21 17:27:14 -07001236enum bfi_fru_h2i_msgs {
1237 BFI_FRUVPD_H2I_WRITE_REQ = 1,
1238 BFI_FRUVPD_H2I_READ_REQ = 2,
1239 BFI_TFRU_H2I_WRITE_REQ = 3,
1240 BFI_TFRU_H2I_READ_REQ = 4,
1241};
1242
1243enum bfi_fru_i2h_msgs {
1244 BFI_FRUVPD_I2H_WRITE_RSP = BFA_I2HM(1),
1245 BFI_FRUVPD_I2H_READ_RSP = BFA_I2HM(2),
1246 BFI_TFRU_I2H_WRITE_RSP = BFA_I2HM(3),
1247 BFI_TFRU_I2H_READ_RSP = BFA_I2HM(4),
1248};
1249
1250/*
1251 * FRU write request
1252 */
1253struct bfi_fru_write_req_s {
1254 struct bfi_mhdr_s mh; /* Common msg header */
1255 u8 last;
1256 u8 rsv[3];
1257 u32 offset;
1258 u32 length;
1259 struct bfi_alen_s alen;
1260};
1261
1262/*
1263 * FRU read request
1264 */
1265struct bfi_fru_read_req_s {
1266 struct bfi_mhdr_s mh; /* Common msg header */
1267 u32 offset;
1268 u32 length;
1269 struct bfi_alen_s alen;
1270};
1271
1272/*
1273 * FRU response
1274 */
1275struct bfi_fru_rsp_s {
1276 struct bfi_mhdr_s mh; /* Common msg header */
1277 u32 status;
1278 u32 length;
1279};
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001280#pragma pack()
1281
1282#endif /* __BFI_H__ */