Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/contrib/dev/iwlwifi/iwl-debug.h
105247 views
1
/*-
2
* Copyright (c) 2020-2021 The FreeBSD Foundation
3
*
4
* This software was developed by Björn Zeeb under sponsorship from
5
* the FreeBSD Foundation.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
* 2. Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
* SUCH DAMAGE.
27
*
28
* $FreeBSD$
29
*/
30
31
#ifndef _IWL_DEBUG_H
32
#define _IWL_DEBUG_H
33
34
#if defined(__FreeBSD__)
35
#ifdef CONFIG_IWLWIFI_DEBUG
36
#include <sys/types.h>
37
#endif
38
#endif
39
40
#include <linux/device.h>
41
42
enum iwl_dl {
43
IWL_DL_ASSOC = 0x00000001,
44
IWL_DL_CALIB = 0x00000002,
45
IWL_DL_COEX = 0x00000004,
46
IWL_DL_WOWLAN = 0x00000008,
47
IWL_DL_DROP = 0x00000010,
48
IWL_DL_EEPROM = 0x00000020,
49
IWL_DL_FW = 0x00000040,
50
IWL_DL_DEV_RADIO = 0x00000080,
51
IWL_DL_HC = 0x00000100,
52
IWL_DL_HT = 0x00000200,
53
IWL_DL_INFO = 0x00000400,
54
IWL_DL_ISR = 0x00000800,
55
IWL_DL_LAR = 0x00001000,
56
IWL_DL_MAC80211 = 0x00002000,
57
IWL_DL_POWER = 0x00004000,
58
IWL_DL_QUOTA = 0x00008000,
59
IWL_DL_RADIO = 0x00010000,
60
IWL_DL_RATE = 0x00020000,
61
IWL_DL_RF_KILL = 0x00040000,
62
IWL_DL_RX = 0x00080000,
63
IWL_DL_SCAN = 0x00100000,
64
IWL_DL_STATS = 0x00200000,
65
IWL_DL_EHT = 0x00400000,
66
IWL_DL_TDLS = 0x00800000,
67
IWL_DL_TE = 0x01000000,
68
IWL_DL_TEMP = 0x02000000,
69
IWL_DL_TPT = 0x04000000,
70
IWL_DL_TX = 0x08000000,
71
IWL_DL_TX_QUEUES = 0x10000000,
72
IWL_DL_TX_REPLY = 0x20000000,
73
IWL_DL_WEP = 0x40000000,
74
IWL_DL_PTP = 0x80000000,
75
76
IWL_DL_ANY = 0x7fffffff,
77
};
78
79
enum iwl_err_mode {
80
IWL_ERR_MODE_RATELIMIT,
81
IWL_ERR_MODE_REGULAR,
82
IWL_ERR_MODE_RFKILL, /* XXX we do not pass that from anywhere? */
83
};
84
85
void __iwl_crit(struct device *, const char *, ...);
86
void __iwl_info(struct device *, const char *, ...);
87
void __iwl_warn(struct device *, const char *, ...);
88
void __iwl_err(struct device *, enum iwl_err_mode, const char *, ...);
89
90
#define IWL_CRIT(_subsys, _fmt, ...) \
91
__iwl_crit((_subsys)->dev, _fmt, ##__VA_ARGS__)
92
#define IWL_INFO(_subsys, _fmt, ...) \
93
__iwl_info((_subsys)->dev, _fmt, ##__VA_ARGS__)
94
#define IWL_WARN(_subsys, _fmt, ...) \
95
__iwl_warn((_subsys)->dev, _fmt, ##__VA_ARGS__)
96
/* XXX Not sure what the two bools are good for if never passed. */
97
#define __IWL_ERR_DEV(_dev, _mode, _fmt, ...) \
98
__iwl_err((_dev), IWL_ERR_MODE_REGULAR, _fmt, ##__VA_ARGS__)
99
#define IWL_ERR_DEV(_dev, _fmt, ...) \
100
__IWL_ERR_DEV(_dev, IWL_ERR_MODE_REGULAR, _fmt, ##__VA_ARGS__)
101
#define IWL_ERR(_subsys, _fmt, ...) \
102
IWL_ERR_DEV((_subsys)->dev, _fmt, ##__VA_ARGS__)
103
#define IWL_ERR_LIMIT(_subsys, _fmt, ...) \
104
__IWL_ERR_DEV((_subsys)->dev, IWL_ERR_MODE_RATELIMIT, \
105
_fmt, ##__VA_ARGS__)
106
107
#define iwl_print_hex_error(_subsys, _pkt, _n) /* XXX-BZ TODO */
108
109
#ifdef CONFIG_IWLWIFI_DEBUG
110
bool iwl_have_debug_level(enum iwl_dl);
111
#if defined(__linux__)
112
void iwl_print_hex_dump(void *, enum iwl_dl, const char *, uint8_t *, size_t);
113
#elif defined(__FreeBSD__)
114
void iwl_print_hex_dump(void *, enum iwl_dl, const char *, const uint8_t *, size_t);
115
#endif
116
void __iwl_dbg(struct device *, u32, bool, const char *, const char *fmt, ...);
117
118
#define IWL_DPRINTF_DEV_PREFIX(_dev, _e, _prefix, _fmt, ...) \
119
__iwl_dbg(_dev, _e, false, __func__, #_prefix " " _fmt, ##__VA_ARGS__)
120
#define IWL_DPRINTF_DEV(_dev, _e, _fmt, ...) \
121
IWL_DPRINTF_DEV_PREFIX(_dev, _e, _e, _fmt, ##__VA_ARGS__)
122
#define IWL_DPRINTF(_subsys, _e, _fmt, ...) \
123
IWL_DPRINTF_DEV((_subsys)->dev, _e, _fmt, ##__VA_ARGS__)
124
#define IWL_DPRINTF_PREFIX(_subsys, _e, _prefix, _fmt, ...) \
125
IWL_DPRINTF_DEV_PREFIX((_subsys)->dev, _e, _prefix, _fmt, ##__VA_ARGS__)
126
127
#else /* !CONFIG_IWLWIFI_DEBUG */
128
#define IWL_DPRINTF_DEV(_dev, _e, _fmt, ...)
129
#define IWL_DPRINTF(_subsys, _e, _fmt, ...)
130
#define IWL_DPRINTF_PREFIX(_subsys, _e, _prefix, _fmt, ...)
131
#endif /* CONFIG_IWLWIFI_DEBUG */
132
133
#define IWL_DEBUG_ASSOC(_subsys, _fmt, ...) \
134
IWL_DPRINTF(_subsys, IWL_DL_ASSOC, _fmt, ##__VA_ARGS__)
135
#define IWL_DEBUG_CALIB(_subsys, _fmt, ...) \
136
IWL_DPRINTF(_subsys, IWL_DL_CALIB, _fmt, ##__VA_ARGS__)
137
#define IWL_DEBUG_COEX(_subsys, _fmt, ...) \
138
IWL_DPRINTF(_subsys, IWL_DL_COEX, _fmt, ##__VA_ARGS__)
139
#define IWL_DEBUG_DEV(_dev, _level, _fmt, ...) \
140
IWL_DPRINTF_DEV((_dev), (_level), _fmt, ##__VA_ARGS__)
141
#define IWL_DEBUG_DROP(_subsys, _fmt, ...) \
142
IWL_DPRINTF(_subsys, IWL_DL_DROP, _fmt, ##__VA_ARGS__)
143
#define IWL_DEBUG_EEPROM(_dev, _fmt, ...) \
144
IWL_DPRINTF_DEV((_dev), IWL_DL_EEPROM, _fmt, ##__VA_ARGS__)
145
#define IWL_DEBUG_FW(_subsys, _fmt, ...) \
146
IWL_DPRINTF(_subsys, IWL_DL_FW, _fmt, ##__VA_ARGS__)
147
#define IWL_DEBUG_FW_INFO(_subsys, _fmt, ...) \
148
IWL_DPRINTF_PREFIX(_subsys, IWL_DL_FW | IWL_DL_INFO, IWL_DL_FW_INFO, _fmt, ##__VA_ARGS__)
149
#define IWL_DEBUG_HC(_subsys, _fmt, ...) \
150
IWL_DPRINTF(_subsys, IWL_DL_HC, _fmt, ##__VA_ARGS__)
151
#define IWL_DEBUG_HT(_subsys, _fmt, ...) \
152
IWL_DPRINTF(_subsys, IWL_DL_HT, _fmt, ##__VA_ARGS__)
153
#define IWL_DEBUG_INFO(_subsys, _fmt, ...) \
154
IWL_DPRINTF(_subsys, IWL_DL_INFO, _fmt, ##__VA_ARGS__)
155
#define IWL_DEBUG_ISR(_subsys, _fmt, ...) \
156
IWL_DPRINTF(_subsys, IWL_DL_ISR, _fmt, ##__VA_ARGS__)
157
#define IWL_DEBUG_LAR(_subsys, _fmt, ...) \
158
IWL_DPRINTF(_subsys, IWL_DL_LAR, _fmt, ##__VA_ARGS__)
159
#define IWL_DEBUG_MAC80211(_subsys, _fmt, ...) \
160
IWL_DPRINTF(_subsys, IWL_DL_MAC80211, _fmt, ##__VA_ARGS__)
161
#define IWL_DEBUG_POWER(_subsys, _fmt, ...) \
162
IWL_DPRINTF(_subsys, IWL_DL_POWER, _fmt, ##__VA_ARGS__)
163
#define IWL_DEBUG_DEV_POWER(_dev, _fmt, ...) \
164
IWL_DPRINTF_DEV((_dev), IWL_DL_POWER, _fmt, ##__VA_ARGS__)
165
#define IWL_DEBUG_QUOTA(_subsys, _fmt, ...) \
166
IWL_DPRINTF(_subsys, IWL_DL_QUOTA, _fmt, ##__VA_ARGS__)
167
#define IWL_DEBUG_RADIO(_subsys, _fmt, ...) \
168
IWL_DPRINTF(_subsys, IWL_DL_RADIO, _fmt, ##__VA_ARGS__)
169
#define IWL_DEBUG_RATE(_subsys, _fmt, ...) \
170
IWL_DPRINTF(_subsys, IWL_DL_RATE, _fmt, ##__VA_ARGS__)
171
#define IWL_DEBUG_RF_KILL(_subsys, _fmt, ...) \
172
IWL_DPRINTF(_subsys, IWL_DL_RF_KILL, _fmt, ##__VA_ARGS__)
173
#define IWL_DEBUG_RX(_subsys, _fmt, ...) \
174
IWL_DPRINTF(_subsys, IWL_DL_RX, _fmt, ##__VA_ARGS__)
175
#define IWL_DEBUG_SCAN(_subsys, _fmt, ...) \
176
IWL_DPRINTF(_subsys, IWL_DL_SCAN, _fmt, ##__VA_ARGS__)
177
#define IWL_DEBUG_STATS(_subsys, _fmt, ...) \
178
IWL_DPRINTF(_subsys, IWL_DL_STATS, _fmt, ##__VA_ARGS__)
179
#define IWL_DEBUG_STATS_LIMIT(_subsys, _fmt, ...) \
180
IWL_DPRINTF(_subsys, IWL_DL_STATS, _fmt, ##__VA_ARGS__)
181
#define IWL_DEBUG_TDLS(_subsys, _fmt, ...) \
182
IWL_DPRINTF(_subsys, IWL_DL_TDLS, _fmt, ##__VA_ARGS__)
183
#define IWL_DEBUG_TE(_subsys, _fmt, ...) \
184
IWL_DPRINTF(_subsys, IWL_DL_TE, _fmt, ##__VA_ARGS__)
185
#define IWL_DEBUG_TEMP(_subsys, _fmt, ...) \
186
IWL_DPRINTF(_subsys, IWL_DL_TEMP, _fmt, ##__VA_ARGS__)
187
#define IWL_DEBUG_TPT(_subsys, _fmt, ...) \
188
IWL_DPRINTF(_subsys, IWL_DL_TPT, _fmt, ##__VA_ARGS__)
189
#define IWL_DEBUG_TX(_subsys, _fmt, ...) \
190
IWL_DPRINTF(_subsys, IWL_DL_TX, _fmt, ##__VA_ARGS__)
191
#define IWL_DEBUG_TX_QUEUES(_subsys, _fmt, ...) \
192
IWL_DPRINTF(_subsys, IWL_DL_TX_QUEUES, _fmt, ##__VA_ARGS__)
193
#define IWL_DEBUG_TX_REPLY(_subsys, _fmt, ...) \
194
IWL_DPRINTF(_subsys, IWL_DL_TX_REPLY, _fmt, ##__VA_ARGS__)
195
#define IWL_DEBUG_WEP(_subsys, _fmt, ...) \
196
IWL_DPRINTF(_subsys, IWL_DL_WEP, _fmt, ##__VA_ARGS__)
197
#define IWL_DEBUG_WOWLAN(_subsys, _fmt, ...) \
198
IWL_DPRINTF(_subsys, IWL_DL_WOWLAN, _fmt, ##__VA_ARGS__)
199
#define IWL_DEBUG_DEV_RADIO(_dev, _fmt, ...) \
200
IWL_DPRINTF_DEV((_dev), IWL_DL_DEV_RADIO, _fmt, ##__VA_ARGS__)
201
#define IWL_DEBUG_PTP(_subsys, _fmt, ...) \
202
IWL_DPRINTF(_subsys, IWL_DL_PTP, _fmt, ##__VA_ARGS__)
203
#define IWL_DEBUG_EHT(_subsys, _fmt, ...) \
204
IWL_DPRINTF(_subsys, IWL_DL_EHT, _fmt, ##__VA_ARGS__)
205
206
#endif /* _IWL_DEBUG_H */
207
208