blob: 7096c5fd2ba0b776a5e3011d8eda42a8545cc2f8 [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
Jing Huangacdc79a2010-10-18 17:15:55 -070026/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070027 * BFI FW image type
28 */
29#define BFI_FLASH_CHUNK_SZ 256 /* Flash chunk size */
30#define BFI_FLASH_CHUNK_SZ_WORDS (BFI_FLASH_CHUNK_SZ/sizeof(u32))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070031
Jing Huangacdc79a2010-10-18 17:15:55 -070032/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070033 * Msg header common to all msgs
34 */
35struct bfi_mhdr_s {
36 u8 msg_class; /* @ref bfi_mclass_t */
37 u8 msg_id; /* msg opcode with in the class */
38 union {
39 struct {
Krishna Gudipatid37779f2011-06-13 15:42:10 -070040 u8 qid;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070041 u8 lpu_id; /* msg destination */
42 } h2i;
43 u16 i2htok; /* token in msgs to host */
44 } mtag;
45};
46
Krishna Gudipati43ffdf42011-06-13 15:46:21 -070047#define bfi_mhdr_2_qid(_mh) ((_mh)->mtag.h2i.qid)
Krishna Gudipatid37779f2011-06-13 15:42:10 -070048
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070049#define bfi_h2i_set(_mh, _mc, _op, _lpuid) do { \
50 (_mh).msg_class = (_mc); \
51 (_mh).msg_id = (_op); \
52 (_mh).mtag.h2i.lpu_id = (_lpuid); \
53} while (0)
54
55#define bfi_i2h_set(_mh, _mc, _op, _i2htok) do { \
56 (_mh).msg_class = (_mc); \
57 (_mh).msg_id = (_op); \
58 (_mh).mtag.i2htok = (_i2htok); \
59} while (0)
60
61/*
62 * Message opcodes: 0-127 to firmware, 128-255 to host
63 */
64#define BFI_I2H_OPCODE_BASE 128
65#define BFA_I2HM(_x) ((_x) + BFI_I2H_OPCODE_BASE)
66
Jing Huangacdc79a2010-10-18 17:15:55 -070067/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070068 ****************************************************************************
69 *
70 * Scatter Gather Element and Page definition
71 *
72 ****************************************************************************
73 */
74
75#define BFI_SGE_INLINE 1
76#define BFI_SGE_INLINE_MAX (BFI_SGE_INLINE + 1)
77
Jing Huangacdc79a2010-10-18 17:15:55 -070078/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070079 * SG Flags
80 */
81enum {
82 BFI_SGE_DATA = 0, /* data address, not last */
83 BFI_SGE_DATA_CPL = 1, /* data addr, last in current page */
84 BFI_SGE_DATA_LAST = 3, /* data address, last */
85 BFI_SGE_LINK = 2, /* link address */
86 BFI_SGE_PGDLEN = 2, /* cumulative data length for page */
87};
88
Jing Huangacdc79a2010-10-18 17:15:55 -070089/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070090 * DMA addresses
91 */
92union bfi_addr_u {
93 struct {
Maggie50444a32010-11-29 18:26:32 -080094 __be32 addr_lo;
95 __be32 addr_hi;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070096 } a32;
97};
98
Jing Huangacdc79a2010-10-18 17:15:55 -070099/*
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700100 * Scatter Gather Element used for fast-path IO requests
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700101 */
102struct bfi_sge_s {
Maggie Zhangf16a1752010-12-09 19:12:32 -0800103#ifdef __BIG_ENDIAN
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700104 u32 flags:2,
105 rsvd:2,
106 sg_len:28;
107#else
108 u32 sg_len:28,
109 rsvd:2,
110 flags:2;
111#endif
112 union bfi_addr_u sga;
113};
114
Krishna Gudipati85ce9282011-06-13 15:39:36 -0700115/**
116 * Generic DMA addr-len pair.
117 */
118struct bfi_alen_s {
119 union bfi_addr_u al_addr; /* DMA addr of buffer */
120 u32 al_len; /* length of buffer */
121};
122
Jing Huangacdc79a2010-10-18 17:15:55 -0700123/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700124 * Scatter Gather Page
125 */
126#define BFI_SGPG_DATA_SGES 7
127#define BFI_SGPG_SGES_MAX (BFI_SGPG_DATA_SGES + 1)
128#define BFI_SGPG_RSVD_WD_LEN 8
129struct bfi_sgpg_s {
130 struct bfi_sge_s sges[BFI_SGPG_SGES_MAX];
131 u32 rsvd[BFI_SGPG_RSVD_WD_LEN];
132};
133
134/*
135 * Large Message structure - 128 Bytes size Msgs
136 */
137#define BFI_LMSG_SZ 128
138#define BFI_LMSG_PL_WSZ \
139 ((BFI_LMSG_SZ - sizeof(struct bfi_mhdr_s)) / 4)
140
141struct bfi_msg_s {
142 struct bfi_mhdr_s mhdr;
143 u32 pl[BFI_LMSG_PL_WSZ];
144};
145
Jing Huangacdc79a2010-10-18 17:15:55 -0700146/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700147 * Mailbox message structure
148 */
149#define BFI_MBMSG_SZ 7
150struct bfi_mbmsg_s {
151 struct bfi_mhdr_s mh;
152 u32 pl[BFI_MBMSG_SZ];
153};
154
Jing Huangacdc79a2010-10-18 17:15:55 -0700155/*
Krishna Gudipatid37779f2011-06-13 15:42:10 -0700156 * Supported PCI function class codes (personality)
157 */
158enum bfi_pcifn_class {
159 BFI_PCIFN_CLASS_FC = 0x0c04,
160 BFI_PCIFN_CLASS_ETH = 0x0200,
161};
162
163/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700164 * Message Classes
165 */
166enum bfi_mclass {
167 BFI_MC_IOC = 1, /* IO Controller (IOC) */
168 BFI_MC_FCPORT = 5, /* FC port */
169 BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */
170 BFI_MC_LL = 7, /* Link Layer */
171 BFI_MC_UF = 8, /* Unsolicited frame receive */
172 BFI_MC_FCXP = 9, /* FC Transport */
173 BFI_MC_LPS = 10, /* lport fc login services */
174 BFI_MC_RPORT = 11, /* Remote port */
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700175 BFI_MC_ITN = 12, /* I-T nexus (Initiator mode) */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700176 BFI_MC_IOIM_READ = 13, /* read IO (Initiator mode) */
177 BFI_MC_IOIM_WRITE = 14, /* write IO (Initiator mode) */
178 BFI_MC_IOIM_IO = 15, /* IO (Initiator mode) */
179 BFI_MC_IOIM = 16, /* IO (Initiator mode) */
180 BFI_MC_IOIM_IOCOM = 17, /* good IO completion */
181 BFI_MC_TSKIM = 18, /* Initiator Task management */
182 BFI_MC_PORT = 21, /* Physical port */
183 BFI_MC_MAX = 32
184};
185
186#define BFI_IOC_MAX_CQS 4
187#define BFI_IOC_MAX_CQS_ASIC 8
188#define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */
189
Jing Huangacdc79a2010-10-18 17:15:55 -0700190/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700191 *----------------------------------------------------------------------
192 * IOC
193 *----------------------------------------------------------------------
194 */
195
Krishna Gudipati11189202011-06-13 15:50:35 -0700196/*
197 * Different asic generations
198 */
199enum bfi_asic_gen {
200 BFI_ASIC_GEN_CB = 1, /* crossbow 8G FC */
201 BFI_ASIC_GEN_CT = 2, /* catapult 8G FC or 10G CNA */
202 BFI_ASIC_GEN_CT2 = 3, /* catapult-2 16G FC or 10G CNA */
203};
204
205enum bfi_asic_mode {
206 BFI_ASIC_MODE_FC = 1, /* FC upto 8G speed */
207 BFI_ASIC_MODE_FC16 = 2, /* FC upto 16G speed */
208 BFI_ASIC_MODE_ETH = 3, /* Ethernet ports */
209 BFI_ASIC_MODE_COMBO = 4, /* FC 16G and Ethernet 10G port */
210};
211
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700212enum bfi_ioc_h2i_msgs {
213 BFI_IOC_H2I_ENABLE_REQ = 1,
214 BFI_IOC_H2I_DISABLE_REQ = 2,
215 BFI_IOC_H2I_GETATTR_REQ = 3,
216 BFI_IOC_H2I_DBG_SYNC = 4,
217 BFI_IOC_H2I_DBG_DUMP = 5,
218};
219
220enum bfi_ioc_i2h_msgs {
221 BFI_IOC_I2H_ENABLE_REPLY = BFA_I2HM(1),
222 BFI_IOC_I2H_DISABLE_REPLY = BFA_I2HM(2),
223 BFI_IOC_I2H_GETATTR_REPLY = BFA_I2HM(3),
224 BFI_IOC_I2H_READY_EVENT = BFA_I2HM(4),
225 BFI_IOC_I2H_HBEAT = BFA_I2HM(5),
226};
227
Jing Huangacdc79a2010-10-18 17:15:55 -0700228/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700229 * BFI_IOC_H2I_GETATTR_REQ message
230 */
231struct bfi_ioc_getattr_req_s {
232 struct bfi_mhdr_s mh;
233 union bfi_addr_u attr_addr;
234};
235
236struct bfi_ioc_attr_s {
237 wwn_t mfg_pwwn; /* Mfg port wwn */
238 wwn_t mfg_nwwn; /* Mfg node wwn */
239 mac_t mfg_mac; /* Mfg mac */
240 u16 rsvd_a;
241 wwn_t pwwn;
242 wwn_t nwwn;
243 mac_t mac; /* PBC or Mfg mac */
244 u16 rsvd_b;
245 mac_t fcoe_mac;
246 u16 rsvd_c;
247 char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
248 u8 pcie_gen;
249 u8 pcie_lanes_orig;
250 u8 pcie_lanes;
251 u8 rx_bbcredit; /* receive buffer credits */
252 u32 adapter_prop; /* adapter properties */
253 u16 maxfrsize; /* max receive frame size */
254 char asic_rev;
255 u8 rsvd_d;
256 char fw_version[BFA_VERSION_LEN];
257 char optrom_version[BFA_VERSION_LEN];
258 struct bfa_mfg_vpd_s vpd;
259 u32 card_type; /* card type */
260};
261
Jing Huangacdc79a2010-10-18 17:15:55 -0700262/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700263 * BFI_IOC_I2H_GETATTR_REPLY message
264 */
265struct bfi_ioc_getattr_reply_s {
266 struct bfi_mhdr_s mh; /* Common msg header */
267 u8 status; /* cfg reply status */
268 u8 rsvd[3];
269};
270
Jing Huangacdc79a2010-10-18 17:15:55 -0700271/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700272 * Firmware memory page offsets
273 */
274#define BFI_IOC_SMEM_PG0_CB (0x40)
275#define BFI_IOC_SMEM_PG0_CT (0x180)
276
Jing Huangacdc79a2010-10-18 17:15:55 -0700277/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700278 * Firmware statistic offset
279 */
280#define BFI_IOC_FWSTATS_OFF (0x6B40)
281#define BFI_IOC_FWSTATS_SZ (4096)
282
Jing Huangacdc79a2010-10-18 17:15:55 -0700283/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700284 * Firmware trace offset
285 */
286#define BFI_IOC_TRC_OFF (0x4b00)
287#define BFI_IOC_TRC_ENTS 256
288
289#define BFI_IOC_FW_SIGNATURE (0xbfadbfad)
290#define BFI_IOC_MD5SUM_SZ 4
291struct bfi_ioc_image_hdr_s {
Krishna Gudipati11189202011-06-13 15:50:35 -0700292 u32 signature; /* constant signature */
293 u8 asic_gen; /* asic generation */
294 u8 asic_mode;
295 u8 port0_mode; /* device mode for port 0 */
296 u8 port1_mode; /* device mode for port 1 */
297 u32 exec; /* exec vector */
298 u32 bootenv; /* fimware boot env */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700299 u32 rsvd_b[4];
300 u32 md5sum[BFI_IOC_MD5SUM_SZ];
301};
302
Krishna Gudipati11189202011-06-13 15:50:35 -0700303#define BFI_FWBOOT_DEVMODE_OFF 4
304#define BFI_FWBOOT_TYPE_OFF 8
305#define BFI_FWBOOT_ENV_OFF 12
306#define BFI_FWBOOT_DEVMODE(__asic_gen, __asic_mode, __p0_mode, __p1_mode) \
307 (((u32)(__asic_gen)) << 24 | \
308 ((u32)(__asic_mode)) << 16 | \
309 ((u32)(__p0_mode)) << 8 | \
310 ((u32)(__p1_mode)))
311
312#define BFI_FWBOOT_TYPE_NORMAL 0
313#define BFI_FWBOOT_TYPE_MEMTEST 1
314#define BFI_FWBOOT_ENV_OS 0
315
316enum bfi_port_mode {
317 BFI_PORT_MODE_FC = 1,
318 BFI_PORT_MODE_ETH = 2,
319};
320
Jing Huangacdc79a2010-10-18 17:15:55 -0700321/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700322 * BFI_IOC_I2H_READY_EVENT message
323 */
324struct bfi_ioc_rdy_event_s {
325 struct bfi_mhdr_s mh; /* common msg header */
326 u8 init_status; /* init event status */
327 u8 rsvd[3];
328};
329
330struct bfi_ioc_hbeat_s {
331 struct bfi_mhdr_s mh; /* common msg header */
332 u32 hb_count; /* current heart beat count */
333};
334
Jing Huangacdc79a2010-10-18 17:15:55 -0700335/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700336 * IOC hardware/firmware state
337 */
338enum bfi_ioc_state {
339 BFI_IOC_UNINIT = 0, /* not initialized */
340 BFI_IOC_INITING = 1, /* h/w is being initialized */
341 BFI_IOC_HWINIT = 2, /* h/w is initialized */
342 BFI_IOC_CFG = 3, /* IOC configuration in progress */
343 BFI_IOC_OP = 4, /* IOC is operational */
344 BFI_IOC_DISABLING = 5, /* IOC is being disabled */
345 BFI_IOC_DISABLED = 6, /* IOC is disabled */
346 BFI_IOC_CFG_DISABLED = 7, /* IOC is being disabled;transient */
347 BFI_IOC_FAIL = 8, /* IOC heart-beat failure */
348 BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */
349};
350
351#define BFI_IOC_ENDIAN_SIG 0x12345678
352
353enum {
354 BFI_ADAPTER_TYPE_FC = 0x01, /* FC adapters */
355 BFI_ADAPTER_TYPE_MK = 0x0f0000, /* adapter type mask */
356 BFI_ADAPTER_TYPE_SH = 16, /* adapter type shift */
357 BFI_ADAPTER_NPORTS_MK = 0xff00, /* number of ports mask */
358 BFI_ADAPTER_NPORTS_SH = 8, /* number of ports shift */
359 BFI_ADAPTER_SPEED_MK = 0xff, /* adapter speed mask */
360 BFI_ADAPTER_SPEED_SH = 0, /* adapter speed shift */
361 BFI_ADAPTER_PROTO = 0x100000, /* prototype adapaters */
362 BFI_ADAPTER_TTV = 0x200000, /* TTV debug capable */
363 BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */
364};
365
366#define BFI_ADAPTER_GETP(__prop, __adap_prop) \
367 (((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \
368 BFI_ADAPTER_ ## __prop ## _SH)
369#define BFI_ADAPTER_SETP(__prop, __val) \
370 ((__val) << BFI_ADAPTER_ ## __prop ## _SH)
371#define BFI_ADAPTER_IS_PROTO(__adap_type) \
372 ((__adap_type) & BFI_ADAPTER_PROTO)
373#define BFI_ADAPTER_IS_TTV(__adap_type) \
374 ((__adap_type) & BFI_ADAPTER_TTV)
375#define BFI_ADAPTER_IS_UNSUPP(__adap_type) \
376 ((__adap_type) & BFI_ADAPTER_UNSUPP)
377#define BFI_ADAPTER_IS_SPECIAL(__adap_type) \
378 ((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO | \
379 BFI_ADAPTER_UNSUPP))
380
Jing Huangacdc79a2010-10-18 17:15:55 -0700381/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700382 * BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
383 */
384struct bfi_ioc_ctrl_req_s {
385 struct bfi_mhdr_s mh;
Krishna Gudipatid37779f2011-06-13 15:42:10 -0700386 u16 clscode;
387 u16 rsvd;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700388 u32 tv_sec;
389};
390#define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
391#define bfi_ioc_disable_req_t struct bfi_ioc_ctrl_req_s;
392
Jing Huangacdc79a2010-10-18 17:15:55 -0700393/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700394 * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
395 */
396struct bfi_ioc_ctrl_reply_s {
397 struct bfi_mhdr_s mh; /* Common msg header */
398 u8 status; /* enable/disable status */
399 u8 rsvd[3];
400};
401#define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
402#define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
403
404#define BFI_IOC_MSGSZ 8
Jing Huangacdc79a2010-10-18 17:15:55 -0700405/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700406 * H2I Messages
407 */
408union bfi_ioc_h2i_msg_u {
409 struct bfi_mhdr_s mh;
410 struct bfi_ioc_ctrl_req_s enable_req;
411 struct bfi_ioc_ctrl_req_s disable_req;
412 struct bfi_ioc_getattr_req_s getattr_req;
413 u32 mboxmsg[BFI_IOC_MSGSZ];
414};
415
Jing Huangacdc79a2010-10-18 17:15:55 -0700416/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700417 * I2H Messages
418 */
419union bfi_ioc_i2h_msg_u {
420 struct bfi_mhdr_s mh;
421 struct bfi_ioc_rdy_event_s rdy_event;
422 u32 mboxmsg[BFI_IOC_MSGSZ];
423};
424
425
Jing Huangacdc79a2010-10-18 17:15:55 -0700426/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700427 *----------------------------------------------------------------------
428 * PBC
429 *----------------------------------------------------------------------
430 */
431
432#define BFI_PBC_MAX_BLUNS 8
433#define BFI_PBC_MAX_VPORTS 16
Krishna Gudipati43ffdf42011-06-13 15:46:21 -0700434#define BFI_PBC_PORT_DISABLED 2
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700435
Jing Huangacdc79a2010-10-18 17:15:55 -0700436/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700437 * PBC boot lun configuration
438 */
439struct bfi_pbc_blun_s {
440 wwn_t tgt_pwwn;
Maggie Zhangf3148782010-12-09 19:11:39 -0800441 struct scsi_lun tgt_lun;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700442};
443
Jing Huangacdc79a2010-10-18 17:15:55 -0700444/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700445 * PBC virtual port configuration
446 */
447struct bfi_pbc_vport_s {
448 wwn_t vp_pwwn;
449 wwn_t vp_nwwn;
450};
451
Jing Huangacdc79a2010-10-18 17:15:55 -0700452/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700453 * BFI pre-boot configuration information
454 */
455struct bfi_pbc_s {
456 u8 port_enabled;
457 u8 boot_enabled;
458 u8 nbluns;
459 u8 nvports;
460 u8 port_speed;
461 u8 rsvd_a;
462 u16 hss;
463 wwn_t pbc_pwwn;
464 wwn_t pbc_nwwn;
465 struct bfi_pbc_blun_s blun[BFI_PBC_MAX_BLUNS];
466 struct bfi_pbc_vport_s vport[BFI_PBC_MAX_VPORTS];
467};
468
Jing Huangacdc79a2010-10-18 17:15:55 -0700469/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700470 *----------------------------------------------------------------------
471 * MSGQ
472 *----------------------------------------------------------------------
473 */
474#define BFI_MSGQ_FULL(_q) (((_q->pi + 1) % _q->q_depth) == _q->ci)
475#define BFI_MSGQ_EMPTY(_q) (_q->pi == _q->ci)
476#define BFI_MSGQ_UPDATE_CI(_q) (_q->ci = (_q->ci + 1) % _q->q_depth)
477#define BFI_MSGQ_UPDATE_PI(_q) (_q->pi = (_q->pi + 1) % _q->q_depth)
478
479/* q_depth must be power of 2 */
480#define BFI_MSGQ_FREE_CNT(_q) ((_q->ci - _q->pi - 1) & (_q->q_depth - 1))
481
482enum bfi_msgq_h2i_msgs_e {
483 BFI_MSGQ_H2I_INIT_REQ = 1,
484 BFI_MSGQ_H2I_DOORBELL = 2,
485 BFI_MSGQ_H2I_SHUTDOWN = 3,
486};
487
488enum bfi_msgq_i2h_msgs_e {
489 BFI_MSGQ_I2H_INIT_RSP = 1,
490 BFI_MSGQ_I2H_DOORBELL = 2,
491};
492
493
494/* Messages(commands/responsed/AENS will have the following header */
495struct bfi_msgq_mhdr_s {
496 u8 msg_class;
497 u8 msg_id;
498 u16 msg_token;
499 u16 num_entries;
500 u8 enet_id;
501 u8 rsvd[1];
502};
503
504#define bfi_msgq_mhdr_set(_mh, _mc, _mid, _tok, _enet_id) do { \
505 (_mh).msg_class = (_mc); \
506 (_mh).msg_id = (_mid); \
507 (_mh).msg_token = (_tok); \
508 (_mh).enet_id = (_enet_id); \
509} while (0)
510
511/*
512 * Mailbox for messaging interface
513 *
514*/
515#define BFI_MSGQ_CMD_ENTRY_SIZE (64) /* TBD */
516#define BFI_MSGQ_RSP_ENTRY_SIZE (64) /* TBD */
517#define BFI_MSGQ_MSG_SIZE_MAX (2048) /* TBD */
518
519struct bfi_msgq_s {
520 union bfi_addr_u addr;
521 u16 q_depth; /* Total num of entries in the queue */
522 u8 rsvd[2];
523};
524
525/* BFI_ENET_MSGQ_CFG_REQ TBD init or cfg? */
526struct bfi_msgq_cfg_req_s {
527 struct bfi_mhdr_s mh;
528 struct bfi_msgq_s cmdq;
529 struct bfi_msgq_s rspq;
530};
531
532/* BFI_ENET_MSGQ_CFG_RSP */
533struct bfi_msgq_cfg_rsp_s {
534 struct bfi_mhdr_s mh;
535 u8 cmd_status;
536 u8 rsvd[3];
537};
538
539
540/* BFI_MSGQ_H2I_DOORBELL */
541struct bfi_msgq_h2i_db_s {
542 struct bfi_mhdr_s mh;
543 u16 cmdq_pi;
544 u16 rspq_ci;
545};
546
547/* BFI_MSGQ_I2H_DOORBELL */
548struct bfi_msgq_i2h_db_s {
549 struct bfi_mhdr_s mh;
550 u16 rspq_pi;
551 u16 cmdq_ci;
552};
553
554#pragma pack()
555
556/* BFI port specific */
557#pragma pack(1)
558
559enum bfi_port_h2i {
560 BFI_PORT_H2I_ENABLE_REQ = (1),
561 BFI_PORT_H2I_DISABLE_REQ = (2),
562 BFI_PORT_H2I_GET_STATS_REQ = (3),
563 BFI_PORT_H2I_CLEAR_STATS_REQ = (4),
564};
565
566enum bfi_port_i2h {
567 BFI_PORT_I2H_ENABLE_RSP = BFA_I2HM(1),
568 BFI_PORT_I2H_DISABLE_RSP = BFA_I2HM(2),
569 BFI_PORT_I2H_GET_STATS_RSP = BFA_I2HM(3),
570 BFI_PORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(4),
571};
572
Jing Huangacdc79a2010-10-18 17:15:55 -0700573/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700574 * Generic REQ type
575 */
576struct bfi_port_generic_req_s {
577 struct bfi_mhdr_s mh; /* msg header */
578 u32 msgtag; /* msgtag for reply */
579 u32 rsvd;
580};
581
Jing Huangacdc79a2010-10-18 17:15:55 -0700582/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700583 * Generic RSP type
584 */
585struct bfi_port_generic_rsp_s {
586 struct bfi_mhdr_s mh; /* common msg header */
587 u8 status; /* port enable status */
588 u8 rsvd[3];
589 u32 msgtag; /* msgtag for reply */
590};
591
Jing Huangacdc79a2010-10-18 17:15:55 -0700592/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700593 * BFI_PORT_H2I_GET_STATS_REQ
594 */
595struct bfi_port_get_stats_req_s {
596 struct bfi_mhdr_s mh; /* common msg header */
597 union bfi_addr_u dma_addr;
598};
599
600union bfi_port_h2i_msg_u {
601 struct bfi_mhdr_s mh;
602 struct bfi_port_generic_req_s enable_req;
603 struct bfi_port_generic_req_s disable_req;
604 struct bfi_port_get_stats_req_s getstats_req;
605 struct bfi_port_generic_req_s clearstats_req;
606};
607
608union bfi_port_i2h_msg_u {
609 struct bfi_mhdr_s mh;
610 struct bfi_port_generic_rsp_s enable_rsp;
611 struct bfi_port_generic_rsp_s disable_rsp;
612 struct bfi_port_generic_rsp_s getstats_rsp;
613 struct bfi_port_generic_rsp_s clearstats_rsp;
614};
615
616#pragma pack()
617
618#endif /* __BFI_H__ */