net/sfc: introduce common driver library
[dpdk.git] / drivers / common / sfc_efx / base / efx_check.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2019-2020 Xilinx, Inc.
4  * Copyright(c) 2012-2019 Solarflare Communications Inc.
5  */
6
7 #ifndef _SYS_EFX_CHECK_H
8 #define _SYS_EFX_CHECK_H
9
10 #include "efsys.h"
11
12 /*
13  * LIBEFX_* defines may be used to put API functions into dedicated code
14  * section if required by driver development framework and conventions.
15  */
16
17 #ifndef LIBEFX_API
18 # error "LIBEFX_API must be defined"
19 #endif
20
21 #ifndef LIBEFX_INTERNAL
22 # error "LIBEFX_INTERNAL must be defined"
23 #endif
24
25 /*
26  * Check that the efsys.h header in client code has a valid combination of
27  * EFSYS_OPT_xxx options.
28  *
29  * NOTE: Keep checks for obsolete options here to ensure that they are removed
30  * from client code (and do not reappear in merges from other branches).
31  */
32
33 /* Check family options for EF10 architecture controllers. */
34 #define EFX_OPTS_EF10() \
35         (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2)
36
37 #ifdef EFSYS_OPT_FALCON
38 # error "FALCON is obsolete and is not supported."
39 #endif
40
41 #if EFSYS_OPT_BOOTCFG
42 /* Support NVRAM based boot config */
43 # if !EFSYS_OPT_NVRAM
44 #  error "BOOTCFG requires NVRAM"
45 # endif
46 #endif /* EFSYS_OPT_BOOTCFG */
47
48 #if EFSYS_OPT_CHECK_REG
49 /* Verify chip implements accessed registers */
50 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
51 #  error "CHECK_REG requires EF10 arch or SIENA"
52 # endif
53 #endif /* EFSYS_OPT_CHECK_REG */
54
55 #if EFSYS_OPT_DECODE_INTR_FATAL
56 /* Decode fatal errors */
57 # if !EFSYS_OPT_SIENA
58 #  error "INTR_FATAL requires SIENA"
59 # endif
60 #endif /* EFSYS_OPT_DECODE_INTR_FATAL */
61
62 #if EFSYS_OPT_DIAG
63 /* Support diagnostic hardware tests */
64 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
65 #  error "DIAG requires EF10 arch or SIENA"
66 # endif
67 #endif /* EFSYS_OPT_DIAG */
68
69 #if EFSYS_OPT_EV_PREFETCH
70 /* Support optimized EVQ data access */
71 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
72 #  error "EV_PREFETCH requires EF10 arch or SIENA"
73 # endif
74 #endif /* EFSYS_OPT_EV_PREFETCH */
75
76 #ifdef EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE
77 # error "FALCON_NIC_CFG_OVERRIDE is obsolete and is not supported."
78 #endif
79
80 #if EFSYS_OPT_FILTER
81 /* Support hardware packet filters */
82 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
83 #  error "FILTER requires EF10 arch or SIENA"
84 # endif
85 #endif /* EFSYS_OPT_FILTER */
86
87 #if EFX_OPTS_EF10()
88 # if !EFSYS_OPT_FILTER
89 #  error "EF10 arch requires FILTER"
90 # endif
91 #endif /* EFX_OPTS_EF10() */
92
93 #if EFSYS_OPT_LOOPBACK
94 /* Support hardware loopback modes */
95 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
96 #  error "LOOPBACK requires EF10 arch or SIENA"
97 # endif
98 #endif /* EFSYS_OPT_LOOPBACK */
99
100 #ifdef EFSYS_OPT_MAC_FALCON_GMAC
101 # error "MAC_FALCON_GMAC is obsolete and is not supported."
102 #endif
103
104 #ifdef EFSYS_OPT_MAC_FALCON_XMAC
105 # error "MAC_FALCON_XMAC is obsolete and is not supported."
106 #endif
107
108 #if EFSYS_OPT_MAC_STATS
109 /* Support MAC statistics */
110 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
111 #  error "MAC_STATS requires EF10 arch or SIENA"
112 # endif
113 #endif /* EFSYS_OPT_MAC_STATS */
114
115 #if EFSYS_OPT_MCDI
116 /* Support management controller messages */
117 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
118 #  error "MCDI requires EF10 arch or SIENA"
119 # endif
120 #endif /* EFSYS_OPT_MCDI */
121
122 #if (EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
123 # if !EFSYS_OPT_MCDI
124 #  error "EF10 arch or SIENA requires MCDI"
125 # endif
126 #endif
127
128 #if EFSYS_OPT_MCDI_LOGGING
129 /* Support MCDI logging */
130 # if !EFSYS_OPT_MCDI
131 #  error "MCDI_LOGGING requires MCDI"
132 # endif
133 #endif /* EFSYS_OPT_MCDI_LOGGING */
134
135 #if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER
136 /* Support MCDI proxy authorization (server) */
137 # if !EFSYS_OPT_MCDI_PROXY_AUTH
138 #  error "MCDI_PROXY_AUTH_SERVER requires MCDI_PROXY_AUTH"
139 # endif
140 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */
141
142 #if EFSYS_OPT_MCDI_PROXY_AUTH
143 /* Support MCDI proxy authorization (client) */
144 # if !EFSYS_OPT_MCDI
145 #  error "MCDI_PROXY_AUTH requires MCDI"
146 # endif
147 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH */
148
149 #ifdef EFSYS_OPT_MON_LM87
150 # error "MON_LM87 is obsolete and is not supported."
151 #endif
152
153 #ifdef EFSYS_OPT_MON_MAX6647
154 # error "MON_MAX6647 is obsolete and is not supported."
155 #endif
156
157 #ifdef EFSYS_OPT_MON_NULL
158 # error "MON_NULL is obsolete and is not supported."
159 #endif
160
161 #ifdef EFSYS_OPT_MON_SIENA
162 #  error "MON_SIENA is obsolete (replaced by MON_MCDI)."
163 #endif
164
165 #ifdef EFSYS_OPT_MON_HUNTINGTON
166 #  error "MON_HUNTINGTON is obsolete (replaced by MON_MCDI)."
167 #endif
168
169 #if EFSYS_OPT_MON_STATS
170 /* Support monitor statistics (voltage/temperature) */
171 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
172 #  error "MON_STATS requires EF10 arch or SIENA"
173 # endif
174 #endif /* EFSYS_OPT_MON_STATS */
175
176 #if EFSYS_OPT_MON_MCDI
177 /* Support Monitor via mcdi */
178 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
179 #  error "MON_MCDI requires EF10 arch or SIENA"
180 # endif
181 #endif /* EFSYS_OPT_MON_MCDI*/
182
183 #if EFSYS_OPT_NAMES
184 /* Support printable names for statistics */
185 # if !(EFSYS_OPT_LOOPBACK || EFSYS_OPT_MAC_STATS || EFSYS_OPT_MCDI || \
186         EFSYS_MON_STATS || EFSYS_OPT_PHY_STATS || EFSYS_OPT_QSTATS)
187 #  error "NAMES requires LOOPBACK or xxxSTATS or MCDI"
188 # endif
189 #endif /* EFSYS_OPT_NAMES */
190
191 #if EFSYS_OPT_NVRAM
192 /* Support non volatile configuration */
193 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
194 #  error "NVRAM requires EF10 arch or SIENA"
195 # endif
196 #endif /* EFSYS_OPT_NVRAM */
197
198 #if EFSYS_OPT_IMAGE_LAYOUT
199 /* Support signed image layout handling */
200 # if !(EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2)
201 #  error "IMAGE_LAYOUT requires MEDFORD or MEDFORD2"
202 # endif
203 #endif /* EFSYS_OPT_IMAGE_LAYOUT */
204
205 #ifdef EFSYS_OPT_NVRAM_FALCON_BOOTROM
206 # error "NVRAM_FALCON_BOOTROM is obsolete and is not supported."
207 #endif
208
209 #ifdef EFSYS_OPT_NVRAM_SFT9001
210 # error "NVRAM_SFT9001 is obsolete and is not supported."
211 #endif
212
213 #ifdef EFSYS_OPT_NVRAM_SFX7101
214 # error "NVRAM_SFX7101 is obsolete and is not supported."
215 #endif
216
217 #ifdef EFSYS_OPT_PCIE_TUNE
218 # error "PCIE_TUNE is obsolete and is not supported."
219 #endif
220
221 #ifdef EFSYS_OPT_PHY_BIST
222 # error "PHY_BIST is obsolete (replaced by BIST)."
223 #endif
224
225 #if EFSYS_OPT_PHY_FLAGS
226 /* Support PHY flags */
227 # if !EFSYS_OPT_SIENA
228 #  error "PHY_FLAGS requires SIENA"
229 # endif
230 #endif /* EFSYS_OPT_PHY_FLAGS */
231
232 #if EFSYS_OPT_PHY_LED_CONTROL
233 /* Support for PHY LED control */
234 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
235 #  error "PHY_LED_CONTROL requires EF10 arch or SIENA"
236 # endif
237 #endif /* EFSYS_OPT_PHY_LED_CONTROL */
238
239 #ifdef EFSYS_OPT_PHY_NULL
240 # error "PHY_NULL is obsolete and is not supported."
241 #endif
242
243 #ifdef EFSYS_OPT_PHY_PM8358
244 # error "PHY_PM8358 is obsolete and is not supported."
245 #endif
246
247 #ifdef EFSYS_OPT_PHY_PROPS
248 # error "PHY_PROPS is obsolete and is not supported."
249 #endif
250
251 #ifdef EFSYS_OPT_PHY_QT2022C2
252 # error "PHY_QT2022C2 is obsolete and is not supported."
253 #endif
254
255 #ifdef EFSYS_OPT_PHY_QT2025C
256 # error "PHY_QT2025C is obsolete and is not supported."
257 #endif
258
259 #ifdef EFSYS_OPT_PHY_SFT9001
260 # error "PHY_SFT9001 is obsolete and is not supported."
261 #endif
262
263 #ifdef EFSYS_OPT_PHY_SFX7101
264 # error "PHY_SFX7101 is obsolete and is not supported."
265 #endif
266
267 #if EFSYS_OPT_PHY_STATS
268 /* Support PHY statistics */
269 # if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
270 #  error "PHY_STATS requires SIENA or HUNTINGTON or MEDFORD"
271 # endif
272 #endif /* EFSYS_OPT_PHY_STATS */
273
274 #ifdef EFSYS_OPT_PHY_TXC43128
275 # error "PHY_TXC43128 is obsolete and is not supported."
276 #endif
277
278 #if EFSYS_OPT_QSTATS
279 /* Support EVQ/RXQ/TXQ statistics */
280 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
281 #  error "QSTATS requires EF10 arch or SIENA"
282 # endif
283 #endif /* EFSYS_OPT_QSTATS */
284
285 #ifdef EFSYS_OPT_RX_HDR_SPLIT
286 # error "RX_HDR_SPLIT is obsolete and is not supported"
287 #endif
288
289 #if EFSYS_OPT_RX_SCALE
290 /* Support receive scaling (RSS) */
291 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
292 #  error "RX_SCALE requires EF10 arch or SIENA"
293 # endif
294 #endif /* EFSYS_OPT_RX_SCALE */
295
296 #if EFSYS_OPT_RX_SCATTER
297 /* Support receive scatter DMA */
298 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
299 #  error "RX_SCATTER requires EF10 arch or SIENA"
300 # endif
301 #endif /* EFSYS_OPT_RX_SCATTER */
302
303 #ifdef EFSYS_OPT_STAT_NAME
304 # error "STAT_NAME is obsolete (replaced by NAMES)."
305 #endif
306
307 #if EFSYS_OPT_VPD
308 /* Support PCI Vital Product Data (VPD) */
309 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
310 #  error "VPD requires EF10 arch or SIENA"
311 # endif
312 #endif /* EFSYS_OPT_VPD */
313
314 #ifdef EFSYS_OPT_WOL
315 # error "WOL is obsolete and is not supported"
316 #endif /* EFSYS_OPT_WOL */
317
318 #ifdef EFSYS_OPT_MCAST_FILTER_LIST
319 #  error "MCAST_FILTER_LIST is obsolete and is not supported"
320 #endif
321
322 #if EFSYS_OPT_BIST
323 /* Support BIST */
324 # if !(EFX_OPTS_EF10() || EFSYS_OPT_SIENA)
325 #  error "BIST requires EF10 arch or SIENA"
326 # endif
327 #endif /* EFSYS_OPT_BIST */
328
329 #if EFSYS_OPT_LICENSING
330 /* Support MCDI licensing API */
331 # if !EFSYS_OPT_MCDI
332 #  error "LICENSING requires MCDI"
333 # endif
334 # if !EFSYS_HAS_UINT64
335 #  error "LICENSING requires UINT64"
336 # endif
337 #endif /* EFSYS_OPT_LICENSING */
338
339 #if EFSYS_OPT_ALLOW_UNCONFIGURED_NIC
340 /* Support adapters with missing static config (for factory use only) */
341 # if !(EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2)
342 #  error "ALLOW_UNCONFIGURED_NIC requires MEDFORD or MEDFORD2"
343 # endif
344 #endif /* EFSYS_OPT_ALLOW_UNCONFIGURED_NIC */
345
346 #if EFSYS_OPT_RX_PACKED_STREAM
347 /* Support packed stream mode */
348 # if !EFX_OPTS_EF10()
349 #  error "PACKED_STREAM requires EF10 arch"
350 # endif
351 #endif
352
353 #if EFSYS_OPT_RX_ES_SUPER_BUFFER
354 /* Support equal stride super-buffer mode */
355 # if !(EFSYS_OPT_MEDFORD2)
356 #  error "ES_SUPER_BUFFER requires MEDFORD2"
357 # endif
358 #endif
359
360 /* Support hardware assistance for tunnels */
361 #if EFSYS_OPT_TUNNEL
362 # if !(EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2)
363 #  error "TUNNEL requires MEDFORD or MEDFORD2"
364 # endif
365 #endif /* EFSYS_OPT_TUNNEL */
366
367 #if EFSYS_OPT_FW_SUBVARIANT_AWARE
368 /* Advertise that the driver is firmware subvariant aware */
369 # if !(EFSYS_OPT_MEDFORD2)
370 #  error "FW_SUBVARIANT_AWARE requires MEDFORD2"
371 # endif
372 #endif
373
374 #if EFSYS_OPT_EVB
375 /* Support enterprise virtual bridging */
376 # if !(EFX_OPTS_EF10())
377 #  error "EVB requires EF10 arch"
378 # endif
379 #endif /* EFSYS_OPT_EVB */
380
381 #endif /* _SYS_EFX_CHECK_H */