KVM: nVMX: Fix returned value of MSR_IA32_VMX_VMCS_ENUM
[linux/fpc-iii.git] / drivers / staging / rtl8821ae / debug.c
blob8aefbf10a45e81e23a5094e2fa959aa29f0984f4
1 /******************************************************************************
3 * Copyright(c) 2009-2010 Realtek Corporation.
5 * This 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 * This 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 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 * The 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 #define GET_INODE_DATA(__node) PDE_DATA(__node)
35 void rtl_dbgp_flag_init(struct ieee80211_hw *hw)
37 struct rtl_priv *rtlpriv = rtl_priv(hw);
38 u8 i;
40 rtlpriv->dbg.global_debuglevel = DBG_DMESG;
42 rtlpriv->dbg.global_debugcomponents =
43 COMP_ERR |
44 COMP_FW |
45 COMP_INIT |
46 COMP_RECV |
47 COMP_SEND |
48 COMP_MLME |
49 COMP_SCAN |
50 COMP_INTR |
51 COMP_LED |
52 COMP_SEC |
53 COMP_BEACON |
54 COMP_RATE |
55 COMP_RXDESC |
56 COMP_DIG |
57 COMP_TXAGC |
58 COMP_POWER |
59 COMP_POWER_TRACKING |
60 COMP_BB_POWERSAVING |
61 COMP_SWAS |
62 COMP_RF |
63 COMP_TURBO |
64 COMP_RATR |
65 COMP_CMD |
66 COMP_EASY_CONCURRENT |
67 COMP_EFUSE |
68 COMP_QOS | COMP_MAC80211 | COMP_REGD |
69 COMP_CHAN |
70 COMP_BT_COEXIST |
71 COMP_IQK |
74 for (i = 0; i < DBGP_TYPE_MAX; i++)
75 rtlpriv->dbg.dbgp_type[i] = 0;
77 /*Init Debug flag enable condition */
80 struct proc_dir_entry *proc_topdir;
81 static int rtl_proc_get_mac_0(struct seq_file *m, void *v)
83 struct ieee80211_hw *hw = m->private;
84 struct rtl_priv *rtlpriv = rtl_priv(hw);
85 int i, n, page;
86 int max = 0xff;
87 page = 0x000;
89 for (n = 0; n <= max; ) {
90 seq_printf(m, "\n%8.8x ", n + page);
91 for (i = 0; i < 4 && n <= max; i++, n += 4)
92 seq_printf(m, "%8.8x ",
93 rtl_read_dword(rtlpriv, (page | n)));
95 seq_puts(m, "\n");
96 return 0;
99 static int dl_proc_open_mac_0(struct inode *inode, struct file *file)
101 return single_open(file, rtl_proc_get_mac_0, GET_INODE_DATA(inode));
104 static const struct file_operations file_ops_mac_0 = {
105 .open = dl_proc_open_mac_0,
106 .read = seq_read,
107 .llseek = seq_lseek,
108 .release = seq_release,
111 static int rtl_proc_get_mac_1(struct seq_file *m, void *v)
113 struct ieee80211_hw *hw = m->private;
114 struct rtl_priv *rtlpriv = rtl_priv(hw);
115 int i, n, page;
116 int max = 0xff;
117 page = 0x100;
119 for (n = 0; n <= max; ) {
120 seq_printf(m, "\n%8.8x ", n + page);
121 for (i = 0; i < 4 && n <= max; i++, n += 4)
122 seq_printf(m, "%8.8x ",
123 rtl_read_dword(rtlpriv, (page | n)));
125 seq_puts(m, "\n");
126 return 0;
129 static int dl_proc_open_mac_1(struct inode *inode, struct file *file)
131 return single_open(file, rtl_proc_get_mac_1, GET_INODE_DATA(inode));
134 static const struct file_operations file_ops_mac_1 = {
135 .open = dl_proc_open_mac_1,
136 .read = seq_read,
137 .llseek = seq_lseek,
138 .release = seq_release,
141 static int rtl_proc_get_mac_2(struct seq_file *m, void *v)
143 struct ieee80211_hw *hw = m->private;
144 struct rtl_priv *rtlpriv = rtl_priv(hw);
145 int i, n, page;
146 int max = 0xff;
147 page = 0x200;
149 for (n = 0; n <= max; ) {
150 seq_printf(m, "\n%8.8x ", n + page);
151 for (i = 0; i < 4 && n <= max; i++, n += 4)
152 seq_printf(m, "%8.8x ",
153 rtl_read_dword(rtlpriv, (page | n)));
155 seq_puts(m, "\n");
156 return 0;
159 static int dl_proc_open_mac_2(struct inode *inode, struct file *file)
161 return single_open(file, rtl_proc_get_mac_2, GET_INODE_DATA(inode));
164 static const struct file_operations file_ops_mac_2 = {
165 .open = dl_proc_open_mac_2,
166 .read = seq_read,
167 .llseek = seq_lseek,
168 .release = seq_release,
171 static int rtl_proc_get_mac_3(struct seq_file *m, void *v)
173 struct ieee80211_hw *hw = m->private;
174 struct rtl_priv *rtlpriv = rtl_priv(hw);
175 int i, n, page;
176 int max = 0xff;
177 page = 0x300;
179 for (n = 0; n <= max; ) {
180 seq_printf(m, "\n%8.8x ", n + page);
181 for (i = 0; i < 4 && n <= max; i++, n += 4)
182 seq_printf(m, "%8.8x ",
183 rtl_read_dword(rtlpriv, (page | n)));
185 seq_puts(m, "\n");
186 return 0;
189 static int dl_proc_open_mac_3(struct inode *inode, struct file *file)
191 return single_open(file, rtl_proc_get_mac_3, GET_INODE_DATA(inode));
194 static const struct file_operations file_ops_mac_3 = {
195 .open = dl_proc_open_mac_3,
196 .read = seq_read,
197 .llseek = seq_lseek,
198 .release = seq_release,
201 static int rtl_proc_get_mac_4(struct seq_file *m, void *v)
203 struct ieee80211_hw *hw = m->private;
204 struct rtl_priv *rtlpriv = rtl_priv(hw);
205 int i, n, page;
206 int max = 0xff;
207 page = 0x400;
209 for (n = 0; n <= max; ) {
210 seq_printf(m, "\n%8.8x ", n + page);
211 for (i = 0; i < 4 && n <= max; i++, n += 4)
212 seq_printf(m, "%8.8x ",
213 rtl_read_dword(rtlpriv, (page | n)));
215 seq_puts(m, "\n");
216 return 0;
219 static int dl_proc_open_mac_4(struct inode *inode, struct file *file)
221 return single_open(file, rtl_proc_get_mac_4, GET_INODE_DATA(inode));
224 static const struct file_operations file_ops_mac_4 = {
225 .open = dl_proc_open_mac_4,
226 .read = seq_read,
227 .llseek = seq_lseek,
228 .release = seq_release,
231 static int rtl_proc_get_mac_5(struct seq_file *m, void *v)
233 struct ieee80211_hw *hw = m->private;
234 struct rtl_priv *rtlpriv = rtl_priv(hw);
235 int i, n, page;
236 int max = 0xff;
237 page = 0x500;
239 for (n = 0; n <= max; ) {
240 seq_printf(m, "\n%8.8x ", n + page);
241 for (i = 0; i < 4 && n <= max; i++, n += 4)
242 seq_printf(m, "%8.8x ",
243 rtl_read_dword(rtlpriv, (page | n)));
245 seq_puts(m, "\n");
246 return 0;
249 static int dl_proc_open_mac_5(struct inode *inode, struct file *file)
251 return single_open(file, rtl_proc_get_mac_5, GET_INODE_DATA(inode));
254 static const struct file_operations file_ops_mac_5 = {
255 .open = dl_proc_open_mac_5,
256 .read = seq_read,
257 .llseek = seq_lseek,
258 .release = seq_release,
261 static int rtl_proc_get_mac_6(struct seq_file *m, void *v)
263 struct ieee80211_hw *hw = m->private;
264 struct rtl_priv *rtlpriv = rtl_priv(hw);
265 int i, n, page;
266 int max = 0xff;
267 page = 0x600;
269 for (n = 0; n <= max; ) {
270 seq_printf(m, "\n%8.8x ", n + page);
271 for (i = 0; i < 4 && n <= max; i++, n += 4)
272 seq_printf(m, "%8.8x ",
273 rtl_read_dword(rtlpriv, (page | n)));
275 seq_puts(m, "\n");
276 return 0;
279 static int dl_proc_open_mac_6(struct inode *inode, struct file *file)
281 return single_open(file, rtl_proc_get_mac_6, GET_INODE_DATA(inode));
284 static const struct file_operations file_ops_mac_6 = {
285 .open = dl_proc_open_mac_6,
286 .read = seq_read,
287 .llseek = seq_lseek,
288 .release = seq_release,
291 static int rtl_proc_get_mac_7(struct seq_file *m, void *v)
293 struct ieee80211_hw *hw = m->private;
294 struct rtl_priv *rtlpriv = rtl_priv(hw);
295 int i, n, page;
296 int max = 0xff;
297 page = 0x700;
299 for (n = 0; n <= max; ) {
300 seq_printf(m, "\n%8.8x ", n + page);
301 for (i = 0; i < 4 && n <= max; i++, n += 4)
302 seq_printf(m, "%8.8x ",
303 rtl_read_dword(rtlpriv, (page | n)));
305 seq_puts(m, "\n");
306 return 0;
309 static int dl_proc_open_mac_7(struct inode *inode, struct file *file)
311 return single_open(file, rtl_proc_get_mac_7, GET_INODE_DATA(inode));
314 static const struct file_operations file_ops_mac_7 = {
315 .open = dl_proc_open_mac_7,
316 .read = seq_read,
317 .llseek = seq_lseek,
318 .release = seq_release,
321 static int rtl_proc_get_bb_8(struct seq_file *m, void *v)
323 struct ieee80211_hw *hw = m->private;
324 int i, n, page;
325 int max = 0xff;
326 page = 0x800;
328 for (n = 0; n <= max; ) {
329 seq_printf(m, "\n%8.8x ", n + page);
330 for (i = 0; i < 4 && n <= max; i++, n += 4)
331 seq_printf(m, "%8.8x ",
332 rtl_get_bbreg(hw, (page | n), 0xffffffff));
334 seq_puts(m, "\n");
335 return 0;
338 static int dl_proc_open_bb_8(struct inode *inode, struct file *file)
340 return single_open(file, rtl_proc_get_bb_8, GET_INODE_DATA(inode));
343 static const struct file_operations file_ops_bb_8 = {
344 .open = dl_proc_open_bb_8,
345 .read = seq_read,
346 .llseek = seq_lseek,
347 .release = seq_release,
350 static int rtl_proc_get_bb_9(struct seq_file *m, void *v)
352 struct ieee80211_hw *hw = m->private;
353 int i, n, page;
354 int max = 0xff;
355 page = 0x900;
357 for (n = 0; n <= max; ) {
358 seq_printf(m, "\n%8.8x ", n + page);
359 for (i = 0; i < 4 && n <= max; i++, n += 4)
360 seq_printf(m, "%8.8x ",
361 rtl_get_bbreg(hw, (page | n), 0xffffffff));
363 seq_puts(m, "\n");
364 return 0;
367 static int dl_proc_open_bb_9(struct inode *inode, struct file *file)
369 return single_open(file, rtl_proc_get_bb_9, GET_INODE_DATA(inode));
372 static const struct file_operations file_ops_bb_9 = {
373 .open = dl_proc_open_bb_9,
374 .read = seq_read,
375 .llseek = seq_lseek,
376 .release = seq_release,
379 static int rtl_proc_get_bb_a(struct seq_file *m, void *v)
381 struct ieee80211_hw *hw = m->private;
382 int i, n, page;
383 int max = 0xff;
384 page = 0xa00;
386 for (n = 0; n <= max; ) {
387 seq_printf(m, "\n%8.8x ", n + page);
388 for (i = 0; i < 4 && n <= max; i++, n += 4)
389 seq_printf(m, "%8.8x ",
390 rtl_get_bbreg(hw, (page | n), 0xffffffff));
392 seq_puts(m, "\n");
393 return 0;
396 static int dl_proc_open_bb_a(struct inode *inode, struct file *file)
398 return single_open(file, rtl_proc_get_bb_a, GET_INODE_DATA(inode));
401 static const struct file_operations file_ops_bb_a = {
402 .open = dl_proc_open_bb_a,
403 .read = seq_read,
404 .llseek = seq_lseek,
405 .release = seq_release,
408 static int rtl_proc_get_bb_b(struct seq_file *m, void *v)
410 struct ieee80211_hw *hw = m->private;
411 int i, n, page;
412 int max = 0xff;
413 page = 0xb00;
415 for (n = 0; n <= max; ) {
416 seq_printf(m, "\n%8.8x ", n + page);
417 for (i = 0; i < 4 && n <= max; i++, n += 4)
418 seq_printf(m, "%8.8x ",
419 rtl_get_bbreg(hw, (page | n), 0xffffffff));
421 seq_puts(m, "\n");
422 return 0;
425 static int dl_proc_open_bb_b(struct inode *inode, struct file *file)
427 return single_open(file, rtl_proc_get_bb_b, GET_INODE_DATA(inode));
430 static const struct file_operations file_ops_bb_b = {
431 .open = dl_proc_open_bb_b,
432 .read = seq_read,
433 .llseek = seq_lseek,
434 .release = seq_release,
437 static int rtl_proc_get_bb_c(struct seq_file *m, void *v)
439 struct ieee80211_hw *hw = m->private;
440 int i, n, page;
441 int max = 0xff;
442 page = 0xc00;
444 for (n = 0; n <= max; ) {
445 seq_printf(m, "\n%8.8x ", n + page);
446 for (i = 0; i < 4 && n <= max; i++, n += 4)
447 seq_printf(m, "%8.8x ",
448 rtl_get_bbreg(hw, (page | n), 0xffffffff));
450 seq_puts(m, "\n");
451 return 0;
454 static int dl_proc_open_bb_c(struct inode *inode, struct file *file)
456 return single_open(file, rtl_proc_get_bb_c, GET_INODE_DATA(inode));
459 static const struct file_operations file_ops_bb_c = {
460 .open = dl_proc_open_bb_c,
461 .read = seq_read,
462 .llseek = seq_lseek,
463 .release = seq_release,
466 static int rtl_proc_get_bb_d(struct seq_file *m, void *v)
468 struct ieee80211_hw *hw = m->private;
469 int i, n, page;
470 int max = 0xff;
471 page = 0xd00;
473 for (n = 0; n <= max; ) {
474 seq_printf(m, "\n%8.8x ", n + page);
475 for (i = 0; i < 4 && n <= max; i++, n += 4)
476 seq_printf(m, "%8.8x ",
477 rtl_get_bbreg(hw, (page | n), 0xffffffff));
479 seq_puts(m, "\n");
480 return 0;
483 static int dl_proc_open_bb_d(struct inode *inode, struct file *file)
485 return single_open(file, rtl_proc_get_bb_d, GET_INODE_DATA(inode));
488 static const struct file_operations file_ops_bb_d = {
489 .open = dl_proc_open_bb_d,
490 .read = seq_read,
491 .llseek = seq_lseek,
492 .release = seq_release,
495 static int rtl_proc_get_bb_e(struct seq_file *m, void *v)
497 struct ieee80211_hw *hw = m->private;
498 int i, n, page;
499 int max = 0xff;
500 page = 0xe00;
502 for (n = 0; n <= max; ) {
503 seq_printf(m, "\n%8.8x ", n + page);
504 for (i = 0; i < 4 && n <= max; i++, n += 4)
505 seq_printf(m, "%8.8x ",
506 rtl_get_bbreg(hw, (page | n), 0xffffffff));
508 seq_puts(m, "\n");
509 return 0;
512 static int dl_proc_open_bb_e(struct inode *inode, struct file *file)
514 return single_open(file, rtl_proc_get_bb_e, GET_INODE_DATA(inode));
517 static const struct file_operations file_ops_bb_e = {
518 .open = dl_proc_open_bb_e,
519 .read = seq_read,
520 .llseek = seq_lseek,
521 .release = seq_release,
524 static int rtl_proc_get_bb_f(struct seq_file *m, void *v)
526 struct ieee80211_hw *hw = m->private;
527 int i, n, page;
528 int max = 0xff;
529 page = 0xf00;
531 for (n = 0; n <= max; ) {
532 seq_printf(m, "\n%8.8x ", n + page);
533 for (i = 0; i < 4 && n <= max; i++, n += 4)
534 seq_printf(m, "%8.8x ",
535 rtl_get_bbreg(hw, (page | n), 0xffffffff));
537 seq_puts(m, "\n");
538 return 0;
541 static int dl_proc_open_bb_f(struct inode *inode, struct file *file)
543 return single_open(file, rtl_proc_get_bb_f, GET_INODE_DATA(inode));
546 static const struct file_operations file_ops_bb_f = {
547 .open = dl_proc_open_bb_f,
548 .read = seq_read,
549 .llseek = seq_lseek,
550 .release = seq_release,
553 static int rtl_proc_get_reg_rf_a(struct seq_file *m, void *v)
555 struct ieee80211_hw *hw = m->private;
556 int i, n;
557 int max = 0x40;
559 for (n = 0; n <= max; ) {
560 seq_printf(m, "\n%8.8x ", n);
561 for (i = 0; i < 4 && n <= max; n += 1, i++)
562 seq_printf(m, "%8.8x ",
563 rtl_get_rfreg(hw, RF90_PATH_A, n, 0xffffffff));
565 seq_puts(m, "\n");
566 return 0;
569 static int dl_proc_open_rf_a(struct inode *inode, struct file *file)
571 return single_open(file, rtl_proc_get_reg_rf_a, GET_INODE_DATA(inode));
574 static const struct file_operations file_ops_rf_a = {
575 .open = dl_proc_open_rf_a,
576 .read = seq_read,
577 .llseek = seq_lseek,
578 .release = seq_release,
581 static int rtl_proc_get_reg_rf_b(struct seq_file *m, void *v)
583 struct ieee80211_hw *hw = m->private;
584 int i, n;
585 int max = 0x40;
587 for (n = 0; n <= max; ) {
588 seq_printf(m, "\n%8.8x ", n);
589 for (i = 0; i < 4 && n <= max; n += 1, i++)
590 seq_printf(m, "%8.8x ",
591 rtl_get_rfreg(hw, RF90_PATH_B, n,
592 0xffffffff));
594 seq_puts(m, "\n");
595 return 0;
598 static int dl_proc_open_rf_b(struct inode *inode, struct file *file)
600 return single_open(file, rtl_proc_get_reg_rf_b, GET_INODE_DATA(inode));
603 static const struct file_operations file_ops_rf_b = {
604 .open = dl_proc_open_rf_b,
605 .read = seq_read,
606 .llseek = seq_lseek,
607 .release = seq_release,
610 static int rtl_proc_get_cam_register_1(struct seq_file *m, void *v)
612 struct ieee80211_hw *hw = m->private;
613 struct rtl_priv *rtlpriv = rtl_priv(hw);
614 u32 target_cmd = 0;
615 u32 target_val=0;
616 u8 entry_i=0;
617 u32 ulstatus;
618 int i = 100, j = 0;
620 /* This dump the current register page */
621 seq_puts(m,
622 "\n#################### SECURITY CAM (0-10) ##################\n ");
624 for (j = 0; j < 11; j++) {
625 seq_printf(m, "\nD: %2x > ", j);
626 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
627 /* polling bit, and No Write enable, and address */
628 target_cmd = entry_i + CAM_CONTENT_COUNT * j;
629 target_cmd = target_cmd | BIT(31);
631 /* Check polling bit is clear */
632 while ((i--) >= 0) {
633 ulstatus = rtl_read_dword(rtlpriv,
634 rtlpriv->cfg->maps[RWCAM]);
635 if (ulstatus & BIT(31)) {
636 continue;
637 } else {
638 break;
642 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
643 target_cmd);
644 target_val = rtl_read_dword(rtlpriv,
645 rtlpriv->cfg->maps[RCAMO]);
646 seq_printf(m, "%8.8x ", target_val);
649 seq_puts(m, "\n");
650 return 0;
653 static int dl_proc_open_cam_1(struct inode *inode, struct file *file)
655 return single_open(file, rtl_proc_get_cam_register_1,
656 GET_INODE_DATA(inode));
659 static const struct file_operations file_ops_cam_1 = {
660 .open = dl_proc_open_cam_1,
661 .read = seq_read,
662 .llseek = seq_lseek,
663 .release = seq_release,
666 static int rtl_proc_get_cam_register_2(struct seq_file *m, void *v)
668 struct ieee80211_hw *hw = m->private;
669 struct rtl_priv *rtlpriv = rtl_priv(hw);
670 u32 target_cmd = 0;
671 u32 target_val = 0;
672 u8 entry_i = 0;
673 u32 ulstatus;
674 int i = 100, j = 0;
676 /* This dump the current register page */
677 seq_puts(m,
678 "\n################### SECURITY CAM (11-21) ##################\n ");
680 for (j = 11; j < 22; j++) {
681 seq_printf(m, "\nD: %2x > ", j);
682 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
683 target_cmd = entry_i + CAM_CONTENT_COUNT * j;
684 target_cmd = target_cmd | BIT(31);
686 while ((i--) >= 0) {
687 ulstatus = rtl_read_dword(rtlpriv,
688 rtlpriv->cfg->maps[RWCAM]);
689 if (ulstatus & BIT(31)) {
690 continue;
691 } else {
692 break;
696 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
697 target_cmd);
698 target_val = rtl_read_dword(rtlpriv,
699 rtlpriv->cfg->maps[RCAMO]);
700 seq_printf(m, "%8.8x ", target_val);
703 seq_puts(m, "\n");
704 return 0;
707 static int dl_proc_open_cam_2(struct inode *inode, struct file *file)
709 return single_open(file, rtl_proc_get_cam_register_2,
710 GET_INODE_DATA(inode));
713 static const struct file_operations file_ops_cam_2 = {
714 .open = dl_proc_open_cam_2,
715 .read = seq_read,
716 .llseek = seq_lseek,
717 .release = seq_release,
720 static int rtl_proc_get_cam_register_3(struct seq_file *m, void *v)
722 struct ieee80211_hw *hw = m->private;
723 struct rtl_priv *rtlpriv = rtl_priv(hw);
724 u32 target_cmd = 0;
725 u32 target_val = 0;
726 u8 entry_i = 0;
727 u32 ulstatus;
728 int i = 100, j = 0;
730 /* This dump the current register page */
731 seq_puts(m,
732 "\n################### SECURITY CAM (22-31) ##################\n ");
734 for (j = 22; j < TOTAL_CAM_ENTRY; j++) {
735 seq_printf(m, "\nD: %2x > ", j);
736 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
737 target_cmd = entry_i+CAM_CONTENT_COUNT*j;
738 target_cmd = target_cmd | BIT(31);
740 while ((i--) >= 0) {
741 ulstatus = rtl_read_dword(rtlpriv,
742 rtlpriv->cfg->maps[RWCAM]);
743 if (ulstatus & BIT(31)) {
744 continue;
745 } else {
746 break;
750 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
751 target_cmd);
752 target_val = rtl_read_dword(rtlpriv,
753 rtlpriv->cfg->maps[RCAMO]);
754 seq_printf(m, "%8.8x ", target_val);
757 seq_puts(m, "\n");
758 return 0;
761 static int dl_proc_open_cam_3(struct inode *inode, struct file *file)
763 return single_open(file, rtl_proc_get_cam_register_3,
764 GET_INODE_DATA(inode));
767 static const struct file_operations file_ops_cam_3 = {
768 .open = dl_proc_open_cam_3,
769 .read = seq_read,
770 .llseek = seq_lseek,
771 .release = seq_release,
774 void rtl_proc_add_one(struct ieee80211_hw *hw)
776 struct rtl_priv *rtlpriv = rtl_priv(hw);
777 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
778 struct proc_dir_entry *entry;
780 snprintf(rtlpriv->dbg.proc_name, 18, "%x-%x-%x-%x-%x-%x",
781 rtlefuse->dev_addr[0], rtlefuse->dev_addr[1],
782 rtlefuse->dev_addr[2], rtlefuse->dev_addr[3],
783 rtlefuse->dev_addr[4], rtlefuse->dev_addr[5]);
785 rtlpriv->dbg.proc_dir = proc_mkdir(rtlpriv->dbg.proc_name, proc_topdir);
786 if (!rtlpriv->dbg.proc_dir) {
787 RT_TRACE(COMP_INIT, DBG_EMERG, ("Unable to init "
788 "/proc/net/%s/%s\n", rtlpriv->cfg->name,
789 rtlpriv->dbg.proc_name));
790 return;
793 entry = proc_create_data("mac-0", S_IFREG | S_IRUGO,
794 rtlpriv->dbg.proc_dir, &file_ops_mac_0, hw);
795 if (!entry)
796 RT_TRACE(COMP_INIT, DBG_EMERG,
797 ("Unable to initialize /proc/net/%s/%s/mac-0\n",
798 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
800 entry = proc_create_data("mac-1", S_IFREG | S_IRUGO,
801 rtlpriv->dbg.proc_dir, &file_ops_mac_1, hw);
802 if (!entry)
803 RT_TRACE(COMP_INIT, COMP_ERR,
804 ("Unable to initialize /proc/net/%s/%s/mac-1\n",
805 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
807 entry = proc_create_data("mac-2", S_IFREG | S_IRUGO,
808 rtlpriv->dbg.proc_dir, &file_ops_mac_2, hw);
809 if (!entry)
810 RT_TRACE(COMP_INIT, COMP_ERR,
811 ("Unable to initialize /proc/net/%s/%s/mac-2\n",
812 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
814 entry = proc_create_data("mac-3", S_IFREG | S_IRUGO,
815 rtlpriv->dbg.proc_dir, &file_ops_mac_3, hw);
816 if (!entry)
817 RT_TRACE(COMP_INIT, COMP_ERR,
818 ("Unable to initialize /proc/net/%s/%s/mac-3\n",
819 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
821 entry = proc_create_data("mac-4", S_IFREG | S_IRUGO,
822 rtlpriv->dbg.proc_dir, &file_ops_mac_4, hw);
823 if (!entry)
824 RT_TRACE(COMP_INIT, COMP_ERR,
825 ("Unable to initialize /proc/net/%s/%s/mac-4\n",
826 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
828 entry = proc_create_data("mac-5", S_IFREG | S_IRUGO,
829 rtlpriv->dbg.proc_dir, &file_ops_mac_5, hw);
830 if (!entry)
831 RT_TRACE(COMP_INIT, COMP_ERR,
832 ("Unable to initialize /proc/net/%s/%s/mac-5\n",
833 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
835 entry = proc_create_data("mac-6", S_IFREG | S_IRUGO,
836 rtlpriv->dbg.proc_dir, &file_ops_mac_6, hw);
837 if (!entry)
838 RT_TRACE(COMP_INIT, COMP_ERR,
839 ("Unable to initialize /proc/net/%s/%s/mac-6\n",
840 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
842 entry = proc_create_data("mac-7", S_IFREG | S_IRUGO,
843 rtlpriv->dbg.proc_dir, &file_ops_mac_7, hw);
844 if (!entry)
845 RT_TRACE(COMP_INIT, COMP_ERR,
846 ("Unable to initialize /proc/net/%s/%s/mac-7\n",
847 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
849 entry = proc_create_data("bb-8", S_IFREG | S_IRUGO,
850 rtlpriv->dbg.proc_dir, &file_ops_bb_8, hw);
851 if (!entry)
852 RT_TRACE(COMP_INIT, COMP_ERR,
853 ("Unable to initialize /proc/net/%s/%s/bb-8\n",
854 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
856 entry = proc_create_data("bb-9", S_IFREG | S_IRUGO,
857 rtlpriv->dbg.proc_dir, &file_ops_bb_9, hw);
858 if (!entry)
859 RT_TRACE(COMP_INIT, COMP_ERR,
860 ("Unable to initialize /proc/net/%s/%s/bb-9\n",
861 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
863 entry = proc_create_data("bb-a", S_IFREG | S_IRUGO,
864 rtlpriv->dbg.proc_dir, &file_ops_bb_a, hw);
865 if (!entry)
866 RT_TRACE(COMP_INIT, COMP_ERR,
867 ("Unable to initialize /proc/net/%s/%s/bb-a\n",
868 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
870 entry = proc_create_data("bb-b", S_IFREG | S_IRUGO,
871 rtlpriv->dbg.proc_dir, &file_ops_bb_b, hw);
872 if (!entry)
873 RT_TRACE(COMP_INIT, COMP_ERR,
874 ("Unable to initialize /proc/net/%s/%s/bb-b\n",
875 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
877 entry = proc_create_data("bb-c", S_IFREG | S_IRUGO,
878 rtlpriv->dbg.proc_dir, &file_ops_bb_c, hw);
879 if (!entry)
880 RT_TRACE(COMP_INIT, COMP_ERR,
881 ("Unable to initialize /proc/net/%s/%s/bb-c\n",
882 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
884 entry = proc_create_data("bb-d", S_IFREG | S_IRUGO,
885 rtlpriv->dbg.proc_dir, &file_ops_bb_d, hw);
886 if (!entry)
887 RT_TRACE(COMP_INIT, COMP_ERR,
888 ("Unable to initialize /proc/net/%s/%s/bb-d\n",
889 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
891 entry = proc_create_data("bb-e", S_IFREG | S_IRUGO,
892 rtlpriv->dbg.proc_dir, &file_ops_bb_e, hw);
893 if (!entry)
894 RT_TRACE(COMP_INIT, COMP_ERR,
895 ("Unable to initialize /proc/net/%s/%s/bb-e\n",
896 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
898 entry = proc_create_data("bb-f", S_IFREG | S_IRUGO,
899 rtlpriv->dbg.proc_dir, &file_ops_bb_f, hw);
900 if (!entry)
901 RT_TRACE(COMP_INIT, COMP_ERR,
902 ("Unable to initialize /proc/net/%s/%s/bb-f\n",
903 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
905 entry = proc_create_data("rf-a", S_IFREG | S_IRUGO,
906 rtlpriv->dbg.proc_dir, &file_ops_rf_a, hw);
907 if (!entry)
908 RT_TRACE(COMP_INIT, COMP_ERR,
909 ("Unable to initialize /proc/net/%s/%s/rf-a\n",
910 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
912 entry = proc_create_data("rf-b", S_IFREG | S_IRUGO,
913 rtlpriv->dbg.proc_dir, &file_ops_rf_b, hw);
914 if (!entry)
915 RT_TRACE(COMP_INIT, COMP_ERR,
916 ("Unable to initialize /proc/net/%s/%s/rf-b\n",
917 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
919 entry = proc_create_data("cam-1", S_IFREG | S_IRUGO,
920 rtlpriv->dbg.proc_dir, &file_ops_cam_1, hw);
921 if (!entry)
922 RT_TRACE(COMP_INIT, COMP_ERR,
923 ("Unable to initialize /proc/net/%s/%s/cam-1\n",
924 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
926 entry = proc_create_data("cam-2", S_IFREG | S_IRUGO,
927 rtlpriv->dbg.proc_dir, &file_ops_cam_2, hw);
928 if (!entry)
929 RT_TRACE(COMP_INIT, COMP_ERR,
930 ("Unable to initialize /proc/net/%s/%s/cam-2\n",
931 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
933 entry = proc_create_data("cam-3", S_IFREG | S_IRUGO,
934 rtlpriv->dbg.proc_dir, &file_ops_cam_3, hw);
935 if (!entry)
936 RT_TRACE(COMP_INIT, COMP_ERR,
937 ("Unable to initialize /proc/net/%s/%s/cam-3\n",
938 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
941 void rtl_proc_remove_one(struct ieee80211_hw *hw)
943 struct rtl_priv *rtlpriv = rtl_priv(hw);
945 if (rtlpriv->dbg.proc_dir) {
946 remove_proc_entry("mac-0", rtlpriv->dbg.proc_dir);
947 remove_proc_entry("mac-1", rtlpriv->dbg.proc_dir);
948 remove_proc_entry("mac-2", rtlpriv->dbg.proc_dir);
949 remove_proc_entry("mac-3", rtlpriv->dbg.proc_dir);
950 remove_proc_entry("mac-4", rtlpriv->dbg.proc_dir);
951 remove_proc_entry("mac-5", rtlpriv->dbg.proc_dir);
952 remove_proc_entry("mac-6", rtlpriv->dbg.proc_dir);
953 remove_proc_entry("mac-7", rtlpriv->dbg.proc_dir);
954 remove_proc_entry("bb-8", rtlpriv->dbg.proc_dir);
955 remove_proc_entry("bb-9", rtlpriv->dbg.proc_dir);
956 remove_proc_entry("bb-a", rtlpriv->dbg.proc_dir);
957 remove_proc_entry("bb-b", rtlpriv->dbg.proc_dir);
958 remove_proc_entry("bb-c", rtlpriv->dbg.proc_dir);
959 remove_proc_entry("bb-d", rtlpriv->dbg.proc_dir);
960 remove_proc_entry("bb-e", rtlpriv->dbg.proc_dir);
961 remove_proc_entry("bb-f", rtlpriv->dbg.proc_dir);
962 remove_proc_entry("rf-a", rtlpriv->dbg.proc_dir);
963 remove_proc_entry("rf-b", rtlpriv->dbg.proc_dir);
964 remove_proc_entry("cam-1", rtlpriv->dbg.proc_dir);
965 remove_proc_entry("cam-2", rtlpriv->dbg.proc_dir);
966 remove_proc_entry("cam-3", rtlpriv->dbg.proc_dir);
968 remove_proc_entry(rtlpriv->dbg.proc_name, proc_topdir);
970 rtlpriv->dbg.proc_dir = NULL;
974 void rtl_proc_add_topdir(void)
976 proc_topdir = proc_mkdir("rtlwifi", init_net.proc_net);
979 void rtl_proc_remove_topdir(void)
981 if (proc_topdir)
982 remove_proc_entry("rtlwifi", init_net.proc_net);