xref: /freebsd/sys/dev/iwn/if_iwn_debug.h (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1 /*-
2  * Copyright (c) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
3  * Copyright (c) 2011 Intel Corporation
4  * Copyright (c) 2007-2009
5  *      Damien Bergamini <damien.bergamini@free.fr>
6  * Copyright (c) 2008
7  *      Benjamin Close <benjsc@FreeBSD.org>
8  * Copyright (c) 2008 Sam Leffler, Errno Consulting
9  *
10  * Permission to use, copy, modify, and distribute this software for any
11  * purpose with or without fee is hereby granted, provided that the above
12  * copyright notice and this permission notice appear in all copies.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  *
22  * $FreeBSD$
23  */
24 
25 #ifndef	__IF_IWN_DEBUG_H__
26 #define	__IF_IWN_DEBUG_H__
27 
28 #ifdef	IWN_DEBUG
29 enum {
30 	IWN_DEBUG_XMIT		= 0x00000001,	/* basic xmit operation */
31 	IWN_DEBUG_RECV		= 0x00000002,	/* basic recv operation */
32 	IWN_DEBUG_STATE		= 0x00000004,	/* 802.11 state transitions */
33 	IWN_DEBUG_TXPOW		= 0x00000008,	/* tx power processing */
34 	IWN_DEBUG_RESET		= 0x00000010,	/* reset processing */
35 	IWN_DEBUG_OPS		= 0x00000020,	/* iwn_ops processing */
36 	IWN_DEBUG_BEACON 	= 0x00000040,	/* beacon handling */
37 	IWN_DEBUG_WATCHDOG 	= 0x00000080,	/* watchdog timeout */
38 	IWN_DEBUG_INTR		= 0x00000100,	/* ISR */
39 	IWN_DEBUG_CALIBRATE	= 0x00000200,	/* periodic calibration */
40 	IWN_DEBUG_NODE		= 0x00000400,	/* node management */
41 	IWN_DEBUG_LED		= 0x00000800,	/* led management */
42 	IWN_DEBUG_CMD		= 0x00001000,	/* cmd submission */
43 	IWN_DEBUG_TXRATE	= 0x00002000,	/* TX rate debugging */
44 	IWN_DEBUG_PWRSAVE	= 0x00004000,	/* Power save operations */
45 	IWN_DEBUG_SCAN		= 0x00008000,	/* Scan related operations */
46 	IWN_DEBUG_STATS		= 0x00010000,	/* Statistics updates */
47 	IWN_DEBUG_AMPDU		= 0x00020000,	/* A-MPDU specific Tx */
48 	IWN_DEBUG_REGISTER	= 0x20000000,	/* print chipset register */
49 	IWN_DEBUG_TRACE		= 0x40000000,	/* Print begin and start driver function */
50 	IWN_DEBUG_FATAL		= 0x80000000,	/* fatal errors */
51 	IWN_DEBUG_ANY		= 0xffffffff
52 };
53 
54 #define DPRINTF(sc, m, fmt, ...) do {			\
55 	if (sc->sc_debug & (m))				\
56 		printf(fmt, __VA_ARGS__);		\
57 } while (0)
58 
59 static const char *
60 iwn_intr_str(uint8_t cmd)
61 {
62 	switch (cmd) {
63 	/* Notifications */
64 	case IWN_UC_READY:		return "UC_READY";
65 	case IWN_ADD_NODE_DONE:		return "ADD_NODE_DONE";
66 	case IWN_TX_DONE:		return "TX_DONE";
67 	case IWN_START_SCAN:		return "START_SCAN";
68 	case IWN_STOP_SCAN:		return "STOP_SCAN";
69 	case IWN_RX_STATISTICS:		return "RX_STATS";
70 	case IWN_BEACON_STATISTICS:	return "BEACON_STATS";
71 	case IWN_STATE_CHANGED:		return "STATE_CHANGED";
72 	case IWN_BEACON_MISSED:		return "BEACON_MISSED";
73 	case IWN_RX_PHY:		return "RX_PHY";
74 	case IWN_MPDU_RX_DONE:		return "MPDU_RX_DONE";
75 	case IWN_RX_DONE:		return "RX_DONE";
76 	case IWN_RX_COMPRESSED_BA:	return "RX_COMPRESSED_BA";
77 
78 	/* Command Notifications */
79 	case IWN_CMD_RXON:		return "IWN_CMD_RXON";
80 	case IWN_CMD_RXON_ASSOC:	return "IWN_CMD_RXON_ASSOC";
81 	case IWN_CMD_EDCA_PARAMS:	return "IWN_CMD_EDCA_PARAMS";
82 	case IWN_CMD_TIMING:		return "IWN_CMD_TIMING";
83 	case IWN_CMD_LINK_QUALITY:	return "IWN_CMD_LINK_QUALITY";
84 	case IWN_CMD_SET_LED:		return "IWN_CMD_SET_LED";
85 	case IWN5000_CMD_WIMAX_COEX:	return "IWN5000_CMD_WIMAX_COEX";
86 	case IWN_TEMP_NOTIFICATION:	return "IWN_TEMP_NOTIFICATION";
87 	case IWN5000_CMD_CALIB_CONFIG:	return "IWN5000_CMD_CALIB_CONFIG";
88 	case IWN5000_CMD_CALIB_RESULT:	return "IWN5000_CMD_CALIB_RESULT";
89 	case IWN5000_CMD_CALIB_COMPLETE: return "IWN5000_CMD_CALIB_COMPLETE";
90 	case IWN_CMD_SET_POWER_MODE:	return "IWN_CMD_SET_POWER_MODE";
91 	case IWN_CMD_SCAN:		return "IWN_CMD_SCAN";
92 	case IWN_CMD_SCAN_RESULTS:	return "IWN_CMD_SCAN_RESULTS";
93 	case IWN_CMD_TXPOWER:		return "IWN_CMD_TXPOWER";
94 	case IWN_CMD_TXPOWER_DBM:	return "IWN_CMD_TXPOWER_DBM";
95 	case IWN5000_CMD_TX_ANT_CONFIG:	return "IWN5000_CMD_TX_ANT_CONFIG";
96 	case IWN_CMD_BT_COEX:		return "IWN_CMD_BT_COEX";
97 	case IWN_CMD_SET_CRITICAL_TEMP:	return "IWN_CMD_SET_CRITICAL_TEMP";
98 	case IWN_CMD_SET_SENSITIVITY:	return "IWN_CMD_SET_SENSITIVITY";
99 	case IWN_CMD_PHY_CALIB:		return "IWN_CMD_PHY_CALIB";
100 
101 	/* Bluetooth commands */
102 	case IWN_CMD_BT_COEX_PRIOTABLE:	return "IWN_CMD_BT_COEX_PRIOTABLE";
103 	case IWN_CMD_BT_COEX_PROT:	return "IWN_CMD_BT_COEX_PROT";
104 	case IWN_CMD_BT_COEX_NOTIF:	return "IWN_CMD_BT_COEX_NOTIF";
105 
106 	/* PAN commands */
107 	case IWN_CMD_WIPAN_PARAMS:	return "IWN_CMD_WIPAN_PARAMS";
108 	case IWN_CMD_WIPAN_RXON:	return "IWN_CMD_WIPAN_RXON";
109 	case IWN_CMD_WIPAN_RXON_TIMING:	return "IWN_CMD_WIPAN_RXON_TIMING";
110 	case IWN_CMD_WIPAN_RXON_ASSOC:	return "IWN_CMD_WIPAN_RXON_ASSOC";
111 	case IWN_CMD_WIPAN_QOS_PARAM:	return "IWN_CMD_WIPAN_QOS_PARAM";
112 	case IWN_CMD_WIPAN_WEPKEY:	return "IWN_CMD_WIPAN_WEPKEY";
113 	case IWN_CMD_WIPAN_P2P_CHANNEL_SWITCH:
114 		return "IWN_CMD_WIPAN_P2P_CHANNEL_SWITCH";
115 	case IWN_CMD_WIPAN_NOA_NOTIFICATION:
116 		return "IWN_CMD_WIPAN_NOA_NOTIFICATION";
117 	case IWN_CMD_WIPAN_DEACTIVATION_COMPLETE:
118 		return "IWN_CMD_WIPAN_DEACTIVATION_COMPLETE";
119 	}
120 	return "UNKNOWN INTR NOTIF/CMD";
121 }
122 #else
123 #define DPRINTF(sc, m, fmt, ...) do { (void) sc; } while (0)
124 #endif
125 
126 #endif	/* __IF_IWN_DEBUG_H__ */
127