xref: /freebsd/sys/dev/sfxge/common/efx_check.h (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
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 || \
56 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
57 #  error "CHECK_REG requires FALCON or SIENA or HUNTINGTON or MEDFORD"
58 # endif
59 #endif /* EFSYS_OPT_CHECK_REG */
60 
61 /* Decode fatal errors */
62 #if EFSYS_OPT_DECODE_INTR_FATAL
63 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
64 #  error "INTR_FATAL requires FALCON or SIENA"
65 # endif
66 #endif /* EFSYS_OPT_DECODE_INTR_FATAL */
67 
68 /* Support diagnostic hardware tests */
69 #if EFSYS_OPT_DIAG
70 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
71 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
72 #  error "DIAG requires FALCON or SIENA or HUNTINGTON or MEDFORD"
73 # endif
74 #endif /* EFSYS_OPT_DIAG */
75 
76 /* Support optimized EVQ data access */
77 #if EFSYS_OPT_EV_PREFETCH
78 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
79 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
80 #  error "EV_PREFETCH requires FALCON or SIENA or HUNTINGTON or MEDFORD"
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 || \
94 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
95 #  error "FILTER requires FALCON or SIENA or HUNTINGTON or MEDFORD"
96 # endif
97 #endif /* EFSYS_OPT_FILTER */
98 
99 #if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
100 # if !EFSYS_OPT_FILTER
101 #  error "HUNTINGTON or MEDFORD requires FILTER"
102 # endif
103 #endif /* EFSYS_OPT_HUNTINGTON */
104 
105 /* Support hardware loopback modes */
106 #if EFSYS_OPT_LOOPBACK
107 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
108 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
109 #  error "LOOPBACK requires FALCON or SIENA or HUNTINGTON or MEDFORD"
110 # endif
111 #endif /* EFSYS_OPT_LOOPBACK */
112 
113 /* Support Falcon GMAC */
114 #if EFSYS_OPT_MAC_FALCON_GMAC
115 # if !EFSYS_OPT_FALCON
116 #  error "MAC_FALCON_GMAC requires FALCON"
117 # endif
118 #endif /* EFSYS_OPT_MAC_FALCON_GMAC */
119 
120 /* Support Falcon XMAC */
121 #if EFSYS_OPT_MAC_FALCON_XMAC
122 # if !EFSYS_OPT_FALCON
123 #  error "MAC_FALCON_XMAC requires FALCON"
124 # endif
125 #endif /* EFSYS_OPT_MAC_FALCON_XMAC */
126 
127 /* Support MAC statistics */
128 #if EFSYS_OPT_MAC_STATS
129 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
130 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
131 #  error "MAC_STATS requires FALCON or SIENA or HUNTINGTON or MEDFORD"
132 # endif
133 #endif /* EFSYS_OPT_MAC_STATS */
134 
135 /* Support management controller messages */
136 #if EFSYS_OPT_MCDI
137 # if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
138 #  error "MCDI requires SIENA or HUNTINGTON or MEDFORD"
139 # endif
140 #endif /* EFSYS_OPT_MCDI */
141 
142 #if (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
143 # if !EFSYS_OPT_MCDI
144 #  error "SIENA or HUNTINGTON or MEDFORD requires MCDI"
145 # endif
146 #endif
147 
148 /* Support MCDI logging */
149 #if EFSYS_OPT_MCDI_LOGGING
150 # if !EFSYS_OPT_MCDI
151 #  error "MCDI_LOGGING requires MCDI"
152 # endif
153 #endif /* EFSYS_OPT_MCDI_LOGGING */
154 
155 /* Support MCDI proxy authorization */
156 #if EFSYS_OPT_MCDI_PROXY_AUTH
157 # if !EFSYS_OPT_MCDI
158 #  error "MCDI_PROXY_AUTH requires MCDI"
159 # endif
160 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH */
161 
162 /* Support LM87 monitor */
163 #if EFSYS_OPT_MON_LM87
164 # if !EFSYS_OPT_FALCON
165 #  error "MON_LM87 requires FALCON"
166 # endif
167 #endif /* EFSYS_OPT_MON_LM87 */
168 
169 /* Support MAX6647 monitor */
170 #if EFSYS_OPT_MON_MAX6647
171 # if !EFSYS_OPT_FALCON
172 #  error "MON_MAX6647 requires FALCON"
173 # endif
174 #endif /* EFSYS_OPT_MON_MAX6647 */
175 
176 /* Support null monitor */
177 #if EFSYS_OPT_MON_NULL
178 # if !EFSYS_OPT_FALCON
179 #  error "MON_NULL requires FALCON"
180 # endif
181 #endif /* EFSYS_OPT_MON_NULL */
182 
183 /* Obsolete option */
184 #ifdef EFSYS_OPT_MON_SIENA
185 #  error "MON_SIENA is obsolete (replaced by MON_MCDI)."
186 #endif /* EFSYS_OPT_MON_SIENA*/
187 
188 /* Obsolete option */
189 #ifdef EFSYS_OPT_MON_HUNTINGTON
190 #  error "MON_HUNTINGTON is obsolete (replaced by MON_MCDI)."
191 #endif /* EFSYS_OPT_MON_HUNTINGTON*/
192 
193 /* Support monitor statistics (voltage/temperature) */
194 #if EFSYS_OPT_MON_STATS
195 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
196 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
197 #  error "MON_STATS requires FALCON or SIENA or HUNTINGTON or MEDFORD"
198 # endif
199 #endif /* EFSYS_OPT_MON_STATS */
200 
201 /* Support Monitor via mcdi */
202 #if EFSYS_OPT_MON_MCDI
203 # if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
204 #  error "MON_MCDI requires SIENA or HUNTINGTON or MEDFORD"
205 # endif
206 #endif /* EFSYS_OPT_MON_MCDI*/
207 
208 /* Support printable names for statistics */
209 #if EFSYS_OPT_NAMES
210 # if !(EFSYS_OPT_LOOPBACK || EFSYS_OPT_MAC_STATS || EFSYS_OPT_MCDI || \
211 	EFSYS_MON_STATS || EFSYS_OPT_PHY_PROPS || EFSYS_OPT_PHY_STATS || \
212 	EFSYS_OPT_QSTATS)
213 #  error "NAMES requires LOOPBACK or xxxSTATS or MCDI or PHY_PROPS"
214 # endif
215 #endif /* EFSYS_OPT_NAMES */
216 
217 /* Support non volatile configuration */
218 #if EFSYS_OPT_NVRAM
219 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
220 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
221 #  error "NVRAM requires FALCON or SIENA or HUNTINGTON or MEDFORD"
222 # endif
223 #endif /* EFSYS_OPT_NVRAM */
224 
225 /* Support Falcon bootrom */
226 #if EFSYS_OPT_NVRAM_FALCON_BOOTROM
227 # if !EFSYS_OPT_NVRAM
228 #  error "NVRAM_FALCON_BOOTROM requires NVRAM"
229 # endif
230 # if !EFSYS_OPT_FALCON
231 #  error "NVRAM_FALCON_BOOTROM requires FALCON"
232 # endif
233 #endif /* EFSYS_OPT_NVRAM_FALCON_BOOTROM */
234 
235 /* Support NVRAM config for SFT9001 */
236 #if EFSYS_OPT_NVRAM_SFT9001
237 # if !EFSYS_OPT_NVRAM
238 #  error "NVRAM_SFT9001 requires NVRAM"
239 # endif
240 # if !EFSYS_OPT_FALCON
241 #  error "NVRAM_SFT9001 requires FALCON"
242 # endif
243 #endif /* EFSYS_OPT_NVRAM_SFT9001 */
244 
245 /* Support NVRAM config for SFX7101 */
246 #if EFSYS_OPT_NVRAM_SFX7101
247 # if !EFSYS_OPT_NVRAM
248 #  error "NVRAM_SFX7101 requires NVRAM"
249 # endif
250 # if !EFSYS_OPT_FALCON
251 #  error "NVRAM_SFX7101 requires FALCON"
252 # endif
253 #endif /* EFSYS_OPT_NVRAM_SFX7101 */
254 
255 /* Support PCIe interface tuning */
256 #if EFSYS_OPT_PCIE_TUNE
257 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
258 #  error "PCIE_TUNE requires FALCON or SIENA"
259 # endif
260 #endif /* EFSYS_OPT_PCIE_TUNE */
261 
262 /* Obsolete option */
263 #if EFSYS_OPT_PHY_BIST
264 #  error "PHY_BIST is obsolete (replaced by BIST)."
265 #endif /* EFSYS_OPT_PHY_BIST */
266 
267 /* Support PHY flags */
268 #if EFSYS_OPT_PHY_FLAGS
269 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
270 #  error "PHY_FLAGS requires FALCON or SIENA"
271 # endif
272 #endif /* EFSYS_OPT_PHY_FLAGS */
273 
274 /* Support for PHY LED control */
275 #if EFSYS_OPT_PHY_LED_CONTROL
276 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
277 #  error "PHY_LED_CONTROL requires FALCON or SIENA"
278 # endif
279 #endif /* EFSYS_OPT_PHY_LED_CONTROL */
280 
281 /* Support NULL PHY */
282 #if EFSYS_OPT_PHY_NULL
283 # if !EFSYS_OPT_FALCON
284 #  error "PHY_NULL requires FALCON"
285 # endif
286 #endif /* EFSYS_OPT_PHY_NULL */
287 
288 /* Obsolete option */
289 #ifdef EFSYS_OPT_PHY_PM8358
290 # error "EFSYS_OPT_PHY_PM8358 is obsolete and is not supported."
291 #endif
292 
293 /* Support PHY properties */
294 #if EFSYS_OPT_PHY_PROPS
295 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
296 #  error "PHY_PROPS requires FALCON or SIENA"
297 # endif
298 #endif /* EFSYS_OPT_PHY_PROPS */
299 
300 /* Support QT2022C2 PHY */
301 #if EFSYS_OPT_PHY_QT2022C2
302 # if !EFSYS_OPT_FALCON
303 #  error "PHY_QT2022C2 requires FALCON"
304 # endif
305 #endif /* EFSYS_OPT_PHY_QT2022C2 */
306 
307 /* Support QT2025C PHY (Wakefield NIC) */
308 #if EFSYS_OPT_PHY_QT2025C
309 # if !EFSYS_OPT_FALCON
310 #  error "PHY_QT2025C requires FALCON"
311 # endif
312 #endif /* EFSYS_OPT_PHY_QT2025C */
313 
314 /* Support SFT9001 PHY (Starbolt NIC) */
315 #if EFSYS_OPT_PHY_SFT9001
316 # if !EFSYS_OPT_FALCON
317 #  error "PHY_SFT9001 requires FALCON"
318 # endif
319 #endif /* EFSYS_OPT_PHY_SFT9001 */
320 
321 /* Support SFX7101 PHY (SFE4001 NIC) */
322 #if EFSYS_OPT_PHY_SFX7101
323 # if !EFSYS_OPT_FALCON
324 #  error "PHY_SFX7101 requires FALCON"
325 # endif
326 #endif /* EFSYS_OPT_PHY_SFX7101 */
327 
328 /* Support PHY statistics */
329 #if EFSYS_OPT_PHY_STATS
330 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
331 #  error "PHY_STATS requires FALCON or SIENA"
332 # endif
333 #endif /* EFSYS_OPT_PHY_STATS */
334 
335 /* Support TXC43128 PHY (SFE4003 NIC) */
336 #if EFSYS_OPT_PHY_TXC43128
337 # if !EFSYS_OPT_FALCON
338 #  error "PHY_TXC43128 requires FALCON"
339 # endif
340 #endif /* EFSYS_OPT_PHY_TXC43128 */
341 
342 /* Support EVQ/RXQ/TXQ statistics */
343 #if EFSYS_OPT_QSTATS
344 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
345 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
346 #  error "QSTATS requires FALCON or SIENA or HUNTINGTON or MEDFORD"
347 # endif
348 #endif /* EFSYS_OPT_QSTATS */
349 
350 /* Obsolete option */
351 #ifdef EFSYS_OPT_RX_HDR_SPLIT
352 # error "RX_HDR_SPLIT is obsolete and is not supported"
353 #endif /* EFSYS_OPT_RX_HDR_SPLIT */
354 
355 /* Support receive scaling (RSS) */
356 #if EFSYS_OPT_RX_SCALE
357 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
358 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
359 #  error "RX_SCALE requires FALCON or SIENA or HUNTINGTON or MEDFORD"
360 # endif
361 #endif /* EFSYS_OPT_RX_SCALE */
362 
363 /* Support receive scatter DMA */
364 #if EFSYS_OPT_RX_SCATTER
365 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
366 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
367 #  error "RX_SCATTER requires FALCON or SIENA or HUNTINGTON or MEDFORD"
368 # endif
369 #endif /* EFSYS_OPT_RX_SCATTER */
370 
371 /* Obsolete option */
372 #ifdef EFSYS_OPT_STAT_NAME
373 # error "STAT_NAME is obsolete (replaced by NAMES)."
374 #endif
375 
376 /* Support PCI Vital Product Data (VPD) */
377 #if EFSYS_OPT_VPD
378 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
379 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
380 #  error "VPD requires FALCON or SIENA or HUNTINGTON or MEDFORD"
381 # endif
382 #endif /* EFSYS_OPT_VPD */
383 
384 /* Support Wake on LAN */
385 #if EFSYS_OPT_WOL
386 # if !EFSYS_OPT_SIENA
387 #  error "WOL requires SIENA"
388 # endif
389 #endif /* EFSYS_OPT_WOL */
390 
391 /* Obsolete option */
392 #ifdef EFSYS_OPT_MCAST_FILTER_LIST
393 #  error "MCAST_FILTER_LIST is obsolete and is not supported"
394 #endif /* EFSYS_OPT_MCAST_FILTER_LIST */
395 
396 /* Support BIST */
397 #if EFSYS_OPT_BIST
398 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
399 	EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
400 #  error "BIST requires FALCON or SIENA or HUNTINGTON or MEDFORD"
401 # endif
402 #endif /* EFSYS_OPT_BIST */
403 
404 /* Support MCDI licensing API */
405 #if EFSYS_OPT_LICENSING
406 # if !EFSYS_OPT_MCDI
407 #  error "LICENSING requires MCDI"
408 # endif
409 # if !EFSYS_HAS_UINT64
410 #  error "LICENSING requires UINT64"
411 # endif
412 #endif /* EFSYS_OPT_LICENSING */
413 
414 
415 #endif /* _SYS_EFX_CHECK_H */
416