blob: bb581ef6d1efa51ae0bbca075498fabea129685f [file] [log] [blame]
Jiri Slabyfa1c1142007-08-12 17:33:16 +02001/*
Bruno Randolfbe9b7252008-01-23 10:27:51 +09002 * Copyright (c) 2007-2008 Bruno Randolf <bruno@thinktube.com>
Jiri Slabyfa1c1142007-08-12 17:33:16 +02003 *
4 * This file is free software: you may copy, redistribute and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation, either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 *
18 * This file incorporates work covered by the following copyright and
19 * permission notice:
20 *
21 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
22 * Copyright (c) 2004-2005 Atheros Communications, Inc.
23 * Copyright (c) 2006 Devicescape Software, Inc.
24 * Copyright (c) 2007 Jiri Slaby <jirislaby@gmail.com>
25 * Copyright (c) 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
26 *
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 * 1. Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer,
34 * without modification.
35 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
36 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
37 * redistribution must be conditioned upon including a substantially
38 * similar Disclaimer requirement for further binary redistribution.
39 * 3. Neither the names of the above-listed copyright holders nor the names
40 * of any contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
42 *
43 * Alternatively, this software may be distributed under the terms of the
44 * GNU General Public License ("GPL") version 2 as published by the Free
45 * Software Foundation.
46 *
47 * NO WARRANTY
48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
49 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
50 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
51 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
52 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
53 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
54 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
55 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
56 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
57 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
58 * THE POSSIBILITY OF SUCH DAMAGES.
59 */
60
61#include "debug.h"
62#include "base.h"
63
64static unsigned int ath5k_debug;
65module_param_named(debug, ath5k_debug, uint, 0);
66
67
68#if ATH5K_DEBUG
69
70#include <linux/seq_file.h>
71#include "reg.h"
72
73static struct dentry *ath5k_global_debugfs;
74
75static int ath5k_debugfs_open(struct inode *inode, struct file *file)
76{
77 file->private_data = inode->i_private;
78 return 0;
79}
80
81
82/* debugfs: registers */
83
84struct reg {
85 char *name;
86 int addr;
87};
88
89#define REG_STRUCT_INIT(r) { #r, r }
90
91/* just a few random registers, might want to add more */
92static struct reg regs[] = {
93 REG_STRUCT_INIT(AR5K_CR),
94 REG_STRUCT_INIT(AR5K_RXDP),
95 REG_STRUCT_INIT(AR5K_CFG),
96 REG_STRUCT_INIT(AR5K_IER),
97 REG_STRUCT_INIT(AR5K_BCR),
98 REG_STRUCT_INIT(AR5K_RTSD0),
99 REG_STRUCT_INIT(AR5K_RTSD1),
100 REG_STRUCT_INIT(AR5K_TXCFG),
101 REG_STRUCT_INIT(AR5K_RXCFG),
102 REG_STRUCT_INIT(AR5K_RXJLA),
103 REG_STRUCT_INIT(AR5K_MIBC),
104 REG_STRUCT_INIT(AR5K_TOPS),
105 REG_STRUCT_INIT(AR5K_RXNOFRM),
106 REG_STRUCT_INIT(AR5K_TXNOFRM),
107 REG_STRUCT_INIT(AR5K_RPGTO),
108 REG_STRUCT_INIT(AR5K_RFCNT),
109 REG_STRUCT_INIT(AR5K_MISC),
110 REG_STRUCT_INIT(AR5K_QCUDCU_CLKGT),
111 REG_STRUCT_INIT(AR5K_ISR),
112 REG_STRUCT_INIT(AR5K_PISR),
113 REG_STRUCT_INIT(AR5K_SISR0),
114 REG_STRUCT_INIT(AR5K_SISR1),
115 REG_STRUCT_INIT(AR5K_SISR2),
116 REG_STRUCT_INIT(AR5K_SISR3),
117 REG_STRUCT_INIT(AR5K_SISR4),
118 REG_STRUCT_INIT(AR5K_IMR),
119 REG_STRUCT_INIT(AR5K_PIMR),
120 REG_STRUCT_INIT(AR5K_SIMR0),
121 REG_STRUCT_INIT(AR5K_SIMR1),
122 REG_STRUCT_INIT(AR5K_SIMR2),
123 REG_STRUCT_INIT(AR5K_SIMR3),
124 REG_STRUCT_INIT(AR5K_SIMR4),
125 REG_STRUCT_INIT(AR5K_DCM_ADDR),
126 REG_STRUCT_INIT(AR5K_DCCFG),
127 REG_STRUCT_INIT(AR5K_CCFG),
128 REG_STRUCT_INIT(AR5K_CPC0),
129 REG_STRUCT_INIT(AR5K_CPC1),
130 REG_STRUCT_INIT(AR5K_CPC2),
131 REG_STRUCT_INIT(AR5K_CPC3),
132 REG_STRUCT_INIT(AR5K_CPCORN),
133 REG_STRUCT_INIT(AR5K_RESET_CTL),
134 REG_STRUCT_INIT(AR5K_SLEEP_CTL),
135 REG_STRUCT_INIT(AR5K_INTPEND),
136 REG_STRUCT_INIT(AR5K_SFR),
137 REG_STRUCT_INIT(AR5K_PCICFG),
138 REG_STRUCT_INIT(AR5K_GPIOCR),
139 REG_STRUCT_INIT(AR5K_GPIODO),
140 REG_STRUCT_INIT(AR5K_SREV),
141};
142
143static void *reg_start(struct seq_file *seq, loff_t *pos)
144{
145 return *pos < ARRAY_SIZE(regs) ? &regs[*pos] : NULL;
146}
147
148static void reg_stop(struct seq_file *seq, void *p)
149{
150 /* nothing to do */
151}
152
153static void *reg_next(struct seq_file *seq, void *p, loff_t *pos)
154{
155 ++*pos;
156 return *pos < ARRAY_SIZE(regs) ? &regs[*pos] : NULL;
157}
158
159static int reg_show(struct seq_file *seq, void *p)
160{
161 struct ath5k_softc *sc = seq->private;
162 struct reg *r = p;
163 seq_printf(seq, "%-25s0x%08x\n", r->name,
164 ath5k_hw_reg_read(sc->ah, r->addr));
165 return 0;
166}
167
168static struct seq_operations register_seq_ops = {
169 .start = reg_start,
170 .next = reg_next,
171 .stop = reg_stop,
172 .show = reg_show
173};
174
175static int open_file_registers(struct inode *inode, struct file *file)
176{
177 struct seq_file *s;
178 int res;
179 res = seq_open(file, &register_seq_ops);
180 if (res == 0) {
181 s = file->private_data;
182 s->private = inode->i_private;
183 }
184 return res;
185}
186
187static const struct file_operations fops_registers = {
188 .open = open_file_registers,
189 .read = seq_read,
190 .llseek = seq_lseek,
191 .release = seq_release,
192 .owner = THIS_MODULE,
193};
194
195
196/* debugfs: TSF */
197
198static ssize_t read_file_tsf(struct file *file, char __user *user_buf,
199 size_t count, loff_t *ppos)
200{
201 struct ath5k_softc *sc = file->private_data;
202 char buf[100];
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900203 snprintf(buf, sizeof(buf), "0x%016llx\n", ath5k_hw_get_tsf64(sc->ah));
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200204 return simple_read_from_buffer(user_buf, count, ppos, buf, 19);
205}
206
207static ssize_t write_file_tsf(struct file *file,
208 const char __user *userbuf,
209 size_t count, loff_t *ppos)
210{
211 struct ath5k_softc *sc = file->private_data;
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900212 char buf[20];
213
214 if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
215 return -EFAULT;
216
217 if (strncmp(buf, "reset", 5) == 0) {
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200218 ath5k_hw_reset_tsf(sc->ah);
219 printk(KERN_INFO "debugfs reset TSF\n");
220 }
221 return count;
222}
223
224static const struct file_operations fops_tsf = {
225 .read = read_file_tsf,
226 .write = write_file_tsf,
227 .open = ath5k_debugfs_open,
228 .owner = THIS_MODULE,
229};
230
231
232/* debugfs: beacons */
233
234static ssize_t read_file_beacon(struct file *file, char __user *user_buf,
235 size_t count, loff_t *ppos)
236{
237 struct ath5k_softc *sc = file->private_data;
238 struct ath5k_hw *ah = sc->ah;
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900239 char buf[500];
240 unsigned int len = 0;
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200241 unsigned int v;
242 u64 tsf;
243
244 v = ath5k_hw_reg_read(sc->ah, AR5K_BEACON);
245 len += snprintf(buf+len, sizeof(buf)-len,
246 "%-24s0x%08x\tintval: %d\tTIM: 0x%x\n",
247 "AR5K_BEACON", v, v & AR5K_BEACON_PERIOD,
248 (v & AR5K_BEACON_TIM) >> AR5K_BEACON_TIM_S);
249
250 len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\n",
251 "AR5K_LAST_TSTP", ath5k_hw_reg_read(sc->ah, AR5K_LAST_TSTP));
252
253 len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\n\n",
254 "AR5K_BEACON_CNT", ath5k_hw_reg_read(sc->ah, AR5K_BEACON_CNT));
255
256 v = ath5k_hw_reg_read(sc->ah, AR5K_TIMER0);
257 len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\tTU: %08x\n",
258 "AR5K_TIMER0 (TBTT)", v, v);
259
260 v = ath5k_hw_reg_read(sc->ah, AR5K_TIMER1);
261 len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\tTU: %08x\n",
262 "AR5K_TIMER1 (DMA)", v, v >> 3);
263
264 v = ath5k_hw_reg_read(sc->ah, AR5K_TIMER2);
265 len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\tTU: %08x\n",
266 "AR5K_TIMER2 (SWBA)", v, v >> 3);
267
268 v = ath5k_hw_reg_read(sc->ah, AR5K_TIMER3);
269 len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\tTU: %08x\n",
270 "AR5K_TIMER3 (ATIM)", v, v);
271
272 tsf = ath5k_hw_get_tsf64(sc->ah);
273 len += snprintf(buf+len, sizeof(buf)-len,
274 "TSF\t\t0x%016llx\tTU: %08x\n", tsf, TSF_TO_TU(tsf));
275
276 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
277}
278
279static ssize_t write_file_beacon(struct file *file,
280 const char __user *userbuf,
281 size_t count, loff_t *ppos)
282{
283 struct ath5k_softc *sc = file->private_data;
284 struct ath5k_hw *ah = sc->ah;
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900285 char buf[20];
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200286
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900287 if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
288 return -EFAULT;
289
290 if (strncmp(buf, "disable", 7) == 0) {
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200291 AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE);
292 printk(KERN_INFO "debugfs disable beacons\n");
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900293 } else if (strncmp(buf, "enable", 6) == 0) {
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200294 AR5K_REG_ENABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE);
295 printk(KERN_INFO "debugfs enable beacons\n");
296 }
297 return count;
298}
299
300static const struct file_operations fops_beacon = {
301 .read = read_file_beacon,
302 .write = write_file_beacon,
303 .open = ath5k_debugfs_open,
304 .owner = THIS_MODULE,
305};
306
307
308/* debugfs: reset */
309
310static ssize_t write_file_reset(struct file *file,
311 const char __user *userbuf,
312 size_t count, loff_t *ppos)
313{
314 struct ath5k_softc *sc = file->private_data;
315 tasklet_schedule(&sc->restq);
316 return count;
317}
318
319static const struct file_operations fops_reset = {
320 .write = write_file_reset,
321 .open = ath5k_debugfs_open,
322 .owner = THIS_MODULE,
323};
324
325
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900326/* debugfs: debug level */
327
328static struct {
329 enum ath5k_debug_level level;
330 const char *name;
331 const char *desc;
332} dbg_info[] = {
333 { ATH5K_DEBUG_RESET, "reset", "reset and initialization" },
334 { ATH5K_DEBUG_INTR, "intr", "interrupt handling" },
335 { ATH5K_DEBUG_MODE, "mode", "mode init/setup" },
336 { ATH5K_DEBUG_XMIT, "xmit", "basic xmit operation" },
337 { ATH5K_DEBUG_BEACON, "beacon", "beacon handling" },
338 { ATH5K_DEBUG_CALIBRATE, "calib", "periodic calibration" },
339 { ATH5K_DEBUG_TXPOWER, "txpower", "transmit power setting" },
340 { ATH5K_DEBUG_LED, "led", "LED mamagement" },
341 { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" },
342 { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" },
343 { ATH5K_DEBUG_DUMPMODES, "dumpmodes", "dump modes" },
344 { ATH5K_DEBUG_TRACE, "trace", "trace function calls" },
345 { ATH5K_DEBUG_ANY, "all", "show all debug levels" },
346};
347
348static ssize_t read_file_debug(struct file *file, char __user *user_buf,
349 size_t count, loff_t *ppos)
350{
351 struct ath5k_softc *sc = file->private_data;
352 char buf[700];
353 unsigned int len = 0;
354 unsigned int i;
355
356 len += snprintf(buf+len, sizeof(buf)-len,
357 "DEBUG LEVEL: 0x%08x\n\n", sc->debug.level);
358
359 for (i = 0; i < ARRAY_SIZE(dbg_info) - 1; i++) {
360 len += snprintf(buf+len, sizeof(buf)-len,
361 "%10s %c 0x%08x - %s\n", dbg_info[i].name,
362 sc->debug.level & dbg_info[i].level ? '+' : ' ',
363 dbg_info[i].level, dbg_info[i].desc);
364 }
365 len += snprintf(buf+len, sizeof(buf)-len,
366 "%10s %c 0x%08x - %s\n", dbg_info[i].name,
367 sc->debug.level == dbg_info[i].level ? '+' : ' ',
368 dbg_info[i].level, dbg_info[i].desc);
369
370 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
371}
372
373static ssize_t write_file_debug(struct file *file,
374 const char __user *userbuf,
375 size_t count, loff_t *ppos)
376{
377 struct ath5k_softc *sc = file->private_data;
378 unsigned int i;
379 char buf[20];
380
381 if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
382 return -EFAULT;
383
384 for (i = 0; i < ARRAY_SIZE(dbg_info); i++) {
385 if (strncmp(buf, dbg_info[i].name,
386 strlen(dbg_info[i].name)) == 0) {
387 sc->debug.level ^= dbg_info[i].level; /* toggle bit */
388 break;
389 }
390 }
391 return count;
392}
393
394static const struct file_operations fops_debug = {
395 .read = read_file_debug,
396 .write = write_file_debug,
397 .open = ath5k_debugfs_open,
398 .owner = THIS_MODULE,
399};
400
401
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200402/* init */
403
404void
405ath5k_debug_init(void)
406{
407 ath5k_global_debugfs = debugfs_create_dir("ath5k", NULL);
408}
409
410void
411ath5k_debug_init_device(struct ath5k_softc *sc)
412{
413 sc->debug.level = ath5k_debug;
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900414
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200415 sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900416 ath5k_global_debugfs);
417
418 sc->debug.debugfs_debug = debugfs_create_file("debug", 0666,
419 sc->debug.debugfs_phydir, sc, &fops_debug);
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200420
421 sc->debug.debugfs_registers = debugfs_create_file("registers", 0444,
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900422 sc->debug.debugfs_phydir, sc, &fops_registers);
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200423
424 sc->debug.debugfs_tsf = debugfs_create_file("tsf", 0666,
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900425 sc->debug.debugfs_phydir, sc, &fops_tsf);
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200426
427 sc->debug.debugfs_beacon = debugfs_create_file("beacon", 0666,
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900428 sc->debug.debugfs_phydir, sc, &fops_beacon);
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200429
430 sc->debug.debugfs_reset = debugfs_create_file("reset", 0222,
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900431 sc->debug.debugfs_phydir, sc, &fops_reset);
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200432}
433
434void
435ath5k_debug_finish(void)
436{
437 debugfs_remove(ath5k_global_debugfs);
438}
439
440void
441ath5k_debug_finish_device(struct ath5k_softc *sc)
442{
443 debugfs_remove(sc->debug.debugfs_debug);
444 debugfs_remove(sc->debug.debugfs_registers);
445 debugfs_remove(sc->debug.debugfs_tsf);
446 debugfs_remove(sc->debug.debugfs_beacon);
447 debugfs_remove(sc->debug.debugfs_reset);
448 debugfs_remove(sc->debug.debugfs_phydir);
449}
450
451
452/* functions used in other places */
453
454void
455ath5k_debug_dump_modes(struct ath5k_softc *sc, struct ieee80211_hw_mode *modes)
456{
457 unsigned int m, i;
458
459 if (likely(!(sc->debug.level & ATH5K_DEBUG_DUMPMODES)))
460 return;
461
462 for (m = 0; m < NUM_DRIVER_MODES; m++) {
463 printk(KERN_DEBUG "Mode %u: channels %d, rates %d\n", m,
464 modes[m].num_channels, modes[m].num_rates);
465 printk(KERN_DEBUG " channels:\n");
466 for (i = 0; i < modes[m].num_channels; i++)
467 printk(KERN_DEBUG " %3d %d %.4x %.4x\n",
468 modes[m].channels[i].chan,
469 modes[m].channels[i].freq,
470 modes[m].channels[i].val,
471 modes[m].channels[i].flag);
472 printk(KERN_DEBUG " rates:\n");
473 for (i = 0; i < modes[m].num_rates; i++)
474 printk(KERN_DEBUG " %4d %.4x %.4x %.4x\n",
475 modes[m].rates[i].rate,
476 modes[m].rates[i].val,
477 modes[m].rates[i].flags,
478 modes[m].rates[i].val2);
479 }
480}
481
482static inline void
483ath5k_debug_printrxbuf(struct ath5k_buf *bf, int done)
484{
485 struct ath5k_desc *ds = bf->desc;
486
487 printk(KERN_DEBUG "R (%p %llx) %08x %08x %08x %08x %08x %08x %c\n",
488 ds, (unsigned long long)bf->daddr,
489 ds->ds_link, ds->ds_data, ds->ds_ctl0, ds->ds_ctl1,
490 ds->ds_hw[0], ds->ds_hw[1],
491 !done ? ' ' : (ds->ds_rxstat.rs_status == 0) ? '*' : '!');
492}
493
494void
495ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah)
496{
497 struct ath5k_desc *ds;
498 struct ath5k_buf *bf;
499 int status;
500
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900501 if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET)))
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200502 return;
503
504 printk(KERN_DEBUG "rx queue %x, link %p\n",
505 ath5k_hw_get_rx_buf(ah), sc->rxlink);
506
507 spin_lock_bh(&sc->rxbuflock);
508 list_for_each_entry(bf, &sc->rxbuf, list) {
509 ds = bf->desc;
510 status = ah->ah_proc_rx_desc(ah, ds);
Bruno Randolfbe9b7252008-01-23 10:27:51 +0900511 if (!status)
Jiri Slabyfa1c1142007-08-12 17:33:16 +0200512 ath5k_debug_printrxbuf(bf, status == 0);
513 }
514 spin_unlock_bh(&sc->rxbuflock);
515}
516
517void
518ath5k_debug_dump_skb(struct ath5k_softc *sc,
519 struct sk_buff *skb, const char *prefix, int tx)
520{
521 char buf[16];
522
523 if (likely(!((tx && (sc->debug.level & ATH5K_DEBUG_DUMP_TX)) ||
524 (!tx && (sc->debug.level & ATH5K_DEBUG_DUMP_RX)))))
525 return;
526
527 snprintf(buf, sizeof(buf), "%s %s", wiphy_name(sc->hw->wiphy), prefix);
528
529 print_hex_dump_bytes(buf, DUMP_PREFIX_NONE, skb->data,
530 min(200U, skb->len));
531
532 printk(KERN_DEBUG "\n");
533}
534
535void
536ath5k_debug_printtxbuf(struct ath5k_softc *sc,
537 struct ath5k_buf *bf, int done)
538{
539 struct ath5k_desc *ds = bf->desc;
540
541 if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET)))
542 return;
543
544 printk(KERN_DEBUG "T (%p %llx) %08x %08x %08x %08x %08x %08x %08x "
545 "%08x %c\n", ds, (unsigned long long)bf->daddr, ds->ds_link,
546 ds->ds_data, ds->ds_ctl0, ds->ds_ctl1,
547 ds->ds_hw[0], ds->ds_hw[1], ds->ds_hw[2], ds->ds_hw[3],
548 !done ? ' ' : (ds->ds_txstat.ts_status == 0) ? '*' : '!');
549}
550
551#endif /* if ATH5K_DEBUG */