]>
Commit | Line | Data |
---|---|---|
b481de9c ZY |
1 | /****************************************************************************** |
2 | * | |
901069c7 | 3 | * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. |
b481de9c ZY |
4 | * |
5 | * Portions of this file are derived from the ipw3945 project. | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify it | |
8 | * under the terms of version 2 of the GNU General Public License as | |
9 | * published by the Free Software Foundation. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
14 | * more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License along with | |
17 | * this program; if not, write to the Free Software Foundation, Inc., | |
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | |
19 | * | |
20 | * The full GNU General Public License is included in this distribution in the | |
21 | * file called LICENSE. | |
22 | * | |
23 | * Contact Information: | |
759ef89f | 24 | * Intel Linux Wireless <[email protected]> |
b481de9c ZY |
25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
26 | * | |
27 | *****************************************************************************/ | |
28 | ||
0a6857e7 TW |
29 | #ifndef __iwl_debug_h__ |
30 | #define __iwl_debug_h__ | |
b481de9c | 31 | |
a72b8b08 | 32 | #include "iwl-bus.h" |
44856c65 EG |
33 | #include "iwl-shared.h" |
34 | ||
40b8ec0b SO |
35 | struct iwl_priv; |
36 | ||
44856c65 EG |
37 | /*No matter what is m (priv, bus, trans), this will work */ |
38 | #define IWL_ERR(m, f, a...) dev_err(bus(m)->dev, f, ## a) | |
39 | #define IWL_WARN(m, f, a...) dev_warn(bus(m)->dev, f, ## a) | |
40 | #define IWL_INFO(m, f, a...) dev_info(bus(m)->dev, f, ## a) | |
41 | #define IWL_CRIT(m, f, a...) dev_crit(bus(m)->dev, f, ## a) | |
978785a3 | 42 | |
44856c65 | 43 | #define iwl_print_hex_error(m, p, len) \ |
68021b96 RC |
44 | do { \ |
45 | print_hex_dump(KERN_ERR, "iwl data: ", \ | |
46 | DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ | |
47 | } while (0) | |
48 | ||
0a6857e7 | 49 | #ifdef CONFIG_IWLWIFI_DEBUG |
44856c65 | 50 | #define IWL_DEBUG(m, level, fmt, args...) \ |
e1623446 | 51 | do { \ |
44856c65 EG |
52 | if (iwl_get_debug_level((m)->shrd) & (level)) \ |
53 | dev_printk(KERN_ERR, bus(m)->dev, \ | |
e1623446 TW |
54 | "%c %s " fmt, in_interrupt() ? 'I' : 'U', \ |
55 | __func__ , ## args); \ | |
d2bf5583 | 56 | } while (0) |
b481de9c | 57 | |
44856c65 | 58 | #define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ |
e1623446 | 59 | do { \ |
44856c65 EG |
60 | if (iwl_get_debug_level((m)->shrd) & (level) && net_ratelimit())\ |
61 | dev_printk(KERN_ERR, bus(m)->dev, \ | |
e1623446 TW |
62 | "%c %s " fmt, in_interrupt() ? 'I' : 'U', \ |
63 | __func__ , ## args); \ | |
d2bf5583 | 64 | } while (0) |
17744ff6 | 65 | |
44856c65 | 66 | #define iwl_print_hex_dump(m, level, p, len) \ |
cb299bae | 67 | do { \ |
44856c65 | 68 | if (iwl_get_debug_level((m)->shrd) & level) \ |
cb299bae WT |
69 | print_hex_dump(KERN_DEBUG, "iwl data: ", \ |
70 | DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ | |
71 | } while (0) | |
72 | ||
712b6cf5 | 73 | #else |
44856c65 EG |
74 | #define IWL_DEBUG(m, level, fmt, args...) |
75 | #define IWL_DEBUG_LIMIT(m, level, fmt, args...) | |
76 | #define iwl_print_hex_dump(m, level, p, len) | |
0a6857e7 | 77 | #endif /* CONFIG_IWLWIFI_DEBUG */ |
b481de9c | 78 | |
4c84a8f1 JB |
79 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
80 | int iwl_dbgfs_register(struct iwl_priv *priv, const char *name); | |
81 | void iwl_dbgfs_unregister(struct iwl_priv *priv); | |
82 | #else | |
712b6cf5 TW |
83 | static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) |
84 | { | |
85 | return 0; | |
86 | } | |
87 | static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | |
88 | { | |
89 | } | |
90 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ | |
91 | ||
b481de9c | 92 | /* |
c3a739fa | 93 | * To use the debug system: |
b481de9c ZY |
94 | * |
95 | * If you are defining a new debug classification, simply add it to the #define | |
c3a739fa | 96 | * list here in the form of |
b481de9c ZY |
97 | * |
98 | * #define IWL_DL_xxxx VALUE | |
99 | * | |
c3a739fa | 100 | * where xxxx should be the name of the classification (for example, WEP). |
b481de9c ZY |
101 | * |
102 | * You then need to either add a IWL_xxxx_DEBUG() macro definition for your | |
103 | * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want | |
104 | * to send output to that classification. | |
105 | * | |
c3a739fa | 106 | * The active debug levels can be accessed via files |
b481de9c | 107 | * |
c3a739fa WF |
108 | * /sys/module/iwlagn/parameters/debug{50} |
109 | * /sys/class/net/wlan0/device/debug_level | |
b481de9c | 110 | * |
c3a739fa | 111 | * when CONFIG_IWLWIFI_DEBUG=y. |
b481de9c ZY |
112 | */ |
113 | ||
d2bf5583 | 114 | /* 0x0000000F - 0x00000001 */ |
ded2ae7c EK |
115 | #define IWL_DL_INFO (1 << 0) |
116 | #define IWL_DL_MAC80211 (1 << 1) | |
117 | #define IWL_DL_HCMD (1 << 2) | |
118 | #define IWL_DL_STATE (1 << 3) | |
d2bf5583 | 119 | /* 0x000000F0 - 0x00000010 */ |
f3674227 | 120 | #define IWL_DL_MACDUMP (1 << 4) |
ded2ae7c | 121 | #define IWL_DL_HCMD_DUMP (1 << 5) |
fb4c32bb | 122 | #define IWL_DL_EEPROM (1 << 6) |
d2bf5583 | 123 | #define IWL_DL_RADIO (1 << 7) |
146846ae | 124 | /* 0x00000F00 - 0x00000100 */ |
d2bf5583 WF |
125 | #define IWL_DL_POWER (1 << 8) |
126 | #define IWL_DL_TEMP (1 << 9) | |
bf300252 | 127 | /* reserved (1 << 10) */ |
d2bf5583 | 128 | #define IWL_DL_SCAN (1 << 11) |
146846ae | 129 | /* 0x0000F000 - 0x00001000 */ |
d2bf5583 WF |
130 | #define IWL_DL_ASSOC (1 << 12) |
131 | #define IWL_DL_DROP (1 << 13) | |
bf300252 | 132 | /* reserved (1 << 14) */ |
ebbb491e | 133 | #define IWL_DL_COEX (1 << 15) |
146846ae | 134 | /* 0x000F0000 - 0x00010000 */ |
d2bf5583 WF |
135 | #define IWL_DL_FW (1 << 16) |
136 | #define IWL_DL_RF_KILL (1 << 17) | |
137 | #define IWL_DL_FW_ERRORS (1 << 18) | |
138 | #define IWL_DL_LED (1 << 19) | |
146846ae | 139 | /* 0x00F00000 - 0x00100000 */ |
d2bf5583 WF |
140 | #define IWL_DL_RATE (1 << 20) |
141 | #define IWL_DL_CALIB (1 << 21) | |
142 | #define IWL_DL_WEP (1 << 22) | |
143 | #define IWL_DL_TX (1 << 23) | |
146846ae | 144 | /* 0x0F000000 - 0x01000000 */ |
d2bf5583 WF |
145 | #define IWL_DL_RX (1 << 24) |
146 | #define IWL_DL_ISR (1 << 25) | |
147 | #define IWL_DL_HT (1 << 26) | |
146846ae | 148 | /* 0xF0000000 - 0x10000000 */ |
d2bf5583 WF |
149 | #define IWL_DL_11H (1 << 28) |
150 | #define IWL_DL_STATS (1 << 29) | |
151 | #define IWL_DL_TX_REPLY (1 << 30) | |
152 | #define IWL_DL_QOS (1 << 31) | |
153 | ||
e1623446 TW |
154 | #define IWL_DEBUG_INFO(p, f, a...) IWL_DEBUG(p, IWL_DL_INFO, f, ## a) |
155 | #define IWL_DEBUG_MAC80211(p, f, a...) IWL_DEBUG(p, IWL_DL_MAC80211, f, ## a) | |
156 | #define IWL_DEBUG_MACDUMP(p, f, a...) IWL_DEBUG(p, IWL_DL_MACDUMP, f, ## a) | |
157 | #define IWL_DEBUG_TEMP(p, f, a...) IWL_DEBUG(p, IWL_DL_TEMP, f, ## a) | |
158 | #define IWL_DEBUG_SCAN(p, f, a...) IWL_DEBUG(p, IWL_DL_SCAN, f, ## a) | |
159 | #define IWL_DEBUG_RX(p, f, a...) IWL_DEBUG(p, IWL_DL_RX, f, ## a) | |
160 | #define IWL_DEBUG_TX(p, f, a...) IWL_DEBUG(p, IWL_DL_TX, f, ## a) | |
161 | #define IWL_DEBUG_ISR(p, f, a...) IWL_DEBUG(p, IWL_DL_ISR, f, ## a) | |
162 | #define IWL_DEBUG_LED(p, f, a...) IWL_DEBUG(p, IWL_DL_LED, f, ## a) | |
163 | #define IWL_DEBUG_WEP(p, f, a...) IWL_DEBUG(p, IWL_DL_WEP, f, ## a) | |
164 | #define IWL_DEBUG_HC(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD, f, ## a) | |
165 | #define IWL_DEBUG_HC_DUMP(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD_DUMP, f, ## a) | |
fb4c32bb | 166 | #define IWL_DEBUG_EEPROM(p, f, a...) IWL_DEBUG(p, IWL_DL_EEPROM, f, ## a) |
e1623446 TW |
167 | #define IWL_DEBUG_CALIB(p, f, a...) IWL_DEBUG(p, IWL_DL_CALIB, f, ## a) |
168 | #define IWL_DEBUG_FW(p, f, a...) IWL_DEBUG(p, IWL_DL_FW, f, ## a) | |
169 | #define IWL_DEBUG_RF_KILL(p, f, a...) IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a) | |
9ca06f0a | 170 | #define IWL_DEBUG_FW_ERRORS(p, f, a...) IWL_DEBUG(p, IWL_DL_FW_ERRORS, f, ## a) |
e1623446 TW |
171 | #define IWL_DEBUG_DROP(p, f, a...) IWL_DEBUG(p, IWL_DL_DROP, f, ## a) |
172 | #define IWL_DEBUG_DROP_LIMIT(p, f, a...) \ | |
173 | IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a) | |
ebbb491e | 174 | #define IWL_DEBUG_COEX(p, f, a...) IWL_DEBUG(p, IWL_DL_COEX, f, ## a) |
e1623446 TW |
175 | #define IWL_DEBUG_RATE(p, f, a...) IWL_DEBUG(p, IWL_DL_RATE, f, ## a) |
176 | #define IWL_DEBUG_RATE_LIMIT(p, f, a...) \ | |
177 | IWL_DEBUG_LIMIT(p, IWL_DL_RATE, f, ## a) | |
e1623446 TW |
178 | #define IWL_DEBUG_ASSOC(p, f, a...) \ |
179 | IWL_DEBUG(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) | |
180 | #define IWL_DEBUG_ASSOC_LIMIT(p, f, a...) \ | |
181 | IWL_DEBUG_LIMIT(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) | |
182 | #define IWL_DEBUG_HT(p, f, a...) IWL_DEBUG(p, IWL_DL_HT, f, ## a) | |
183 | #define IWL_DEBUG_STATS(p, f, a...) IWL_DEBUG(p, IWL_DL_STATS, f, ## a) | |
184 | #define IWL_DEBUG_STATS_LIMIT(p, f, a...) \ | |
185 | IWL_DEBUG_LIMIT(p, IWL_DL_STATS, f, ## a) | |
186 | #define IWL_DEBUG_TX_REPLY(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_REPLY, f, ## a) | |
187 | #define IWL_DEBUG_TX_REPLY_LIMIT(p, f, a...) \ | |
188 | IWL_DEBUG_LIMIT(p, IWL_DL_TX_REPLY, f, ## a) | |
189 | #define IWL_DEBUG_QOS(p, f, a...) IWL_DEBUG(p, IWL_DL_QOS, f, ## a) | |
190 | #define IWL_DEBUG_RADIO(p, f, a...) IWL_DEBUG(p, IWL_DL_RADIO, f, ## a) | |
191 | #define IWL_DEBUG_POWER(p, f, a...) IWL_DEBUG(p, IWL_DL_POWER, f, ## a) | |
192 | #define IWL_DEBUG_11H(p, f, a...) IWL_DEBUG(p, IWL_DL_11H, f, ## a) | |
b481de9c ZY |
193 | |
194 | #endif |