sfc: Don't use enums as a bitmask.
[zen-stable.git] / drivers / net / wireless / ath / ath9k / debug.c
blobbad1a87249b6011898027cce7300cea8358dbc49
1 /*
2 * Copyright (c) 2008-2009 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include <linux/slab.h>
18 #include <linux/vmalloc.h>
19 #include <asm/unaligned.h>
21 #include "ath9k.h"
23 #define REG_WRITE_D(_ah, _reg, _val) \
24 ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
25 #define REG_READ_D(_ah, _reg) \
26 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
28 static int ath9k_debugfs_open(struct inode *inode, struct file *file)
30 file->private_data = inode->i_private;
31 return 0;
34 static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf,
35 size_t count, loff_t *ppos)
37 u8 *buf = file->private_data;
38 return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
41 static int ath9k_debugfs_release_buf(struct inode *inode, struct file *file)
43 vfree(file->private_data);
44 return 0;
47 #ifdef CONFIG_ATH_DEBUG
49 static ssize_t read_file_debug(struct file *file, char __user *user_buf,
50 size_t count, loff_t *ppos)
52 struct ath_softc *sc = file->private_data;
53 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
54 char buf[32];
55 unsigned int len;
57 len = sprintf(buf, "0x%08x\n", common->debug_mask);
58 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
61 static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
62 size_t count, loff_t *ppos)
64 struct ath_softc *sc = file->private_data;
65 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
66 unsigned long mask;
67 char buf[32];
68 ssize_t len;
70 len = min(count, sizeof(buf) - 1);
71 if (copy_from_user(buf, user_buf, len))
72 return -EFAULT;
74 buf[len] = '\0';
75 if (strict_strtoul(buf, 0, &mask))
76 return -EINVAL;
78 common->debug_mask = mask;
79 return count;
82 static const struct file_operations fops_debug = {
83 .read = read_file_debug,
84 .write = write_file_debug,
85 .open = ath9k_debugfs_open,
86 .owner = THIS_MODULE,
87 .llseek = default_llseek,
90 #endif
92 #define DMA_BUF_LEN 1024
94 static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf,
95 size_t count, loff_t *ppos)
97 struct ath_softc *sc = file->private_data;
98 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
99 char buf[32];
100 unsigned int len;
102 len = sprintf(buf, "0x%08x\n", common->tx_chainmask);
103 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
106 static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf,
107 size_t count, loff_t *ppos)
109 struct ath_softc *sc = file->private_data;
110 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
111 unsigned long mask;
112 char buf[32];
113 ssize_t len;
115 len = min(count, sizeof(buf) - 1);
116 if (copy_from_user(buf, user_buf, len))
117 return -EFAULT;
119 buf[len] = '\0';
120 if (strict_strtoul(buf, 0, &mask))
121 return -EINVAL;
123 common->tx_chainmask = mask;
124 sc->sc_ah->caps.tx_chainmask = mask;
125 return count;
128 static const struct file_operations fops_tx_chainmask = {
129 .read = read_file_tx_chainmask,
130 .write = write_file_tx_chainmask,
131 .open = ath9k_debugfs_open,
132 .owner = THIS_MODULE,
133 .llseek = default_llseek,
137 static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
138 size_t count, loff_t *ppos)
140 struct ath_softc *sc = file->private_data;
141 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
142 char buf[32];
143 unsigned int len;
145 len = sprintf(buf, "0x%08x\n", common->rx_chainmask);
146 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
149 static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf,
150 size_t count, loff_t *ppos)
152 struct ath_softc *sc = file->private_data;
153 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
154 unsigned long mask;
155 char buf[32];
156 ssize_t len;
158 len = min(count, sizeof(buf) - 1);
159 if (copy_from_user(buf, user_buf, len))
160 return -EFAULT;
162 buf[len] = '\0';
163 if (strict_strtoul(buf, 0, &mask))
164 return -EINVAL;
166 common->rx_chainmask = mask;
167 sc->sc_ah->caps.rx_chainmask = mask;
168 return count;
171 static const struct file_operations fops_rx_chainmask = {
172 .read = read_file_rx_chainmask,
173 .write = write_file_rx_chainmask,
174 .open = ath9k_debugfs_open,
175 .owner = THIS_MODULE,
176 .llseek = default_llseek,
180 static ssize_t read_file_dma(struct file *file, char __user *user_buf,
181 size_t count, loff_t *ppos)
183 struct ath_softc *sc = file->private_data;
184 struct ath_hw *ah = sc->sc_ah;
185 char *buf;
186 int retval;
187 unsigned int len = 0;
188 u32 val[ATH9K_NUM_DMA_DEBUG_REGS];
189 int i, qcuOffset = 0, dcuOffset = 0;
190 u32 *qcuBase = &val[0], *dcuBase = &val[4];
192 buf = kmalloc(DMA_BUF_LEN, GFP_KERNEL);
193 if (!buf)
194 return -ENOMEM;
196 ath9k_ps_wakeup(sc);
198 REG_WRITE_D(ah, AR_MACMISC,
199 ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
200 (AR_MACMISC_MISC_OBS_BUS_1 <<
201 AR_MACMISC_MISC_OBS_BUS_MSB_S)));
203 len += snprintf(buf + len, DMA_BUF_LEN - len,
204 "Raw DMA Debug values:\n");
206 for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) {
207 if (i % 4 == 0)
208 len += snprintf(buf + len, DMA_BUF_LEN - len, "\n");
210 val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32)));
211 len += snprintf(buf + len, DMA_BUF_LEN - len, "%d: %08x ",
212 i, val[i]);
215 len += snprintf(buf + len, DMA_BUF_LEN - len, "\n\n");
216 len += snprintf(buf + len, DMA_BUF_LEN - len,
217 "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
219 for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) {
220 if (i == 8) {
221 qcuOffset = 0;
222 qcuBase++;
225 if (i == 6) {
226 dcuOffset = 0;
227 dcuBase++;
230 len += snprintf(buf + len, DMA_BUF_LEN - len,
231 "%2d %2x %1x %2x %2x\n",
232 i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset,
233 (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3),
234 val[2] & (0x7 << (i * 3)) >> (i * 3),
235 (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset);
238 len += snprintf(buf + len, DMA_BUF_LEN - len, "\n");
240 len += snprintf(buf + len, DMA_BUF_LEN - len,
241 "qcu_stitch state: %2x qcu_fetch state: %2x\n",
242 (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22);
243 len += snprintf(buf + len, DMA_BUF_LEN - len,
244 "qcu_complete state: %2x dcu_complete state: %2x\n",
245 (val[3] & 0x1c000000) >> 26, (val[6] & 0x3));
246 len += snprintf(buf + len, DMA_BUF_LEN - len,
247 "dcu_arb state: %2x dcu_fp state: %2x\n",
248 (val[5] & 0x06000000) >> 25, (val[5] & 0x38000000) >> 27);
249 len += snprintf(buf + len, DMA_BUF_LEN - len,
250 "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n",
251 (val[6] & 0x000003fc) >> 2, (val[6] & 0x00000400) >> 10);
252 len += snprintf(buf + len, DMA_BUF_LEN - len,
253 "txfifo_valid_0: %1d txfifo_valid_1: %1d\n",
254 (val[6] & 0x00000800) >> 11, (val[6] & 0x00001000) >> 12);
255 len += snprintf(buf + len, DMA_BUF_LEN - len,
256 "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n",
257 (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17);
259 len += snprintf(buf + len, DMA_BUF_LEN - len, "pcu observe: 0x%x\n",
260 REG_READ_D(ah, AR_OBS_BUS_1));
261 len += snprintf(buf + len, DMA_BUF_LEN - len,
262 "AR_CR: 0x%x\n", REG_READ_D(ah, AR_CR));
264 ath9k_ps_restore(sc);
266 if (len > DMA_BUF_LEN)
267 len = DMA_BUF_LEN;
269 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
270 kfree(buf);
271 return retval;
274 static const struct file_operations fops_dma = {
275 .read = read_file_dma,
276 .open = ath9k_debugfs_open,
277 .owner = THIS_MODULE,
278 .llseek = default_llseek,
282 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status)
284 if (status)
285 sc->debug.stats.istats.total++;
286 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
287 if (status & ATH9K_INT_RXLP)
288 sc->debug.stats.istats.rxlp++;
289 if (status & ATH9K_INT_RXHP)
290 sc->debug.stats.istats.rxhp++;
291 if (status & ATH9K_INT_BB_WATCHDOG)
292 sc->debug.stats.istats.bb_watchdog++;
293 } else {
294 if (status & ATH9K_INT_RX)
295 sc->debug.stats.istats.rxok++;
297 if (status & ATH9K_INT_RXEOL)
298 sc->debug.stats.istats.rxeol++;
299 if (status & ATH9K_INT_RXORN)
300 sc->debug.stats.istats.rxorn++;
301 if (status & ATH9K_INT_TX)
302 sc->debug.stats.istats.txok++;
303 if (status & ATH9K_INT_TXURN)
304 sc->debug.stats.istats.txurn++;
305 if (status & ATH9K_INT_MIB)
306 sc->debug.stats.istats.mib++;
307 if (status & ATH9K_INT_RXPHY)
308 sc->debug.stats.istats.rxphyerr++;
309 if (status & ATH9K_INT_RXKCM)
310 sc->debug.stats.istats.rx_keycache_miss++;
311 if (status & ATH9K_INT_SWBA)
312 sc->debug.stats.istats.swba++;
313 if (status & ATH9K_INT_BMISS)
314 sc->debug.stats.istats.bmiss++;
315 if (status & ATH9K_INT_BNR)
316 sc->debug.stats.istats.bnr++;
317 if (status & ATH9K_INT_CST)
318 sc->debug.stats.istats.cst++;
319 if (status & ATH9K_INT_GTT)
320 sc->debug.stats.istats.gtt++;
321 if (status & ATH9K_INT_TIM)
322 sc->debug.stats.istats.tim++;
323 if (status & ATH9K_INT_CABEND)
324 sc->debug.stats.istats.cabend++;
325 if (status & ATH9K_INT_DTIMSYNC)
326 sc->debug.stats.istats.dtimsync++;
327 if (status & ATH9K_INT_DTIM)
328 sc->debug.stats.istats.dtim++;
329 if (status & ATH9K_INT_TSFOOR)
330 sc->debug.stats.istats.tsfoor++;
333 static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
334 size_t count, loff_t *ppos)
336 struct ath_softc *sc = file->private_data;
337 char buf[512];
338 unsigned int len = 0;
340 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
341 len += snprintf(buf + len, sizeof(buf) - len,
342 "%8s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);
343 len += snprintf(buf + len, sizeof(buf) - len,
344 "%8s: %10u\n", "RXHP", sc->debug.stats.istats.rxhp);
345 len += snprintf(buf + len, sizeof(buf) - len,
346 "%8s: %10u\n", "WATCHDOG",
347 sc->debug.stats.istats.bb_watchdog);
348 } else {
349 len += snprintf(buf + len, sizeof(buf) - len,
350 "%8s: %10u\n", "RX", sc->debug.stats.istats.rxok);
352 len += snprintf(buf + len, sizeof(buf) - len,
353 "%8s: %10u\n", "RXEOL", sc->debug.stats.istats.rxeol);
354 len += snprintf(buf + len, sizeof(buf) - len,
355 "%8s: %10u\n", "RXORN", sc->debug.stats.istats.rxorn);
356 len += snprintf(buf + len, sizeof(buf) - len,
357 "%8s: %10u\n", "TX", sc->debug.stats.istats.txok);
358 len += snprintf(buf + len, sizeof(buf) - len,
359 "%8s: %10u\n", "TXURN", sc->debug.stats.istats.txurn);
360 len += snprintf(buf + len, sizeof(buf) - len,
361 "%8s: %10u\n", "MIB", sc->debug.stats.istats.mib);
362 len += snprintf(buf + len, sizeof(buf) - len,
363 "%8s: %10u\n", "RXPHY", sc->debug.stats.istats.rxphyerr);
364 len += snprintf(buf + len, sizeof(buf) - len,
365 "%8s: %10u\n", "RXKCM", sc->debug.stats.istats.rx_keycache_miss);
366 len += snprintf(buf + len, sizeof(buf) - len,
367 "%8s: %10u\n", "SWBA", sc->debug.stats.istats.swba);
368 len += snprintf(buf + len, sizeof(buf) - len,
369 "%8s: %10u\n", "BMISS", sc->debug.stats.istats.bmiss);
370 len += snprintf(buf + len, sizeof(buf) - len,
371 "%8s: %10u\n", "BNR", sc->debug.stats.istats.bnr);
372 len += snprintf(buf + len, sizeof(buf) - len,
373 "%8s: %10u\n", "CST", sc->debug.stats.istats.cst);
374 len += snprintf(buf + len, sizeof(buf) - len,
375 "%8s: %10u\n", "GTT", sc->debug.stats.istats.gtt);
376 len += snprintf(buf + len, sizeof(buf) - len,
377 "%8s: %10u\n", "TIM", sc->debug.stats.istats.tim);
378 len += snprintf(buf + len, sizeof(buf) - len,
379 "%8s: %10u\n", "CABEND", sc->debug.stats.istats.cabend);
380 len += snprintf(buf + len, sizeof(buf) - len,
381 "%8s: %10u\n", "DTIMSYNC", sc->debug.stats.istats.dtimsync);
382 len += snprintf(buf + len, sizeof(buf) - len,
383 "%8s: %10u\n", "DTIM", sc->debug.stats.istats.dtim);
384 len += snprintf(buf + len, sizeof(buf) - len,
385 "%8s: %10u\n", "TSFOOR", sc->debug.stats.istats.tsfoor);
386 len += snprintf(buf + len, sizeof(buf) - len,
387 "%8s: %10u\n", "TOTAL", sc->debug.stats.istats.total);
390 if (len > sizeof(buf))
391 len = sizeof(buf);
393 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
396 static const struct file_operations fops_interrupt = {
397 .read = read_file_interrupt,
398 .open = ath9k_debugfs_open,
399 .owner = THIS_MODULE,
400 .llseek = default_llseek,
403 static const char *channel_type_str(enum nl80211_channel_type t)
405 switch (t) {
406 case NL80211_CHAN_NO_HT:
407 return "no ht";
408 case NL80211_CHAN_HT20:
409 return "ht20";
410 case NL80211_CHAN_HT40MINUS:
411 return "ht40-";
412 case NL80211_CHAN_HT40PLUS:
413 return "ht40+";
414 default:
415 return "???";
419 static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
420 size_t count, loff_t *ppos)
422 struct ath_softc *sc = file->private_data;
423 struct ieee80211_channel *chan = sc->hw->conf.channel;
424 struct ieee80211_conf *conf = &(sc->hw->conf);
425 char buf[512];
426 unsigned int len = 0;
427 u8 addr[ETH_ALEN];
428 u32 tmp;
430 len += snprintf(buf + len, sizeof(buf) - len,
431 "%s (chan=%d center-freq: %d MHz channel-type: %d (%s))\n",
432 wiphy_name(sc->hw->wiphy),
433 ieee80211_frequency_to_channel(chan->center_freq),
434 chan->center_freq,
435 conf->channel_type,
436 channel_type_str(conf->channel_type));
438 put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr);
439 put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4);
440 len += snprintf(buf + len, sizeof(buf) - len,
441 "addr: %pM\n", addr);
442 put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_BSSMSKL), addr);
443 put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_BSSMSKU) & 0xffff, addr + 4);
444 len += snprintf(buf + len, sizeof(buf) - len,
445 "addrmask: %pM\n", addr);
446 tmp = ath9k_hw_getrxfilter(sc->sc_ah);
447 len += snprintf(buf + len, sizeof(buf) - len,
448 "rfilt: 0x%x", tmp);
449 if (tmp & ATH9K_RX_FILTER_UCAST)
450 len += snprintf(buf + len, sizeof(buf) - len, " UCAST");
451 if (tmp & ATH9K_RX_FILTER_MCAST)
452 len += snprintf(buf + len, sizeof(buf) - len, " MCAST");
453 if (tmp & ATH9K_RX_FILTER_BCAST)
454 len += snprintf(buf + len, sizeof(buf) - len, " BCAST");
455 if (tmp & ATH9K_RX_FILTER_CONTROL)
456 len += snprintf(buf + len, sizeof(buf) - len, " CONTROL");
457 if (tmp & ATH9K_RX_FILTER_BEACON)
458 len += snprintf(buf + len, sizeof(buf) - len, " BEACON");
459 if (tmp & ATH9K_RX_FILTER_PROM)
460 len += snprintf(buf + len, sizeof(buf) - len, " PROM");
461 if (tmp & ATH9K_RX_FILTER_PROBEREQ)
462 len += snprintf(buf + len, sizeof(buf) - len, " PROBEREQ");
463 if (tmp & ATH9K_RX_FILTER_PHYERR)
464 len += snprintf(buf + len, sizeof(buf) - len, " PHYERR");
465 if (tmp & ATH9K_RX_FILTER_MYBEACON)
466 len += snprintf(buf + len, sizeof(buf) - len, " MYBEACON");
467 if (tmp & ATH9K_RX_FILTER_COMP_BAR)
468 len += snprintf(buf + len, sizeof(buf) - len, " COMP_BAR");
469 if (tmp & ATH9K_RX_FILTER_PSPOLL)
470 len += snprintf(buf + len, sizeof(buf) - len, " PSPOLL");
471 if (tmp & ATH9K_RX_FILTER_PHYRADAR)
472 len += snprintf(buf + len, sizeof(buf) - len, " PHYRADAR");
473 if (tmp & ATH9K_RX_FILTER_MCAST_BCAST_ALL)
474 len += snprintf(buf + len, sizeof(buf) - len, " MCAST_BCAST_ALL\n");
475 else
476 len += snprintf(buf + len, sizeof(buf) - len, "\n");
478 if (len > sizeof(buf))
479 len = sizeof(buf);
481 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
484 static const struct file_operations fops_wiphy = {
485 .read = read_file_wiphy,
486 .open = ath9k_debugfs_open,
487 .owner = THIS_MODULE,
488 .llseek = default_llseek,
491 #define PR_QNUM(_n) sc->tx.txq_map[_n]->axq_qnum
492 #define PR(str, elem) \
493 do { \
494 len += snprintf(buf + len, size - len, \
495 "%s%13u%11u%10u%10u\n", str, \
496 sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].elem, \
497 sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].elem, \
498 sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].elem, \
499 sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].elem); \
500 if (len >= size) \
501 goto done; \
502 } while(0)
504 #define PRX(str, elem) \
505 do { \
506 len += snprintf(buf + len, size - len, \
507 "%s%13u%11u%10u%10u\n", str, \
508 (unsigned int)(sc->tx.txq_map[WME_AC_BE]->elem), \
509 (unsigned int)(sc->tx.txq_map[WME_AC_BK]->elem), \
510 (unsigned int)(sc->tx.txq_map[WME_AC_VI]->elem), \
511 (unsigned int)(sc->tx.txq_map[WME_AC_VO]->elem)); \
512 if (len >= size) \
513 goto done; \
514 } while(0)
516 #define PRQLE(str, elem) \
517 do { \
518 len += snprintf(buf + len, size - len, \
519 "%s%13i%11i%10i%10i\n", str, \
520 list_empty(&sc->tx.txq_map[WME_AC_BE]->elem), \
521 list_empty(&sc->tx.txq_map[WME_AC_BK]->elem), \
522 list_empty(&sc->tx.txq_map[WME_AC_VI]->elem), \
523 list_empty(&sc->tx.txq_map[WME_AC_VO]->elem)); \
524 if (len >= size) \
525 goto done; \
526 } while (0)
528 static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
529 size_t count, loff_t *ppos)
531 struct ath_softc *sc = file->private_data;
532 char *buf;
533 unsigned int len = 0, size = 8000;
534 int i;
535 ssize_t retval = 0;
536 char tmp[32];
538 buf = kzalloc(size, GFP_KERNEL);
539 if (buf == NULL)
540 return -ENOMEM;
542 len += sprintf(buf, "Num-Tx-Queues: %i tx-queues-setup: 0x%x"
543 " poll-work-seen: %u\n"
544 "%30s %10s%10s%10s\n\n",
545 ATH9K_NUM_TX_QUEUES, sc->tx.txqsetup,
546 sc->tx_complete_poll_work_seen,
547 "BE", "BK", "VI", "VO");
549 PR("MPDUs Queued: ", queued);
550 PR("MPDUs Completed: ", completed);
551 PR("Aggregates: ", a_aggr);
552 PR("AMPDUs Queued HW:", a_queued_hw);
553 PR("AMPDUs Queued SW:", a_queued_sw);
554 PR("AMPDUs Completed:", a_completed);
555 PR("AMPDUs Retried: ", a_retries);
556 PR("AMPDUs XRetried: ", a_xretries);
557 PR("FIFO Underrun: ", fifo_underrun);
558 PR("TXOP Exceeded: ", xtxop);
559 PR("TXTIMER Expiry: ", timer_exp);
560 PR("DESC CFG Error: ", desc_cfg_err);
561 PR("DATA Underrun: ", data_underrun);
562 PR("DELIM Underrun: ", delim_underrun);
563 PR("TX-Pkts-All: ", tx_pkts_all);
564 PR("TX-Bytes-All: ", tx_bytes_all);
565 PR("hw-put-tx-buf: ", puttxbuf);
566 PR("hw-tx-start: ", txstart);
567 PR("hw-tx-proc-desc: ", txprocdesc);
568 len += snprintf(buf + len, size - len,
569 "%s%11p%11p%10p%10p\n", "txq-memory-address:",
570 sc->tx.txq_map[WME_AC_BE],
571 sc->tx.txq_map[WME_AC_BK],
572 sc->tx.txq_map[WME_AC_VI],
573 sc->tx.txq_map[WME_AC_VO]);
574 if (len >= size)
575 goto done;
577 PRX("axq-qnum: ", axq_qnum);
578 PRX("axq-depth: ", axq_depth);
579 PRX("axq-ampdu_depth: ", axq_ampdu_depth);
580 PRX("axq-stopped ", stopped);
581 PRX("tx-in-progress ", axq_tx_inprogress);
582 PRX("pending-frames ", pending_frames);
583 PRX("txq_headidx: ", txq_headidx);
584 PRX("txq_tailidx: ", txq_headidx);
586 PRQLE("axq_q empty: ", axq_q);
587 PRQLE("axq_acq empty: ", axq_acq);
588 PRQLE("txq_fifo_pending: ", txq_fifo_pending);
589 for (i = 0; i < ATH_TXFIFO_DEPTH; i++) {
590 snprintf(tmp, sizeof(tmp) - 1, "txq_fifo[%i] empty: ", i);
591 PRQLE(tmp, txq_fifo[i]);
594 /* Print out more detailed queue-info */
595 for (i = 0; i <= WME_AC_BK; i++) {
596 struct ath_txq *txq = &(sc->tx.txq[i]);
597 struct ath_atx_ac *ac;
598 struct ath_atx_tid *tid;
599 if (len >= size)
600 goto done;
601 spin_lock_bh(&txq->axq_lock);
602 if (!list_empty(&txq->axq_acq)) {
603 ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac,
604 list);
605 len += snprintf(buf + len, size - len,
606 "txq[%i] first-ac: %p sched: %i\n",
607 i, ac, ac->sched);
608 if (list_empty(&ac->tid_q) || (len >= size))
609 goto done_for;
610 tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
611 list);
612 len += snprintf(buf + len, size - len,
613 " first-tid: %p sched: %i paused: %i\n",
614 tid, tid->sched, tid->paused);
616 done_for:
617 spin_unlock_bh(&txq->axq_lock);
620 done:
621 if (len > size)
622 len = size;
624 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
625 kfree(buf);
627 return retval;
630 static ssize_t read_file_stations(struct file *file, char __user *user_buf,
631 size_t count, loff_t *ppos)
633 struct ath_softc *sc = file->private_data;
634 char *buf;
635 unsigned int len = 0, size = 64000;
636 struct ath_node *an = NULL;
637 ssize_t retval = 0;
638 int q;
640 buf = kzalloc(size, GFP_KERNEL);
641 if (buf == NULL)
642 return -ENOMEM;
644 len += snprintf(buf + len, size - len,
645 "Stations:\n"
646 " tid: addr sched paused buf_q-empty an ac\n"
647 " ac: addr sched tid_q-empty txq\n");
649 spin_lock(&sc->nodes_lock);
650 list_for_each_entry(an, &sc->nodes, list) {
651 len += snprintf(buf + len, size - len,
652 "%pM\n", an->sta->addr);
653 if (len >= size)
654 goto done;
656 for (q = 0; q < WME_NUM_TID; q++) {
657 struct ath_atx_tid *tid = &(an->tid[q]);
658 len += snprintf(buf + len, size - len,
659 " tid: %p %s %s %i %p %p\n",
660 tid, tid->sched ? "sched" : "idle",
661 tid->paused ? "paused" : "running",
662 list_empty(&tid->buf_q),
663 tid->an, tid->ac);
664 if (len >= size)
665 goto done;
668 for (q = 0; q < WME_NUM_AC; q++) {
669 struct ath_atx_ac *ac = &(an->ac[q]);
670 len += snprintf(buf + len, size - len,
671 " ac: %p %s %i %p\n",
672 ac, ac->sched ? "sched" : "idle",
673 list_empty(&ac->tid_q), ac->txq);
674 if (len >= size)
675 goto done;
679 done:
680 spin_unlock(&sc->nodes_lock);
681 if (len > size)
682 len = size;
684 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
685 kfree(buf);
687 return retval;
690 static ssize_t read_file_misc(struct file *file, char __user *user_buf,
691 size_t count, loff_t *ppos)
693 struct ath_softc *sc = file->private_data;
694 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
695 struct ath_hw *ah = sc->sc_ah;
696 struct ieee80211_hw *hw = sc->hw;
697 char *buf;
698 unsigned int len = 0, size = 8000;
699 ssize_t retval = 0;
700 const char *tmp;
701 unsigned int reg;
702 struct ath9k_vif_iter_data iter_data;
704 ath9k_calculate_iter_data(hw, NULL, &iter_data);
706 buf = kzalloc(size, GFP_KERNEL);
707 if (buf == NULL)
708 return -ENOMEM;
710 switch (sc->sc_ah->opmode) {
711 case NL80211_IFTYPE_ADHOC:
712 tmp = "ADHOC";
713 break;
714 case NL80211_IFTYPE_MESH_POINT:
715 tmp = "MESH";
716 break;
717 case NL80211_IFTYPE_AP:
718 tmp = "AP";
719 break;
720 case NL80211_IFTYPE_STATION:
721 tmp = "STATION";
722 break;
723 default:
724 tmp = "???";
725 break;
728 len += snprintf(buf + len, size - len,
729 "curbssid: %pM\n"
730 "OP-Mode: %s(%i)\n"
731 "Beacon-Timer-Register: 0x%x\n",
732 common->curbssid,
733 tmp, (int)(sc->sc_ah->opmode),
734 REG_READ(ah, AR_BEACON_PERIOD));
736 reg = REG_READ(ah, AR_TIMER_MODE);
737 len += snprintf(buf + len, size - len, "Timer-Mode-Register: 0x%x (",
738 reg);
739 if (reg & AR_TBTT_TIMER_EN)
740 len += snprintf(buf + len, size - len, "TBTT ");
741 if (reg & AR_DBA_TIMER_EN)
742 len += snprintf(buf + len, size - len, "DBA ");
743 if (reg & AR_SWBA_TIMER_EN)
744 len += snprintf(buf + len, size - len, "SWBA ");
745 if (reg & AR_HCF_TIMER_EN)
746 len += snprintf(buf + len, size - len, "HCF ");
747 if (reg & AR_TIM_TIMER_EN)
748 len += snprintf(buf + len, size - len, "TIM ");
749 if (reg & AR_DTIM_TIMER_EN)
750 len += snprintf(buf + len, size - len, "DTIM ");
751 len += snprintf(buf + len, size - len, ")\n");
753 reg = sc->sc_ah->imask;
754 len += snprintf(buf + len, size - len, "imask: 0x%x (", reg);
755 if (reg & ATH9K_INT_SWBA)
756 len += snprintf(buf + len, size - len, "SWBA ");
757 if (reg & ATH9K_INT_BMISS)
758 len += snprintf(buf + len, size - len, "BMISS ");
759 if (reg & ATH9K_INT_CST)
760 len += snprintf(buf + len, size - len, "CST ");
761 if (reg & ATH9K_INT_RX)
762 len += snprintf(buf + len, size - len, "RX ");
763 if (reg & ATH9K_INT_RXHP)
764 len += snprintf(buf + len, size - len, "RXHP ");
765 if (reg & ATH9K_INT_RXLP)
766 len += snprintf(buf + len, size - len, "RXLP ");
767 if (reg & ATH9K_INT_BB_WATCHDOG)
768 len += snprintf(buf + len, size - len, "BB_WATCHDOG ");
769 /* there are other IRQs if one wanted to add them. */
770 len += snprintf(buf + len, size - len, ")\n");
772 len += snprintf(buf + len, size - len,
773 "VIF Counts: AP: %i STA: %i MESH: %i WDS: %i"
774 " ADHOC: %i OTHER: %i nvifs: %hi beacon-vifs: %hi\n",
775 iter_data.naps, iter_data.nstations, iter_data.nmeshes,
776 iter_data.nwds, iter_data.nadhocs, iter_data.nothers,
777 sc->nvifs, sc->nbcnvifs);
779 len += snprintf(buf + len, size - len,
780 "Calculated-BSSID-Mask: %pM\n",
781 iter_data.mask);
783 if (len > size)
784 len = size;
786 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
787 kfree(buf);
789 return retval;
792 void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
793 struct ath_tx_status *ts, struct ath_txq *txq)
795 int qnum = txq->axq_qnum;
797 TX_STAT_INC(qnum, tx_pkts_all);
798 sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len;
800 if (bf_isampdu(bf)) {
801 if (bf_isxretried(bf))
802 TX_STAT_INC(qnum, a_xretries);
803 else
804 TX_STAT_INC(qnum, a_completed);
805 } else {
806 TX_STAT_INC(qnum, completed);
809 if (ts->ts_status & ATH9K_TXERR_FIFO)
810 TX_STAT_INC(qnum, fifo_underrun);
811 if (ts->ts_status & ATH9K_TXERR_XTXOP)
812 TX_STAT_INC(qnum, xtxop);
813 if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED)
814 TX_STAT_INC(qnum, timer_exp);
815 if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR)
816 TX_STAT_INC(qnum, desc_cfg_err);
817 if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN)
818 TX_STAT_INC(qnum, data_underrun);
819 if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
820 TX_STAT_INC(qnum, delim_underrun);
823 static const struct file_operations fops_xmit = {
824 .read = read_file_xmit,
825 .open = ath9k_debugfs_open,
826 .owner = THIS_MODULE,
827 .llseek = default_llseek,
830 static const struct file_operations fops_stations = {
831 .read = read_file_stations,
832 .open = ath9k_debugfs_open,
833 .owner = THIS_MODULE,
834 .llseek = default_llseek,
837 static const struct file_operations fops_misc = {
838 .read = read_file_misc,
839 .open = ath9k_debugfs_open,
840 .owner = THIS_MODULE,
841 .llseek = default_llseek,
844 static ssize_t read_file_recv(struct file *file, char __user *user_buf,
845 size_t count, loff_t *ppos)
847 #define PHY_ERR(s, p) \
848 len += snprintf(buf + len, size - len, "%18s : %10u\n", s, \
849 sc->debug.stats.rxstats.phy_err_stats[p]);
851 struct ath_softc *sc = file->private_data;
852 char *buf;
853 unsigned int len = 0, size = 1400;
854 ssize_t retval = 0;
856 buf = kzalloc(size, GFP_KERNEL);
857 if (buf == NULL)
858 return -ENOMEM;
860 len += snprintf(buf + len, size - len,
861 "%18s : %10u\n", "CRC ERR",
862 sc->debug.stats.rxstats.crc_err);
863 len += snprintf(buf + len, size - len,
864 "%18s : %10u\n", "DECRYPT CRC ERR",
865 sc->debug.stats.rxstats.decrypt_crc_err);
866 len += snprintf(buf + len, size - len,
867 "%18s : %10u\n", "PHY ERR",
868 sc->debug.stats.rxstats.phy_err);
869 len += snprintf(buf + len, size - len,
870 "%18s : %10u\n", "MIC ERR",
871 sc->debug.stats.rxstats.mic_err);
872 len += snprintf(buf + len, size - len,
873 "%18s : %10u\n", "PRE-DELIM CRC ERR",
874 sc->debug.stats.rxstats.pre_delim_crc_err);
875 len += snprintf(buf + len, size - len,
876 "%18s : %10u\n", "POST-DELIM CRC ERR",
877 sc->debug.stats.rxstats.post_delim_crc_err);
878 len += snprintf(buf + len, size - len,
879 "%18s : %10u\n", "DECRYPT BUSY ERR",
880 sc->debug.stats.rxstats.decrypt_busy_err);
882 len += snprintf(buf + len, size - len,
883 "%18s : %10d\n", "RSSI-CTL0",
884 sc->debug.stats.rxstats.rs_rssi_ctl0);
886 len += snprintf(buf + len, size - len,
887 "%18s : %10d\n", "RSSI-CTL1",
888 sc->debug.stats.rxstats.rs_rssi_ctl1);
890 len += snprintf(buf + len, size - len,
891 "%18s : %10d\n", "RSSI-CTL2",
892 sc->debug.stats.rxstats.rs_rssi_ctl2);
894 len += snprintf(buf + len, size - len,
895 "%18s : %10d\n", "RSSI-EXT0",
896 sc->debug.stats.rxstats.rs_rssi_ext0);
898 len += snprintf(buf + len, size - len,
899 "%18s : %10d\n", "RSSI-EXT1",
900 sc->debug.stats.rxstats.rs_rssi_ext1);
902 len += snprintf(buf + len, size - len,
903 "%18s : %10d\n", "RSSI-EXT2",
904 sc->debug.stats.rxstats.rs_rssi_ext2);
906 len += snprintf(buf + len, size - len,
907 "%18s : %10d\n", "Rx Antenna",
908 sc->debug.stats.rxstats.rs_antenna);
910 PHY_ERR("UNDERRUN", ATH9K_PHYERR_UNDERRUN);
911 PHY_ERR("TIMING", ATH9K_PHYERR_TIMING);
912 PHY_ERR("PARITY", ATH9K_PHYERR_PARITY);
913 PHY_ERR("RATE", ATH9K_PHYERR_RATE);
914 PHY_ERR("LENGTH", ATH9K_PHYERR_LENGTH);
915 PHY_ERR("RADAR", ATH9K_PHYERR_RADAR);
916 PHY_ERR("SERVICE", ATH9K_PHYERR_SERVICE);
917 PHY_ERR("TOR", ATH9K_PHYERR_TOR);
918 PHY_ERR("OFDM-TIMING", ATH9K_PHYERR_OFDM_TIMING);
919 PHY_ERR("OFDM-SIGNAL-PARITY", ATH9K_PHYERR_OFDM_SIGNAL_PARITY);
920 PHY_ERR("OFDM-RATE", ATH9K_PHYERR_OFDM_RATE_ILLEGAL);
921 PHY_ERR("OFDM-LENGTH", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL);
922 PHY_ERR("OFDM-POWER-DROP", ATH9K_PHYERR_OFDM_POWER_DROP);
923 PHY_ERR("OFDM-SERVICE", ATH9K_PHYERR_OFDM_SERVICE);
924 PHY_ERR("OFDM-RESTART", ATH9K_PHYERR_OFDM_RESTART);
925 PHY_ERR("FALSE-RADAR-EXT", ATH9K_PHYERR_FALSE_RADAR_EXT);
926 PHY_ERR("CCK-TIMING", ATH9K_PHYERR_CCK_TIMING);
927 PHY_ERR("CCK-HEADER-CRC", ATH9K_PHYERR_CCK_HEADER_CRC);
928 PHY_ERR("CCK-RATE", ATH9K_PHYERR_CCK_RATE_ILLEGAL);
929 PHY_ERR("CCK-SERVICE", ATH9K_PHYERR_CCK_SERVICE);
930 PHY_ERR("CCK-RESTART", ATH9K_PHYERR_CCK_RESTART);
931 PHY_ERR("CCK-LENGTH", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL);
932 PHY_ERR("CCK-POWER-DROP", ATH9K_PHYERR_CCK_POWER_DROP);
933 PHY_ERR("HT-CRC", ATH9K_PHYERR_HT_CRC_ERROR);
934 PHY_ERR("HT-LENGTH", ATH9K_PHYERR_HT_LENGTH_ILLEGAL);
935 PHY_ERR("HT-RATE", ATH9K_PHYERR_HT_RATE_ILLEGAL);
937 len += snprintf(buf + len, size - len,
938 "%18s : %10u\n", "RX-Pkts-All",
939 sc->debug.stats.rxstats.rx_pkts_all);
940 len += snprintf(buf + len, size - len,
941 "%18s : %10u\n", "RX-Bytes-All",
942 sc->debug.stats.rxstats.rx_bytes_all);
944 if (len > size)
945 len = size;
947 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
948 kfree(buf);
950 return retval;
952 #undef PHY_ERR
955 void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
957 #define RX_STAT_INC(c) sc->debug.stats.rxstats.c++
958 #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++
960 u32 phyerr;
962 RX_STAT_INC(rx_pkts_all);
963 sc->debug.stats.rxstats.rx_bytes_all += rs->rs_datalen;
965 if (rs->rs_status & ATH9K_RXERR_CRC)
966 RX_STAT_INC(crc_err);
967 if (rs->rs_status & ATH9K_RXERR_DECRYPT)
968 RX_STAT_INC(decrypt_crc_err);
969 if (rs->rs_status & ATH9K_RXERR_MIC)
970 RX_STAT_INC(mic_err);
971 if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE)
972 RX_STAT_INC(pre_delim_crc_err);
973 if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST)
974 RX_STAT_INC(post_delim_crc_err);
975 if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY)
976 RX_STAT_INC(decrypt_busy_err);
978 if (rs->rs_status & ATH9K_RXERR_PHY) {
979 RX_STAT_INC(phy_err);
980 phyerr = rs->rs_phyerr & 0x24;
981 RX_PHY_ERR_INC(phyerr);
984 sc->debug.stats.rxstats.rs_rssi_ctl0 = rs->rs_rssi_ctl0;
985 sc->debug.stats.rxstats.rs_rssi_ctl1 = rs->rs_rssi_ctl1;
986 sc->debug.stats.rxstats.rs_rssi_ctl2 = rs->rs_rssi_ctl2;
988 sc->debug.stats.rxstats.rs_rssi_ext0 = rs->rs_rssi_ext0;
989 sc->debug.stats.rxstats.rs_rssi_ext1 = rs->rs_rssi_ext1;
990 sc->debug.stats.rxstats.rs_rssi_ext2 = rs->rs_rssi_ext2;
992 sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna;
994 #undef RX_STAT_INC
995 #undef RX_PHY_ERR_INC
998 static const struct file_operations fops_recv = {
999 .read = read_file_recv,
1000 .open = ath9k_debugfs_open,
1001 .owner = THIS_MODULE,
1002 .llseek = default_llseek,
1005 static ssize_t read_file_regidx(struct file *file, char __user *user_buf,
1006 size_t count, loff_t *ppos)
1008 struct ath_softc *sc = file->private_data;
1009 char buf[32];
1010 unsigned int len;
1012 len = sprintf(buf, "0x%08x\n", sc->debug.regidx);
1013 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1016 static ssize_t write_file_regidx(struct file *file, const char __user *user_buf,
1017 size_t count, loff_t *ppos)
1019 struct ath_softc *sc = file->private_data;
1020 unsigned long regidx;
1021 char buf[32];
1022 ssize_t len;
1024 len = min(count, sizeof(buf) - 1);
1025 if (copy_from_user(buf, user_buf, len))
1026 return -EFAULT;
1028 buf[len] = '\0';
1029 if (strict_strtoul(buf, 0, &regidx))
1030 return -EINVAL;
1032 sc->debug.regidx = regidx;
1033 return count;
1036 static const struct file_operations fops_regidx = {
1037 .read = read_file_regidx,
1038 .write = write_file_regidx,
1039 .open = ath9k_debugfs_open,
1040 .owner = THIS_MODULE,
1041 .llseek = default_llseek,
1044 static ssize_t read_file_regval(struct file *file, char __user *user_buf,
1045 size_t count, loff_t *ppos)
1047 struct ath_softc *sc = file->private_data;
1048 struct ath_hw *ah = sc->sc_ah;
1049 char buf[32];
1050 unsigned int len;
1051 u32 regval;
1053 regval = REG_READ_D(ah, sc->debug.regidx);
1054 len = sprintf(buf, "0x%08x\n", regval);
1055 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1058 static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
1059 size_t count, loff_t *ppos)
1061 struct ath_softc *sc = file->private_data;
1062 struct ath_hw *ah = sc->sc_ah;
1063 unsigned long regval;
1064 char buf[32];
1065 ssize_t len;
1067 len = min(count, sizeof(buf) - 1);
1068 if (copy_from_user(buf, user_buf, len))
1069 return -EFAULT;
1071 buf[len] = '\0';
1072 if (strict_strtoul(buf, 0, &regval))
1073 return -EINVAL;
1075 REG_WRITE_D(ah, sc->debug.regidx, regval);
1076 return count;
1079 static const struct file_operations fops_regval = {
1080 .read = read_file_regval,
1081 .write = write_file_regval,
1082 .open = ath9k_debugfs_open,
1083 .owner = THIS_MODULE,
1084 .llseek = default_llseek,
1087 #define REGDUMP_LINE_SIZE 20
1089 static int open_file_regdump(struct inode *inode, struct file *file)
1091 struct ath_softc *sc = inode->i_private;
1092 unsigned int len = 0;
1093 u8 *buf;
1094 int i;
1095 unsigned long num_regs, regdump_len, max_reg_offset;
1097 max_reg_offset = AR_SREV_9300_20_OR_LATER(sc->sc_ah) ? 0x16bd4 : 0xb500;
1098 num_regs = max_reg_offset / 4 + 1;
1099 regdump_len = num_regs * REGDUMP_LINE_SIZE + 1;
1100 buf = vmalloc(regdump_len);
1101 if (!buf)
1102 return -ENOMEM;
1104 ath9k_ps_wakeup(sc);
1105 for (i = 0; i < num_regs; i++)
1106 len += scnprintf(buf + len, regdump_len - len,
1107 "0x%06x 0x%08x\n", i << 2, REG_READ(sc->sc_ah, i << 2));
1108 ath9k_ps_restore(sc);
1110 file->private_data = buf;
1112 return 0;
1115 static const struct file_operations fops_regdump = {
1116 .open = open_file_regdump,
1117 .read = ath9k_debugfs_read_buf,
1118 .release = ath9k_debugfs_release_buf,
1119 .owner = THIS_MODULE,
1120 .llseek = default_llseek,/* read accesses f_pos */
1123 int ath9k_init_debug(struct ath_hw *ah)
1125 struct ath_common *common = ath9k_hw_common(ah);
1126 struct ath_softc *sc = (struct ath_softc *) common->priv;
1128 sc->debug.debugfs_phy = debugfs_create_dir("ath9k",
1129 sc->hw->wiphy->debugfsdir);
1130 if (!sc->debug.debugfs_phy)
1131 return -ENOMEM;
1133 #ifdef CONFIG_ATH_DEBUG
1134 debugfs_create_file("debug", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1135 sc, &fops_debug);
1136 #endif
1137 debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc,
1138 &fops_dma);
1139 debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
1140 &fops_interrupt);
1141 debugfs_create_file("wiphy", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1142 sc, &fops_wiphy);
1143 debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc,
1144 &fops_xmit);
1145 debugfs_create_file("stations", S_IRUSR, sc->debug.debugfs_phy, sc,
1146 &fops_stations);
1147 debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc,
1148 &fops_misc);
1149 debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc,
1150 &fops_recv);
1151 debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR,
1152 sc->debug.debugfs_phy, sc, &fops_rx_chainmask);
1153 debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR,
1154 sc->debug.debugfs_phy, sc, &fops_tx_chainmask);
1155 debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1156 sc, &fops_regidx);
1157 debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1158 sc, &fops_regval);
1159 debugfs_create_bool("ignore_extcca", S_IRUSR | S_IWUSR,
1160 sc->debug.debugfs_phy,
1161 &ah->config.cwm_ignore_extcca);
1162 debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc,
1163 &fops_regdump);
1165 debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
1166 sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
1168 debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
1169 sc->debug.debugfs_phy, &sc->sc_ah->gpio_val);
1171 sc->debug.regidx = 0;
1172 return 0;