debug.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. // SPDX-License-Identifier: GPL-2.0
  2. /******************************************************************************
  3. *
  4. * Copyright(c) 2009-2012 Realtek Corporation.
  5. *
  6. * Contact Information:
  7. * wlanfae <wlanfae@realtek.com>
  8. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  9. * Hsinchu 300, Taiwan.
  10. *
  11. * Larry Finger <Larry.Finger@lwfinger.net>
  12. *****************************************************************************/
  13. #include "wifi.h"
  14. #include "cam.h"
  15. #include <linux/moduleparam.h>
  16. #include <linux/vmalloc.h>
  17. #ifdef CONFIG_RTLWIFI_DEBUG_ST
  18. void _rtl_dbg_trace(struct rtl_priv *rtlpriv, u64 comp, int level,
  19. const char *fmt, ...)
  20. {
  21. if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
  22. level <= rtlpriv->cfg->mod_params->debug_level)) {
  23. struct va_format vaf;
  24. va_list args;
  25. va_start(args, fmt);
  26. vaf.fmt = fmt;
  27. vaf.va = &args;
  28. pr_info(":<%lx> %pV", in_interrupt(), &vaf);
  29. va_end(args);
  30. }
  31. }
  32. void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
  33. const char *fmt, ...)
  34. {
  35. if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
  36. level <= rtlpriv->cfg->mod_params->debug_level)) {
  37. struct va_format vaf;
  38. va_list args;
  39. va_start(args, fmt);
  40. vaf.fmt = fmt;
  41. vaf.va = &args;
  42. pr_info("%pV", &vaf);
  43. va_end(args);
  44. }
  45. }
  46. void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
  47. const char *titlestring,
  48. const void *hexdata, int hexdatalen)
  49. {
  50. if (unlikely(((comp) & rtlpriv->cfg->mod_params->debug_mask) &&
  51. ((level) <= rtlpriv->cfg->mod_params->debug_level))) {
  52. pr_info("In process \"%s\" (pid %i): %s\n",
  53. current->comm, current->pid, titlestring);
  54. print_hex_dump_bytes("", DUMP_PREFIX_NONE,
  55. hexdata, hexdatalen);
  56. }
  57. }
  58. struct rtl_debugfs_priv {
  59. struct rtl_priv *rtlpriv;
  60. int (*cb_read)(struct seq_file *m, void *v);
  61. ssize_t (*cb_write)(struct file *filp, const char __user *buffer,
  62. size_t count, loff_t *loff);
  63. u32 cb_data;
  64. };
  65. static struct dentry *debugfs_topdir;
  66. static int rtl_debug_get_common(struct seq_file *m, void *v)
  67. {
  68. struct rtl_debugfs_priv *debugfs_priv = m->private;
  69. return debugfs_priv->cb_read(m, v);
  70. }
  71. static int dl_debug_open_common(struct inode *inode, struct file *file)
  72. {
  73. return single_open(file, rtl_debug_get_common, inode->i_private);
  74. }
  75. static const struct file_operations file_ops_common = {
  76. .open = dl_debug_open_common,
  77. .read = seq_read,
  78. .llseek = seq_lseek,
  79. .release = single_release,
  80. };
  81. static int rtl_debug_get_mac_page(struct seq_file *m, void *v)
  82. {
  83. struct rtl_debugfs_priv *debugfs_priv = m->private;
  84. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  85. u32 page = debugfs_priv->cb_data;
  86. int i, n;
  87. int max = 0xff;
  88. for (n = 0; n <= max; ) {
  89. seq_printf(m, "\n%8.8x ", n + page);
  90. for (i = 0; i < 4 && n <= max; i++, n += 4)
  91. seq_printf(m, "%8.8x ",
  92. rtl_read_dword(rtlpriv, (page | n)));
  93. }
  94. seq_puts(m, "\n");
  95. return 0;
  96. }
  97. #define RTL_DEBUG_IMPL_MAC_SERIES(page, addr) \
  98. static struct rtl_debugfs_priv rtl_debug_priv_mac_ ##page = { \
  99. .cb_read = rtl_debug_get_mac_page, \
  100. .cb_data = addr, \
  101. }
  102. RTL_DEBUG_IMPL_MAC_SERIES(0, 0x0000);
  103. RTL_DEBUG_IMPL_MAC_SERIES(1, 0x0100);
  104. RTL_DEBUG_IMPL_MAC_SERIES(2, 0x0200);
  105. RTL_DEBUG_IMPL_MAC_SERIES(3, 0x0300);
  106. RTL_DEBUG_IMPL_MAC_SERIES(4, 0x0400);
  107. RTL_DEBUG_IMPL_MAC_SERIES(5, 0x0500);
  108. RTL_DEBUG_IMPL_MAC_SERIES(6, 0x0600);
  109. RTL_DEBUG_IMPL_MAC_SERIES(7, 0x0700);
  110. RTL_DEBUG_IMPL_MAC_SERIES(10, 0x1000);
  111. RTL_DEBUG_IMPL_MAC_SERIES(11, 0x1100);
  112. RTL_DEBUG_IMPL_MAC_SERIES(12, 0x1200);
  113. RTL_DEBUG_IMPL_MAC_SERIES(13, 0x1300);
  114. RTL_DEBUG_IMPL_MAC_SERIES(14, 0x1400);
  115. RTL_DEBUG_IMPL_MAC_SERIES(15, 0x1500);
  116. RTL_DEBUG_IMPL_MAC_SERIES(16, 0x1600);
  117. RTL_DEBUG_IMPL_MAC_SERIES(17, 0x1700);
  118. static int rtl_debug_get_bb_page(struct seq_file *m, void *v)
  119. {
  120. struct rtl_debugfs_priv *debugfs_priv = m->private;
  121. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  122. struct ieee80211_hw *hw = rtlpriv->hw;
  123. u32 page = debugfs_priv->cb_data;
  124. int i, n;
  125. int max = 0xff;
  126. for (n = 0; n <= max; ) {
  127. seq_printf(m, "\n%8.8x ", n + page);
  128. for (i = 0; i < 4 && n <= max; i++, n += 4)
  129. seq_printf(m, "%8.8x ",
  130. rtl_get_bbreg(hw, (page | n), 0xffffffff));
  131. }
  132. seq_puts(m, "\n");
  133. return 0;
  134. }
  135. #define RTL_DEBUG_IMPL_BB_SERIES(page, addr) \
  136. static struct rtl_debugfs_priv rtl_debug_priv_bb_ ##page = { \
  137. .cb_read = rtl_debug_get_bb_page, \
  138. .cb_data = addr, \
  139. }
  140. RTL_DEBUG_IMPL_BB_SERIES(8, 0x0800);
  141. RTL_DEBUG_IMPL_BB_SERIES(9, 0x0900);
  142. RTL_DEBUG_IMPL_BB_SERIES(a, 0x0a00);
  143. RTL_DEBUG_IMPL_BB_SERIES(b, 0x0b00);
  144. RTL_DEBUG_IMPL_BB_SERIES(c, 0x0c00);
  145. RTL_DEBUG_IMPL_BB_SERIES(d, 0x0d00);
  146. RTL_DEBUG_IMPL_BB_SERIES(e, 0x0e00);
  147. RTL_DEBUG_IMPL_BB_SERIES(f, 0x0f00);
  148. RTL_DEBUG_IMPL_BB_SERIES(18, 0x1800);
  149. RTL_DEBUG_IMPL_BB_SERIES(19, 0x1900);
  150. RTL_DEBUG_IMPL_BB_SERIES(1a, 0x1a00);
  151. RTL_DEBUG_IMPL_BB_SERIES(1b, 0x1b00);
  152. RTL_DEBUG_IMPL_BB_SERIES(1c, 0x1c00);
  153. RTL_DEBUG_IMPL_BB_SERIES(1d, 0x1d00);
  154. RTL_DEBUG_IMPL_BB_SERIES(1e, 0x1e00);
  155. RTL_DEBUG_IMPL_BB_SERIES(1f, 0x1f00);
  156. static int rtl_debug_get_reg_rf(struct seq_file *m, void *v)
  157. {
  158. struct rtl_debugfs_priv *debugfs_priv = m->private;
  159. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  160. struct ieee80211_hw *hw = rtlpriv->hw;
  161. enum radio_path rfpath = debugfs_priv->cb_data;
  162. int i, n;
  163. int max = 0x40;
  164. if (IS_HARDWARE_TYPE_8822B(rtlpriv))
  165. max = 0xff;
  166. seq_printf(m, "\nPATH(%d)", rfpath);
  167. for (n = 0; n <= max; ) {
  168. seq_printf(m, "\n%8.8x ", n);
  169. for (i = 0; i < 4 && n <= max; n += 1, i++)
  170. seq_printf(m, "%8.8x ",
  171. rtl_get_rfreg(hw, rfpath, n, 0xffffffff));
  172. }
  173. seq_puts(m, "\n");
  174. return 0;
  175. }
  176. #define RTL_DEBUG_IMPL_RF_SERIES(page, addr) \
  177. static struct rtl_debugfs_priv rtl_debug_priv_rf_ ##page = { \
  178. .cb_read = rtl_debug_get_reg_rf, \
  179. .cb_data = addr, \
  180. }
  181. RTL_DEBUG_IMPL_RF_SERIES(a, RF90_PATH_A);
  182. RTL_DEBUG_IMPL_RF_SERIES(b, RF90_PATH_B);
  183. static int rtl_debug_get_cam_register(struct seq_file *m, void *v)
  184. {
  185. struct rtl_debugfs_priv *debugfs_priv = m->private;
  186. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  187. int start = debugfs_priv->cb_data;
  188. u32 target_cmd = 0;
  189. u32 target_val = 0;
  190. u8 entry_i = 0;
  191. u32 ulstatus;
  192. int i = 100, j = 0;
  193. int end = (start + 11 > TOTAL_CAM_ENTRY ? TOTAL_CAM_ENTRY : start + 11);
  194. /* This dump the current register page */
  195. seq_printf(m,
  196. "\n#################### SECURITY CAM (%d-%d) ##################\n",
  197. start, end - 1);
  198. for (j = start; j < end; j++) {
  199. seq_printf(m, "\nD: %2x > ", j);
  200. for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
  201. /* polling bit, and No Write enable, and address */
  202. target_cmd = entry_i + CAM_CONTENT_COUNT * j;
  203. target_cmd = target_cmd | BIT(31);
  204. /* Check polling bit is clear */
  205. while ((i--) >= 0) {
  206. ulstatus = rtl_read_dword(
  207. rtlpriv,
  208. rtlpriv->cfg->maps[RWCAM]);
  209. if (ulstatus & BIT(31))
  210. continue;
  211. else
  212. break;
  213. }
  214. rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
  215. target_cmd);
  216. target_val = rtl_read_dword(rtlpriv,
  217. rtlpriv->cfg->maps[RCAMO]);
  218. seq_printf(m, "%8.8x ", target_val);
  219. }
  220. }
  221. seq_puts(m, "\n");
  222. return 0;
  223. }
  224. #define RTL_DEBUG_IMPL_CAM_SERIES(page, addr) \
  225. static struct rtl_debugfs_priv rtl_debug_priv_cam_ ##page = { \
  226. .cb_read = rtl_debug_get_cam_register, \
  227. .cb_data = addr, \
  228. }
  229. RTL_DEBUG_IMPL_CAM_SERIES(1, 0);
  230. RTL_DEBUG_IMPL_CAM_SERIES(2, 11);
  231. RTL_DEBUG_IMPL_CAM_SERIES(3, 22);
  232. static int rtl_debug_get_btcoex(struct seq_file *m, void *v)
  233. {
  234. struct rtl_debugfs_priv *debugfs_priv = m->private;
  235. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  236. if (rtlpriv->cfg->ops->get_btc_status())
  237. rtlpriv->btcoexist.btc_ops->btc_display_bt_coex_info(rtlpriv,
  238. m);
  239. seq_puts(m, "\n");
  240. return 0;
  241. }
  242. static struct rtl_debugfs_priv rtl_debug_priv_btcoex = {
  243. .cb_read = rtl_debug_get_btcoex,
  244. .cb_data = 0,
  245. };
  246. static ssize_t rtl_debugfs_set_write_reg(struct file *filp,
  247. const char __user *buffer,
  248. size_t count, loff_t *loff)
  249. {
  250. struct rtl_debugfs_priv *debugfs_priv = filp->private_data;
  251. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  252. char tmp[32 + 1];
  253. int tmp_len;
  254. u32 addr, val, len;
  255. int num;
  256. if (count < 3)
  257. return -EFAULT;
  258. tmp_len = (count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count);
  259. if (!buffer || copy_from_user(tmp, buffer, tmp_len))
  260. return count;
  261. tmp[tmp_len] = '\0';
  262. /* write BB/MAC register */
  263. num = sscanf(tmp, "%x %x %x", &addr, &val, &len);
  264. if (num != 3)
  265. return count;
  266. switch (len) {
  267. case 1:
  268. rtl_write_byte(rtlpriv, addr, (u8)val);
  269. break;
  270. case 2:
  271. rtl_write_word(rtlpriv, addr, (u16)val);
  272. break;
  273. case 4:
  274. rtl_write_dword(rtlpriv, addr, val);
  275. break;
  276. default:
  277. /*printk("error write length=%d", len);*/
  278. break;
  279. }
  280. return count;
  281. }
  282. static struct rtl_debugfs_priv rtl_debug_priv_write_reg = {
  283. .cb_write = rtl_debugfs_set_write_reg,
  284. };
  285. static ssize_t rtl_debugfs_set_write_h2c(struct file *filp,
  286. const char __user *buffer,
  287. size_t count, loff_t *loff)
  288. {
  289. struct rtl_debugfs_priv *debugfs_priv = filp->private_data;
  290. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  291. struct ieee80211_hw *hw = rtlpriv->hw;
  292. char tmp[32 + 1];
  293. int tmp_len;
  294. u8 h2c_len, h2c_data_packed[8];
  295. int h2c_data[8]; /* idx 0: cmd */
  296. int i;
  297. if (count < 3)
  298. return -EFAULT;
  299. tmp_len = (count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count);
  300. if (!buffer || copy_from_user(tmp, buffer, tmp_len))
  301. return count;
  302. tmp[tmp_len] = '\0';
  303. h2c_len = sscanf(tmp, "%X %X %X %X %X %X %X %X",
  304. &h2c_data[0], &h2c_data[1],
  305. &h2c_data[2], &h2c_data[3],
  306. &h2c_data[4], &h2c_data[5],
  307. &h2c_data[6], &h2c_data[7]);
  308. if (h2c_len <= 0)
  309. return count;
  310. for (i = 0; i < h2c_len; i++)
  311. h2c_data_packed[i] = (u8)h2c_data[i];
  312. rtlpriv->cfg->ops->fill_h2c_cmd(hw, h2c_data_packed[0],
  313. h2c_len - 1,
  314. &h2c_data_packed[1]);
  315. return count;
  316. }
  317. static struct rtl_debugfs_priv rtl_debug_priv_write_h2c = {
  318. .cb_write = rtl_debugfs_set_write_h2c,
  319. };
  320. static ssize_t rtl_debugfs_set_write_rfreg(struct file *filp,
  321. const char __user *buffer,
  322. size_t count, loff_t *loff)
  323. {
  324. struct rtl_debugfs_priv *debugfs_priv = filp->private_data;
  325. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  326. struct ieee80211_hw *hw = rtlpriv->hw;
  327. char tmp[32 + 1];
  328. int tmp_len;
  329. int num;
  330. int path;
  331. u32 addr, bitmask, data;
  332. if (count < 3)
  333. return -EFAULT;
  334. tmp_len = (count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count);
  335. if (!buffer || copy_from_user(tmp, buffer, tmp_len))
  336. return count;
  337. tmp[tmp_len] = '\0';
  338. num = sscanf(tmp, "%X %X %X %X",
  339. &path, &addr, &bitmask, &data);
  340. if (num != 4) {
  341. RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
  342. "Format is <path> <addr> <mask> <data>\n");
  343. return count;
  344. }
  345. rtl_set_rfreg(hw, path, addr, bitmask, data);
  346. return count;
  347. }
  348. static struct rtl_debugfs_priv rtl_debug_priv_write_rfreg = {
  349. .cb_write = rtl_debugfs_set_write_rfreg,
  350. };
  351. static int rtl_debugfs_close(struct inode *inode, struct file *filp)
  352. {
  353. return 0;
  354. }
  355. static ssize_t rtl_debugfs_common_write(struct file *filp,
  356. const char __user *buffer,
  357. size_t count, loff_t *loff)
  358. {
  359. struct rtl_debugfs_priv *debugfs_priv = filp->private_data;
  360. return debugfs_priv->cb_write(filp, buffer, count, loff);
  361. }
  362. static const struct file_operations file_ops_common_write = {
  363. .owner = THIS_MODULE,
  364. .write = rtl_debugfs_common_write,
  365. .open = simple_open,
  366. .release = rtl_debugfs_close,
  367. };
  368. static ssize_t rtl_debugfs_phydm_cmd(struct file *filp,
  369. const char __user *buffer,
  370. size_t count, loff_t *loff)
  371. {
  372. struct rtl_debugfs_priv *debugfs_priv = filp->private_data;
  373. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  374. char tmp[64];
  375. if (!rtlpriv->dbg.msg_buf)
  376. return -ENOMEM;
  377. if (!rtlpriv->phydm.ops)
  378. return -EFAULT;
  379. if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
  380. tmp[count] = '\0';
  381. rtlpriv->phydm.ops->phydm_debug_cmd(rtlpriv, tmp, count,
  382. rtlpriv->dbg.msg_buf,
  383. 80 * 25);
  384. }
  385. return count;
  386. }
  387. static int rtl_debug_get_phydm_cmd(struct seq_file *m, void *v)
  388. {
  389. struct rtl_debugfs_priv *debugfs_priv = m->private;
  390. struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
  391. if (rtlpriv->dbg.msg_buf)
  392. seq_puts(m, rtlpriv->dbg.msg_buf);
  393. return 0;
  394. }
  395. static int rtl_debugfs_open_rw(struct inode *inode, struct file *filp)
  396. {
  397. int ret = 0;
  398. if (filp->f_mode & FMODE_READ)
  399. ret = single_open(filp, rtl_debug_get_common, inode->i_private);
  400. else
  401. filp->private_data = inode->i_private;
  402. return ret;
  403. }
  404. static int rtl_debugfs_close_rw(struct inode *inode, struct file *filp)
  405. {
  406. if (filp->f_mode == FMODE_READ)
  407. single_release(inode, filp);
  408. return 0;
  409. }
  410. static struct rtl_debugfs_priv rtl_debug_priv_phydm_cmd = {
  411. .cb_read = rtl_debug_get_phydm_cmd,
  412. .cb_write = rtl_debugfs_phydm_cmd,
  413. .cb_data = 0,
  414. };
  415. static const struct file_operations file_ops_common_rw = {
  416. .owner = THIS_MODULE,
  417. .open = rtl_debugfs_open_rw,
  418. .release = rtl_debugfs_close_rw,
  419. .read = seq_read,
  420. .llseek = seq_lseek,
  421. .write = rtl_debugfs_common_write,
  422. };
  423. #define RTL_DEBUGFS_ADD_CORE(name, mode, fopname) \
  424. do { \
  425. rtl_debug_priv_ ##name.rtlpriv = rtlpriv; \
  426. debugfs_create_file(#name, mode, parent, \
  427. &rtl_debug_priv_ ##name, \
  428. &file_ops_ ##fopname); \
  429. } while (0)
  430. #define RTL_DEBUGFS_ADD(name) \
  431. RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  432. #define RTL_DEBUGFS_ADD_W(name) \
  433. RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0222, common_write)
  434. #define RTL_DEBUGFS_ADD_RW(name) \
  435. RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0666, common_rw)
  436. void rtl_debug_add_one(struct ieee80211_hw *hw)
  437. {
  438. struct rtl_priv *rtlpriv = rtl_priv(hw);
  439. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  440. struct dentry *parent;
  441. rtlpriv->dbg.msg_buf = vzalloc(80 * 25);
  442. snprintf(rtlpriv->dbg.debugfs_name, 18, "%pMF", rtlefuse->dev_addr);
  443. rtlpriv->dbg.debugfs_dir =
  444. debugfs_create_dir(rtlpriv->dbg.debugfs_name, debugfs_topdir);
  445. if (!rtlpriv->dbg.debugfs_dir) {
  446. pr_err("Unable to init debugfs:/%s/%s\n", rtlpriv->cfg->name,
  447. rtlpriv->dbg.debugfs_name);
  448. return;
  449. }
  450. parent = rtlpriv->dbg.debugfs_dir;
  451. RTL_DEBUGFS_ADD(mac_0);
  452. RTL_DEBUGFS_ADD(mac_1);
  453. RTL_DEBUGFS_ADD(mac_2);
  454. RTL_DEBUGFS_ADD(mac_3);
  455. RTL_DEBUGFS_ADD(mac_4);
  456. RTL_DEBUGFS_ADD(mac_5);
  457. RTL_DEBUGFS_ADD(mac_6);
  458. RTL_DEBUGFS_ADD(mac_7);
  459. RTL_DEBUGFS_ADD(bb_8);
  460. RTL_DEBUGFS_ADD(bb_9);
  461. RTL_DEBUGFS_ADD(bb_a);
  462. RTL_DEBUGFS_ADD(bb_b);
  463. RTL_DEBUGFS_ADD(bb_c);
  464. RTL_DEBUGFS_ADD(bb_d);
  465. RTL_DEBUGFS_ADD(bb_e);
  466. RTL_DEBUGFS_ADD(bb_f);
  467. RTL_DEBUGFS_ADD(mac_10);
  468. RTL_DEBUGFS_ADD(mac_11);
  469. RTL_DEBUGFS_ADD(mac_12);
  470. RTL_DEBUGFS_ADD(mac_13);
  471. RTL_DEBUGFS_ADD(mac_14);
  472. RTL_DEBUGFS_ADD(mac_15);
  473. RTL_DEBUGFS_ADD(mac_16);
  474. RTL_DEBUGFS_ADD(mac_17);
  475. RTL_DEBUGFS_ADD(bb_18);
  476. RTL_DEBUGFS_ADD(bb_19);
  477. RTL_DEBUGFS_ADD(bb_1a);
  478. RTL_DEBUGFS_ADD(bb_1b);
  479. RTL_DEBUGFS_ADD(bb_1c);
  480. RTL_DEBUGFS_ADD(bb_1d);
  481. RTL_DEBUGFS_ADD(bb_1e);
  482. RTL_DEBUGFS_ADD(bb_1f);
  483. RTL_DEBUGFS_ADD(rf_a);
  484. RTL_DEBUGFS_ADD(rf_b);
  485. RTL_DEBUGFS_ADD(cam_1);
  486. RTL_DEBUGFS_ADD(cam_2);
  487. RTL_DEBUGFS_ADD(cam_3);
  488. RTL_DEBUGFS_ADD(btcoex);
  489. RTL_DEBUGFS_ADD_W(write_reg);
  490. RTL_DEBUGFS_ADD_W(write_h2c);
  491. RTL_DEBUGFS_ADD_W(write_rfreg);
  492. RTL_DEBUGFS_ADD_RW(phydm_cmd);
  493. }
  494. void rtl_debug_remove_one(struct ieee80211_hw *hw)
  495. {
  496. struct rtl_priv *rtlpriv = rtl_priv(hw);
  497. debugfs_remove_recursive(rtlpriv->dbg.debugfs_dir);
  498. rtlpriv->dbg.debugfs_dir = NULL;
  499. vfree(rtlpriv->dbg.msg_buf);
  500. }
  501. void rtl_debugfs_add_topdir(void)
  502. {
  503. debugfs_topdir = debugfs_create_dir("rtlwifi", NULL);
  504. }
  505. void rtl_debugfs_remove_topdir(void)
  506. {
  507. debugfs_remove_recursive(debugfs_topdir);
  508. }
  509. #endif