blob: 96ef05670659dcb6dd9472b1fe7a9f918f11cb9c [file] [log] [blame]
Jing Huang7725ccf2009-09-23 17:46:15 -07001/*
2 * Copyright (c) 2005-2009 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_IOC_H__
19#define __BFI_IOC_H__
20
21#include "bfi.h"
22#include <defs/bfa_defs_ioc.h>
23
24#pragma pack(1)
25
26enum bfi_ioc_h2i_msgs {
27 BFI_IOC_H2I_ENABLE_REQ = 1,
28 BFI_IOC_H2I_DISABLE_REQ = 2,
29 BFI_IOC_H2I_GETATTR_REQ = 3,
30 BFI_IOC_H2I_DBG_SYNC = 4,
31 BFI_IOC_H2I_DBG_DUMP = 5,
32};
33
34enum bfi_ioc_i2h_msgs {
35 BFI_IOC_I2H_ENABLE_REPLY = BFA_I2HM(1),
36 BFI_IOC_I2H_DISABLE_REPLY = BFA_I2HM(2),
37 BFI_IOC_I2H_GETATTR_REPLY = BFA_I2HM(3),
38 BFI_IOC_I2H_READY_EVENT = BFA_I2HM(4),
39 BFI_IOC_I2H_HBEAT = BFA_I2HM(5),
40};
41
42/**
43 * BFI_IOC_H2I_GETATTR_REQ message
44 */
45struct bfi_ioc_getattr_req_s {
46 struct bfi_mhdr_s mh;
47 union bfi_addr_u attr_addr;
48};
49
50struct bfi_ioc_attr_s {
51 wwn_t mfg_wwn;
52 mac_t mfg_mac;
53 u16 rsvd_a;
54 char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
55 u8 pcie_gen;
56 u8 pcie_lanes_orig;
57 u8 pcie_lanes;
58 u8 rx_bbcredit; /* receive buffer credits */
59 u32 adapter_prop; /* adapter properties */
60 u16 maxfrsize; /* max receive frame size */
61 char asic_rev;
62 u8 rsvd_b;
63 char fw_version[BFA_VERSION_LEN];
64 char optrom_version[BFA_VERSION_LEN];
65 struct bfa_mfg_vpd_s vpd;
66};
67
68/**
69 * BFI_IOC_I2H_GETATTR_REPLY message
70 */
71struct bfi_ioc_getattr_reply_s {
72 struct bfi_mhdr_s mh; /* Common msg header */
73 u8 status; /* cfg reply status */
74 u8 rsvd[3];
75};
76
77/**
78 * Firmware memory page offsets
79 */
80#define BFI_IOC_SMEM_PG0_CB (0x40)
81#define BFI_IOC_SMEM_PG0_CT (0x180)
82
83/**
84 * Firmware trace offset
85 */
86#define BFI_IOC_TRC_OFF (0x4b00)
87#define BFI_IOC_TRC_ENTS 256
88
89#define BFI_IOC_FW_SIGNATURE (0xbfadbfad)
90#define BFI_IOC_MD5SUM_SZ 4
91struct bfi_ioc_image_hdr_s {
92 u32 signature; /* constant signature */
93 u32 rsvd_a;
94 u32 exec; /* exec vector */
95 u32 param; /* parameters */
96 u32 rsvd_b[4];
97 u32 md5sum[BFI_IOC_MD5SUM_SZ];
98};
99
100/**
101 * BFI_IOC_I2H_READY_EVENT message
102 */
103struct bfi_ioc_rdy_event_s {
104 struct bfi_mhdr_s mh; /* common msg header */
105 u8 init_status; /* init event status */
106 u8 rsvd[3];
107};
108
109struct bfi_ioc_hbeat_s {
110 struct bfi_mhdr_s mh; /* common msg header */
111 u32 hb_count; /* current heart beat count */
112};
113
114/**
115 * IOC hardware/firmware state
116 */
117enum bfi_ioc_state {
118 BFI_IOC_UNINIT = 0, /* not initialized */
119 BFI_IOC_INITING = 1, /* h/w is being initialized */
120 BFI_IOC_HWINIT = 2, /* h/w is initialized */
121 BFI_IOC_CFG = 3, /* IOC configuration in progress */
122 BFI_IOC_OP = 4, /* IOC is operational */
123 BFI_IOC_DISABLING = 5, /* IOC is being disabled */
124 BFI_IOC_DISABLED = 6, /* IOC is disabled */
125 BFI_IOC_CFG_DISABLED = 7, /* IOC is being disabled;transient */
126 BFI_IOC_HBFAIL = 8, /* IOC heart-beat failure */
127 BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */
128};
129
130#define BFI_IOC_ENDIAN_SIG 0x12345678
131
132enum {
133 BFI_ADAPTER_TYPE_FC = 0x01, /* FC adapters */
134 BFI_ADAPTER_TYPE_MK = 0x0f0000, /* adapter type mask */
135 BFI_ADAPTER_TYPE_SH = 16, /* adapter type shift */
136 BFI_ADAPTER_NPORTS_MK = 0xff00, /* number of ports mask */
137 BFI_ADAPTER_NPORTS_SH = 8, /* number of ports shift */
138 BFI_ADAPTER_SPEED_MK = 0xff, /* adapter speed mask */
139 BFI_ADAPTER_SPEED_SH = 0, /* adapter speed shift */
140 BFI_ADAPTER_PROTO = 0x100000, /* prototype adapaters */
141 BFI_ADAPTER_TTV = 0x200000, /* TTV debug capable */
142 BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */
143};
144
Jing Huangf8ceafd2009-09-25 12:29:54 -0700145#define BFI_ADAPTER_GETP(__prop, __adap_prop) \
Jing Huang7725ccf2009-09-23 17:46:15 -0700146 (((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \
147 BFI_ADAPTER_ ## __prop ## _SH)
148#define BFI_ADAPTER_SETP(__prop, __val) \
149 ((__val) << BFI_ADAPTER_ ## __prop ## _SH)
150#define BFI_ADAPTER_IS_PROTO(__adap_type) \
151 ((__adap_type) & BFI_ADAPTER_PROTO)
152#define BFI_ADAPTER_IS_TTV(__adap_type) \
153 ((__adap_type) & BFI_ADAPTER_TTV)
154#define BFI_ADAPTER_IS_UNSUPP(__adap_type) \
155 ((__adap_type) & BFI_ADAPTER_UNSUPP)
156#define BFI_ADAPTER_IS_SPECIAL(__adap_type) \
157 ((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO | \
158 BFI_ADAPTER_UNSUPP))
159
160/**
161 * BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
162 */
163struct bfi_ioc_ctrl_req_s {
164 struct bfi_mhdr_s mh;
165 u8 ioc_class;
166 u8 rsvd[3];
167};
168
169/**
170 * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
171 */
172struct bfi_ioc_ctrl_reply_s {
173 struct bfi_mhdr_s mh; /* Common msg header */
174 u8 status; /* enable/disable status */
175 u8 rsvd[3];
176};
177
178#define BFI_IOC_MSGSZ 8
179/**
180 * H2I Messages
181 */
182union bfi_ioc_h2i_msg_u {
183 struct bfi_mhdr_s mh;
184 struct bfi_ioc_ctrl_req_s enable_req;
185 struct bfi_ioc_ctrl_req_s disable_req;
186 struct bfi_ioc_getattr_req_s getattr_req;
187 u32 mboxmsg[BFI_IOC_MSGSZ];
188};
189
190/**
191 * I2H Messages
192 */
193union bfi_ioc_i2h_msg_u {
194 struct bfi_mhdr_s mh;
195 struct bfi_ioc_rdy_event_s rdy_event;
196 u32 mboxmsg[BFI_IOC_MSGSZ];
197};
198
199#pragma pack()
200
201#endif /* __BFI_IOC_H__ */
202