xref: /freebsd/sys/dev/sfxge/common/efx_check.h (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
1 /*-
2  * Copyright (c) 2012-2015 Solarflare Communications Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * The views and conclusions contained in the software and documentation are
27  * those of the authors and should not be interpreted as representing official
28  * policies, either expressed or implied, of the FreeBSD Project.
29  *
30  * $FreeBSD$
31  */
32 
33 #ifndef _SYS_EFX_CHECK_H
34 #define	_SYS_EFX_CHECK_H
35 
36 #include "efsys.h"
37 
38 /*
39  * Check that the efsys.h header in client code has a valid combination of
40  * EFSYS_OPT_xxx options.
41  *
42  * NOTE: Keep checks for obsolete options here to ensure that they are removed
43  * from client code (and do not reappear in merges from other branches).
44  */
45 
46 /* Support NVRAM based boot config */
47 #if EFSYS_OPT_BOOTCFG
48 # if !EFSYS_OPT_NVRAM
49 #  error "BOOTCFG requires NVRAM"
50 # endif
51 #endif /* EFSYS_OPT_BOOTCFG */
52 
53 /* Verify chip implements accessed registers */
54 #if EFSYS_OPT_CHECK_REG
55 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
56 #  error "CHECK_REG requires FALCON or SIENA or HUNTINGTON"
57 # endif
58 #endif /* EFSYS_OPT_CHECK_REG */
59 
60 /* Decode fatal errors */
61 #if EFSYS_OPT_DECODE_INTR_FATAL
62 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
63 #  if EFSYS_OPT_HUNTINGTON
64 #   error "INTR_FATAL not supported on HUNTINGTON"
65 #  endif
66 #  error "INTR_FATAL requires FALCON or SIENA"
67 # endif
68 #endif /* EFSYS_OPT_DECODE_INTR_FATAL */
69 
70 /* Support diagnostic hardware tests */
71 #if EFSYS_OPT_DIAG
72 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
73 #  error "DIAG requires FALCON or SIENA or HUNTINGTON"
74 # endif
75 #endif /* EFSYS_OPT_DIAG */
76 
77 /* Support optimized EVQ data access */
78 #if EFSYS_OPT_EV_PREFETCH
79 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
80 #  error "EV_PREFETCH requires FALCON or SIENA or HUNTINGTON"
81 # endif
82 #endif /* EFSYS_OPT_EV_PREFETCH */
83 
84 /* Support overriding the NVRAM and VPD configuration */
85 #if EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE
86 # if !EFSYS_OPT_FALCON
87 #  error "FALCON_NIC_CFG_OVERRIDE requires FALCON"
88 # endif
89 #endif /* EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE */
90 
91 /* Support hardware packet filters */
92 #if EFSYS_OPT_FILTER
93 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
94 #  error "FILTER requires FALCON or SIENA or HUNTINGTON"
95 # endif
96 #endif /* EFSYS_OPT_FILTER */
97 
98 #if EFSYS_OPT_HUNTINGTON
99 # if !EFSYS_OPT_FILTER
100 #  error "HUNTINGTON requires FILTER"
101 # endif
102 #endif /* EFSYS_OPT_HUNTINGTON */
103 
104 /* Support hardware loopback modes */
105 #if EFSYS_OPT_LOOPBACK
106 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
107 #  error "LOOPBACK requires FALCON or SIENA or HUNTINGTON"
108 # endif
109 #endif /* EFSYS_OPT_LOOPBACK */
110 
111 /* Support Falcon GMAC */
112 #if EFSYS_OPT_MAC_FALCON_GMAC
113 # if !EFSYS_OPT_FALCON
114 #  error "MAC_FALCON_GMAC requires FALCON"
115 # endif
116 #endif /* EFSYS_OPT_MAC_FALCON_GMAC */
117 
118 /* Support Falcon XMAC */
119 #if EFSYS_OPT_MAC_FALCON_XMAC
120 # if !EFSYS_OPT_FALCON
121 #  error "MAC_FALCON_XMAC requires FALCON"
122 # endif
123 #endif /* EFSYS_OPT_MAC_FALCON_XMAC */
124 
125 /* Support MAC statistics */
126 #if EFSYS_OPT_MAC_STATS
127 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
128 #  error "MAC_STATS requires FALCON or SIENA or HUNTINGTON"
129 # endif
130 #endif /* EFSYS_OPT_MAC_STATS */
131 
132 /* Support management controller messages */
133 #if EFSYS_OPT_MCDI
134 # if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
135 #  if EFSYS_OPT_FALCON
136 #   error "MCDI not supported on FALCON"
137 #  endif
138 #  error "MCDI requires SIENA or HUNTINGTON"
139 # endif
140 #endif /* EFSYS_OPT_MCDI */
141 
142 #if EFSYS_OPT_SIENA && !EFSYS_OPT_MCDI
143 # error "SIENA requires MCDI"
144 #endif
145 #if EFSYS_OPT_HUNTINGTON && !EFSYS_OPT_MCDI
146 # error "HUNTINGTON requires MCDI"
147 #endif
148 
149 /* Support LM87 monitor */
150 #if EFSYS_OPT_MON_LM87
151 # if !EFSYS_OPT_FALCON
152 #  error "MON_LM87 requires FALCON"
153 # endif
154 #endif /* EFSYS_OPT_MON_LM87 */
155 
156 /* Support MAX6647 monitor */
157 #if EFSYS_OPT_MON_MAX6647
158 # if !EFSYS_OPT_FALCON
159 #  error "MON_MAX6647 requires FALCON"
160 # endif
161 #endif /* EFSYS_OPT_MON_MAX6647 */
162 
163 /* Support null monitor */
164 #if EFSYS_OPT_MON_NULL
165 # if !EFSYS_OPT_FALCON
166 #  error "MON_NULL requires FALCON"
167 # endif
168 #endif /* EFSYS_OPT_MON_NULL */
169 
170 /* Support Siena monitor */
171 #ifdef EFSYS_OPT_MON_SIENA
172 #  error "MON_SIENA is obsolete use MON_MCDI"
173 #endif /* EFSYS_OPT_MON_SIENA*/
174 
175 /* Support Huntington monitor */
176 #ifdef EFSYS_OPT_MON_HUNTINGTON
177 #  error "MON_HUNTINGTON is obsolete use MON_MCDI"
178 #endif /* EFSYS_OPT_MON_HUNTINGTON*/
179 
180 /* Support monitor statistics (voltage/temperature) */
181 #if EFSYS_OPT_MON_STATS
182 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
183 #  error "MON_STATS requires FALCON or SIENA or HUNTINGTON"
184 # endif
185 #endif /* EFSYS_OPT_MON_STATS */
186 
187 /* Support Monitor via mcdi */
188 #if EFSYS_OPT_MON_MCDI
189 # if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
190 #  error "MON_MCDI requires SIENA or HUNTINGTON"
191 # endif
192 #endif /* EFSYS_OPT_MON_MCDI*/
193 
194 /* Support printable names for statistics */
195 #if EFSYS_OPT_NAMES
196 # if !(EFSYS_OPT_LOOPBACK || EFSYS_OPT_MAC_STATS || EFSYS_OPT_MCDI || \
197 	EFSYS_MON_STATS || EFSYS_OPT_PHY_PROPS || EFSYS_OPT_PHY_STATS || \
198 	EFSYS_OPT_QSTATS)
199 #  error "NAMES requires LOOPBACK or xxxSTATS or MCDI or PHY_PROPS"
200 # endif
201 #endif /* EFSYS_OPT_NAMES */
202 
203 /* Support non volatile configuration */
204 #if EFSYS_OPT_NVRAM
205 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
206 #  error "NVRAM requires FALCON or SIENA or HUNTINGTON"
207 # endif
208 #endif /* EFSYS_OPT_NVRAM */
209 
210 /* Support Falcon bootrom */
211 #if EFSYS_OPT_NVRAM_FALCON_BOOTROM
212 # if !EFSYS_OPT_NVRAM
213 #  error "NVRAM_FALCON_BOOTROM requires NVRAM"
214 # endif
215 # if !EFSYS_OPT_FALCON
216 #  error "NVRAM_FALCON_BOOTROM requires FALCON"
217 # endif
218 #endif /* EFSYS_OPT_NVRAM_FALCON_BOOTROM */
219 
220 /* Support NVRAM config for SFT9001 */
221 #if EFSYS_OPT_NVRAM_SFT9001
222 # if !EFSYS_OPT_NVRAM
223 #  error "NVRAM_SFT9001 requires NVRAM"
224 # endif
225 # if !EFSYS_OPT_FALCON
226 #  error "NVRAM_SFT9001 requires FALCON"
227 # endif
228 #endif /* EFSYS_OPT_NVRAM_SFT9001 */
229 
230 /* Support NVRAM config for SFX7101 */
231 #if EFSYS_OPT_NVRAM_SFX7101
232 # if !EFSYS_OPT_NVRAM
233 #  error "NVRAM_SFX7101 requires NVRAM"
234 # endif
235 # if !EFSYS_OPT_FALCON
236 #  error "NVRAM_SFX7101 requires FALCON"
237 # endif
238 #endif /* EFSYS_OPT_NVRAM_SFX7101 */
239 
240 /* Support PCIe interface tuning */
241 #if EFSYS_OPT_PCIE_TUNE
242 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
243 #  error "PCIE_TUNE requires FALCON or SIENA"
244 # endif
245 #endif /* EFSYS_OPT_PCIE_TUNE */
246 
247 /* Support PHY BIST diagnostics */
248 #if EFSYS_OPT_PHY_BIST
249 #  error "PHY_BIST is obsolete. It has been replaced by the BIST option."
250 #endif /* EFSYS_OPT_PHY_BIST */
251 
252 /* Support PHY flags */
253 #if EFSYS_OPT_PHY_FLAGS
254 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
255 #  error "PHY_FLAGS requires FALCON or SIENA"
256 # endif
257 #endif /* EFSYS_OPT_PHY_FLAGS */
258 
259 /* Support for PHY LED control */
260 #if EFSYS_OPT_PHY_LED_CONTROL
261 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
262 #  error "PHY_LED_CONTROL requires FALCON or SIENA"
263 # endif
264 #endif /* EFSYS_OPT_PHY_LED_CONTROL */
265 
266 /* Support NULL PHY */
267 #if EFSYS_OPT_PHY_NULL
268 # if !EFSYS_OPT_FALCON
269 #  error "PHY_NULL requires FALCON"
270 # endif
271 #endif /* EFSYS_OPT_PHY_NULL */
272 
273 /* Obsolete option */
274 #ifdef EFSYS_OPT_PHY_PM8358
275 # error "EFSYS_OPT_PHY_PM8358 is obsolete and is not supported."
276 #endif
277 
278 /* Support PHY properties */
279 #if EFSYS_OPT_PHY_PROPS
280 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
281 #  error "PHY_PROPS requires FALCON or SIENA"
282 # endif
283 #endif /* EFSYS_OPT_PHY_PROPS */
284 
285 /* Support QT2022C2 PHY */
286 #if EFSYS_OPT_PHY_QT2022C2
287 # if !EFSYS_OPT_FALCON
288 #  error "PHY_QT2022C2 requires FALCON"
289 # endif
290 #endif /* EFSYS_OPT_PHY_QT2022C2 */
291 
292 /* Support QT2025C PHY (Wakefield NIC) */
293 #if EFSYS_OPT_PHY_QT2025C
294 # if !EFSYS_OPT_FALCON
295 #  error "PHY_QT2025C requires FALCON"
296 # endif
297 #endif /* EFSYS_OPT_PHY_QT2025C */
298 
299 /* Support SFT9001 PHY (Starbolt NIC) */
300 #if EFSYS_OPT_PHY_SFT9001
301 # if !EFSYS_OPT_FALCON
302 #  error "PHY_SFT9001 requires FALCON"
303 # endif
304 #endif /* EFSYS_OPT_PHY_SFT9001 */
305 
306 /* Support SFX7101 PHY (SFE4001 NIC) */
307 #if EFSYS_OPT_PHY_SFX7101
308 # if !EFSYS_OPT_FALCON
309 #  error "PHY_SFX7101 requires FALCON"
310 # endif
311 #endif /* EFSYS_OPT_PHY_SFX7101 */
312 
313 /* Support PHY statistics */
314 #if EFSYS_OPT_PHY_STATS
315 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
316 #  error "PHY_STATS requires FALCON or SIENA"
317 # endif
318 #endif /* EFSYS_OPT_PHY_STATS */
319 
320 /* Support TXC43128 PHY (SFE4003 NIC) */
321 #if EFSYS_OPT_PHY_TXC43128
322 # if !EFSYS_OPT_FALCON
323 #  error "PHY_TXC43128 requires FALCON"
324 # endif
325 #endif /* EFSYS_OPT_PHY_TXC43128 */
326 
327 /* Support EVQ/RXQ/TXQ statistics */
328 #if EFSYS_OPT_QSTATS
329 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
330 #  error "QSTATS requires FALCON or SIENA or HUNTINGTON"
331 # endif
332 #endif /* EFSYS_OPT_QSTATS */
333 
334 /* Support receive header split */
335 #if EFSYS_OPT_RX_HDR_SPLIT
336 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
337 #  error "RX_HDR_SPLIT requires FALCON or SIENA or HUNTINGTON"
338 # endif
339 #endif /* EFSYS_OPT_RX_HDR_SPLIT */
340 
341 /* Support receive scaling (RSS) */
342 #if EFSYS_OPT_RX_SCALE
343 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
344 #  error "RX_SCALE requires FALCON or SIENA or HUNTINGTON"
345 # endif
346 #endif /* EFSYS_OPT_RX_SCALE */
347 
348 /* Support receive scatter DMA */
349 #if EFSYS_OPT_RX_SCATTER
350 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
351 #  error "RX_SCATTER requires FALCON or SIENA or HUNTINGTON"
352 # endif
353 #endif /* EFSYS_OPT_RX_SCATTER */
354 
355 /* Obsolete option */
356 #ifdef EFSYS_OPT_STAT_NAME
357 # error "EFSYS_OPT_STAT_NAME is obsolete (replaced by EFSYS_OPT_NAMES)."
358 #endif
359 
360 /* Support PCI Vital Product Data (VPD) */
361 #if EFSYS_OPT_VPD
362 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
363 #  error "VPD requires FALCON or SIENA or HUNTINGTON"
364 # endif
365 #endif /* EFSYS_OPT_VPD */
366 
367 /* Support Wake on LAN */
368 #if EFSYS_OPT_WOL
369 # if !EFSYS_OPT_SIENA
370 #  error "WOL requires SIENA"
371 # endif
372 #endif /* EFSYS_OPT_WOL */
373 
374 /* Support calculating multicast pktfilter in common code */
375 #if EFSYS_OPT_MCAST_FILTER_LIST
376 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
377 #  error "MCAST_FILTER_LIST requires FALCON or SIENA or HUNTINGTON"
378 # endif
379 #endif /* EFSYS_OPT_MCAST_FILTER_LIST */
380 
381 /* Support BIST */
382 #if EFSYS_OPT_BIST
383 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
384 #  error "BIST requires FALCON or SIENA or HUNTINGTON"
385 # endif
386 #endif /* EFSYS_OPT_BIST */
387 
388 #endif /* _SYS_EFX_CHECK_H */
389