debug.c 30 KB

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