Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / drivers / staging / rtl8821ae / debug.c
blobcb051223c68420e896ee314e62918718886f197e
1 /******************************************************************************
3 * Copyright(c) 2009-2010 Realtek Corporation.
5 * Tmis program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * Tmis program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
14 * You should have received a copy of the GNU General Public License along with
15 * tmis program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 * Tme full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
26 * Larry Finger <Larry.Finger@lwfinger.net>
28 *****************************************************************************/
30 #include "wifi.h"
31 #include "cam.h"
33 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
34 #define GET_INODE_DATA(__node) PDE_DATA(__node)
35 #else
36 #define GET_INODE_DATA(__node) PDE(__node)->data
37 #endif
40 void rtl_dbgp_flag_init(struct ieee80211_hw *hw)
42 struct rtl_priv *rtlpriv = rtl_priv(hw);
43 u8 i;
45 rtlpriv->dbg.global_debuglevel = DBG_DMESG;
47 rtlpriv->dbg.global_debugcomponents =
48 COMP_ERR |
49 COMP_FW |
50 COMP_INIT |
51 COMP_RECV |
52 COMP_SEND |
53 COMP_MLME |
54 COMP_SCAN |
55 COMP_INTR |
56 COMP_LED |
57 COMP_SEC |
58 COMP_BEACON |
59 COMP_RATE |
60 COMP_RXDESC |
61 COMP_DIG |
62 COMP_TXAGC |
63 COMP_POWER |
64 COMP_POWER_TRACKING |
65 COMP_BB_POWERSAVING |
66 COMP_SWAS |
67 COMP_RF |
68 COMP_TURBO |
69 COMP_RATR |
70 COMP_CMD |
71 COMP_EASY_CONCURRENT |
72 COMP_EFUSE |
73 COMP_QOS | COMP_MAC80211 | COMP_REGD |
74 COMP_CHAN |
75 COMP_BT_COEXIST |
76 COMP_IQK |
79 for (i = 0; i < DBGP_TYPE_MAX; i++)
80 rtlpriv->dbg.dbgp_type[i] = 0;
82 /*Init Debug flag enable condition */
85 struct proc_dir_entry *proc_topdir;
86 static int rtl_proc_get_mac_0(struct seq_file *m, void *v)
88 struct ieee80211_hw *hw = m->private;
89 struct rtl_priv *rtlpriv = rtl_priv(hw);
90 int i, n, page;
91 int max = 0xff;
92 page = 0x000;
94 for (n = 0; n <= max; ) {
95 seq_printf(m, "\n%8.8x ", n + page);
96 for (i = 0; i < 4 && n <= max; i++, n += 4)
97 seq_printf(m, "%8.8x ",
98 rtl_read_dword(rtlpriv, (page | n)));
100 seq_puts(m, "\n");
101 return 0;
104 static int dl_proc_open_mac_0(struct inode *inode, struct file *file)
106 return single_open(file, rtl_proc_get_mac_0, GET_INODE_DATA(inode));
109 static const struct file_operations file_ops_mac_0 = {
110 .open = dl_proc_open_mac_0,
111 .read = seq_read,
112 .llseek = seq_lseek,
113 .release = seq_release,
116 static int rtl_proc_get_mac_1(struct seq_file *m, void *v)
118 struct ieee80211_hw *hw = m->private;
119 struct rtl_priv *rtlpriv = rtl_priv(hw);
120 int i, n, page;
121 int max = 0xff;
122 page = 0x100;
124 for (n = 0; n <= max; ) {
125 seq_printf(m, "\n%8.8x ", n + page);
126 for (i = 0; i < 4 && n <= max; i++, n += 4)
127 seq_printf(m, "%8.8x ",
128 rtl_read_dword(rtlpriv, (page | n)));
130 seq_puts(m, "\n");
131 return 0;
134 static int dl_proc_open_mac_1(struct inode *inode, struct file *file)
136 return single_open(file, rtl_proc_get_mac_1, GET_INODE_DATA(inode));
139 static const struct file_operations file_ops_mac_1 = {
140 .open = dl_proc_open_mac_1,
141 .read = seq_read,
142 .llseek = seq_lseek,
143 .release = seq_release,
146 static int rtl_proc_get_mac_2(struct seq_file *m, void *v)
148 struct ieee80211_hw *hw = m->private;
149 struct rtl_priv *rtlpriv = rtl_priv(hw);
150 int i, n, page;
151 int max = 0xff;
152 page = 0x200;
154 for (n = 0; n <= max; ) {
155 seq_printf(m, "\n%8.8x ", n + page);
156 for (i = 0; i < 4 && n <= max; i++, n += 4)
157 seq_printf(m, "%8.8x ",
158 rtl_read_dword(rtlpriv, (page | n)));
160 seq_puts(m, "\n");
161 return 0;
164 static int dl_proc_open_mac_2(struct inode *inode, struct file *file)
166 return single_open(file, rtl_proc_get_mac_2, GET_INODE_DATA(inode));
169 static const struct file_operations file_ops_mac_2 = {
170 .open = dl_proc_open_mac_2,
171 .read = seq_read,
172 .llseek = seq_lseek,
173 .release = seq_release,
176 static int rtl_proc_get_mac_3(struct seq_file *m, void *v)
178 struct ieee80211_hw *hw = m->private;
179 struct rtl_priv *rtlpriv = rtl_priv(hw);
180 int i, n, page;
181 int max = 0xff;
182 page = 0x300;
184 for (n = 0; n <= max; ) {
185 seq_printf(m, "\n%8.8x ", n + page);
186 for (i = 0; i < 4 && n <= max; i++, n += 4)
187 seq_printf(m, "%8.8x ",
188 rtl_read_dword(rtlpriv, (page | n)));
190 seq_puts(m, "\n");
191 return 0;
194 static int dl_proc_open_mac_3(struct inode *inode, struct file *file)
196 return single_open(file, rtl_proc_get_mac_3, GET_INODE_DATA(inode));
199 static const struct file_operations file_ops_mac_3 = {
200 .open = dl_proc_open_mac_3,
201 .read = seq_read,
202 .llseek = seq_lseek,
203 .release = seq_release,
206 static int rtl_proc_get_mac_4(struct seq_file *m, void *v)
208 struct ieee80211_hw *hw = m->private;
209 struct rtl_priv *rtlpriv = rtl_priv(hw);
210 int i, n, page;
211 int max = 0xff;
212 page = 0x400;
214 for (n = 0; n <= max; ) {
215 seq_printf(m, "\n%8.8x ", n + page);
216 for (i = 0; i < 4 && n <= max; i++, n += 4)
217 seq_printf(m, "%8.8x ",
218 rtl_read_dword(rtlpriv, (page | n)));
220 seq_puts(m, "\n");
221 return 0;
224 static int dl_proc_open_mac_4(struct inode *inode, struct file *file)
226 return single_open(file, rtl_proc_get_mac_4, GET_INODE_DATA(inode));
229 static const struct file_operations file_ops_mac_4 = {
230 .open = dl_proc_open_mac_4,
231 .read = seq_read,
232 .llseek = seq_lseek,
233 .release = seq_release,
236 static int rtl_proc_get_mac_5(struct seq_file *m, void *v)
238 struct ieee80211_hw *hw = m->private;
239 struct rtl_priv *rtlpriv = rtl_priv(hw);
240 int i, n, page;
241 int max = 0xff;
242 page = 0x500;
244 for (n = 0; n <= max; ) {
245 seq_printf(m, "\n%8.8x ", n + page);
246 for (i = 0; i < 4 && n <= max; i++, n += 4)
247 seq_printf(m, "%8.8x ",
248 rtl_read_dword(rtlpriv, (page | n)));
250 seq_puts(m, "\n");
251 return 0;
254 static int dl_proc_open_mac_5(struct inode *inode, struct file *file)
256 return single_open(file, rtl_proc_get_mac_5, GET_INODE_DATA(inode));
259 static const struct file_operations file_ops_mac_5 = {
260 .open = dl_proc_open_mac_5,
261 .read = seq_read,
262 .llseek = seq_lseek,
263 .release = seq_release,
266 static int rtl_proc_get_mac_6(struct seq_file *m, void *v)
268 struct ieee80211_hw *hw = m->private;
269 struct rtl_priv *rtlpriv = rtl_priv(hw);
270 int i, n, page;
271 int max = 0xff;
272 page = 0x600;
274 for (n = 0; n <= max; ) {
275 seq_printf(m, "\n%8.8x ", n + page);
276 for (i = 0; i < 4 && n <= max; i++, n += 4)
277 seq_printf(m, "%8.8x ",
278 rtl_read_dword(rtlpriv, (page | n)));
280 seq_puts(m, "\n");
281 return 0;
284 static int dl_proc_open_mac_6(struct inode *inode, struct file *file)
286 return single_open(file, rtl_proc_get_mac_6, GET_INODE_DATA(inode));
289 static const struct file_operations file_ops_mac_6 = {
290 .open = dl_proc_open_mac_6,
291 .read = seq_read,
292 .llseek = seq_lseek,
293 .release = seq_release,
296 static int rtl_proc_get_mac_7(struct seq_file *m, void *v)
298 struct ieee80211_hw *hw = m->private;
299 struct rtl_priv *rtlpriv = rtl_priv(hw);
300 int i, n, page;
301 int max = 0xff;
302 page = 0x700;
304 for (n = 0; n <= max; ) {
305 seq_printf(m, "\n%8.8x ", n + page);
306 for (i = 0; i < 4 && n <= max; i++, n += 4)
307 seq_printf(m, "%8.8x ",
308 rtl_read_dword(rtlpriv, (page | n)));
310 seq_puts(m, "\n");
311 return 0;
314 static int dl_proc_open_mac_7(struct inode *inode, struct file *file)
316 return single_open(file, rtl_proc_get_mac_7, GET_INODE_DATA(inode));
319 static const struct file_operations file_ops_mac_7 = {
320 .open = dl_proc_open_mac_7,
321 .read = seq_read,
322 .llseek = seq_lseek,
323 .release = seq_release,
326 static int rtl_proc_get_bb_8(struct seq_file *m, void *v)
328 struct ieee80211_hw *hw = m->private;
329 int i, n, page;
330 int max = 0xff;
331 page = 0x800;
333 for (n = 0; n <= max; ) {
334 seq_printf(m, "\n%8.8x ", n + page);
335 for (i = 0; i < 4 && n <= max; i++, n += 4)
336 seq_printf(m, "%8.8x ",
337 rtl_get_bbreg(hw, (page | n), 0xffffffff));
339 seq_puts(m, "\n");
340 return 0;
343 static int dl_proc_open_bb_8(struct inode *inode, struct file *file)
345 return single_open(file, rtl_proc_get_bb_8, GET_INODE_DATA(inode));
348 static const struct file_operations file_ops_bb_8 = {
349 .open = dl_proc_open_bb_8,
350 .read = seq_read,
351 .llseek = seq_lseek,
352 .release = seq_release,
355 static int rtl_proc_get_bb_9(struct seq_file *m, void *v)
357 struct ieee80211_hw *hw = m->private;
358 int i, n, page;
359 int max = 0xff;
360 page = 0x900;
362 for (n = 0; n <= max; ) {
363 seq_printf(m, "\n%8.8x ", n + page);
364 for (i = 0; i < 4 && n <= max; i++, n += 4)
365 seq_printf(m, "%8.8x ",
366 rtl_get_bbreg(hw, (page | n), 0xffffffff));
368 seq_puts(m, "\n");
369 return 0;
372 static int dl_proc_open_bb_9(struct inode *inode, struct file *file)
374 return single_open(file, rtl_proc_get_bb_9, GET_INODE_DATA(inode));
377 static const struct file_operations file_ops_bb_9 = {
378 .open = dl_proc_open_bb_9,
379 .read = seq_read,
380 .llseek = seq_lseek,
381 .release = seq_release,
384 static int rtl_proc_get_bb_a(struct seq_file *m, void *v)
386 struct ieee80211_hw *hw = m->private;
387 int i, n, page;
388 int max = 0xff;
389 page = 0xa00;
391 for (n = 0; n <= max; ) {
392 seq_printf(m, "\n%8.8x ", n + page);
393 for (i = 0; i < 4 && n <= max; i++, n += 4)
394 seq_printf(m, "%8.8x ",
395 rtl_get_bbreg(hw, (page | n), 0xffffffff));
397 seq_puts(m, "\n");
398 return 0;
401 static int dl_proc_open_bb_a(struct inode *inode, struct file *file)
403 return single_open(file, rtl_proc_get_bb_a, GET_INODE_DATA(inode));
406 static const struct file_operations file_ops_bb_a = {
407 .open = dl_proc_open_bb_a,
408 .read = seq_read,
409 .llseek = seq_lseek,
410 .release = seq_release,
413 static int rtl_proc_get_bb_b(struct seq_file *m, void *v)
415 struct ieee80211_hw *hw = m->private;
416 int i, n, page;
417 int max = 0xff;
418 page = 0xb00;
420 for (n = 0; n <= max; ) {
421 seq_printf(m, "\n%8.8x ", n + page);
422 for (i = 0; i < 4 && n <= max; i++, n += 4)
423 seq_printf(m, "%8.8x ",
424 rtl_get_bbreg(hw, (page | n), 0xffffffff));
426 seq_puts(m, "\n");
427 return 0;
430 static int dl_proc_open_bb_b(struct inode *inode, struct file *file)
432 return single_open(file, rtl_proc_get_bb_b, GET_INODE_DATA(inode));
435 static const struct file_operations file_ops_bb_b = {
436 .open = dl_proc_open_bb_b,
437 .read = seq_read,
438 .llseek = seq_lseek,
439 .release = seq_release,
442 static int rtl_proc_get_bb_c(struct seq_file *m, void *v)
444 struct ieee80211_hw *hw = m->private;
445 int i, n, page;
446 int max = 0xff;
447 page = 0xc00;
449 for (n = 0; n <= max; ) {
450 seq_printf(m, "\n%8.8x ", n + page);
451 for (i = 0; i < 4 && n <= max; i++, n += 4)
452 seq_printf(m, "%8.8x ",
453 rtl_get_bbreg(hw, (page | n), 0xffffffff));
455 seq_puts(m, "\n");
456 return 0;
459 static int dl_proc_open_bb_c(struct inode *inode, struct file *file)
461 return single_open(file, rtl_proc_get_bb_c, GET_INODE_DATA(inode));
464 static const struct file_operations file_ops_bb_c = {
465 .open = dl_proc_open_bb_c,
466 .read = seq_read,
467 .llseek = seq_lseek,
468 .release = seq_release,
471 static int rtl_proc_get_bb_d(struct seq_file *m, void *v)
473 struct ieee80211_hw *hw = m->private;
474 int i, n, page;
475 int max = 0xff;
476 page = 0xd00;
478 for (n = 0; n <= max; ) {
479 seq_printf(m, "\n%8.8x ", n + page);
480 for (i = 0; i < 4 && n <= max; i++, n += 4)
481 seq_printf(m, "%8.8x ",
482 rtl_get_bbreg(hw, (page | n), 0xffffffff));
484 seq_puts(m, "\n");
485 return 0;
488 static int dl_proc_open_bb_d(struct inode *inode, struct file *file)
490 return single_open(file, rtl_proc_get_bb_d, GET_INODE_DATA(inode));
493 static const struct file_operations file_ops_bb_d = {
494 .open = dl_proc_open_bb_d,
495 .read = seq_read,
496 .llseek = seq_lseek,
497 .release = seq_release,
500 static int rtl_proc_get_bb_e(struct seq_file *m, void *v)
502 struct ieee80211_hw *hw = m->private;
503 int i, n, page;
504 int max = 0xff;
505 page = 0xe00;
507 for (n = 0; n <= max; ) {
508 seq_printf(m, "\n%8.8x ", n + page);
509 for (i = 0; i < 4 && n <= max; i++, n += 4)
510 seq_printf(m, "%8.8x ",
511 rtl_get_bbreg(hw, (page | n), 0xffffffff));
513 seq_puts(m, "\n");
514 return 0;
517 static int dl_proc_open_bb_e(struct inode *inode, struct file *file)
519 return single_open(file, rtl_proc_get_bb_e, GET_INODE_DATA(inode));
522 static const struct file_operations file_ops_bb_e = {
523 .open = dl_proc_open_bb_e,
524 .read = seq_read,
525 .llseek = seq_lseek,
526 .release = seq_release,
529 static int rtl_proc_get_bb_f(struct seq_file *m, void *v)
531 struct ieee80211_hw *hw = m->private;
532 int i, n, page;
533 int max = 0xff;
534 page = 0xf00;
536 for (n = 0; n <= max; ) {
537 seq_printf(m, "\n%8.8x ", n + page);
538 for (i = 0; i < 4 && n <= max; i++, n += 4)
539 seq_printf(m, "%8.8x ",
540 rtl_get_bbreg(hw, (page | n), 0xffffffff));
542 seq_puts(m, "\n");
543 return 0;
546 static int dl_proc_open_bb_f(struct inode *inode, struct file *file)
548 return single_open(file, rtl_proc_get_bb_f, GET_INODE_DATA(inode));
551 static const struct file_operations file_ops_bb_f = {
552 .open = dl_proc_open_bb_f,
553 .read = seq_read,
554 .llseek = seq_lseek,
555 .release = seq_release,
558 static int rtl_proc_get_reg_rf_a(struct seq_file *m, void *v)
560 struct ieee80211_hw *hw = m->private;
561 int i, n;
562 int max = 0x40;
564 for (n = 0; n <= max; ) {
565 seq_printf(m, "\n%8.8x ", n);
566 for (i = 0; i < 4 && n <= max; n += 1, i++)
567 seq_printf(m, "%8.8x ",
568 rtl_get_rfreg(hw, RF90_PATH_A, n, 0xffffffff));
570 seq_puts(m, "\n");
571 return 0;
574 static int dl_proc_open_rf_a(struct inode *inode, struct file *file)
576 return single_open(file, rtl_proc_get_reg_rf_a, GET_INODE_DATA(inode));
579 static const struct file_operations file_ops_rf_a = {
580 .open = dl_proc_open_rf_a,
581 .read = seq_read,
582 .llseek = seq_lseek,
583 .release = seq_release,
586 static int rtl_proc_get_reg_rf_b(struct seq_file *m, void *v)
588 struct ieee80211_hw *hw = m->private;
589 int i, n;
590 int max = 0x40;
592 for (n = 0; n <= max; ) {
593 seq_printf(m, "\n%8.8x ", n);
594 for (i = 0; i < 4 && n <= max; n += 1, i++)
595 seq_printf(m, "%8.8x ",
596 rtl_get_rfreg(hw, RF90_PATH_B, n,
597 0xffffffff));
599 seq_puts(m, "\n");
600 return 0;
603 static int dl_proc_open_rf_b(struct inode *inode, struct file *file)
605 return single_open(file, rtl_proc_get_reg_rf_b, GET_INODE_DATA(inode));
608 static const struct file_operations file_ops_rf_b = {
609 .open = dl_proc_open_rf_b,
610 .read = seq_read,
611 .llseek = seq_lseek,
612 .release = seq_release,
615 static int rtl_proc_get_cam_register_1(struct seq_file *m, void *v)
617 struct ieee80211_hw *hw = m->private;
618 struct rtl_priv *rtlpriv = rtl_priv(hw);
619 u32 target_cmd = 0;
620 u32 target_val=0;
621 u8 entry_i=0;
622 u32 ulstatus;
623 int i = 100, j = 0;
625 /* This dump the current register page */
626 seq_puts(m,
627 "\n#################### SECURITY CAM (0-10) ##################\n ");
629 for (j = 0; j < 11; j++) {
630 seq_printf(m, "\nD: %2x > ", j);
631 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
632 /* polling bit, and No Write enable, and address */
633 target_cmd = entry_i + CAM_CONTENT_COUNT * j;
634 target_cmd = target_cmd | BIT(31);
636 /* Check polling bit is clear */
637 while ((i--) >= 0) {
638 ulstatus = rtl_read_dword(rtlpriv,
639 rtlpriv->cfg->maps[RWCAM]);
640 if (ulstatus & BIT(31)) {
641 continue;
642 } else {
643 break;
647 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
648 target_cmd);
649 target_val = rtl_read_dword(rtlpriv,
650 rtlpriv->cfg->maps[RCAMO]);
651 seq_printf(m, "%8.8x ", target_val);
654 seq_puts(m, "\n");
655 return 0;
658 static int dl_proc_open_cam_1(struct inode *inode, struct file *file)
660 return single_open(file, rtl_proc_get_cam_register_1,
661 GET_INODE_DATA(inode));
664 static const struct file_operations file_ops_cam_1 = {
665 .open = dl_proc_open_cam_1,
666 .read = seq_read,
667 .llseek = seq_lseek,
668 .release = seq_release,
671 static int rtl_proc_get_cam_register_2(struct seq_file *m, void *v)
673 struct ieee80211_hw *hw = m->private;
674 struct rtl_priv *rtlpriv = rtl_priv(hw);
675 u32 target_cmd = 0;
676 u32 target_val = 0;
677 u8 entry_i = 0;
678 u32 ulstatus;
679 int i = 100, j = 0;
681 /* This dump the current register page */
682 seq_puts(m,
683 "\n################### SECURITY CAM (11-21) ##################\n ");
685 for (j = 11; j < 22; j++) {
686 seq_printf(m, "\nD: %2x > ", j);
687 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
688 target_cmd = entry_i + CAM_CONTENT_COUNT * j;
689 target_cmd = target_cmd | BIT(31);
691 while ((i--) >= 0) {
692 ulstatus = rtl_read_dword(rtlpriv,
693 rtlpriv->cfg->maps[RWCAM]);
694 if (ulstatus & BIT(31)) {
695 continue;
696 } else {
697 break;
701 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
702 target_cmd);
703 target_val = rtl_read_dword(rtlpriv,
704 rtlpriv->cfg->maps[RCAMO]);
705 seq_printf(m, "%8.8x ", target_val);
708 seq_puts(m, "\n");
709 return 0;
712 static int dl_proc_open_cam_2(struct inode *inode, struct file *file)
714 return single_open(file, rtl_proc_get_cam_register_2,
715 GET_INODE_DATA(inode));
718 static const struct file_operations file_ops_cam_2 = {
719 .open = dl_proc_open_cam_2,
720 .read = seq_read,
721 .llseek = seq_lseek,
722 .release = seq_release,
725 static int rtl_proc_get_cam_register_3(struct seq_file *m, void *v)
727 struct ieee80211_hw *hw = m->private;
728 struct rtl_priv *rtlpriv = rtl_priv(hw);
729 u32 target_cmd = 0;
730 u32 target_val = 0;
731 u8 entry_i = 0;
732 u32 ulstatus;
733 int i = 100, j = 0;
735 /* This dump the current register page */
736 seq_puts(m,
737 "\n################### SECURITY CAM (22-31) ##################\n ");
739 for (j = 22; j < TOTAL_CAM_ENTRY; j++) {
740 seq_printf(m, "\nD: %2x > ", j);
741 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
742 target_cmd = entry_i+CAM_CONTENT_COUNT*j;
743 target_cmd = target_cmd | BIT(31);
745 while ((i--) >= 0) {
746 ulstatus = rtl_read_dword(rtlpriv,
747 rtlpriv->cfg->maps[RWCAM]);
748 if (ulstatus & BIT(31)) {
749 continue;
750 } else {
751 break;
755 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
756 target_cmd);
757 target_val = rtl_read_dword(rtlpriv,
758 rtlpriv->cfg->maps[RCAMO]);
759 seq_printf(m, "%8.8x ", target_val);
762 seq_puts(m, "\n");
763 return 0;
766 static int dl_proc_open_cam_3(struct inode *inode, struct file *file)
768 return single_open(file, rtl_proc_get_cam_register_3,
769 GET_INODE_DATA(inode));
772 static const struct file_operations file_ops_cam_3 = {
773 .open = dl_proc_open_cam_3,
774 .read = seq_read,
775 .llseek = seq_lseek,
776 .release = seq_release,
779 void rtl_proc_add_one(struct ieee80211_hw *hw)
781 struct rtl_priv *rtlpriv = rtl_priv(hw);
782 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
783 struct proc_dir_entry *entry;
785 snprintf(rtlpriv->dbg.proc_name, 18, "%x-%x-%x-%x-%x-%x",
786 rtlefuse->dev_addr[0], rtlefuse->dev_addr[1],
787 rtlefuse->dev_addr[2], rtlefuse->dev_addr[3],
788 rtlefuse->dev_addr[4], rtlefuse->dev_addr[5]);
790 rtlpriv->dbg.proc_dir = proc_mkdir(rtlpriv->dbg.proc_name, proc_topdir);
791 if (!rtlpriv->dbg.proc_dir) {
792 RT_TRACE(COMP_INIT, DBG_EMERG, ("Unable to init "
793 "/proc/net/%s/%s\n", rtlpriv->cfg->name,
794 rtlpriv->dbg.proc_name));
795 return;
798 entry = proc_create_data("mac-0", S_IFREG | S_IRUGO,
799 rtlpriv->dbg.proc_dir, &file_ops_mac_0, hw);
800 if (!entry)
801 RT_TRACE(COMP_INIT, DBG_EMERG,
802 ("Unable to initialize /proc/net/%s/%s/mac-0\n",
803 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
805 entry = proc_create_data("mac-1", S_IFREG | S_IRUGO,
806 rtlpriv->dbg.proc_dir, &file_ops_mac_1, hw);
807 if (!entry)
808 RT_TRACE(COMP_INIT, COMP_ERR,
809 ("Unable to initialize /proc/net/%s/%s/mac-1\n",
810 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
812 entry = proc_create_data("mac-2", S_IFREG | S_IRUGO,
813 rtlpriv->dbg.proc_dir, &file_ops_mac_2, hw);
814 if (!entry)
815 RT_TRACE(COMP_INIT, COMP_ERR,
816 ("Unable to initialize /proc/net/%s/%s/mac-2\n",
817 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
819 entry = proc_create_data("mac-3", S_IFREG | S_IRUGO,
820 rtlpriv->dbg.proc_dir, &file_ops_mac_3, hw);
821 if (!entry)
822 RT_TRACE(COMP_INIT, COMP_ERR,
823 ("Unable to initialize /proc/net/%s/%s/mac-3\n",
824 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
826 entry = proc_create_data("mac-4", S_IFREG | S_IRUGO,
827 rtlpriv->dbg.proc_dir, &file_ops_mac_4, hw);
828 if (!entry)
829 RT_TRACE(COMP_INIT, COMP_ERR,
830 ("Unable to initialize /proc/net/%s/%s/mac-4\n",
831 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
833 entry = proc_create_data("mac-5", S_IFREG | S_IRUGO,
834 rtlpriv->dbg.proc_dir, &file_ops_mac_5, hw);
835 if (!entry)
836 RT_TRACE(COMP_INIT, COMP_ERR,
837 ("Unable to initialize /proc/net/%s/%s/mac-5\n",
838 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
840 entry = proc_create_data("mac-6", S_IFREG | S_IRUGO,
841 rtlpriv->dbg.proc_dir, &file_ops_mac_6, hw);
842 if (!entry)
843 RT_TRACE(COMP_INIT, COMP_ERR,
844 ("Unable to initialize /proc/net/%s/%s/mac-6\n",
845 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
847 entry = proc_create_data("mac-7", S_IFREG | S_IRUGO,
848 rtlpriv->dbg.proc_dir, &file_ops_mac_7, hw);
849 if (!entry)
850 RT_TRACE(COMP_INIT, COMP_ERR,
851 ("Unable to initialize /proc/net/%s/%s/mac-7\n",
852 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
854 entry = proc_create_data("bb-8", S_IFREG | S_IRUGO,
855 rtlpriv->dbg.proc_dir, &file_ops_bb_8, hw);
856 if (!entry)
857 RT_TRACE(COMP_INIT, COMP_ERR,
858 ("Unable to initialize /proc/net/%s/%s/bb-8\n",
859 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
861 entry = proc_create_data("bb-9", S_IFREG | S_IRUGO,
862 rtlpriv->dbg.proc_dir, &file_ops_bb_9, hw);
863 if (!entry)
864 RT_TRACE(COMP_INIT, COMP_ERR,
865 ("Unable to initialize /proc/net/%s/%s/bb-9\n",
866 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
868 entry = proc_create_data("bb-a", S_IFREG | S_IRUGO,
869 rtlpriv->dbg.proc_dir, &file_ops_bb_a, hw);
870 if (!entry)
871 RT_TRACE(COMP_INIT, COMP_ERR,
872 ("Unable to initialize /proc/net/%s/%s/bb-a\n",
873 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
875 entry = proc_create_data("bb-b", S_IFREG | S_IRUGO,
876 rtlpriv->dbg.proc_dir, &file_ops_bb_b, hw);
877 if (!entry)
878 RT_TRACE(COMP_INIT, COMP_ERR,
879 ("Unable to initialize /proc/net/%s/%s/bb-b\n",
880 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
882 entry = proc_create_data("bb-c", S_IFREG | S_IRUGO,
883 rtlpriv->dbg.proc_dir, &file_ops_bb_c, hw);
884 if (!entry)
885 RT_TRACE(COMP_INIT, COMP_ERR,
886 ("Unable to initialize /proc/net/%s/%s/bb-c\n",
887 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
889 entry = proc_create_data("bb-d", S_IFREG | S_IRUGO,
890 rtlpriv->dbg.proc_dir, &file_ops_bb_d, hw);
891 if (!entry)
892 RT_TRACE(COMP_INIT, COMP_ERR,
893 ("Unable to initialize /proc/net/%s/%s/bb-d\n",
894 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
896 entry = proc_create_data("bb-e", S_IFREG | S_IRUGO,
897 rtlpriv->dbg.proc_dir, &file_ops_bb_e, hw);
898 if (!entry)
899 RT_TRACE(COMP_INIT, COMP_ERR,
900 ("Unable to initialize /proc/net/%s/%s/bb-e\n",
901 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
903 entry = proc_create_data("bb-f", S_IFREG | S_IRUGO,
904 rtlpriv->dbg.proc_dir, &file_ops_bb_f, hw);
905 if (!entry)
906 RT_TRACE(COMP_INIT, COMP_ERR,
907 ("Unable to initialize /proc/net/%s/%s/bb-f\n",
908 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
910 entry = proc_create_data("rf-a", S_IFREG | S_IRUGO,
911 rtlpriv->dbg.proc_dir, &file_ops_rf_a, hw);
912 if (!entry)
913 RT_TRACE(COMP_INIT, COMP_ERR,
914 ("Unable to initialize /proc/net/%s/%s/rf-a\n",
915 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
917 entry = proc_create_data("rf-b", S_IFREG | S_IRUGO,
918 rtlpriv->dbg.proc_dir, &file_ops_rf_b, hw);
919 if (!entry)
920 RT_TRACE(COMP_INIT, COMP_ERR,
921 ("Unable to initialize /proc/net/%s/%s/rf-b\n",
922 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
924 entry = proc_create_data("cam-1", S_IFREG | S_IRUGO,
925 rtlpriv->dbg.proc_dir, &file_ops_cam_1, hw);
926 if (!entry)
927 RT_TRACE(COMP_INIT, COMP_ERR,
928 ("Unable to initialize /proc/net/%s/%s/cam-1\n",
929 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
931 entry = proc_create_data("cam-2", S_IFREG | S_IRUGO,
932 rtlpriv->dbg.proc_dir, &file_ops_cam_2, hw);
933 if (!entry)
934 RT_TRACE(COMP_INIT, COMP_ERR,
935 ("Unable to initialize /proc/net/%s/%s/cam-2\n",
936 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
938 entry = proc_create_data("cam-3", S_IFREG | S_IRUGO,
939 rtlpriv->dbg.proc_dir, &file_ops_cam_3, hw);
940 if (!entry)
941 RT_TRACE(COMP_INIT, COMP_ERR,
942 ("Unable to initialize /proc/net/%s/%s/cam-3\n",
943 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
946 void rtl_proc_remove_one(struct ieee80211_hw *hw)
948 struct rtl_priv *rtlpriv = rtl_priv(hw);
950 if (rtlpriv->dbg.proc_dir) {
951 remove_proc_entry("mac-0", rtlpriv->dbg.proc_dir);
952 remove_proc_entry("mac-1", rtlpriv->dbg.proc_dir);
953 remove_proc_entry("mac-2", rtlpriv->dbg.proc_dir);
954 remove_proc_entry("mac-3", rtlpriv->dbg.proc_dir);
955 remove_proc_entry("mac-4", rtlpriv->dbg.proc_dir);
956 remove_proc_entry("mac-5", rtlpriv->dbg.proc_dir);
957 remove_proc_entry("mac-6", rtlpriv->dbg.proc_dir);
958 remove_proc_entry("mac-7", rtlpriv->dbg.proc_dir);
959 remove_proc_entry("bb-8", rtlpriv->dbg.proc_dir);
960 remove_proc_entry("bb-9", rtlpriv->dbg.proc_dir);
961 remove_proc_entry("bb-a", rtlpriv->dbg.proc_dir);
962 remove_proc_entry("bb-b", rtlpriv->dbg.proc_dir);
963 remove_proc_entry("bb-c", rtlpriv->dbg.proc_dir);
964 remove_proc_entry("bb-d", rtlpriv->dbg.proc_dir);
965 remove_proc_entry("bb-e", rtlpriv->dbg.proc_dir);
966 remove_proc_entry("bb-f", rtlpriv->dbg.proc_dir);
967 remove_proc_entry("rf-a", rtlpriv->dbg.proc_dir);
968 remove_proc_entry("rf-b", rtlpriv->dbg.proc_dir);
969 remove_proc_entry("cam-1", rtlpriv->dbg.proc_dir);
970 remove_proc_entry("cam-2", rtlpriv->dbg.proc_dir);
971 remove_proc_entry("cam-3", rtlpriv->dbg.proc_dir);
973 remove_proc_entry(rtlpriv->dbg.proc_name, proc_topdir);
975 rtlpriv->dbg.proc_dir = NULL;
979 void rtl_proc_add_topdir(void)
981 proc_topdir = proc_mkdir("rtlwifi", init_net.proc_net);
984 void rtl_proc_remove_topdir(void)
986 if (proc_topdir)
987 remove_proc_entry("rtlwifi", init_net.proc_net);