debug.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995
  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. ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "debug file triggered reset\n");
  244. tasklet_schedule(&sc->restq);
  245. return count;
  246. }
  247. static const struct file_operations fops_reset = {
  248. .write = write_file_reset,
  249. .open = ath5k_debugfs_open,
  250. .owner = THIS_MODULE,
  251. };
  252. /* debugfs: debug level */
  253. static const struct {
  254. enum ath5k_debug_level level;
  255. const char *name;
  256. const char *desc;
  257. } dbg_info[] = {
  258. { ATH5K_DEBUG_RESET, "reset", "reset and initialization" },
  259. { ATH5K_DEBUG_INTR, "intr", "interrupt handling" },
  260. { ATH5K_DEBUG_MODE, "mode", "mode init/setup" },
  261. { ATH5K_DEBUG_XMIT, "xmit", "basic xmit operation" },
  262. { ATH5K_DEBUG_BEACON, "beacon", "beacon handling" },
  263. { ATH5K_DEBUG_CALIBRATE, "calib", "periodic calibration" },
  264. { ATH5K_DEBUG_TXPOWER, "txpower", "transmit power setting" },
  265. { ATH5K_DEBUG_LED, "led", "LED management" },
  266. { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" },
  267. { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" },
  268. { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" },
  269. { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" },
  270. { ATH5K_DEBUG_ANY, "all", "show all debug levels" },
  271. };
  272. static ssize_t read_file_debug(struct file *file, char __user *user_buf,
  273. size_t count, loff_t *ppos)
  274. {
  275. struct ath5k_softc *sc = file->private_data;
  276. char buf[700];
  277. unsigned int len = 0;
  278. unsigned int i;
  279. len += snprintf(buf+len, sizeof(buf)-len,
  280. "DEBUG LEVEL: 0x%08x\n\n", sc->debug.level);
  281. for (i = 0; i < ARRAY_SIZE(dbg_info) - 1; i++) {
  282. len += snprintf(buf+len, sizeof(buf)-len,
  283. "%10s %c 0x%08x - %s\n", dbg_info[i].name,
  284. sc->debug.level & dbg_info[i].level ? '+' : ' ',
  285. dbg_info[i].level, dbg_info[i].desc);
  286. }
  287. len += snprintf(buf+len, sizeof(buf)-len,
  288. "%10s %c 0x%08x - %s\n", dbg_info[i].name,
  289. sc->debug.level == dbg_info[i].level ? '+' : ' ',
  290. dbg_info[i].level, dbg_info[i].desc);
  291. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  292. }
  293. static ssize_t write_file_debug(struct file *file,
  294. const char __user *userbuf,
  295. size_t count, loff_t *ppos)
  296. {
  297. struct ath5k_softc *sc = file->private_data;
  298. unsigned int i;
  299. char buf[20];
  300. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  301. return -EFAULT;
  302. for (i = 0; i < ARRAY_SIZE(dbg_info); i++) {
  303. if (strncmp(buf, dbg_info[i].name,
  304. strlen(dbg_info[i].name)) == 0) {
  305. sc->debug.level ^= dbg_info[i].level; /* toggle bit */
  306. break;
  307. }
  308. }
  309. return count;
  310. }
  311. static const struct file_operations fops_debug = {
  312. .read = read_file_debug,
  313. .write = write_file_debug,
  314. .open = ath5k_debugfs_open,
  315. .owner = THIS_MODULE,
  316. };
  317. /* debugfs: antenna */
  318. static ssize_t read_file_antenna(struct file *file, char __user *user_buf,
  319. size_t count, loff_t *ppos)
  320. {
  321. struct ath5k_softc *sc = file->private_data;
  322. char buf[700];
  323. unsigned int len = 0;
  324. unsigned int i;
  325. unsigned int v;
  326. len += snprintf(buf+len, sizeof(buf)-len, "antenna mode\t%d\n",
  327. sc->ah->ah_ant_mode);
  328. len += snprintf(buf+len, sizeof(buf)-len, "default antenna\t%d\n",
  329. sc->ah->ah_def_ant);
  330. len += snprintf(buf+len, sizeof(buf)-len, "tx antenna\t%d\n",
  331. sc->ah->ah_tx_ant);
  332. len += snprintf(buf+len, sizeof(buf)-len, "\nANTENNA\t\tRX\tTX\n");
  333. for (i = 1; i < ARRAY_SIZE(sc->stats.antenna_rx); i++) {
  334. len += snprintf(buf+len, sizeof(buf)-len,
  335. "[antenna %d]\t%d\t%d\n",
  336. i, sc->stats.antenna_rx[i], sc->stats.antenna_tx[i]);
  337. }
  338. len += snprintf(buf+len, sizeof(buf)-len, "[invalid]\t%d\t%d\n",
  339. sc->stats.antenna_rx[0], sc->stats.antenna_tx[0]);
  340. v = ath5k_hw_reg_read(sc->ah, AR5K_DEFAULT_ANTENNA);
  341. len += snprintf(buf+len, sizeof(buf)-len,
  342. "\nAR5K_DEFAULT_ANTENNA\t0x%08x\n", v);
  343. v = ath5k_hw_reg_read(sc->ah, AR5K_STA_ID1);
  344. len += snprintf(buf+len, sizeof(buf)-len,
  345. "AR5K_STA_ID1_DEFAULT_ANTENNA\t%d\n",
  346. (v & AR5K_STA_ID1_DEFAULT_ANTENNA) != 0);
  347. len += snprintf(buf+len, sizeof(buf)-len,
  348. "AR5K_STA_ID1_DESC_ANTENNA\t%d\n",
  349. (v & AR5K_STA_ID1_DESC_ANTENNA) != 0);
  350. len += snprintf(buf+len, sizeof(buf)-len,
  351. "AR5K_STA_ID1_RTS_DEF_ANTENNA\t%d\n",
  352. (v & AR5K_STA_ID1_RTS_DEF_ANTENNA) != 0);
  353. len += snprintf(buf+len, sizeof(buf)-len,
  354. "AR5K_STA_ID1_SELFGEN_DEF_ANT\t%d\n",
  355. (v & AR5K_STA_ID1_SELFGEN_DEF_ANT) != 0);
  356. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_AGCCTL);
  357. len += snprintf(buf+len, sizeof(buf)-len,
  358. "\nAR5K_PHY_AGCCTL_OFDM_DIV_DIS\t%d\n",
  359. (v & AR5K_PHY_AGCCTL_OFDM_DIV_DIS) != 0);
  360. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_RESTART);
  361. len += snprintf(buf+len, sizeof(buf)-len,
  362. "AR5K_PHY_RESTART_DIV_GC\t\t%x\n",
  363. (v & AR5K_PHY_RESTART_DIV_GC) >> AR5K_PHY_RESTART_DIV_GC_S);
  364. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_FAST_ANT_DIV);
  365. len += snprintf(buf+len, sizeof(buf)-len,
  366. "AR5K_PHY_FAST_ANT_DIV_EN\t%d\n",
  367. (v & AR5K_PHY_FAST_ANT_DIV_EN) != 0);
  368. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_ANT_SWITCH_TABLE_0);
  369. len += snprintf(buf+len, sizeof(buf)-len,
  370. "\nAR5K_PHY_ANT_SWITCH_TABLE_0\t0x%08x\n", v);
  371. v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_ANT_SWITCH_TABLE_1);
  372. len += snprintf(buf+len, sizeof(buf)-len,
  373. "AR5K_PHY_ANT_SWITCH_TABLE_1\t0x%08x\n", v);
  374. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  375. }
  376. static ssize_t write_file_antenna(struct file *file,
  377. const char __user *userbuf,
  378. size_t count, loff_t *ppos)
  379. {
  380. struct ath5k_softc *sc = file->private_data;
  381. unsigned int i;
  382. char buf[20];
  383. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  384. return -EFAULT;
  385. if (strncmp(buf, "diversity", 9) == 0) {
  386. ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_DEFAULT);
  387. printk(KERN_INFO "ath5k debug: enable diversity\n");
  388. } else if (strncmp(buf, "fixed-a", 7) == 0) {
  389. ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_A);
  390. printk(KERN_INFO "ath5k debugfs: fixed antenna A\n");
  391. } else if (strncmp(buf, "fixed-b", 7) == 0) {
  392. ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_B);
  393. printk(KERN_INFO "ath5k debug: fixed antenna B\n");
  394. } else if (strncmp(buf, "clear", 5) == 0) {
  395. for (i = 0; i < ARRAY_SIZE(sc->stats.antenna_rx); i++) {
  396. sc->stats.antenna_rx[i] = 0;
  397. sc->stats.antenna_tx[i] = 0;
  398. }
  399. printk(KERN_INFO "ath5k debug: cleared antenna stats\n");
  400. }
  401. return count;
  402. }
  403. static const struct file_operations fops_antenna = {
  404. .read = read_file_antenna,
  405. .write = write_file_antenna,
  406. .open = ath5k_debugfs_open,
  407. .owner = THIS_MODULE,
  408. };
  409. /* debugfs: frameerrors */
  410. static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
  411. size_t count, loff_t *ppos)
  412. {
  413. struct ath5k_softc *sc = file->private_data;
  414. struct ath5k_statistics *st = &sc->stats;
  415. char buf[700];
  416. unsigned int len = 0;
  417. int i;
  418. len += snprintf(buf+len, sizeof(buf)-len,
  419. "RX\n---------------------\n");
  420. len += snprintf(buf+len, sizeof(buf)-len, "CRC\t%d\t(%d%%)\n",
  421. st->rxerr_crc,
  422. st->rx_all_count > 0 ?
  423. st->rxerr_crc*100/st->rx_all_count : 0);
  424. len += snprintf(buf+len, sizeof(buf)-len, "PHY\t%d\t(%d%%)\n",
  425. st->rxerr_phy,
  426. st->rx_all_count > 0 ?
  427. st->rxerr_phy*100/st->rx_all_count : 0);
  428. for (i = 0; i < 32; i++) {
  429. if (st->rxerr_phy_code[i])
  430. len += snprintf(buf+len, sizeof(buf)-len,
  431. " phy_err[%d]\t%d\n",
  432. i, st->rxerr_phy_code[i]);
  433. }
  434. len += snprintf(buf+len, sizeof(buf)-len, "FIFO\t%d\t(%d%%)\n",
  435. st->rxerr_fifo,
  436. st->rx_all_count > 0 ?
  437. st->rxerr_fifo*100/st->rx_all_count : 0);
  438. len += snprintf(buf+len, sizeof(buf)-len, "decrypt\t%d\t(%d%%)\n",
  439. st->rxerr_decrypt,
  440. st->rx_all_count > 0 ?
  441. st->rxerr_decrypt*100/st->rx_all_count : 0);
  442. len += snprintf(buf+len, sizeof(buf)-len, "MIC\t%d\t(%d%%)\n",
  443. st->rxerr_mic,
  444. st->rx_all_count > 0 ?
  445. st->rxerr_mic*100/st->rx_all_count : 0);
  446. len += snprintf(buf+len, sizeof(buf)-len, "process\t%d\t(%d%%)\n",
  447. st->rxerr_proc,
  448. st->rx_all_count > 0 ?
  449. st->rxerr_proc*100/st->rx_all_count : 0);
  450. len += snprintf(buf+len, sizeof(buf)-len, "jumbo\t%d\t(%d%%)\n",
  451. st->rxerr_jumbo,
  452. st->rx_all_count > 0 ?
  453. st->rxerr_jumbo*100/st->rx_all_count : 0);
  454. len += snprintf(buf+len, sizeof(buf)-len, "[RX all\t%d]\n",
  455. st->rx_all_count);
  456. len += snprintf(buf+len, sizeof(buf)-len,
  457. "\nTX\n---------------------\n");
  458. len += snprintf(buf+len, sizeof(buf)-len, "retry\t%d\t(%d%%)\n",
  459. st->txerr_retry,
  460. st->tx_all_count > 0 ?
  461. st->txerr_retry*100/st->tx_all_count : 0);
  462. len += snprintf(buf+len, sizeof(buf)-len, "FIFO\t%d\t(%d%%)\n",
  463. st->txerr_fifo,
  464. st->tx_all_count > 0 ?
  465. st->txerr_fifo*100/st->tx_all_count : 0);
  466. len += snprintf(buf+len, sizeof(buf)-len, "filter\t%d\t(%d%%)\n",
  467. st->txerr_filt,
  468. st->tx_all_count > 0 ?
  469. st->txerr_filt*100/st->tx_all_count : 0);
  470. len += snprintf(buf+len, sizeof(buf)-len, "[TX all\t%d]\n",
  471. st->tx_all_count);
  472. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  473. }
  474. static ssize_t write_file_frameerrors(struct file *file,
  475. const char __user *userbuf,
  476. size_t count, loff_t *ppos)
  477. {
  478. struct ath5k_softc *sc = file->private_data;
  479. struct ath5k_statistics *st = &sc->stats;
  480. char buf[20];
  481. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  482. return -EFAULT;
  483. if (strncmp(buf, "clear", 5) == 0) {
  484. st->rxerr_crc = 0;
  485. st->rxerr_phy = 0;
  486. st->rxerr_fifo = 0;
  487. st->rxerr_decrypt = 0;
  488. st->rxerr_mic = 0;
  489. st->rxerr_proc = 0;
  490. st->rxerr_jumbo = 0;
  491. st->rx_all_count = 0;
  492. st->txerr_retry = 0;
  493. st->txerr_fifo = 0;
  494. st->txerr_filt = 0;
  495. st->tx_all_count = 0;
  496. printk(KERN_INFO "ath5k debug: cleared frameerrors stats\n");
  497. }
  498. return count;
  499. }
  500. static const struct file_operations fops_frameerrors = {
  501. .read = read_file_frameerrors,
  502. .write = write_file_frameerrors,
  503. .open = ath5k_debugfs_open,
  504. .owner = THIS_MODULE,
  505. };
  506. /* debugfs: ani */
  507. static ssize_t read_file_ani(struct file *file, char __user *user_buf,
  508. size_t count, loff_t *ppos)
  509. {
  510. struct ath5k_softc *sc = file->private_data;
  511. struct ath5k_statistics *st = &sc->stats;
  512. struct ath5k_ani_state *as = &sc->ani_state;
  513. char buf[700];
  514. unsigned int len = 0;
  515. len += snprintf(buf+len, sizeof(buf)-len,
  516. "HW has PHY error counters:\t%s\n",
  517. sc->ah->ah_capabilities.cap_has_phyerr_counters ?
  518. "yes" : "no");
  519. len += snprintf(buf+len, sizeof(buf)-len,
  520. "HW max spur immunity level:\t%d\n",
  521. as->max_spur_level);
  522. len += snprintf(buf+len, sizeof(buf)-len,
  523. "\nANI state\n--------------------------------------------\n");
  524. len += snprintf(buf+len, sizeof(buf)-len, "operating mode:\t\t\t");
  525. switch (as->ani_mode) {
  526. case ATH5K_ANI_MODE_OFF:
  527. len += snprintf(buf+len, sizeof(buf)-len, "OFF\n");
  528. break;
  529. case ATH5K_ANI_MODE_MANUAL_LOW:
  530. len += snprintf(buf+len, sizeof(buf)-len,
  531. "MANUAL LOW\n");
  532. break;
  533. case ATH5K_ANI_MODE_MANUAL_HIGH:
  534. len += snprintf(buf+len, sizeof(buf)-len,
  535. "MANUAL HIGH\n");
  536. break;
  537. case ATH5K_ANI_MODE_AUTO:
  538. len += snprintf(buf+len, sizeof(buf)-len, "AUTO\n");
  539. break;
  540. default:
  541. len += snprintf(buf+len, sizeof(buf)-len,
  542. "??? (not good)\n");
  543. break;
  544. }
  545. len += snprintf(buf+len, sizeof(buf)-len,
  546. "noise immunity level:\t\t%d\n",
  547. as->noise_imm_level);
  548. len += snprintf(buf+len, sizeof(buf)-len,
  549. "spur immunity level:\t\t%d\n",
  550. as->spur_level);
  551. len += snprintf(buf+len, sizeof(buf)-len, "firstep level:\t\t\t%d\n",
  552. as->firstep_level);
  553. len += snprintf(buf+len, sizeof(buf)-len,
  554. "OFDM weak signal detection:\t%s\n",
  555. as->ofdm_weak_sig ? "on" : "off");
  556. len += snprintf(buf+len, sizeof(buf)-len,
  557. "CCK weak signal detection:\t%s\n",
  558. as->cck_weak_sig ? "on" : "off");
  559. len += snprintf(buf+len, sizeof(buf)-len,
  560. "\nMIB INTERRUPTS:\t\t%u\n",
  561. st->mib_intr);
  562. len += snprintf(buf+len, sizeof(buf)-len,
  563. "beacon RSSI average:\t%d\n",
  564. sc->ah->ah_beacon_rssi_avg.avg);
  565. len += snprintf(buf+len, sizeof(buf)-len, "profcnt tx\t\t%u\t(%d%%)\n",
  566. as->pfc_tx,
  567. as->pfc_cycles > 0 ?
  568. as->pfc_tx*100/as->pfc_cycles : 0);
  569. len += snprintf(buf+len, sizeof(buf)-len, "profcnt rx\t\t%u\t(%d%%)\n",
  570. as->pfc_rx,
  571. as->pfc_cycles > 0 ?
  572. as->pfc_rx*100/as->pfc_cycles : 0);
  573. len += snprintf(buf+len, sizeof(buf)-len, "profcnt busy\t\t%u\t(%d%%)\n",
  574. as->pfc_busy,
  575. as->pfc_cycles > 0 ?
  576. as->pfc_busy*100/as->pfc_cycles : 0);
  577. len += snprintf(buf+len, sizeof(buf)-len, "profcnt cycles\t\t%u\n",
  578. as->pfc_cycles);
  579. len += snprintf(buf+len, sizeof(buf)-len,
  580. "listen time\t\t%d\tlast: %d\n",
  581. as->listen_time, as->last_listen);
  582. len += snprintf(buf+len, sizeof(buf)-len,
  583. "OFDM errors\t\t%u\tlast: %u\tsum: %u\n",
  584. as->ofdm_errors, as->last_ofdm_errors,
  585. as->sum_ofdm_errors);
  586. len += snprintf(buf+len, sizeof(buf)-len,
  587. "CCK errors\t\t%u\tlast: %u\tsum: %u\n",
  588. as->cck_errors, as->last_cck_errors,
  589. as->sum_cck_errors);
  590. len += snprintf(buf+len, sizeof(buf)-len,
  591. "AR5K_PHYERR_CNT1\t%x\t(=%d)\n",
  592. ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT1),
  593. ATH5K_ANI_OFDM_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX -
  594. ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT1)));
  595. len += snprintf(buf+len, sizeof(buf)-len,
  596. "AR5K_PHYERR_CNT2\t%x\t(=%d)\n",
  597. ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT2),
  598. ATH5K_ANI_CCK_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX -
  599. ath5k_hw_reg_read(sc->ah, AR5K_PHYERR_CNT2)));
  600. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  601. }
  602. static ssize_t write_file_ani(struct file *file,
  603. const char __user *userbuf,
  604. size_t count, loff_t *ppos)
  605. {
  606. struct ath5k_softc *sc = file->private_data;
  607. char buf[20];
  608. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  609. return -EFAULT;
  610. if (strncmp(buf, "sens-low", 8) == 0) {
  611. ath5k_ani_init(sc->ah, ATH5K_ANI_MODE_MANUAL_HIGH);
  612. } else if (strncmp(buf, "sens-high", 9) == 0) {
  613. ath5k_ani_init(sc->ah, ATH5K_ANI_MODE_MANUAL_LOW);
  614. } else if (strncmp(buf, "ani-off", 7) == 0) {
  615. ath5k_ani_init(sc->ah, ATH5K_ANI_MODE_OFF);
  616. } else if (strncmp(buf, "ani-on", 6) == 0) {
  617. ath5k_ani_init(sc->ah, ATH5K_ANI_MODE_AUTO);
  618. } else if (strncmp(buf, "noise-low", 9) == 0) {
  619. ath5k_ani_set_noise_immunity_level(sc->ah, 0);
  620. } else if (strncmp(buf, "noise-high", 10) == 0) {
  621. ath5k_ani_set_noise_immunity_level(sc->ah,
  622. ATH5K_ANI_MAX_NOISE_IMM_LVL);
  623. } else if (strncmp(buf, "spur-low", 8) == 0) {
  624. ath5k_ani_set_spur_immunity_level(sc->ah, 0);
  625. } else if (strncmp(buf, "spur-high", 9) == 0) {
  626. ath5k_ani_set_spur_immunity_level(sc->ah,
  627. sc->ani_state.max_spur_level);
  628. } else if (strncmp(buf, "fir-low", 7) == 0) {
  629. ath5k_ani_set_firstep_level(sc->ah, 0);
  630. } else if (strncmp(buf, "fir-high", 8) == 0) {
  631. ath5k_ani_set_firstep_level(sc->ah, ATH5K_ANI_MAX_FIRSTEP_LVL);
  632. } else if (strncmp(buf, "ofdm-off", 8) == 0) {
  633. ath5k_ani_set_ofdm_weak_signal_detection(sc->ah, false);
  634. } else if (strncmp(buf, "ofdm-on", 7) == 0) {
  635. ath5k_ani_set_ofdm_weak_signal_detection(sc->ah, true);
  636. } else if (strncmp(buf, "cck-off", 7) == 0) {
  637. ath5k_ani_set_cck_weak_signal_detection(sc->ah, false);
  638. } else if (strncmp(buf, "cck-on", 6) == 0) {
  639. ath5k_ani_set_cck_weak_signal_detection(sc->ah, true);
  640. }
  641. return count;
  642. }
  643. static const struct file_operations fops_ani = {
  644. .read = read_file_ani,
  645. .write = write_file_ani,
  646. .open = ath5k_debugfs_open,
  647. .owner = THIS_MODULE,
  648. };
  649. /* debugfs: queues etc */
  650. static ssize_t read_file_queue(struct file *file, char __user *user_buf,
  651. size_t count, loff_t *ppos)
  652. {
  653. struct ath5k_softc *sc = file->private_data;
  654. char buf[700];
  655. unsigned int len = 0;
  656. struct ath5k_txq *txq;
  657. struct ath5k_buf *bf, *bf0;
  658. int i, n = 0;
  659. len += snprintf(buf+len, sizeof(buf)-len,
  660. "available txbuffers: %d\n", sc->txbuf_len);
  661. for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
  662. txq = &sc->txqs[i];
  663. len += snprintf(buf+len, sizeof(buf)-len,
  664. "%02d: %ssetup\n", i, txq->setup ? "" : "not ");
  665. if (!txq->setup)
  666. continue;
  667. list_for_each_entry_safe(bf, bf0, &txq->q, list)
  668. n++;
  669. len += snprintf(buf+len, sizeof(buf)-len, " len: %d\n", n);
  670. }
  671. return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  672. }
  673. static ssize_t write_file_queue(struct file *file,
  674. const char __user *userbuf,
  675. size_t count, loff_t *ppos)
  676. {
  677. struct ath5k_softc *sc = file->private_data;
  678. char buf[20];
  679. if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
  680. return -EFAULT;
  681. if (strncmp(buf, "start", 5) == 0)
  682. ieee80211_wake_queues(sc->hw);
  683. else if (strncmp(buf, "stop", 4) == 0)
  684. ieee80211_stop_queues(sc->hw);
  685. return count;
  686. }
  687. static const struct file_operations fops_queue = {
  688. .read = read_file_queue,
  689. .write = write_file_queue,
  690. .open = ath5k_debugfs_open,
  691. .owner = THIS_MODULE,
  692. };
  693. /* init */
  694. void
  695. ath5k_debug_init(void)
  696. {
  697. ath5k_global_debugfs = debugfs_create_dir("ath5k", NULL);
  698. }
  699. void
  700. ath5k_debug_init_device(struct ath5k_softc *sc)
  701. {
  702. sc->debug.level = ath5k_debug;
  703. sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
  704. ath5k_global_debugfs);
  705. sc->debug.debugfs_debug = debugfs_create_file("debug",
  706. S_IWUSR | S_IRUSR,
  707. sc->debug.debugfs_phydir, sc, &fops_debug);
  708. sc->debug.debugfs_registers = debugfs_create_file("registers", S_IRUSR,
  709. sc->debug.debugfs_phydir, sc, &fops_registers);
  710. sc->debug.debugfs_beacon = debugfs_create_file("beacon",
  711. S_IWUSR | S_IRUSR,
  712. sc->debug.debugfs_phydir, sc, &fops_beacon);
  713. sc->debug.debugfs_reset = debugfs_create_file("reset", S_IWUSR,
  714. sc->debug.debugfs_phydir, sc, &fops_reset);
  715. sc->debug.debugfs_antenna = debugfs_create_file("antenna",
  716. S_IWUSR | S_IRUSR,
  717. sc->debug.debugfs_phydir, sc, &fops_antenna);
  718. sc->debug.debugfs_frameerrors = debugfs_create_file("frameerrors",
  719. S_IWUSR | S_IRUSR,
  720. sc->debug.debugfs_phydir, sc,
  721. &fops_frameerrors);
  722. sc->debug.debugfs_ani = debugfs_create_file("ani",
  723. S_IWUSR | S_IRUSR,
  724. sc->debug.debugfs_phydir, sc,
  725. &fops_ani);
  726. sc->debug.debugfs_queue = debugfs_create_file("queue",
  727. S_IWUSR | S_IRUSR,
  728. sc->debug.debugfs_phydir, sc,
  729. &fops_queue);
  730. }
  731. void
  732. ath5k_debug_finish(void)
  733. {
  734. debugfs_remove(ath5k_global_debugfs);
  735. }
  736. void
  737. ath5k_debug_finish_device(struct ath5k_softc *sc)
  738. {
  739. debugfs_remove(sc->debug.debugfs_debug);
  740. debugfs_remove(sc->debug.debugfs_registers);
  741. debugfs_remove(sc->debug.debugfs_beacon);
  742. debugfs_remove(sc->debug.debugfs_reset);
  743. debugfs_remove(sc->debug.debugfs_antenna);
  744. debugfs_remove(sc->debug.debugfs_frameerrors);
  745. debugfs_remove(sc->debug.debugfs_ani);
  746. debugfs_remove(sc->debug.debugfs_queue);
  747. debugfs_remove(sc->debug.debugfs_phydir);
  748. }
  749. /* functions used in other places */
  750. void
  751. ath5k_debug_dump_bands(struct ath5k_softc *sc)
  752. {
  753. unsigned int b, i;
  754. if (likely(!(sc->debug.level & ATH5K_DEBUG_DUMPBANDS)))
  755. return;
  756. BUG_ON(!sc->sbands);
  757. for (b = 0; b < IEEE80211_NUM_BANDS; b++) {
  758. struct ieee80211_supported_band *band = &sc->sbands[b];
  759. char bname[6];
  760. switch (band->band) {
  761. case IEEE80211_BAND_2GHZ:
  762. strcpy(bname, "2 GHz");
  763. break;
  764. case IEEE80211_BAND_5GHZ:
  765. strcpy(bname, "5 GHz");
  766. break;
  767. default:
  768. printk(KERN_DEBUG "Band not supported: %d\n",
  769. band->band);
  770. return;
  771. }
  772. printk(KERN_DEBUG "Band %s: channels %d, rates %d\n", bname,
  773. band->n_channels, band->n_bitrates);
  774. printk(KERN_DEBUG " channels:\n");
  775. for (i = 0; i < band->n_channels; i++)
  776. printk(KERN_DEBUG " %3d %d %.4x %.4x\n",
  777. ieee80211_frequency_to_channel(
  778. band->channels[i].center_freq),
  779. band->channels[i].center_freq,
  780. band->channels[i].hw_value,
  781. band->channels[i].flags);
  782. printk(KERN_DEBUG " rates:\n");
  783. for (i = 0; i < band->n_bitrates; i++)
  784. printk(KERN_DEBUG " %4d %.4x %.4x %.4x\n",
  785. band->bitrates[i].bitrate,
  786. band->bitrates[i].hw_value,
  787. band->bitrates[i].flags,
  788. band->bitrates[i].hw_value_short);
  789. }
  790. }
  791. static inline void
  792. ath5k_debug_printrxbuf(struct ath5k_buf *bf, int done,
  793. struct ath5k_rx_status *rs)
  794. {
  795. struct ath5k_desc *ds = bf->desc;
  796. struct ath5k_hw_all_rx_desc *rd = &ds->ud.ds_rx;
  797. printk(KERN_DEBUG "R (%p %llx) %08x %08x %08x %08x %08x %08x %c\n",
  798. ds, (unsigned long long)bf->daddr,
  799. ds->ds_link, ds->ds_data,
  800. rd->rx_ctl.rx_control_0, rd->rx_ctl.rx_control_1,
  801. rd->rx_stat.rx_status_0, rd->rx_stat.rx_status_1,
  802. !done ? ' ' : (rs->rs_status == 0) ? '*' : '!');
  803. }
  804. void
  805. ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah)
  806. {
  807. struct ath5k_desc *ds;
  808. struct ath5k_buf *bf;
  809. struct ath5k_rx_status rs = {};
  810. int status;
  811. if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET)))
  812. return;
  813. printk(KERN_DEBUG "rxdp %x, rxlink %p\n",
  814. ath5k_hw_get_rxdp(ah), sc->rxlink);
  815. spin_lock_bh(&sc->rxbuflock);
  816. list_for_each_entry(bf, &sc->rxbuf, list) {
  817. ds = bf->desc;
  818. status = ah->ah_proc_rx_desc(ah, ds, &rs);
  819. if (!status)
  820. ath5k_debug_printrxbuf(bf, status == 0, &rs);
  821. }
  822. spin_unlock_bh(&sc->rxbuflock);
  823. }
  824. void
  825. ath5k_debug_dump_skb(struct ath5k_softc *sc,
  826. struct sk_buff *skb, const char *prefix, int tx)
  827. {
  828. char buf[16];
  829. if (likely(!((tx && (sc->debug.level & ATH5K_DEBUG_DUMP_TX)) ||
  830. (!tx && (sc->debug.level & ATH5K_DEBUG_DUMP_RX)))))
  831. return;
  832. snprintf(buf, sizeof(buf), "%s %s", wiphy_name(sc->hw->wiphy), prefix);
  833. print_hex_dump_bytes(buf, DUMP_PREFIX_NONE, skb->data,
  834. min(200U, skb->len));
  835. printk(KERN_DEBUG "\n");
  836. }
  837. void
  838. ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf)
  839. {
  840. struct ath5k_desc *ds = bf->desc;
  841. struct ath5k_hw_5212_tx_desc *td = &ds->ud.ds_tx5212;
  842. struct ath5k_tx_status ts = {};
  843. int done;
  844. if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET)))
  845. return;
  846. done = sc->ah->ah_proc_tx_desc(sc->ah, bf->desc, &ts);
  847. printk(KERN_DEBUG "T (%p %llx) %08x %08x %08x %08x %08x %08x %08x "
  848. "%08x %c\n", ds, (unsigned long long)bf->daddr, ds->ds_link,
  849. ds->ds_data, td->tx_ctl.tx_control_0, td->tx_ctl.tx_control_1,
  850. td->tx_ctl.tx_control_2, td->tx_ctl.tx_control_3,
  851. td->tx_stat.tx_status_0, td->tx_stat.tx_status_1,
  852. done ? ' ' : (ts.ts_status == 0) ? '*' : '!');
  853. }
  854. #endif /* ifdef CONFIG_ATH5K_DEBUG */