xref: /NextBSD/sys/dev/sfxge/common/efx_check.h (revision 4557fabb34e865d7f40be64b39c9e34fa41dbb60)
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 MCDI logging */
150 #if EFSYS_OPT_MCDI_LOGGING
151 # if !EFSYS_OPT_MCDI
152 #  error "MCDI_LOGGING requires MCDI"
153 # endif
154 #endif /* EFSYS_OPT_MCDI_LOGGING */
155 
156 /* Support MCDI proxy authorization */
157 #if EFSYS_OPT_MCDI_PROXY_AUTH
158 # if !EFSYS_OPT_MCDI
159 #  error "MCDI_PROXY_AUTH requires MCDI"
160 # endif
161 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH */
162 
163 /* Support LM87 monitor */
164 #if EFSYS_OPT_MON_LM87
165 # if !EFSYS_OPT_FALCON
166 #  error "MON_LM87 requires FALCON"
167 # endif
168 #endif /* EFSYS_OPT_MON_LM87 */
169 
170 /* Support MAX6647 monitor */
171 #if EFSYS_OPT_MON_MAX6647
172 # if !EFSYS_OPT_FALCON
173 #  error "MON_MAX6647 requires FALCON"
174 # endif
175 #endif /* EFSYS_OPT_MON_MAX6647 */
176 
177 /* Support null monitor */
178 #if EFSYS_OPT_MON_NULL
179 # if !EFSYS_OPT_FALCON
180 #  error "MON_NULL requires FALCON"
181 # endif
182 #endif /* EFSYS_OPT_MON_NULL */
183 
184 /* Support Siena monitor */
185 #ifdef EFSYS_OPT_MON_SIENA
186 #  error "MON_SIENA is obsolete use MON_MCDI"
187 #endif /* EFSYS_OPT_MON_SIENA*/
188 
189 /* Support Huntington monitor */
190 #ifdef EFSYS_OPT_MON_HUNTINGTON
191 #  error "MON_HUNTINGTON is obsolete use MON_MCDI"
192 #endif /* EFSYS_OPT_MON_HUNTINGTON*/
193 
194 /* Support monitor statistics (voltage/temperature) */
195 #if EFSYS_OPT_MON_STATS
196 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
197 #  error "MON_STATS requires FALCON or SIENA or HUNTINGTON"
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)
204 #  error "MON_MCDI requires SIENA or HUNTINGTON"
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 || EFSYS_OPT_HUNTINGTON)
220 #  error "NVRAM requires FALCON or SIENA or HUNTINGTON"
221 # endif
222 #endif /* EFSYS_OPT_NVRAM */
223 
224 /* Support Falcon bootrom */
225 #if EFSYS_OPT_NVRAM_FALCON_BOOTROM
226 # if !EFSYS_OPT_NVRAM
227 #  error "NVRAM_FALCON_BOOTROM requires NVRAM"
228 # endif
229 # if !EFSYS_OPT_FALCON
230 #  error "NVRAM_FALCON_BOOTROM requires FALCON"
231 # endif
232 #endif /* EFSYS_OPT_NVRAM_FALCON_BOOTROM */
233 
234 /* Support NVRAM config for SFT9001 */
235 #if EFSYS_OPT_NVRAM_SFT9001
236 # if !EFSYS_OPT_NVRAM
237 #  error "NVRAM_SFT9001 requires NVRAM"
238 # endif
239 # if !EFSYS_OPT_FALCON
240 #  error "NVRAM_SFT9001 requires FALCON"
241 # endif
242 #endif /* EFSYS_OPT_NVRAM_SFT9001 */
243 
244 /* Support NVRAM config for SFX7101 */
245 #if EFSYS_OPT_NVRAM_SFX7101
246 # if !EFSYS_OPT_NVRAM
247 #  error "NVRAM_SFX7101 requires NVRAM"
248 # endif
249 # if !EFSYS_OPT_FALCON
250 #  error "NVRAM_SFX7101 requires FALCON"
251 # endif
252 #endif /* EFSYS_OPT_NVRAM_SFX7101 */
253 
254 /* Support PCIe interface tuning */
255 #if EFSYS_OPT_PCIE_TUNE
256 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
257 #  error "PCIE_TUNE requires FALCON or SIENA"
258 # endif
259 #endif /* EFSYS_OPT_PCIE_TUNE */
260 
261 /* Support PHY BIST diagnostics */
262 #if EFSYS_OPT_PHY_BIST
263 #  error "PHY_BIST is obsolete. It has been replaced by the BIST option."
264 #endif /* EFSYS_OPT_PHY_BIST */
265 
266 /* Support PHY flags */
267 #if EFSYS_OPT_PHY_FLAGS
268 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
269 #  error "PHY_FLAGS requires FALCON or SIENA"
270 # endif
271 #endif /* EFSYS_OPT_PHY_FLAGS */
272 
273 /* Support for PHY LED control */
274 #if EFSYS_OPT_PHY_LED_CONTROL
275 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
276 #  error "PHY_LED_CONTROL requires FALCON or SIENA"
277 # endif
278 #endif /* EFSYS_OPT_PHY_LED_CONTROL */
279 
280 /* Support NULL PHY */
281 #if EFSYS_OPT_PHY_NULL
282 # if !EFSYS_OPT_FALCON
283 #  error "PHY_NULL requires FALCON"
284 # endif
285 #endif /* EFSYS_OPT_PHY_NULL */
286 
287 /* Obsolete option */
288 #ifdef EFSYS_OPT_PHY_PM8358
289 # error "EFSYS_OPT_PHY_PM8358 is obsolete and is not supported."
290 #endif
291 
292 /* Support PHY properties */
293 #if EFSYS_OPT_PHY_PROPS
294 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
295 #  error "PHY_PROPS requires FALCON or SIENA"
296 # endif
297 #endif /* EFSYS_OPT_PHY_PROPS */
298 
299 /* Support QT2022C2 PHY */
300 #if EFSYS_OPT_PHY_QT2022C2
301 # if !EFSYS_OPT_FALCON
302 #  error "PHY_QT2022C2 requires FALCON"
303 # endif
304 #endif /* EFSYS_OPT_PHY_QT2022C2 */
305 
306 /* Support QT2025C PHY (Wakefield NIC) */
307 #if EFSYS_OPT_PHY_QT2025C
308 # if !EFSYS_OPT_FALCON
309 #  error "PHY_QT2025C requires FALCON"
310 # endif
311 #endif /* EFSYS_OPT_PHY_QT2025C */
312 
313 /* Support SFT9001 PHY (Starbolt NIC) */
314 #if EFSYS_OPT_PHY_SFT9001
315 # if !EFSYS_OPT_FALCON
316 #  error "PHY_SFT9001 requires FALCON"
317 # endif
318 #endif /* EFSYS_OPT_PHY_SFT9001 */
319 
320 /* Support SFX7101 PHY (SFE4001 NIC) */
321 #if EFSYS_OPT_PHY_SFX7101
322 # if !EFSYS_OPT_FALCON
323 #  error "PHY_SFX7101 requires FALCON"
324 # endif
325 #endif /* EFSYS_OPT_PHY_SFX7101 */
326 
327 /* Support PHY statistics */
328 #if EFSYS_OPT_PHY_STATS
329 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
330 #  error "PHY_STATS requires FALCON or SIENA"
331 # endif
332 #endif /* EFSYS_OPT_PHY_STATS */
333 
334 /* Support TXC43128 PHY (SFE4003 NIC) */
335 #if EFSYS_OPT_PHY_TXC43128
336 # if !EFSYS_OPT_FALCON
337 #  error "PHY_TXC43128 requires FALCON"
338 # endif
339 #endif /* EFSYS_OPT_PHY_TXC43128 */
340 
341 /* Support EVQ/RXQ/TXQ statistics */
342 #if EFSYS_OPT_QSTATS
343 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
344 #  error "QSTATS requires FALCON or SIENA or HUNTINGTON"
345 # endif
346 #endif /* EFSYS_OPT_QSTATS */
347 
348 /* Support receive header split */
349 #if EFSYS_OPT_RX_HDR_SPLIT
350 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
351 #  error "RX_HDR_SPLIT requires FALCON or SIENA or HUNTINGTON"
352 # endif
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 || EFSYS_OPT_HUNTINGTON)
358 #  error "RX_SCALE requires FALCON or SIENA or HUNTINGTON"
359 # endif
360 #endif /* EFSYS_OPT_RX_SCALE */
361 
362 /* Support receive scatter DMA */
363 #if EFSYS_OPT_RX_SCATTER
364 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
365 #  error "RX_SCATTER requires FALCON or SIENA or HUNTINGTON"
366 # endif
367 #endif /* EFSYS_OPT_RX_SCATTER */
368 
369 /* Obsolete option */
370 #ifdef EFSYS_OPT_STAT_NAME
371 # error "EFSYS_OPT_STAT_NAME is obsolete (replaced by EFSYS_OPT_NAMES)."
372 #endif
373 
374 /* Support PCI Vital Product Data (VPD) */
375 #if EFSYS_OPT_VPD
376 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
377 #  error "VPD requires FALCON or SIENA or HUNTINGTON"
378 # endif
379 #endif /* EFSYS_OPT_VPD */
380 
381 /* Support Wake on LAN */
382 #if EFSYS_OPT_WOL
383 # if !EFSYS_OPT_SIENA
384 #  error "WOL requires SIENA"
385 # endif
386 #endif /* EFSYS_OPT_WOL */
387 
388 /* Support calculating multicast pktfilter in common code */
389 #if EFSYS_OPT_MCAST_FILTER_LIST
390 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
391 #  error "MCAST_FILTER_LIST requires FALCON or SIENA or HUNTINGTON"
392 # endif
393 #endif /* EFSYS_OPT_MCAST_FILTER_LIST */
394 
395 /* Support BIST */
396 #if EFSYS_OPT_BIST
397 # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
398 #  error "BIST requires FALCON or SIENA or HUNTINGTON"
399 # endif
400 #endif /* EFSYS_OPT_BIST */
401 
402 #endif /* _SYS_EFX_CHECK_H */
403