diff options
Diffstat (limited to 'drivers/net/bna/bfa_defs.h')
-rw-r--r-- | drivers/net/bna/bfa_defs.h | 243 |
1 files changed, 243 insertions, 0 deletions
diff --git a/drivers/net/bna/bfa_defs.h b/drivers/net/bna/bfa_defs.h new file mode 100644 index 000000000000..29c1b8de2c2d --- /dev/null +++ b/drivers/net/bna/bfa_defs.h | |||
@@ -0,0 +1,243 @@ | |||
1 | /* | ||
2 | * Linux network driver for Brocade Converged Network Adapter. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License (GPL) Version 2 as | ||
6 | * published by the Free Software Foundation | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
11 | * General Public License for more details. | ||
12 | */ | ||
13 | /* | ||
14 | * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. | ||
15 | * All rights reserved | ||
16 | * www.brocade.com | ||
17 | */ | ||
18 | |||
19 | #ifndef __BFA_DEFS_H__ | ||
20 | #define __BFA_DEFS_H__ | ||
21 | |||
22 | #include "cna.h" | ||
23 | #include "bfa_defs_status.h" | ||
24 | #include "bfa_defs_mfg_comm.h" | ||
25 | |||
26 | #define BFA_STRING_32 32 | ||
27 | #define BFA_VERSION_LEN 64 | ||
28 | |||
29 | /** | ||
30 | * ---------------------- adapter definitions ------------ | ||
31 | */ | ||
32 | |||
33 | /** | ||
34 | * BFA adapter level attributes. | ||
35 | */ | ||
36 | enum { | ||
37 | BFA_ADAPTER_SERIAL_NUM_LEN = STRSZ(BFA_MFG_SERIALNUM_SIZE), | ||
38 | /* | ||
39 | *!< adapter serial num length | ||
40 | */ | ||
41 | BFA_ADAPTER_MODEL_NAME_LEN = 16, /*!< model name length */ | ||
42 | BFA_ADAPTER_MODEL_DESCR_LEN = 128, /*!< model description length */ | ||
43 | BFA_ADAPTER_MFG_NAME_LEN = 8, /*!< manufacturer name length */ | ||
44 | BFA_ADAPTER_SYM_NAME_LEN = 64, /*!< adapter symbolic name length */ | ||
45 | BFA_ADAPTER_OS_TYPE_LEN = 64, /*!< adapter os type length */ | ||
46 | }; | ||
47 | |||
48 | struct bfa_adapter_attr { | ||
49 | char manufacturer[BFA_ADAPTER_MFG_NAME_LEN]; | ||
50 | char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN]; | ||
51 | u32 card_type; | ||
52 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; | ||
53 | char model_descr[BFA_ADAPTER_MODEL_DESCR_LEN]; | ||
54 | u64 pwwn; | ||
55 | char node_symname[FC_SYMNAME_MAX]; | ||
56 | char hw_ver[BFA_VERSION_LEN]; | ||
57 | char fw_ver[BFA_VERSION_LEN]; | ||
58 | char optrom_ver[BFA_VERSION_LEN]; | ||
59 | char os_type[BFA_ADAPTER_OS_TYPE_LEN]; | ||
60 | struct bfa_mfg_vpd vpd; | ||
61 | struct mac mac; | ||
62 | |||
63 | u8 nports; | ||
64 | u8 max_speed; | ||
65 | u8 prototype; | ||
66 | char asic_rev; | ||
67 | |||
68 | u8 pcie_gen; | ||
69 | u8 pcie_lanes_orig; | ||
70 | u8 pcie_lanes; | ||
71 | u8 cna_capable; | ||
72 | |||
73 | u8 is_mezz; | ||
74 | u8 trunk_capable; | ||
75 | }; | ||
76 | |||
77 | /** | ||
78 | * ---------------------- IOC definitions ------------ | ||
79 | */ | ||
80 | |||
81 | enum { | ||
82 | BFA_IOC_DRIVER_LEN = 16, | ||
83 | BFA_IOC_CHIP_REV_LEN = 8, | ||
84 | }; | ||
85 | |||
86 | /** | ||
87 | * Driver and firmware versions. | ||
88 | */ | ||
89 | struct bfa_ioc_driver_attr { | ||
90 | char driver[BFA_IOC_DRIVER_LEN]; /*!< driver name */ | ||
91 | char driver_ver[BFA_VERSION_LEN]; /*!< driver version */ | ||
92 | char fw_ver[BFA_VERSION_LEN]; /*!< firmware version */ | ||
93 | char bios_ver[BFA_VERSION_LEN]; /*!< bios version */ | ||
94 | char efi_ver[BFA_VERSION_LEN]; /*!< EFI version */ | ||
95 | char ob_ver[BFA_VERSION_LEN]; /*!< openboot version */ | ||
96 | }; | ||
97 | |||
98 | /** | ||
99 | * IOC PCI device attributes | ||
100 | */ | ||
101 | struct bfa_ioc_pci_attr { | ||
102 | u16 vendor_id; /*!< PCI vendor ID */ | ||
103 | u16 device_id; /*!< PCI device ID */ | ||
104 | u16 ssid; /*!< subsystem ID */ | ||
105 | u16 ssvid; /*!< subsystem vendor ID */ | ||
106 | u32 pcifn; /*!< PCI device function */ | ||
107 | u32 rsvd; /* padding */ | ||
108 | char chip_rev[BFA_IOC_CHIP_REV_LEN]; /*!< chip revision */ | ||
109 | }; | ||
110 | |||
111 | /** | ||
112 | * IOC states | ||
113 | */ | ||
114 | enum bfa_ioc_state { | ||
115 | BFA_IOC_RESET = 1, /*!< IOC is in reset state */ | ||
116 | BFA_IOC_SEMWAIT = 2, /*!< Waiting for IOC h/w semaphore */ | ||
117 | BFA_IOC_HWINIT = 3, /*!< IOC h/w is being initialized */ | ||
118 | BFA_IOC_GETATTR = 4, /*!< IOC is being configured */ | ||
119 | BFA_IOC_OPERATIONAL = 5, /*!< IOC is operational */ | ||
120 | BFA_IOC_INITFAIL = 6, /*!< IOC hardware failure */ | ||
121 | BFA_IOC_HBFAIL = 7, /*!< IOC heart-beat failure */ | ||
122 | BFA_IOC_DISABLING = 8, /*!< IOC is being disabled */ | ||
123 | BFA_IOC_DISABLED = 9, /*!< IOC is disabled */ | ||
124 | BFA_IOC_FWMISMATCH = 10, /*!< IOC f/w different from drivers */ | ||
125 | }; | ||
126 | |||
127 | /** | ||
128 | * IOC firmware stats | ||
129 | */ | ||
130 | struct bfa_fw_ioc_stats { | ||
131 | u32 enable_reqs; | ||
132 | u32 disable_reqs; | ||
133 | u32 get_attr_reqs; | ||
134 | u32 dbg_sync; | ||
135 | u32 dbg_dump; | ||
136 | u32 unknown_reqs; | ||
137 | }; | ||
138 | |||
139 | /** | ||
140 | * IOC driver stats | ||
141 | */ | ||
142 | struct bfa_ioc_drv_stats { | ||
143 | u32 ioc_isrs; | ||
144 | u32 ioc_enables; | ||
145 | u32 ioc_disables; | ||
146 | u32 ioc_hbfails; | ||
147 | u32 ioc_boots; | ||
148 | u32 stats_tmos; | ||
149 | u32 hb_count; | ||
150 | u32 disable_reqs; | ||
151 | u32 enable_reqs; | ||
152 | u32 disable_replies; | ||
153 | u32 enable_replies; | ||
154 | }; | ||
155 | |||
156 | /** | ||
157 | * IOC statistics | ||
158 | */ | ||
159 | struct bfa_ioc_stats { | ||
160 | struct bfa_ioc_drv_stats drv_stats; /*!< driver IOC stats */ | ||
161 | struct bfa_fw_ioc_stats fw_stats; /*!< firmware IOC stats */ | ||
162 | }; | ||
163 | |||
164 | enum bfa_ioc_type { | ||
165 | BFA_IOC_TYPE_FC = 1, | ||
166 | BFA_IOC_TYPE_FCoE = 2, | ||
167 | BFA_IOC_TYPE_LL = 3, | ||
168 | }; | ||
169 | |||
170 | /** | ||
171 | * IOC attributes returned in queries | ||
172 | */ | ||
173 | struct bfa_ioc_attr { | ||
174 | enum bfa_ioc_type ioc_type; | ||
175 | enum bfa_ioc_state state; /*!< IOC state */ | ||
176 | struct bfa_adapter_attr adapter_attr; /*!< HBA attributes */ | ||
177 | struct bfa_ioc_driver_attr driver_attr; /*!< driver attr */ | ||
178 | struct bfa_ioc_pci_attr pci_attr; | ||
179 | u8 port_id; /*!< port number */ | ||
180 | u8 rsvd[7]; /*!< 64bit align */ | ||
181 | }; | ||
182 | |||
183 | /** | ||
184 | * ---------------------- mfg definitions ------------ | ||
185 | */ | ||
186 | |||
187 | /** | ||
188 | * Checksum size | ||
189 | */ | ||
190 | #define BFA_MFG_CHKSUM_SIZE 16 | ||
191 | |||
192 | #define BFA_MFG_PARTNUM_SIZE 14 | ||
193 | #define BFA_MFG_SUPPLIER_ID_SIZE 10 | ||
194 | #define BFA_MFG_SUPPLIER_PARTNUM_SIZE 20 | ||
195 | #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE 20 | ||
196 | #define BFA_MFG_SUPPLIER_REVISION_SIZE 4 | ||
197 | |||
198 | #pragma pack(1) | ||
199 | |||
200 | /** | ||
201 | * @brief BFA adapter manufacturing block definition. | ||
202 | * | ||
203 | * All numerical fields are in big-endian format. | ||
204 | */ | ||
205 | struct bfa_mfg_block { | ||
206 | u8 version; /*!< manufacturing block version */ | ||
207 | u8 mfg_sig[3]; /*!< characters 'M', 'F', 'G' */ | ||
208 | u16 mfgsize; /*!< mfg block size */ | ||
209 | u16 u16_chksum; /*!< old u16 checksum */ | ||
210 | char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)]; | ||
211 | char brcd_partnum[STRSZ(BFA_MFG_PARTNUM_SIZE)]; | ||
212 | u8 mfg_day; /*!< manufacturing day */ | ||
213 | u8 mfg_month; /*!< manufacturing month */ | ||
214 | u16 mfg_year; /*!< manufacturing year */ | ||
215 | u64 mfg_wwn; /*!< wwn base for this adapter */ | ||
216 | u8 num_wwn; /*!< number of wwns assigned */ | ||
217 | u8 mfg_speeds; /*!< speeds allowed for this adapter */ | ||
218 | u8 rsv[2]; | ||
219 | char supplier_id[STRSZ(BFA_MFG_SUPPLIER_ID_SIZE)]; | ||
220 | char supplier_partnum[STRSZ(BFA_MFG_SUPPLIER_PARTNUM_SIZE)]; | ||
221 | char | ||
222 | supplier_serialnum[STRSZ(BFA_MFG_SUPPLIER_SERIALNUM_SIZE)]; | ||
223 | char | ||
224 | supplier_revision[STRSZ(BFA_MFG_SUPPLIER_REVISION_SIZE)]; | ||
225 | mac_t mfg_mac; /*!< mac address */ | ||
226 | u8 num_mac; /*!< number of mac addresses */ | ||
227 | u8 rsv2; | ||
228 | u32 mfg_type; /*!< card type */ | ||
229 | u8 rsv3[108]; | ||
230 | u8 md5_chksum[BFA_MFG_CHKSUM_SIZE]; /*!< md5 checksum */ | ||
231 | }; | ||
232 | |||
233 | #pragma pack() | ||
234 | |||
235 | /** | ||
236 | * ---------------------- pci definitions ------------ | ||
237 | */ | ||
238 | |||
239 | #define bfa_asic_id_ct(devid) \ | ||
240 | ((devid) == PCI_DEVICE_ID_BROCADE_CT || \ | ||
241 | (devid) == PCI_DEVICE_ID_BROCADE_CT_FC) | ||
242 | |||
243 | #endif /* __BFA_DEFS_H__ */ | ||