blob: 6f1dd9eac1d19079f99d39c4d65831cd14a54bc0 [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 Gudipatia36c61f2010-09-15 11:50:55 -0700213 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
Jing Huangacdc79a2010-10-18 17:15:55 -0700220/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700221 *----------------------------------------------------------------------
222 * IOC
223 *----------------------------------------------------------------------
224 */
225
Krishna Gudipati11189202011-06-13 15:50:35 -0700226/*
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
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700242enum 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),
Krishna Gudipati775c7742011-06-13 15:52:12 -0700254 BFI_IOC_I2H_HBEAT = BFA_I2HM(4),
Krishna Gudipatia7141342011-06-24 20:23:19 -0700255 BFI_IOC_I2H_ACQ_ADDR_REPLY = BFA_I2HM(5),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700256};
257
Jing Huangacdc79a2010-10-18 17:15:55 -0700258/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700259 * 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 */
Krishna Gudipati5a0adae2011-06-24 20:22:56 -0700270 u8 port_mode; /* bfi_port_mode */
271 u8 rsvd_a;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700272 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;
Krishna Gudipati10a07372011-06-24 20:23:38 -0700286 u8 rsvd_d;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700287 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 */
Krishna Gudipatiea5d7c92012-09-21 17:25:02 -0700291 u8 mfg_day; /* manufacturing day */
292 u8 mfg_month; /* manufacturing month */
293 u16 mfg_year; /* manufacturing year */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700294};
295
Jing Huangacdc79a2010-10-18 17:15:55 -0700296/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700297 * BFI_IOC_I2H_GETATTR_REPLY message
298 */
299struct bfi_ioc_getattr_reply_s {
300 struct bfi_mhdr_s mh; /* Common msg header */
301 u8 status; /* cfg reply status */
302 u8 rsvd[3];
303};
304
Jing Huangacdc79a2010-10-18 17:15:55 -0700305/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700306 * Firmware memory page offsets
307 */
308#define BFI_IOC_SMEM_PG0_CB (0x40)
309#define BFI_IOC_SMEM_PG0_CT (0x180)
310
Jing Huangacdc79a2010-10-18 17:15:55 -0700311/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700312 * Firmware statistic offset
313 */
314#define BFI_IOC_FWSTATS_OFF (0x6B40)
315#define BFI_IOC_FWSTATS_SZ (4096)
316
Jing Huangacdc79a2010-10-18 17:15:55 -0700317/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700318 * Firmware trace offset
319 */
320#define BFI_IOC_TRC_OFF (0x4b00)
321#define BFI_IOC_TRC_ENTS 256
322
323#define BFI_IOC_FW_SIGNATURE (0xbfadbfad)
324#define BFI_IOC_MD5SUM_SZ 4
325struct bfi_ioc_image_hdr_s {
Krishna Gudipati11189202011-06-13 15:50:35 -0700326 u32 signature; /* constant signature */
327 u8 asic_gen; /* asic generation */
328 u8 asic_mode;
329 u8 port0_mode; /* device mode for port 0 */
330 u8 port1_mode; /* device mode for port 1 */
331 u32 exec; /* exec vector */
332 u32 bootenv; /* fimware boot env */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700333 u32 rsvd_b[4];
334 u32 md5sum[BFI_IOC_MD5SUM_SZ];
335};
336
Krishna Gudipati11189202011-06-13 15:50:35 -0700337#define BFI_FWBOOT_DEVMODE_OFF 4
338#define BFI_FWBOOT_TYPE_OFF 8
339#define BFI_FWBOOT_ENV_OFF 12
340#define BFI_FWBOOT_DEVMODE(__asic_gen, __asic_mode, __p0_mode, __p1_mode) \
341 (((u32)(__asic_gen)) << 24 | \
342 ((u32)(__asic_mode)) << 16 | \
343 ((u32)(__p0_mode)) << 8 | \
344 ((u32)(__p1_mode)))
345
346#define BFI_FWBOOT_TYPE_NORMAL 0
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700347#define BFI_FWBOOT_TYPE_MEMTEST 2
Krishna Gudipati11189202011-06-13 15:50:35 -0700348#define BFI_FWBOOT_ENV_OS 0
349
350enum bfi_port_mode {
351 BFI_PORT_MODE_FC = 1,
352 BFI_PORT_MODE_ETH = 2,
353};
354
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700355struct bfi_ioc_hbeat_s {
356 struct bfi_mhdr_s mh; /* common msg header */
357 u32 hb_count; /* current heart beat count */
358};
359
Jing Huangacdc79a2010-10-18 17:15:55 -0700360/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700361 * IOC hardware/firmware state
362 */
363enum bfi_ioc_state {
364 BFI_IOC_UNINIT = 0, /* not initialized */
365 BFI_IOC_INITING = 1, /* h/w is being initialized */
366 BFI_IOC_HWINIT = 2, /* h/w is initialized */
367 BFI_IOC_CFG = 3, /* IOC configuration in progress */
368 BFI_IOC_OP = 4, /* IOC is operational */
369 BFI_IOC_DISABLING = 5, /* IOC is being disabled */
370 BFI_IOC_DISABLED = 6, /* IOC is disabled */
371 BFI_IOC_CFG_DISABLED = 7, /* IOC is being disabled;transient */
372 BFI_IOC_FAIL = 8, /* IOC heart-beat failure */
373 BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */
374};
375
376#define BFI_IOC_ENDIAN_SIG 0x12345678
377
378enum {
379 BFI_ADAPTER_TYPE_FC = 0x01, /* FC adapters */
380 BFI_ADAPTER_TYPE_MK = 0x0f0000, /* adapter type mask */
381 BFI_ADAPTER_TYPE_SH = 16, /* adapter type shift */
382 BFI_ADAPTER_NPORTS_MK = 0xff00, /* number of ports mask */
383 BFI_ADAPTER_NPORTS_SH = 8, /* number of ports shift */
384 BFI_ADAPTER_SPEED_MK = 0xff, /* adapter speed mask */
385 BFI_ADAPTER_SPEED_SH = 0, /* adapter speed shift */
386 BFI_ADAPTER_PROTO = 0x100000, /* prototype adapaters */
387 BFI_ADAPTER_TTV = 0x200000, /* TTV debug capable */
388 BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */
389};
390
391#define BFI_ADAPTER_GETP(__prop, __adap_prop) \
392 (((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \
393 BFI_ADAPTER_ ## __prop ## _SH)
394#define BFI_ADAPTER_SETP(__prop, __val) \
395 ((__val) << BFI_ADAPTER_ ## __prop ## _SH)
396#define BFI_ADAPTER_IS_PROTO(__adap_type) \
397 ((__adap_type) & BFI_ADAPTER_PROTO)
398#define BFI_ADAPTER_IS_TTV(__adap_type) \
399 ((__adap_type) & BFI_ADAPTER_TTV)
400#define BFI_ADAPTER_IS_UNSUPP(__adap_type) \
401 ((__adap_type) & BFI_ADAPTER_UNSUPP)
402#define BFI_ADAPTER_IS_SPECIAL(__adap_type) \
403 ((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO | \
404 BFI_ADAPTER_UNSUPP))
405
Jing Huangacdc79a2010-10-18 17:15:55 -0700406/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700407 * BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
408 */
409struct bfi_ioc_ctrl_req_s {
410 struct bfi_mhdr_s mh;
Krishna Gudipatid37779f2011-06-13 15:42:10 -0700411 u16 clscode;
412 u16 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700413 u32 tv_sec;
414};
415#define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
416#define bfi_ioc_disable_req_t struct bfi_ioc_ctrl_req_s;
417
Jing Huangacdc79a2010-10-18 17:15:55 -0700418/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700419 * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
420 */
421struct bfi_ioc_ctrl_reply_s {
422 struct bfi_mhdr_s mh; /* Common msg header */
423 u8 status; /* enable/disable status */
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -0700424 u8 port_mode; /* bfa_mode_s */
425 u8 cap_bm; /* capability bit mask */
426 u8 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700427};
428#define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
429#define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
430
431#define BFI_IOC_MSGSZ 8
Jing Huangacdc79a2010-10-18 17:15:55 -0700432/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700433 * H2I Messages
434 */
435union bfi_ioc_h2i_msg_u {
436 struct bfi_mhdr_s mh;
437 struct bfi_ioc_ctrl_req_s enable_req;
438 struct bfi_ioc_ctrl_req_s disable_req;
439 struct bfi_ioc_getattr_req_s getattr_req;
440 u32 mboxmsg[BFI_IOC_MSGSZ];
441};
442
Jing Huangacdc79a2010-10-18 17:15:55 -0700443/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700444 * I2H Messages
445 */
446union bfi_ioc_i2h_msg_u {
447 struct bfi_mhdr_s mh;
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -0700448 struct bfi_ioc_ctrl_reply_s fw_event;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700449 u32 mboxmsg[BFI_IOC_MSGSZ];
450};
451
452
Jing Huangacdc79a2010-10-18 17:15:55 -0700453/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700454 *----------------------------------------------------------------------
455 * PBC
456 *----------------------------------------------------------------------
457 */
458
459#define BFI_PBC_MAX_BLUNS 8
460#define BFI_PBC_MAX_VPORTS 16
Krishna Gudipati43ffdf42011-06-13 15:46:21 -0700461#define BFI_PBC_PORT_DISABLED 2
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700462
Jing Huangacdc79a2010-10-18 17:15:55 -0700463/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700464 * PBC boot lun configuration
465 */
466struct bfi_pbc_blun_s {
467 wwn_t tgt_pwwn;
Maggie Zhangf3148782010-12-09 19:11:39 -0800468 struct scsi_lun tgt_lun;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700469};
470
Jing Huangacdc79a2010-10-18 17:15:55 -0700471/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700472 * PBC virtual port configuration
473 */
474struct bfi_pbc_vport_s {
475 wwn_t vp_pwwn;
476 wwn_t vp_nwwn;
477};
478
Jing Huangacdc79a2010-10-18 17:15:55 -0700479/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700480 * BFI pre-boot configuration information
481 */
482struct bfi_pbc_s {
483 u8 port_enabled;
484 u8 boot_enabled;
485 u8 nbluns;
486 u8 nvports;
487 u8 port_speed;
488 u8 rsvd_a;
489 u16 hss;
490 wwn_t pbc_pwwn;
491 wwn_t pbc_nwwn;
492 struct bfi_pbc_blun_s blun[BFI_PBC_MAX_BLUNS];
493 struct bfi_pbc_vport_s vport[BFI_PBC_MAX_VPORTS];
494};
495
Jing Huangacdc79a2010-10-18 17:15:55 -0700496/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700497 *----------------------------------------------------------------------
498 * MSGQ
499 *----------------------------------------------------------------------
500 */
501#define BFI_MSGQ_FULL(_q) (((_q->pi + 1) % _q->q_depth) == _q->ci)
502#define BFI_MSGQ_EMPTY(_q) (_q->pi == _q->ci)
503#define BFI_MSGQ_UPDATE_CI(_q) (_q->ci = (_q->ci + 1) % _q->q_depth)
504#define BFI_MSGQ_UPDATE_PI(_q) (_q->pi = (_q->pi + 1) % _q->q_depth)
505
506/* q_depth must be power of 2 */
507#define BFI_MSGQ_FREE_CNT(_q) ((_q->ci - _q->pi - 1) & (_q->q_depth - 1))
508
509enum bfi_msgq_h2i_msgs_e {
510 BFI_MSGQ_H2I_INIT_REQ = 1,
511 BFI_MSGQ_H2I_DOORBELL = 2,
512 BFI_MSGQ_H2I_SHUTDOWN = 3,
513};
514
515enum bfi_msgq_i2h_msgs_e {
516 BFI_MSGQ_I2H_INIT_RSP = 1,
517 BFI_MSGQ_I2H_DOORBELL = 2,
518};
519
520
521/* Messages(commands/responsed/AENS will have the following header */
522struct bfi_msgq_mhdr_s {
523 u8 msg_class;
524 u8 msg_id;
525 u16 msg_token;
526 u16 num_entries;
527 u8 enet_id;
528 u8 rsvd[1];
529};
530
531#define bfi_msgq_mhdr_set(_mh, _mc, _mid, _tok, _enet_id) do { \
532 (_mh).msg_class = (_mc); \
533 (_mh).msg_id = (_mid); \
534 (_mh).msg_token = (_tok); \
535 (_mh).enet_id = (_enet_id); \
536} while (0)
537
538/*
539 * Mailbox for messaging interface
540 *
541*/
542#define BFI_MSGQ_CMD_ENTRY_SIZE (64) /* TBD */
543#define BFI_MSGQ_RSP_ENTRY_SIZE (64) /* TBD */
544#define BFI_MSGQ_MSG_SIZE_MAX (2048) /* TBD */
545
546struct bfi_msgq_s {
547 union bfi_addr_u addr;
548 u16 q_depth; /* Total num of entries in the queue */
549 u8 rsvd[2];
550};
551
552/* BFI_ENET_MSGQ_CFG_REQ TBD init or cfg? */
553struct bfi_msgq_cfg_req_s {
554 struct bfi_mhdr_s mh;
555 struct bfi_msgq_s cmdq;
556 struct bfi_msgq_s rspq;
557};
558
559/* BFI_ENET_MSGQ_CFG_RSP */
560struct bfi_msgq_cfg_rsp_s {
561 struct bfi_mhdr_s mh;
562 u8 cmd_status;
563 u8 rsvd[3];
564};
565
566
567/* BFI_MSGQ_H2I_DOORBELL */
568struct bfi_msgq_h2i_db_s {
569 struct bfi_mhdr_s mh;
570 u16 cmdq_pi;
571 u16 rspq_ci;
572};
573
574/* BFI_MSGQ_I2H_DOORBELL */
575struct bfi_msgq_i2h_db_s {
576 struct bfi_mhdr_s mh;
577 u16 rspq_pi;
578 u16 cmdq_ci;
579};
580
581#pragma pack()
582
583/* BFI port specific */
584#pragma pack(1)
585
586enum bfi_port_h2i {
587 BFI_PORT_H2I_ENABLE_REQ = (1),
588 BFI_PORT_H2I_DISABLE_REQ = (2),
589 BFI_PORT_H2I_GET_STATS_REQ = (3),
590 BFI_PORT_H2I_CLEAR_STATS_REQ = (4),
591};
592
593enum bfi_port_i2h {
594 BFI_PORT_I2H_ENABLE_RSP = BFA_I2HM(1),
595 BFI_PORT_I2H_DISABLE_RSP = BFA_I2HM(2),
596 BFI_PORT_I2H_GET_STATS_RSP = BFA_I2HM(3),
597 BFI_PORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(4),
598};
599
Jing Huangacdc79a2010-10-18 17:15:55 -0700600/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700601 * Generic REQ type
602 */
603struct bfi_port_generic_req_s {
604 struct bfi_mhdr_s mh; /* msg header */
605 u32 msgtag; /* msgtag for reply */
606 u32 rsvd;
607};
608
Jing Huangacdc79a2010-10-18 17:15:55 -0700609/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700610 * Generic RSP type
611 */
612struct bfi_port_generic_rsp_s {
613 struct bfi_mhdr_s mh; /* common msg header */
614 u8 status; /* port enable status */
615 u8 rsvd[3];
616 u32 msgtag; /* msgtag for reply */
617};
618
Jing Huangacdc79a2010-10-18 17:15:55 -0700619/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700620 * BFI_PORT_H2I_GET_STATS_REQ
621 */
622struct bfi_port_get_stats_req_s {
623 struct bfi_mhdr_s mh; /* common msg header */
624 union bfi_addr_u dma_addr;
625};
626
627union bfi_port_h2i_msg_u {
628 struct bfi_mhdr_s mh;
629 struct bfi_port_generic_req_s enable_req;
630 struct bfi_port_generic_req_s disable_req;
631 struct bfi_port_get_stats_req_s getstats_req;
632 struct bfi_port_generic_req_s clearstats_req;
633};
634
635union bfi_port_i2h_msg_u {
636 struct bfi_mhdr_s mh;
637 struct bfi_port_generic_rsp_s enable_rsp;
638 struct bfi_port_generic_rsp_s disable_rsp;
639 struct bfi_port_generic_rsp_s getstats_rsp;
640 struct bfi_port_generic_rsp_s clearstats_rsp;
641};
642
Krishna Gudipati1a4d8e12011-06-24 20:22:28 -0700643/*
644 *----------------------------------------------------------------------
645 * ABLK
646 *----------------------------------------------------------------------
647 */
648enum bfi_ablk_h2i_msgs_e {
649 BFI_ABLK_H2I_QUERY = 1,
650 BFI_ABLK_H2I_ADPT_CONFIG = 2,
651 BFI_ABLK_H2I_PORT_CONFIG = 3,
652 BFI_ABLK_H2I_PF_CREATE = 4,
653 BFI_ABLK_H2I_PF_DELETE = 5,
654 BFI_ABLK_H2I_PF_UPDATE = 6,
655 BFI_ABLK_H2I_OPTROM_ENABLE = 7,
656 BFI_ABLK_H2I_OPTROM_DISABLE = 8,
657};
658
659enum bfi_ablk_i2h_msgs_e {
660 BFI_ABLK_I2H_QUERY = BFA_I2HM(BFI_ABLK_H2I_QUERY),
661 BFI_ABLK_I2H_ADPT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG),
662 BFI_ABLK_I2H_PORT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG),
663 BFI_ABLK_I2H_PF_CREATE = BFA_I2HM(BFI_ABLK_H2I_PF_CREATE),
664 BFI_ABLK_I2H_PF_DELETE = BFA_I2HM(BFI_ABLK_H2I_PF_DELETE),
665 BFI_ABLK_I2H_PF_UPDATE = BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE),
666 BFI_ABLK_I2H_OPTROM_ENABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE),
667 BFI_ABLK_I2H_OPTROM_DISABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE),
668};
669
670/* BFI_ABLK_H2I_QUERY */
671struct bfi_ablk_h2i_query_s {
672 struct bfi_mhdr_s mh;
673 union bfi_addr_u addr;
674};
675
676/* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */
677struct bfi_ablk_h2i_cfg_req_s {
678 struct bfi_mhdr_s mh;
679 u8 mode;
680 u8 port;
681 u8 max_pf;
682 u8 max_vf;
683};
684
685/*
686 * BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE,
687 */
688struct bfi_ablk_h2i_pf_req_s {
689 struct bfi_mhdr_s mh;
690 u8 pcifn;
691 u8 port;
692 u16 pers;
693 u32 bw;
694};
695
696/* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */
697struct bfi_ablk_h2i_optrom_s {
698 struct bfi_mhdr_s mh;
699};
700
701/*
702 * BFI_ABLK_I2H_QUERY
703 * BFI_ABLK_I2H_PORT_CONFIG
704 * BFI_ABLK_I2H_PF_CREATE
705 * BFI_ABLK_I2H_PF_DELETE
706 * BFI_ABLK_I2H_PF_UPDATE
707 * BFI_ABLK_I2H_OPTROM_ENABLE
708 * BFI_ABLK_I2H_OPTROM_DISABLE
709 */
710struct bfi_ablk_i2h_rsp_s {
711 struct bfi_mhdr_s mh;
712 u8 status;
713 u8 pcifn;
714 u8 port_mode;
715};
716
Krishna Gudipati148d6102011-06-24 20:25:36 -0700717
718/*
719 * CEE module specific messages
720 */
721
722/* Mailbox commands from host to firmware */
723enum bfi_cee_h2i_msgs_e {
724 BFI_CEE_H2I_GET_CFG_REQ = 1,
725 BFI_CEE_H2I_RESET_STATS = 2,
726 BFI_CEE_H2I_GET_STATS_REQ = 3,
727};
728
729enum bfi_cee_i2h_msgs_e {
730 BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
731 BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
732 BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
733};
734
735/*
736 * H2I command structure for resetting the stats
737 */
738struct bfi_cee_reset_stats_s {
739 struct bfi_mhdr_s mh;
740};
741
742/*
743 * Get configuration command from host
744 */
745struct bfi_cee_get_req_s {
746 struct bfi_mhdr_s mh;
747 union bfi_addr_u dma_addr;
748};
749
750/*
751 * Reply message from firmware
752 */
753struct bfi_cee_get_rsp_s {
754 struct bfi_mhdr_s mh;
755 u8 cmd_status;
756 u8 rsvd[3];
757};
758
759/*
760 * Reply message from firmware
761 */
762struct bfi_cee_stats_rsp_s {
763 struct bfi_mhdr_s mh;
764 u8 cmd_status;
765 u8 rsvd[3];
766};
767
768/* Mailbox message structures from firmware to host */
769union bfi_cee_i2h_msg_u {
770 struct bfi_mhdr_s mh;
771 struct bfi_cee_get_rsp_s get_rsp;
772 struct bfi_cee_stats_rsp_s stats_rsp;
773};
774
Krishna Gudipati51e569a2011-06-24 20:26:25 -0700775/*
776 * SFP related
777 */
778
779enum bfi_sfp_h2i_e {
780 BFI_SFP_H2I_SHOW = 1,
781 BFI_SFP_H2I_SCN = 2,
782};
783
784enum bfi_sfp_i2h_e {
785 BFI_SFP_I2H_SHOW = BFA_I2HM(BFI_SFP_H2I_SHOW),
786 BFI_SFP_I2H_SCN = BFA_I2HM(BFI_SFP_H2I_SCN),
787};
788
789/*
Krishna Gudipati7826f302011-07-20 16:59:13 -0700790 * SFP state change notification
791 */
792struct bfi_sfp_scn_s {
793 struct bfi_mhdr_s mhr; /* host msg header */
794 u8 event;
795 u8 sfpid;
796 u8 pomlvl; /* pom level: normal/warning/alarm */
797 u8 is_elb; /* e-loopback */
798};
799
800/*
Krishna Gudipati51e569a2011-06-24 20:26:25 -0700801 * SFP state
802 */
803enum bfa_sfp_stat_e {
804 BFA_SFP_STATE_INIT = 0, /* SFP state is uninit */
805 BFA_SFP_STATE_REMOVED = 1, /* SFP is removed */
806 BFA_SFP_STATE_INSERTED = 2, /* SFP is inserted */
807 BFA_SFP_STATE_VALID = 3, /* SFP is valid */
808 BFA_SFP_STATE_UNSUPPORT = 4, /* SFP is unsupport */
809 BFA_SFP_STATE_FAILED = 5, /* SFP i2c read fail */
810};
811
812/*
813 * SFP memory access type
814 */
815enum bfi_sfp_mem_e {
816 BFI_SFP_MEM_ALL = 0x1, /* access all data field */
817 BFI_SFP_MEM_DIAGEXT = 0x2, /* access diag ext data field only */
818};
819
820struct bfi_sfp_req_s {
821 struct bfi_mhdr_s mh;
822 u8 memtype;
823 u8 rsvd[3];
824 struct bfi_alen_s alen;
825};
826
827struct bfi_sfp_rsp_s {
828 struct bfi_mhdr_s mh;
829 u8 status;
830 u8 state;
831 u8 rsvd[2];
832};
833
Krishna Gudipati5a54b1d2011-06-24 20:27:13 -0700834/*
835 * FLASH module specific
836 */
837enum bfi_flash_h2i_msgs {
838 BFI_FLASH_H2I_QUERY_REQ = 1,
839 BFI_FLASH_H2I_ERASE_REQ = 2,
840 BFI_FLASH_H2I_WRITE_REQ = 3,
841 BFI_FLASH_H2I_READ_REQ = 4,
842 BFI_FLASH_H2I_BOOT_VER_REQ = 5,
843};
844
845enum bfi_flash_i2h_msgs {
846 BFI_FLASH_I2H_QUERY_RSP = BFA_I2HM(1),
847 BFI_FLASH_I2H_ERASE_RSP = BFA_I2HM(2),
848 BFI_FLASH_I2H_WRITE_RSP = BFA_I2HM(3),
849 BFI_FLASH_I2H_READ_RSP = BFA_I2HM(4),
850 BFI_FLASH_I2H_BOOT_VER_RSP = BFA_I2HM(5),
851 BFI_FLASH_I2H_EVENT = BFA_I2HM(127),
852};
853
854/*
855 * Flash query request
856 */
857struct bfi_flash_query_req_s {
858 struct bfi_mhdr_s mh; /* Common msg header */
859 struct bfi_alen_s alen;
860};
861
862/*
863 * Flash erase request
864 */
865struct bfi_flash_erase_req_s {
866 struct bfi_mhdr_s mh; /* Common msg header */
867 u32 type; /* partition type */
868 u8 instance; /* partition instance */
869 u8 rsv[3];
870};
871
872/*
873 * Flash write request
874 */
875struct bfi_flash_write_req_s {
876 struct bfi_mhdr_s mh; /* Common msg header */
877 struct bfi_alen_s alen;
878 u32 type; /* partition type */
879 u8 instance; /* partition instance */
880 u8 last;
881 u8 rsv[2];
882 u32 offset;
883 u32 length;
884};
885
886/*
887 * Flash read request
888 */
889struct bfi_flash_read_req_s {
890 struct bfi_mhdr_s mh; /* Common msg header */
891 u32 type; /* partition type */
892 u8 instance; /* partition instance */
893 u8 rsv[3];
894 u32 offset;
895 u32 length;
896 struct bfi_alen_s alen;
897};
898
899/*
900 * Flash query response
901 */
902struct bfi_flash_query_rsp_s {
903 struct bfi_mhdr_s mh; /* Common msg header */
904 u32 status;
905};
906
907/*
908 * Flash read response
909 */
910struct bfi_flash_read_rsp_s {
911 struct bfi_mhdr_s mh; /* Common msg header */
912 u32 type; /* partition type */
913 u8 instance; /* partition instance */
914 u8 rsv[3];
915 u32 status;
916 u32 length;
917};
918
919/*
920 * Flash write response
921 */
922struct bfi_flash_write_rsp_s {
923 struct bfi_mhdr_s mh; /* Common msg header */
924 u32 type; /* partition type */
925 u8 instance; /* partition instance */
926 u8 rsv[3];
927 u32 status;
928 u32 length;
929};
930
931/*
932 * Flash erase response
933 */
934struct bfi_flash_erase_rsp_s {
935 struct bfi_mhdr_s mh; /* Common msg header */
936 u32 type; /* partition type */
937 u8 instance; /* partition instance */
938 u8 rsv[3];
939 u32 status;
940};
941
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700942/*
Krishna Gudipati7826f302011-07-20 16:59:13 -0700943 * Flash event notification
944 */
945struct bfi_flash_event_s {
946 struct bfi_mhdr_s mh; /* Common msg header */
947 bfa_status_t status;
948 u32 param;
949};
950
951/*
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700952 *----------------------------------------------------------------------
953 * DIAG
954 *----------------------------------------------------------------------
955 */
956enum bfi_diag_h2i {
957 BFI_DIAG_H2I_PORTBEACON = 1,
958 BFI_DIAG_H2I_LOOPBACK = 2,
959 BFI_DIAG_H2I_FWPING = 3,
960 BFI_DIAG_H2I_TEMPSENSOR = 4,
961 BFI_DIAG_H2I_LEDTEST = 5,
962 BFI_DIAG_H2I_QTEST = 6,
Krishna Gudipatie3535462012-09-21 17:26:07 -0700963 BFI_DIAG_H2I_DPORT = 7,
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700964};
965
966enum bfi_diag_i2h {
967 BFI_DIAG_I2H_PORTBEACON = BFA_I2HM(BFI_DIAG_H2I_PORTBEACON),
968 BFI_DIAG_I2H_LOOPBACK = BFA_I2HM(BFI_DIAG_H2I_LOOPBACK),
969 BFI_DIAG_I2H_FWPING = BFA_I2HM(BFI_DIAG_H2I_FWPING),
970 BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR),
971 BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST),
972 BFI_DIAG_I2H_QTEST = BFA_I2HM(BFI_DIAG_H2I_QTEST),
Krishna Gudipatie3535462012-09-21 17:26:07 -0700973 BFI_DIAG_I2H_DPORT = BFA_I2HM(BFI_DIAG_H2I_DPORT),
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700974};
975
976#define BFI_DIAG_MAX_SGES 2
977#define BFI_DIAG_DMA_BUF_SZ (2 * 1024)
978#define BFI_BOOT_MEMTEST_RES_ADDR 0x900
979#define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3
980
981struct bfi_diag_lb_req_s {
982 struct bfi_mhdr_s mh;
983 u32 loopcnt;
984 u32 pattern;
985 u8 lb_mode; /*!< bfa_port_opmode_t */
986 u8 speed; /*!< bfa_port_speed_t */
987 u8 rsvd[2];
988};
989
990struct bfi_diag_lb_rsp_s {
991 struct bfi_mhdr_s mh; /* 4 bytes */
992 struct bfa_diag_loopback_result_s res; /* 16 bytes */
993};
994
995struct bfi_diag_fwping_req_s {
996 struct bfi_mhdr_s mh; /* 4 bytes */
997 struct bfi_alen_s alen; /* 12 bytes */
998 u32 data; /* user input data pattern */
999 u32 count; /* user input dma count */
1000 u8 qtag; /* track CPE vc */
1001 u8 rsv[3];
1002};
1003
1004struct bfi_diag_fwping_rsp_s {
1005 struct bfi_mhdr_s mh; /* 4 bytes */
1006 u32 data; /* user input data pattern */
1007 u8 qtag; /* track CPE vc */
1008 u8 dma_status; /* dma status */
1009 u8 rsv[2];
1010};
1011
1012/*
1013 * Temperature Sensor
1014 */
1015struct bfi_diag_ts_req_s {
1016 struct bfi_mhdr_s mh; /* 4 bytes */
1017 u16 temp; /* 10-bit A/D value */
1018 u16 brd_temp; /* 9-bit board temp */
1019 u8 status;
1020 u8 ts_junc; /* show junction tempsensor */
1021 u8 ts_brd; /* show board tempsensor */
1022 u8 rsv;
1023};
1024#define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
1025
1026struct bfi_diag_ledtest_req_s {
1027 struct bfi_mhdr_s mh; /* 4 bytes */
1028 u8 cmd;
1029 u8 color;
1030 u8 portid;
1031 u8 led; /* bitmap of LEDs to be tested */
1032 u16 freq; /* no. of blinks every 10 secs */
1033 u8 rsv[2];
1034};
1035
1036/* notify host led operation is done */
1037struct bfi_diag_ledtest_rsp_s {
1038 struct bfi_mhdr_s mh; /* 4 bytes */
1039};
1040
1041struct bfi_diag_portbeacon_req_s {
1042 struct bfi_mhdr_s mh; /* 4 bytes */
1043 u32 period; /* beaconing period */
1044 u8 beacon; /* 1: beacon on */
1045 u8 rsvd[3];
1046};
1047
1048/* notify host the beacon is off */
1049struct bfi_diag_portbeacon_rsp_s {
1050 struct bfi_mhdr_s mh; /* 4 bytes */
1051};
1052
1053struct bfi_diag_qtest_req_s {
1054 struct bfi_mhdr_s mh; /* 4 bytes */
1055 u32 data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
1056};
1057#define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
1058
Krishna Gudipati3350d982011-06-24 20:28:37 -07001059/*
Krishna Gudipatie3535462012-09-21 17:26:07 -07001060 * D-port test
1061 */
1062enum bfi_dport_req {
1063 BFI_DPORT_DISABLE = 0, /* disable dport request */
1064 BFI_DPORT_ENABLE = 1, /* enable dport request */
1065};
1066
1067struct bfi_diag_dport_req_s {
1068 struct bfi_mhdr_s mh; /* 4 bytes */
1069 u8 req; /* request 1: enable 0: disable */
1070 u8 status; /* reply status */
1071 u8 rsvd[2];
1072 u32 msgtag; /* msgtag for reply */
1073};
1074#define bfi_diag_dport_rsp_t struct bfi_diag_dport_req_s
1075
1076/*
Krishna Gudipati3350d982011-06-24 20:28:37 -07001077 * PHY module specific
1078 */
1079enum bfi_phy_h2i_msgs_e {
1080 BFI_PHY_H2I_QUERY_REQ = 1,
1081 BFI_PHY_H2I_STATS_REQ = 2,
1082 BFI_PHY_H2I_WRITE_REQ = 3,
1083 BFI_PHY_H2I_READ_REQ = 4,
1084};
1085
1086enum bfi_phy_i2h_msgs_e {
1087 BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
1088 BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
1089 BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
1090 BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
1091};
1092
1093/*
1094 * External PHY query request
1095 */
1096struct bfi_phy_query_req_s {
1097 struct bfi_mhdr_s mh; /* Common msg header */
1098 u8 instance;
1099 u8 rsv[3];
1100 struct bfi_alen_s alen;
1101};
1102
1103/*
1104 * External PHY stats request
1105 */
1106struct bfi_phy_stats_req_s {
1107 struct bfi_mhdr_s mh; /* Common msg header */
1108 u8 instance;
1109 u8 rsv[3];
1110 struct bfi_alen_s alen;
1111};
1112
1113/*
1114 * External PHY write request
1115 */
1116struct bfi_phy_write_req_s {
1117 struct bfi_mhdr_s mh; /* Common msg header */
1118 u8 instance;
1119 u8 last;
1120 u8 rsv[2];
1121 u32 offset;
1122 u32 length;
1123 struct bfi_alen_s alen;
1124};
1125
1126/*
1127 * External PHY read request
1128 */
1129struct bfi_phy_read_req_s {
1130 struct bfi_mhdr_s mh; /* Common msg header */
1131 u8 instance;
1132 u8 rsv[3];
1133 u32 offset;
1134 u32 length;
1135 struct bfi_alen_s alen;
1136};
1137
1138/*
1139 * External PHY query response
1140 */
1141struct bfi_phy_query_rsp_s {
1142 struct bfi_mhdr_s mh; /* Common msg header */
1143 u32 status;
1144};
1145
1146/*
1147 * External PHY stats response
1148 */
1149struct bfi_phy_stats_rsp_s {
1150 struct bfi_mhdr_s mh; /* Common msg header */
1151 u32 status;
1152};
1153
1154/*
1155 * External PHY read response
1156 */
1157struct bfi_phy_read_rsp_s {
1158 struct bfi_mhdr_s mh; /* Common msg header */
1159 u32 status;
1160 u32 length;
1161};
1162
1163/*
1164 * External PHY write response
1165 */
1166struct bfi_phy_write_rsp_s {
1167 struct bfi_mhdr_s mh; /* Common msg header */
1168 u32 status;
1169 u32 length;
1170};
1171
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001172#pragma pack()
1173
1174#endif /* __BFI_H__ */