xref: /freebsd/sys/dev/rge/if_rge_debug.h (revision 4bf8ce037dc8fa699be87350bb6467f1b74cb96d)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2025 Adrian Chadd <adrian@FreeBSD.org>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 #ifndef	__IF_RGE_DEBUG_H__
19 #define	__IF_RGE_DEBUG_H__
20 
21 #define	RGE_DEBUG_XMIT		0x00000001
22 #define	RGE_DEBUG_RECV		0x00000002
23 #define	RGE_DEBUG_INTR		0x00000004
24 #define	RGE_DEBUG_SETUP		0x00000008
25 #define	RGE_DEBUG_INIT		0x00000010
26 #define	RGE_DEBUG_XMIT_DESC	0x00000020
27 #define	RGE_DEBUG_RECV_DESC	0x00000040
28 
29 #define	RGE_DPRINTF(sc, dbg, ...)					\
30 	do {								\
31 		if (((sc)->sc_debug & (dbg)) != 0)			\
32 			device_printf((sc)->sc_dev, __VA_ARGS__);	\
33 	} while (0)
34 
35 #define	RGE_DLOG(sc, dbg, ...)						\
36 	do {								\
37 		if (((sc)->sc_debug & (dbg)) != 0)			\
38 			device_log((sc)->sc_dev, LOG_DEBUG,		\
39 			    __VA_ARGS__);				\
40 	} while (0)
41 
42 #define	RGE_PRINT_ERROR(sc, ...)					\
43 	do {								\
44 		device_printf((sc)->sc_dev, "[ERR] " __VA_ARGS__);	\
45 	} while (0)
46 
47 #define	RGE_PRINT_INFO(sc, ...)						\
48 	do {								\
49 		device_printf((sc)->sc_dev, "[INFO] " __VA_ARGS__);	\
50 	} while (0)
51 
52 #define	RGE_PRINT_TODO(sc, ...)						\
53 	do {								\
54 		device_printf((sc)->sc_dev, "[TODO] " __VA_ARGS__);	\
55 	} while (0)
56 
57 
58 #define	RGE_PRINT_WARN(sc, ...)						\
59 	do {								\
60 		device_printf((sc)->sc_dev, "[WARN] " __VA_ARGS__);	\
61 	} while (0)
62 
63 #endif	/* __IF_RGE_DEBUG_H__ */
64