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