xref: /freebsd/sys/dev/ice/ice_fault.h (revision b9cee186b83ecb531a6d4b4421230acfd5314c16)
1*b9cee186SKevin Bowling /*
2*b9cee186SKevin Bowling  * Copyright (c) 2026 BBOX.io
3*b9cee186SKevin Bowling  *
4*b9cee186SKevin Bowling  * SPDX-License-Identifier: BSD-2-Clause
5*b9cee186SKevin Bowling  */
6*b9cee186SKevin Bowling 
7*b9cee186SKevin Bowling #ifndef _ICE_FAULT_H_
8*b9cee186SKevin Bowling #define _ICE_FAULT_H_
9*b9cee186SKevin Bowling 
10*b9cee186SKevin Bowling #include "ice_opts.h"
11*b9cee186SKevin Bowling 
12*b9cee186SKevin Bowling #ifdef DRIVER_FAILPOINTS
13*b9cee186SKevin Bowling 
14*b9cee186SKevin Bowling #include <sys/fail.h>
15*b9cee186SKevin Bowling 
16*b9cee186SKevin Bowling struct ice_softc;
17*b9cee186SKevin Bowling 
18*b9cee186SKevin Bowling SYSCTL_DECL(_debug_fail_point_ice);
19*b9cee186SKevin Bowling 
20*b9cee186SKevin Bowling bool ice_fail_point_device_matches(struct ice_softc *sc);
21*b9cee186SKevin Bowling 
22*b9cee186SKevin Bowling #define ICE_FAIL_POINT_CODE_COND(_sc, _parent, _name, _cond, _flags, _code...) \
23*b9cee186SKevin Bowling 	KFAIL_POINT_CODE_COND(_parent, _name, \
24*b9cee186SKevin Bowling 	    ice_fail_point_device_matches((_sc)) && (_cond), _flags, _code)
25*b9cee186SKevin Bowling #define ICE_FAIL_POINT_CODE(_sc, _parent, _name, _flags, _code...) \
26*b9cee186SKevin Bowling 	ICE_FAIL_POINT_CODE_COND(_sc, _parent, _name, true, _flags, _code)
27*b9cee186SKevin Bowling 
28*b9cee186SKevin Bowling #else /* !DRIVER_FAILPOINTS */
29*b9cee186SKevin Bowling 
30*b9cee186SKevin Bowling #define ICE_FAIL_POINT_CODE_COND(_sc, _parent, _name, _cond, _flags, _code...) \
31*b9cee186SKevin Bowling 	do { } while (0)
32*b9cee186SKevin Bowling #define ICE_FAIL_POINT_CODE(_sc, _parent, _name, _flags, _code...) \
33*b9cee186SKevin Bowling 	do { } while (0)
34*b9cee186SKevin Bowling 
35*b9cee186SKevin Bowling #endif /* DRIVER_FAILPOINTS */
36*b9cee186SKevin Bowling 
37*b9cee186SKevin Bowling #endif /* _ICE_FAULT_H_ */
38