debug.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  1. /*
  2. * Copyright (c) 2007-2008 Bruno Randolf <bruno@thinktube.com>
  3. *
  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. #include "base.h"
  61. #include "debug.h"
  62. static unsigned int ath5k_debug;
  63. module_param_named(debug, ath5k_debug, uint, 0);
  64. #ifdef CONFIG_ATH5K_DEBUG
  65. #include <linux/seq_file.h>
  66. #include "reg.h"
  67. #include "ani.h"
  68. static struct dentry *ath5k_global_debugfs;
  69. static int ath5k_debugfs_open(struct inode *inode, struct file *file)
  70. {
  71. file->private_data = inode->i_private;
  72. return 0;
  73. }
  74. /* debugfs: registers */
  75. struct reg {
  76. const char *name;
  77. int addr;
  78. };
  79. #define REG_STRUCT_INIT(r) { #r, r }
  80. /* just a few random registers, might want to add more */
  81. static const struct reg regs[] = {
  82. REG_STRUCT_INIT(AR5K_CR),
  83. REG_STRUCT_INIT(AR5K_RXDP),
  84. REG_STRUCT_INIT(AR5K_CFG),
  85. REG_STRUCT_INIT(AR5K_IER),
  86. REG_STRUCT_INIT(AR5K_BCR),
  87. REG_STRUCT_INIT(AR5K_RTSD0),
  88. REG_STRUCT_INIT(AR5K_RTSD1),
  89. REG_STRUCT_INIT(AR5K_TXCFG),
  90. REG_STRUCT_INIT(AR5K_RXCFG),
  91. REG_STRUCT_INIT(AR5K_RXJLA),
  92. REG_STRUCT_INIT(AR5K_MIBC),
  93. REG_STRUCT_INIT(AR5K_TOPS),
  94. REG_STRUCT_INIT(AR5K_RXNOFRM),
  95. REG_STRUCT_INIT(AR5K_TXNOFRM),
  96. REG_STRUCT_INIT(AR5K_RPGTO),
  97. REG_STRUCT_INIT(AR5K_RFCNT),
  98. REG_STRUCT_INIT(AR5K_MISC),
  99. REG_STRUCT_INIT(AR5K_QCUDCU_CLKGT),
  100. REG_STRUCT_INIT(AR5K_ISR),
  101. REG_STRUCT_INIT(AR5K_PISR),
  102. REG_STRUCT_INIT(AR5K_SISR0),
  103. REG_STRUCT_INIT(AR5K_SISR1),
  104. REG_STRUCT_INIT(AR5K_SISR2),
  105. REG_STRUCT_INIT(AR5K_SISR3),
  106. REG_STRUCT_INIT(AR5K_SISR4),
  107. REG_STRUCT_INIT(AR5K_IMR),
  108. REG_STRUCT_INIT(AR5K_PIMR),
  109. REG_STRUCT_INIT(AR5K_SIMR0),
  110. REG_STRUCT_INIT(AR5K_SIMR1),
  111. REG_STRUCT_INIT(AR5K_SIMR2),
  112. REG_STRUCT_INIT(AR5K_SIMR3),
  113. REG_STRUCT_INIT(AR5K_SIMR4),
  114. REG_STRUCT_INIT(AR5K_DCM_ADDR),
  115. REG_STRUCT_INIT(AR5K_DCCFG),
  116. REG_STRUCT_INIT(AR5K_CCFG),
  117. REG_STRUCT_INIT(AR5K_CPC0),
  118. REG_STRUCT_INIT(AR5K_CPC1),
  119. REG_STRUCT_INIT(AR5K_CPC2),
  120. REG_STRUCT_INIT(AR5K_CPC3),
  121. REG_STRUCT_INIT(AR5K_CPCOVF),
  122. REG_STRUCT_INIT(AR5K_RESET_CTL),
  123. REG_STRUCT_INIT(AR5K_SLEEP_CTL),
  124. REG_STRUCT_INIT(AR5K_INTPEND),
  125. REG_STRUCT_INIT(AR5K_SFR),
  126. REG_STRUCT_INIT(AR5K_PCICFG),
  127. REG_STRUCT_INIT(AR5K_GPIOCR),
  128. REG_STRUCT_INIT(AR5K_GPIODO),
  129. REG_STRUCT_INIT(AR5K_SREV),
  130. };
  131. static void *reg_start(struct seq_file *seq, loff_t *pos)
  132. {
  133. return *pos < ARRAY_SIZE(regs) ? (void *)&regs[*pos] : NULL;
  134. }
  135. static void reg_stop(struct seq_file *seq, void *p)
  136. {
  137. /* nothing to do */
  138. }
  139. static void *reg_next(struct seq_file *seq, void *p, loff_t *pos)
  140. {
  141. ++*pos;
  142. return *pos < ARRAY_SIZE(regs) ? (void *)&regs[*pos] : NULL;
  143. }
  144. static int reg_show(struct seq_file *seq, void *p)
  145. {
  146. struct ath5k_softc *sc = seq->private;
  147. struct reg *r = p;
  148. seq_printf(seq, "%-25s0x%08x\n", r->name,
  149. ath5k_hw_reg_read(sc->ah, r->addr));
  150. return 0;
  151. }
  152. static const struct seq_operations register_seq_ops = {
  153. .start = reg_start,
  154. .next = reg_next,
  155. .stop = reg_stop,
  156. .show = reg_show
  157. };
  158. static int open_file_registers(struct inode *inode, struct file *file)
  159. {
  160. struct seq_file *s;
  161. int res;
  162. res = seq_open(file, &register_seq_ops);
  163. if (res == 0) {
  164. s = file->private_data;
  165. s->private = inode->i_private;
  166. }
  167. return res;
  168. }
  169. static const struct file_operations fops_registers = {
  170. .open = open_file_registers,
  171. .read = seq_read,
  172. .llseek = seq_lseek,
  173. .release = seq_release,
  174. .owner = THIS_MODULE,
  175. };
  176. /* debugfs: beacons */
  177. static ssize_t read_file_beacon(struct file *file, char __user *user_buf,
  178. size_t count, loff_t *ppos)
  179. {
  180. struct ath5k_softc *sc = file->private_data;
  181. struct ath5k_hw *ah = sc->ah;
  182. char buf[500];
  183. unsigned int len = 0;
  184. unsigned int v;
  185. u64 tsf;
  186. v = ath5k_hw_reg_read(sc->ah, AR5K_BEACON);
  187. len += snprintf(buf+len, sizeof(buf)-len,
  188. "%-24s0x%08x\tintval: %d\tTIM: 0x%x\n",
  189. "AR5K_BEACON", v, v & AR5K_BEACON_PERIOD,
  190. (v & AR5K_BEACON_TIM) >> AR5K_BEACON_TIM_S);
  191. len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\n",
  192. "AR5K_LAST_TSTP", ath5k_hw_reg_read(sc->ah, AR5K_LAST_TSTP));
  193. len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\n\n",
  194. "AR5K_BEACON_CNT", ath5k_hw_reg_read(sc->ah, AR5K_BEACON_CNT));
  195. v = ath5k_hw_reg_read(sc->ah, AR5K_TIMER0);
  196. len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\tTU: %08x\n",
  197. "AR5K_TIMER0 (TBTT)", v, v);
  198. v = ath5k_hw_reg_read(sc->ah, AR5K_TIMER1);
  199. len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\tTU: %08x\n",
  200. "AR5K_TIMER1 (DMA)", v, v >> 3);
  201. v = ath5k_hw_reg_read(sc->ah, AR5K_TIMER2);
  202. len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\tTU: %08x\n",
  203. "AR5K_TIMER2 (SWBA)", v, v >> 3);
  204. v = ath5k_hw_reg_read(sc->ah, AR5K_TIMER3);
  205. len += snprintf(buf+len, sizeof(buf)-len, "%-24s0x%08x\tTU: %08x\n",
  206. "AR5K_TIMER3 (ATIM)", v, v);
  207. tsf = ath5k_hw_get_tsf64(sc->ah);
  208. len += snprintf(buf+len, sizeof(buf)-len,
  209. "TSF\t\t0x%016llx\tTU: %08x\n",
  210. (unsigned long long)tsf, TSF_TO_TU(tsf));
  211. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  212. }
  213. static ssize_t write_file_beacon(struct file *file,
  214. const char __user *userbuf,
  215. size_t count, loff_t *ppos)
  216. {
  217. struct ath5k_softc *sc = file->private_data;
  218. struct ath5k_hw *ah = sc->ah;
  219. char buf[20];
  220. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  221. return -EFAULT;
  222. if (strncmp(buf, "disable", 7) == 0) {
  223. AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE);
  224. printk(KERN_INFO "debugfs disable beacons\n");
  225. } else if (strncmp(buf, "enable", 6) == 0) {
  226. AR5K_REG_ENABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE);
  227. printk(KERN_INFO "debugfs enable beacons\n");
  228. }
  229. return count;
  230. }
  231. static const struct file_operations fops_beacon = {
  232. .read = read_file_beacon,
  233. .write = write_file_beacon,
  234. .open = ath5k_debugfs_open,
  235. .owner = THIS_MODULE,
  236. };
  237. /* debugfs: reset */
  238. static ssize_t write_file_reset(struct file *file,
  239. const char __user *userbuf,
  240. size_t count, loff_t *ppos)
  241. {
  242. struct ath5k_softc *sc = file->private_data;
  243. tasklet_schedule(&sc->restq);
  244. return count;
  245. }
  246. static const struct file_operations fops_reset = {
  247. .write = write_file_reset,
  248. .open = ath5k_debugfs_open,
  249. .owner = THIS_MODULE,
  250. };
  251. /* debugfs: debug level */
  252. static const struct {
  253. enum ath5k_debug_level level;
  254. const char *name;
  255. const char *desc;
  256. } dbg_info[] = {
  257. { ATH5K_DEBUG_RESET, "reset", "reset and initialization" },
  258. { ATH5K_DEBUG_INTR, "intr", "interrupt handling" },
  259. { ATH5K_DEBUG_MODE, "mode", "mode init/setup" },
  260. { ATH5K_DEBUG_XMIT, "xmit", "basic xmit operation" },
  261. { ATH5K_DEBUG_BEACON, "beacon", "beacon handling" },
  262. { ATH5K_DEBUG_CALIBRATE, "calib", "periodic calibration" },
  263. { ATH5K_DEBUG_TXPOWER, "txpower", "transmit power setting" },
  264. { ATH5K_DEBUG_LED, "led", "LED management" },
  265. { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" },
  266. { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" },
  267. { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" },
  268. { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" },
  269. { ATH5K_DEBUG_ANY, "all", "show all debug levels" },
  270. };
  271. static ssize_t read_file_debug(struct file *file, char __user *user_buf,
  272. size_t count, loff_t *ppos)
  273. {
  274. struct ath5k_softc *sc = file->private_data;
  275. char buf[700];
  276. unsigned int len = 0;
  277. unsigned int i;
  278. len += snprintf(buf+len, sizeof(buf)-len,
  279. "DEBUG LEVEL: 0x%08x\n\n", sc->debug.level);
  280. for (i = 0; i < ARRAY_SIZE(dbg_info) - 1; i++) {
  281. len += snprintf(buf+len, sizeof(buf)-len,
  282. "%10s %c 0x%08x - %s\n", dbg_info[i].name,
  283. sc->debug.level & dbg_info[i].level ? '+' : ' ',
  284. dbg_info[i].level, dbg_info[i].desc);
  285. }
  286. len += snprintf(buf+len, sizeof(buf)-len,
  287. "%10s %c 0x%08x - %s\n", dbg_info[i].name,
  288. sc->debug.level == dbg_info[i].level ? '+' : ' ',
  289. dbg_info[i].level, dbg_info[i].desc);
  290. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  291. }
  292. static ssize_t write_file_debug(struct file *file,
  293. const char __user *userbuf,
  294. size_t count, loff_t *ppos)
  295. {
  296. struct ath5k_softc *sc = file->private_data;
  297. unsigned int i;
  298. char buf[20];
  299. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  300. return -EFAULT;
  301. for (i = 0; i < ARRAY_SIZE(dbg_info); i++) {
  302. if (strncmp(buf, dbg_info[i].name,
  303. strlen(dbg_info[i].name)) == 0) {
  304. sc->debug.level ^= dbg_info[i].level; /* toggle bit */
  305. break;
  306. }
  307. }
  308. return count;
  309. }
  310. static const struct file_operations fops_debug = {
  311. .read = read_file_debug,
  312. .write = write_file_debug,
  313. .open = ath5k_debugfs_open,
  314. .owner = THIS_MODULE,
  315. };
  316. /* debugfs: antenna */
  317. static ssize_t read_file_antenna(struct file *file, char __user *user_buf,
  318. size_t count, loff_t *ppos)
  319. {
  320. struct ath5k_softc *sc = file->private_data;
  321. char buf[700];
  322. unsigned int len = 0;
  323. unsigned int i;
  324. unsigned int v;
  325. len += snprintf(buf+len, sizeof(buf)-len, "antenna mode\t%d\n",
  326. sc->ah->ah_ant_mode);
  327. len += snprintf(buf+len, sizeof(buf)-len, "default antenna\t%d\n",
  328. sc->ah->ah_def_ant);
  329. len += snprintf(buf+len, sizeof(buf)-len, "tx antenna\t%d\n",
  330. sc->ah->ah_tx_ant);
  331. len += snprintf(buf+len, sizeof(buf)-len, "\nANTENNA\t\tRX\tTX\n");
  332. for (i = 1; i < ARRAY_SIZE(sc->stats.antenna_rx); i++) {
  333. len += snprintf(buf+len, sizeof(buf)-len,
  334. "[antenna %d]\t%d\t%d\n",
  335. i, sc->stats.antenna_rx[i], sc->stats.antenna_tx[i]);
  336. }
  337. len += snprintf(buf+len, sizeof(buf)-len, "[invalid]\t%d\t%d\n",
  338. sc->stats.antenna_rx[0], sc->stats.antenna_tx[0]);
  339. v = ath5k_hw_reg_read(sc->ah, AR5K_DEFAULT_ANTENNA);
  340. len += snprintf(buf+len, sizeof(buf)-len,
  341. "\nAR5K_DEFAULT_ANTENNA\t0x%08x\n", v);
  342. v = ath5k_hw_reg_read(sc->ah, AR5K_STA_ID1);
  343. len += snprintf(buf+len, sizeof(buf)-len,
  344. "AR5K_STA_ID1_DEFAULT_ANTENNA\t%d\n",
  345. (v & AR5K_STA_ID1_DEFAULT_ANTENNA) != 0);
  346. len += snprintf(buf+len, sizeof(buf)-len,
  347. "AR5K_STA_ID1_DESC_ANTENNA\t%d\n",
  348. (v & AR5K_STA_ID1_DESC_ANTENNA) != 0);
  349. len += snprintf(buf+len, sizeof(buf)-len,
  350. "AR5K_STA_ID1_RTS_DEF_ANTENNA\t%d\n",
  351. (v & AR5K_STA_ID1_RTS_DEF_ANTENNA) != 0);
  352. len += snprintf(buf+len, sizeof(buf)-len,
  353. "AR5K_STA_ID1_SELFGEN_DEF_ANT\t%d\n",
  354. (v & AR5K_STA_ID1_SELFGEN_DEF_ANT) != 0);
  355. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_AGCCTL);
  356. len += snprintf(buf+len, sizeof(buf)-len,
  357. "\nAR5K_PHY_AGCCTL_OFDM_DIV_DIS\t%d\n",
  358. (v & AR5K_PHY_AGCCTL_OFDM_DIV_DIS) != 0);
  359. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_RESTART);
  360. len += snprintf(buf+len, sizeof(buf)-len,
  361. "AR5K_PHY_RESTART_DIV_GC\t\t%x\n",
  362. (v & AR5K_PHY_RESTART_DIV_GC) >> AR5K_PHY_RESTART_DIV_GC_S);
  363. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_FAST_ANT_DIV);
  364. len += snprintf(buf+len, sizeof(buf)-len,
  365. "AR5K_PHY_FAST_ANT_DIV_EN\t%d\n",
  366. (v & AR5K_PHY_FAST_ANT_DIV_EN) != 0);
  367. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_ANT_SWITCH_TABLE_0);
  368. len += snprintf(buf+len, sizeof(buf)-len,
  369. "\nAR5K_PHY_ANT_SWITCH_TABLE_0\t0x%08x\n", v);
  370. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_ANT_SWITCH_TABLE_1);
  371. len += snprintf(buf+len, sizeof(buf)-len,
  372. "AR5K_PHY_ANT_SWITCH_TABLE_1\t0x%08x\n", v);
  373. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  374. }
  375. static ssize_t write_file_antenna(struct file *file,
  376. const char __user *userbuf,
  377. size_t count, loff_t *ppos)
  378. {
  379. struct ath5k_softc *sc = file->private_data;
  380. unsigned int i;
  381. char buf[20];
  382. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  383. return -EFAULT;
  384. if (strncmp(buf, "diversity", 9) == 0) {
  385. ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_DEFAULT);
  386. printk(KERN_INFO "ath5k debug: enable diversity\n");
  387. } else if (strncmp(buf, "fixed-a", 7) == 0) {
  388. ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_A);
  389. printk(KERN_INFO "ath5k debugfs: fixed antenna A\n");
  390. } else if (strncmp(buf, "fixed-b", 7) == 0) {
  391. ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_B);
  392. printk(KERN_INFO "ath5k debug: fixed antenna B\n");
  393. } else if (strncmp(buf, "clear", 5) == 0) {
  394. for (i = 0; i < ARRAY_SIZE(sc->stats.antenna_rx); i++) {
  395. sc->stats.antenna_rx[i] = 0;
  396. sc->stats.antenna_tx[i] = 0;
  397. }
  398. printk(KERN_INFO "ath5k debug: cleared antenna stats\n");
  399. }
  400. return count;
  401. }
  402. static const struct file_operations fops_antenna = {
  403. .read = read_file_antenna,
  404. .write = write_file_antenna,
  405. .open = ath5k_debugfs_open,
  406. .owner = THIS_MODULE,
  407. };
  408. /* debugfs: frameerrors */
  409. static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
  410. size_t count, loff_t *ppos)
  411. {
  412. struct ath5k_softc *sc = file->private_data;
  413. struct ath5k_statistics *st = &sc->stats;
  414. char buf[700];
  415. unsigned int len = 0;
  416. int i;
  417. len += snprintf(buf+len, sizeof(buf)-len,
  418. "RX\n---------------------\n");
  419. len += snprintf(buf+len, sizeof(buf)-len, "CRC\t%d\t(%d%%)\n",
  420. st->rxerr_crc,
  421. st->rx_all_count > 0 ?
  422. st->rxerr_crc*100/st->rx_all_count : 0);
  423. len += snprintf(buf+len, sizeof(buf)-len, "PHY\t%d\t(%d%%)\n",
  424. st->rxerr_phy,
  425. st->rx_all_count > 0 ?
  426. st->rxerr_phy*100/st->rx_all_count : 0);
  427. for (i = 0; i < 32; i++) {
  428. if (st->rxerr_phy_code[i])
  429. len += snprintf(buf+len, sizeof(buf)-len,
  430. " phy_err[%d]\t%d\n",
  431. i, st->rxerr_phy_code[i]);
  432. }
  433. len += snprintf(buf+len, sizeof(buf)-len, "FIFO\t%d\t(%d%%)\n",
  434. st->rxerr_fifo,
  435. st->rx_all_count > 0 ?
  436. st->rxerr_fifo*100/st->rx_all_count : 0);
  437. len += snprintf(buf+len, sizeof(buf)-len, "decrypt\t%d\t(%d%%)\n",
  438. st->rxerr_decrypt,
  439. st->rx_all_count > 0 ?
  440. st->rxerr_decrypt*100/st->rx_all_count : 0);
  441. len += snprintf(buf+len, sizeof(buf)-len, "MIC\t%d\t(%d%%)\n",
  442. st->rxerr_mic,
  443. st->rx_all_count > 0 ?
  444. st->rxerr_mic*100/st->rx_all_count : 0);
  445. len += snprintf(buf+len, sizeof(buf)-len, "process\t%d\t(%d%%)\n",
  446. st->rxerr_proc,
  447. st->rx_all_count > 0 ?
  448. st->rxerr_proc*100/st->rx_all_count : 0);
  449. len += snprintf(buf+len, sizeof(buf)-len, "jumbo\t%d\t(%d%%)\n",
  450. st->rxerr_jumbo,
  451. st->rx_all_count > 0 ?
  452. st->rxerr_jumbo*100/st->rx_all_count : 0);
  453. len += snprintf(buf+len, sizeof(buf)-len, "[RX all\t%d]\n",
  454. st->rx_all_count);
  455. len += snprintf(buf+len, sizeof(buf)-len,
  456. "\nTX\n---------------------\n");
  457. len += snprintf(buf+len, sizeof(buf)-len, "retry\t%d\t(%d%%)\n",
  458. st->txerr_retry,
  459. st->tx_all_count > 0 ?
  460. st->txerr_retry*100/st->tx_all_count : 0);
  461. len += snprintf(buf+len, sizeof(buf)-len, "FIFO\t%d\t(%d%%)\n",
  462. st->txerr_fifo,
  463. st->tx_all_count > 0 ?
  464. st->txerr_fifo*100/st->tx_all_count : 0);
  465. len += snprintf(buf+len, sizeof(buf)-len, "filter\t%d\t(%d%%)\n",
  466. st->txerr_filt,
  467. st->tx_all_count > 0 ?
  468. st->txerr_filt*100/st->tx_all_count : 0);
  469. len += snprintf(buf+len, sizeof(buf)-len, "[TX all\t%d]\n",
  470. st->tx_all_count);
  471. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  472. }
  473. static ssize_t write_file_frameerrors(struct file *file,
  474. const char __user *userbuf,
  475. size_t count, loff_t *ppos)
  476. {
  477. struct ath5k_softc *sc = file->private_data;
  478. struct ath5k_statistics *st = &sc->stats;
  479. char buf[20];
  480. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  481. return -EFAULT;
  482. if (strncmp(buf, "clear", 5) == 0) {
  483. st->rxerr_crc = 0;
  484. st->rxerr_phy = 0;
  485. st->rxerr_fifo = 0;
  486. st->rxerr_decrypt = 0;
  487. st->rxerr_mic = 0;
  488. st->rxerr_proc = 0;
  489. st->rxerr_jumbo = 0;
  490. st->rx_all_count = 0;
  491. st->txerr_retry = 0;
  492. st->txerr_fifo = 0;
  493. st->txerr_filt = 0;
  494. st->tx_all_count = 0;
  495. printk(KERN_INFO "ath5k debug: cleared frameerrors stats\n");
  496. }
  497. return count;
  498. }
  499. static const struct file_operations fops_frameerrors = {
  500. .read = read_file_frameerrors,
  501. .write = write_file_frameerrors,
  502. .open = ath5k_debugfs_open,
  503. .owner = THIS_MODULE,
  504. };
  505. /* debugfs: ani */
  506. static ssize_t read_file_ani(struct file *file, char __user *user_buf,
  507. size_t count, loff_t *ppos)
  508. {
  509. struct ath5k_softc *sc = file->private_data;
  510. struct ath5k_statistics *st = &sc->stats;
  511. struct ath5k_ani_state *as = &sc->ani_state;
  512. char buf[700];
  513. unsigned int len = 0;
  514. len += snprintf(buf+len, sizeof(buf)-len,
  515. "HW has PHY error counters:\t%s\n",
  516. sc->ah->ah_capabilities.cap_has_phyerr_counters ?
  517. "yes" : "no");
  518. len += snprintf(buf+len, sizeof(buf)-len,
  519. "HW max spur immunity level:\t%d\n",
  520. as->max_spur_level);
  521. len += snprintf(buf+len, sizeof(buf)-len,
  522. "\nANI state\n--------------------------------------------\n");
  523. len += snprintf(buf+len, sizeof(buf)-len, "operating mode:\t\t\t");
  524. switch (as->ani_mode) {
  525. case ATH5K_ANI_MODE_OFF:
  526. len += snprintf(buf+len, sizeof(buf)-len, "OFF\n");
  527. break;
  528. case ATH5K_ANI_MODE_MANUAL_LOW:
  529. len += snprintf(buf+len, sizeof(buf)-len,
  530. "MANUAL LOW\n");
  531. break;
  532. case ATH5K_ANI_MODE_MANUAL_HIGH:
  533. len += snprintf(buf+len, sizeof(buf)-len,
  534. "MANUAL HIGH\n");
  535. break;
  536. case ATH5K_ANI_MODE_AUTO:
  537. len += snprintf(buf+len, sizeof(buf)-len, "AUTO\n");
  538. break;
  539. default:
  540. len += snprintf(buf+len, sizeof(buf)-len,
  541. "??? (not good)\n");
  542. break;
  543. }
  544. len += snprintf(buf+len, sizeof(buf)-len,
  545. "noise immunity level:\t\t%d\n",
  546. as->noise_imm_level);
  547. len += snprintf(buf+len, sizeof(buf)-len,
  548. "spur immunity level:\t\t%d\n",
  549. as->spur_level);
  550. len += snprintf(buf+len, sizeof(buf)-len, "firstep level:\t\t\t%d\n",
  551. as->firstep_level);
  552. len += snprintf(buf+len, sizeof(buf)-len,
  553. "OFDM weak signal detection:\t%s\n",
  554. as->ofdm_weak_sig ? "on" : "off");
  555. len += snprintf(buf+len, sizeof(buf)-len,
  556. "CCK weak signal detection:\t%s\n",
  557. as->cck_weak_sig ? "on" : "off");
  558. len += snprintf(buf+len, sizeof(buf)-len,
  559. "\nMIB INTERRUPTS:\t\t%u\n",
  560. st->mib_intr);
  561. len += snprintf(buf+len, sizeof(buf)-len,
  562. "beacon RSSI average:\t%d\n",
  563. sc->ah->ah_beacon_rssi_avg.avg);
  564. len += snprintf(buf+len, sizeof(buf)-len, "profcnt tx\t\t%u\t(%d%%)\n",
  565. as->pfc_tx,
  566. as->pfc_cycles > 0 ?
  567. as->pfc_tx*100/as->pfc_cycles : 0);
  568. len += snprintf(buf+len, sizeof(buf)-len, "profcnt rx\t\t%u\t(%d%%)\n",
  569. as->pfc_rx,
  570. as->pfc_cycles > 0 ?
  571. as->pfc_rx*100/as->pfc_cycles : 0);
  572. len += snprintf(buf+len, sizeof(buf)-len, "profcnt busy\t\t%u\t(%d%%)\n",
  573. as->pfc_busy,
  574. as->pfc_cycles > 0 ?
  575. as->pfc_busy*100/as->pfc_cycles : 0);
  576. len += snprintf(buf+len, sizeof(buf)-len, "profcnt cycles\t\t%u\n",
  577. as->pfc_cycles);
  578. len += snprintf(buf+len, sizeof(buf)-len,
  579. "listen time\t\t%d\tlast: %d\n",
  580. as->listen_time, as->last_listen);
  581. len += snprintf(buf+len, sizeof(buf)-len,
  582. "OFDM errors\t\t%u\tlast: %u\tsum: %u\n",
  583. as->ofdm_errors, as->last_ofdm_errors,
  584. as->sum_ofdm_errors);
  585. len += snprintf(buf+len, sizeof(buf)-len,
  586. "CCK errors\t\t%u\tlast: %u\tsum: %u\n",
  587. as->cck_errors, as->last_cck_errors,
  588. as->sum_cck_errors);
  589. len += snprintf(buf+len, sizeof(buf)-len,
  590. "AR5K_PHYERR_CNT1\t%x\t(=%d)\n",
  591. ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT1),
  592. ATH5K_ANI_OFDM_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX -
  593. ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT1)));
  594. len += snprintf(buf+len, sizeof(buf)-len,
  595. "AR5K_PHYERR_CNT2\t%x\t(=%d)\n",
  596. ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT2),
  597. ATH5K_ANI_CCK_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX -
  598. ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT2)));
  599. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  600. }
  601. static ssize_t write_file_ani(struct file *file,
  602. const char __user *userbuf,
  603. size_t count, loff_t *ppos)
  604. {
  605. struct ath5k_softc *sc = file->private_data;
  606. char buf[20];
  607. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  608. return -EFAULT;
  609. if (strncmp(buf, "sens-low", 8) == 0) {
  610. ath5k_ani_init(sc->ah, ATH5K_ANI_MODE_MANUAL_HIGH);
  611. } else if (strncmp(buf, "sens-high", 9) == 0) {
  612. ath5k_ani_init(sc->ah, ATH5K_ANI_MODE_MANUAL_LOW);
  613. } else if (strncmp(buf, "ani-off", 7) == 0) {
  614. ath5k_ani_init(sc->ah, ATH5K_ANI_MODE_OFF);
  615. } else if (strncmp(buf, "ani-on", 6) == 0) {
  616. ath5k_ani_init(sc->ah, ATH5K_ANI_MODE_AUTO);
  617. } else if (strncmp(buf, "noise-low", 9) == 0) {
  618. ath5k_ani_set_noise_immunity_level(sc->ah, 0);
  619. } else if (strncmp(buf, "noise-high", 10) == 0) {
  620. ath5k_ani_set_noise_immunity_level(sc->ah,
  621. ATH5K_ANI_MAX_NOISE_IMM_LVL);
  622. } else if (strncmp(buf, "spur-low", 8) == 0) {
  623. ath5k_ani_set_spur_immunity_level(sc->ah, 0);
  624. } else if (strncmp(buf, "spur-high", 9) == 0) {
  625. ath5k_ani_set_spur_immunity_level(sc->ah,
  626. sc->ani_state.max_spur_level);
  627. } else if (strncmp(buf, "fir-low", 7) == 0) {
  628. ath5k_ani_set_firstep_level(sc->ah, 0);
  629. } else if (strncmp(buf, "fir-high", 8) == 0) {
  630. ath5k_ani_set_firstep_level(sc->ah, ATH5K_ANI_MAX_FIRSTEP_LVL);
  631. } else if (strncmp(buf, "ofdm-off", 8) == 0) {
  632. ath5k_ani_set_ofdm_weak_signal_detection(sc->ah, false);
  633. } else if (strncmp(buf, "ofdm-on", 7) == 0) {
  634. ath5k_ani_set_ofdm_weak_signal_detection(sc->ah, true);
  635. } else if (strncmp(buf, "cck-off", 7) == 0) {
  636. ath5k_ani_set_cck_weak_signal_detection(sc->ah, false);
  637. } else if (strncmp(buf, "cck-on", 6) == 0) {
  638. ath5k_ani_set_cck_weak_signal_detection(sc->ah, true);
  639. }
  640. return count;
  641. }
  642. static const struct file_operations fops_ani = {
  643. .read = read_file_ani,
  644. .write = write_file_ani,
  645. .open = ath5k_debugfs_open,
  646. .owner = THIS_MODULE,
  647. };
  648. /* debugfs: queues etc */
  649. static ssize_t read_file_queue(struct file *file, char __user *user_buf,
  650. size_t count, loff_t *ppos)
  651. {
  652. struct ath5k_softc *sc = file->private_data;
  653. char buf[700];
  654. unsigned int len = 0;
  655. struct ath5k_txq *txq;
  656. struct ath5k_buf *bf, *bf0;
  657. int i, n = 0;
  658. len += snprintf(buf+len, sizeof(buf)-len,
  659. "available txbuffers: %d\n", sc->txbuf_len);
  660. for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
  661. txq = &sc->txqs[i];
  662. len += snprintf(buf+len, sizeof(buf)-len,
  663. "%02d: %ssetup\n", i, txq->setup ? "" : "not ");
  664. if (!txq->setup)
  665. continue;
  666. list_for_each_entry_safe(bf, bf0, &txq->q, list)
  667. n++;
  668. len += snprintf(buf+len, sizeof(buf)-len, " len: %d\n", n);
  669. }
  670. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  671. }
  672. static ssize_t write_file_queue(struct file *file,
  673. const char __user *userbuf,
  674. size_t count, loff_t *ppos)
  675. {
  676. struct ath5k_softc *sc = file->private_data;
  677. char buf[20];
  678. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  679. return -EFAULT;
  680. if (strncmp(buf, "start", 5) == 0)
  681. ieee80211_wake_queues(sc->hw);
  682. else if (strncmp(buf, "stop", 4) == 0)
  683. ieee80211_stop_queues(sc->hw);
  684. return count;
  685. }
  686. static const struct file_operations fops_queue = {
  687. .read = read_file_queue,
  688. .write = write_file_queue,
  689. .open = ath5k_debugfs_open,
  690. .owner = THIS_MODULE,
  691. };
  692. /* init */
  693. void
  694. ath5k_debug_init(void)
  695. {
  696. ath5k_global_debugfs = debugfs_create_dir("ath5k", NULL);
  697. }
  698. void
  699. ath5k_debug_init_device(struct ath5k_softc *sc)
  700. {
  701. sc->debug.level = ath5k_debug;
  702. sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
  703. ath5k_global_debugfs);
  704. sc->debug.debugfs_debug = debugfs_create_file("debug",
  705. S_IWUSR | S_IRUSR,
  706. sc->debug.debugfs_phydir, sc, &fops_debug);
  707. sc->debug.debugfs_registers = debugfs_create_file("registers", S_IRUSR,
  708. sc->debug.debugfs_phydir, sc, &fops_registers);
  709. sc->debug.debugfs_beacon = debugfs_create_file("beacon",
  710. S_IWUSR | S_IRUSR,
  711. sc->debug.debugfs_phydir, sc, &fops_beacon);
  712. sc->debug.debugfs_reset = debugfs_create_file("reset", S_IWUSR,
  713. sc->debug.debugfs_phydir, sc, &fops_reset);
  714. sc->debug.debugfs_antenna = debugfs_create_file("antenna",
  715. S_IWUSR | S_IRUSR,
  716. sc->debug.debugfs_phydir, sc, &fops_antenna);
  717. sc->debug.debugfs_frameerrors = debugfs_create_file("frameerrors",
  718. S_IWUSR | S_IRUSR,
  719. sc->debug.debugfs_phydir, sc,
  720. &fops_frameerrors);
  721. sc->debug.debugfs_ani = debugfs_create_file("ani",
  722. S_IWUSR | S_IRUSR,
  723. sc->debug.debugfs_phydir, sc,
  724. &fops_ani);
  725. sc->debug.debugfs_queue = debugfs_create_file("queue",
  726. S_IWUSR | S_IRUSR,
  727. sc->debug.debugfs_phydir, sc,
  728. &fops_queue);
  729. }
  730. void
  731. ath5k_debug_finish(void)
  732. {
  733. debugfs_remove(ath5k_global_debugfs);
  734. }
  735. void
  736. ath5k_debug_finish_device(struct ath5k_softc *sc)
  737. {
  738. debugfs_remove(sc->debug.debugfs_debug);
  739. debugfs_remove(sc->debug.debugfs_registers);
  740. debugfs_remove(sc->debug.debugfs_beacon);
  741. debugfs_remove(sc->debug.debugfs_reset);
  742. debugfs_remove(sc->debug.debugfs_antenna);
  743. debugfs_remove(sc->debug.debugfs_frameerrors);
  744. debugfs_remove(sc->debug.debugfs_ani);
  745. debugfs_remove(sc->debug.debugfs_queue);
  746. debugfs_remove(sc->debug.debugfs_phydir);
  747. }
  748. /* functions used in other places */
  749. void
  750. ath5k_debug_dump_bands(struct ath5k_softc *sc)
  751. {
  752. unsigned int b, i;
  753. if (likely(!(sc->debug.level & ATH5K_DEBUG_DUMPBANDS)))
  754. return;
  755. BUG_ON(!sc->sbands);
  756. for (b = 0; b < IEEE80211_NUM_BANDS; b++) {
  757. struct ieee80211_supported_band *band = &sc->sbands[b];
  758. char bname[6];
  759. switch (band->band) {
  760. case IEEE80211_BAND_2GHZ:
  761. strcpy(bname, "2 GHz");
  762. break;
  763. case IEEE80211_BAND_5GHZ:
  764. strcpy(bname, "5 GHz");
  765. break;
  766. default:
  767. printk(KERN_DEBUG "Band not supported: %d\n",
  768. band->band);
  769. return;
  770. }
  771. printk(KERN_DEBUG "Band %s: channels %d, rates %d\n", bname,
  772. band->n_channels, band->n_bitrates);
  773. printk(KERN_DEBUG " channels:\n");
  774. for (i = 0; i < band->n_channels; i++)
  775. printk(KERN_DEBUG " %3d %d %.4x %.4x\n",
  776. ieee80211_frequency_to_channel(
  777. band->channels[i].center_freq),
  778. band->channels[i].center_freq,
  779. band->channels[i].hw_value,
  780. band->channels[i].flags);
  781. printk(KERN_DEBUG " rates:\n");
  782. for (i = 0; i < band->n_bitrates; i++)
  783. printk(KERN_DEBUG " %4d %.4x %.4x %.4x\n",
  784. band->bitrates[i].bitrate,
  785. band->bitrates[i].hw_value,
  786. band->bitrates[i].flags,
  787. band->bitrates[i].hw_value_short);
  788. }
  789. }
  790. static inline void
  791. ath5k_debug_printrxbuf(struct ath5k_buf *bf, int done,
  792. struct ath5k_rx_status *rs)
  793. {
  794. struct ath5k_desc *ds = bf->desc;
  795. struct ath5k_hw_all_rx_desc *rd = &ds->ud.ds_rx;
  796. printk(KERN_DEBUG "R (%p %llx) %08x %08x %08x %08x %08x %08x %c\n",
  797. ds, (unsigned long long)bf->daddr,
  798. ds->ds_link, ds->ds_data,
  799. rd->rx_ctl.rx_control_0, rd->rx_ctl.rx_control_1,
  800. rd->u.rx_stat.rx_status_0, rd->u.rx_stat.rx_status_0,
  801. !done ? ' ' : (rs->rs_status == 0) ? '*' : '!');
  802. }
  803. void
  804. ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah)
  805. {
  806. struct ath5k_desc *ds;
  807. struct ath5k_buf *bf;
  808. struct ath5k_rx_status rs = {};
  809. int status;
  810. if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET)))
  811. return;
  812. printk(KERN_DEBUG "rx queue %x, link %p\n",
  813. ath5k_hw_get_rxdp(ah), sc->rxlink);
  814. spin_lock_bh(&sc->rxbuflock);
  815. list_for_each_entry(bf, &sc->rxbuf, list) {
  816. ds = bf->desc;
  817. status = ah->ah_proc_rx_desc(ah, ds, &rs);
  818. if (!status)
  819. ath5k_debug_printrxbuf(bf, status == 0, &rs);
  820. }
  821. spin_unlock_bh(&sc->rxbuflock);
  822. }
  823. void
  824. ath5k_debug_dump_skb(struct ath5k_softc *sc,
  825. struct sk_buff *skb, const char *prefix, int tx)
  826. {
  827. char buf[16];
  828. if (likely(!((tx && (sc->debug.level & ATH5K_DEBUG_DUMP_TX)) ||
  829. (!tx && (sc->debug.level & ATH5K_DEBUG_DUMP_RX)))))
  830. return;
  831. snprintf(buf, sizeof(buf), "%s %s", wiphy_name(sc->hw->wiphy), prefix);
  832. print_hex_dump_bytes(buf, DUMP_PREFIX_NONE, skb->data,
  833. min(200U, skb->len));
  834. printk(KERN_DEBUG "\n");
  835. }
  836. void
  837. ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf)
  838. {
  839. struct ath5k_desc *ds = bf->desc;
  840. struct ath5k_hw_5212_tx_desc *td = &ds->ud.ds_tx5212;
  841. struct ath5k_tx_status ts = {};
  842. int done;
  843. if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET)))
  844. return;
  845. done = sc->ah->ah_proc_tx_desc(sc->ah, bf->desc, &ts);
  846. printk(KERN_DEBUG "T (%p %llx) %08x %08x %08x %08x %08x %08x %08x "
  847. "%08x %c\n", ds, (unsigned long long)bf->daddr, ds->ds_link,
  848. ds->ds_data, td->tx_ctl.tx_control_0, td->tx_ctl.tx_control_1,
  849. td->tx_ctl.tx_control_2, td->tx_ctl.tx_control_3,
  850. td->tx_stat.tx_status_0, td->tx_stat.tx_status_1,
  851. done ? ' ' : (ts.ts_status == 0) ? '*' : '!');
  852. }
  853. #endif /* ifdef CONFIG_ATH5K_DEBUG */