xref: /freebsd/sys/dev/iwx/if_iwx_debug.h (revision b670c9bafc0e31c7609969bf374b2e80bdc00211)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2015 Adrian Chadd <adrian@FreeBSD.org>
5  * Copyright (c) 2025 The FreeBSD Foundation
6  *
7  * Portions of this software were developed by Tom Jones <thj@FreeBSD.org>
8  * under sponsorship from the FreeBSD Foundation.
9  */
10 
11 #ifndef	__IF_IWX_DEBUG_H__
12 #define	__IF_IWX_DEBUG_H__
13 
14 #ifdef	IWX_DEBUG
15 enum {
16 	IWX_DEBUG_XMIT		= 0x00000001,	/* basic xmit operation */
17 	IWX_DEBUG_RECV		= 0x00000002,	/* basic recv operation */
18 	IWX_DEBUG_STATE		= 0x00000004,	/* 802.11 state transitions */
19 	IWX_DEBUG_TXPOW		= 0x00000008,	/* tx power processing */
20 	IWX_DEBUG_RESET		= 0x00000010,	/* reset processing */
21 	IWX_DEBUG_OPS		= 0x00000020,	/* iwx_ops processing */
22 	IWX_DEBUG_BEACON 	= 0x00000040,	/* beacon handling */
23 	IWX_DEBUG_WATCHDOG 	= 0x00000080,	/* watchdog timeout */
24 	IWX_DEBUG_INTR		= 0x00000100,	/* ISR */
25 	IWX_DEBUG_CALIBRATE	= 0x00000200,	/* periodic calibration */
26 	IWX_DEBUG_NODE		= 0x00000400,	/* node management */
27 	IWX_DEBUG_LED		= 0x00000800,	/* led management */
28 	IWX_DEBUG_CMD		= 0x00001000,	/* cmd submission */
29 	IWX_DEBUG_TXRATE	= 0x00002000,	/* TX rate debugging */
30 	IWX_DEBUG_PWRSAVE	= 0x00004000,	/* Power save operations */
31 	IWX_DEBUG_SCAN		= 0x00008000,	/* Scan related operations */
32 	IWX_DEBUG_STATS		= 0x00010000,	/* Statistics updates */
33 	IWX_DEBUG_FIRMWARE_TLV	= 0x00020000,	/* Firmware TLV parsing */
34 	IWX_DEBUG_TRANS		= 0x00040000,	/* Transport layer (eg PCIe) */
35 	IWX_DEBUG_EEPROM	= 0x00080000,	/* EEPROM/channel information */
36 	IWX_DEBUG_TEMP		= 0x00100000,	/* Thermal Sensor handling */
37 	IWX_DEBUG_FW		= 0x00200000,	/* Firmware management */
38 	IWX_DEBUG_LAR		= 0x00400000,	/* Location Aware Regulatory */
39 	IWX_DEBUG_TE		= 0x00800000,	/* Time Event handling */
40 						/* 0x0n000000 are available */
41 	IWX_DEBUG_NI		= 0x10000000,	/* Not Implemented  */
42 	IWX_DEBUG_REGISTER	= 0x20000000,	/* print chipset register */
43 	IWX_DEBUG_TRACE		= 0x40000000,	/* Print begin and start driver function */
44 	IWX_DEBUG_FATAL		= 0x80000000,	/* fatal errors */
45 	IWX_DEBUG_ANY		= 0xffffffff
46 };
47 
48 #define IWX_DPRINTF(sc, m, fmt, ...) do {			\
49 	if (sc->sc_debug & (m))				\
50 		device_printf(sc->sc_dev, fmt, ##__VA_ARGS__);	\
51 } while (0)
52 #else
53 #define IWX_DPRINTF(sc, m, fmt, ...) do { (void) sc; } while (0)
54 #endif
55 
56 void print_opcode(const char *, int, uint32_t);
57 void print_ratenflags(const char *, int , uint32_t , int );
58 
59 #endif	/* __IF_IWX_DEBUG_H__ */
60