Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target...
[deliverable/linux.git] / drivers / staging / rtl8821ae / debug.c
1 /******************************************************************************
2 *
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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.
8 *
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.
13 *
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
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
20 *
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
25 *
26 * Larry Finger <Larry.Finger@lwfinger.net>
27 *
28 *****************************************************************************/
29
30 #include "wifi.h"
31 #include "cam.h"
32
33 #define GET_INODE_DATA(__node) PDE_DATA(__node)
34
35 void rtl_dbgp_flag_init(struct ieee80211_hw *hw)
36 {
37 struct rtl_priv *rtlpriv = rtl_priv(hw);
38 u8 i;
39
40 rtlpriv->dbg.global_debuglevel = DBG_DMESG;
41
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 |
72 0;
73
74 for (i = 0; i < DBGP_TYPE_MAX; i++)
75 rtlpriv->dbg.dbgp_type[i] = 0;
76
77 /*Init Debug flag enable condition */
78 }
79
80 struct proc_dir_entry *proc_topdir;
81 static int rtl_proc_get_mac_0(struct seq_file *m, void *v)
82 {
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;
88
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)));
94 }
95 seq_puts(m, "\n");
96 return 0;
97 }
98
99 static int dl_proc_open_mac_0(struct inode *inode, struct file *file)
100 {
101 return single_open(file, rtl_proc_get_mac_0, GET_INODE_DATA(inode));
102 }
103
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,
109 };
110
111 static int rtl_proc_get_mac_1(struct seq_file *m, void *v)
112 {
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;
118
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)));
124 }
125 seq_puts(m, "\n");
126 return 0;
127 }
128
129 static int dl_proc_open_mac_1(struct inode *inode, struct file *file)
130 {
131 return single_open(file, rtl_proc_get_mac_1, GET_INODE_DATA(inode));
132 }
133
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,
139 };
140
141 static int rtl_proc_get_mac_2(struct seq_file *m, void *v)
142 {
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;
148
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)));
154 }
155 seq_puts(m, "\n");
156 return 0;
157 }
158
159 static int dl_proc_open_mac_2(struct inode *inode, struct file *file)
160 {
161 return single_open(file, rtl_proc_get_mac_2, GET_INODE_DATA(inode));
162 }
163
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,
169 };
170
171 static int rtl_proc_get_mac_3(struct seq_file *m, void *v)
172 {
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;
178
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)));
184 }
185 seq_puts(m, "\n");
186 return 0;
187 }
188
189 static int dl_proc_open_mac_3(struct inode *inode, struct file *file)
190 {
191 return single_open(file, rtl_proc_get_mac_3, GET_INODE_DATA(inode));
192 }
193
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,
199 };
200
201 static int rtl_proc_get_mac_4(struct seq_file *m, void *v)
202 {
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;
208
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)));
214 }
215 seq_puts(m, "\n");
216 return 0;
217 }
218
219 static int dl_proc_open_mac_4(struct inode *inode, struct file *file)
220 {
221 return single_open(file, rtl_proc_get_mac_4, GET_INODE_DATA(inode));
222 }
223
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,
229 };
230
231 static int rtl_proc_get_mac_5(struct seq_file *m, void *v)
232 {
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;
238
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)));
244 }
245 seq_puts(m, "\n");
246 return 0;
247 }
248
249 static int dl_proc_open_mac_5(struct inode *inode, struct file *file)
250 {
251 return single_open(file, rtl_proc_get_mac_5, GET_INODE_DATA(inode));
252 }
253
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,
259 };
260
261 static int rtl_proc_get_mac_6(struct seq_file *m, void *v)
262 {
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;
268
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)));
274 }
275 seq_puts(m, "\n");
276 return 0;
277 }
278
279 static int dl_proc_open_mac_6(struct inode *inode, struct file *file)
280 {
281 return single_open(file, rtl_proc_get_mac_6, GET_INODE_DATA(inode));
282 }
283
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,
289 };
290
291 static int rtl_proc_get_mac_7(struct seq_file *m, void *v)
292 {
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;
298
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)));
304 }
305 seq_puts(m, "\n");
306 return 0;
307 }
308
309 static int dl_proc_open_mac_7(struct inode *inode, struct file *file)
310 {
311 return single_open(file, rtl_proc_get_mac_7, GET_INODE_DATA(inode));
312 }
313
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,
319 };
320
321 static int rtl_proc_get_bb_8(struct seq_file *m, void *v)
322 {
323 struct ieee80211_hw *hw = m->private;
324 int i, n, page;
325 int max = 0xff;
326 page = 0x800;
327
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));
333 }
334 seq_puts(m, "\n");
335 return 0;
336 }
337
338 static int dl_proc_open_bb_8(struct inode *inode, struct file *file)
339 {
340 return single_open(file, rtl_proc_get_bb_8, GET_INODE_DATA(inode));
341 }
342
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,
348 };
349
350 static int rtl_proc_get_bb_9(struct seq_file *m, void *v)
351 {
352 struct ieee80211_hw *hw = m->private;
353 int i, n, page;
354 int max = 0xff;
355 page = 0x900;
356
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));
362 }
363 seq_puts(m, "\n");
364 return 0;
365 }
366
367 static int dl_proc_open_bb_9(struct inode *inode, struct file *file)
368 {
369 return single_open(file, rtl_proc_get_bb_9, GET_INODE_DATA(inode));
370 }
371
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,
377 };
378
379 static int rtl_proc_get_bb_a(struct seq_file *m, void *v)
380 {
381 struct ieee80211_hw *hw = m->private;
382 int i, n, page;
383 int max = 0xff;
384 page = 0xa00;
385
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));
391 }
392 seq_puts(m, "\n");
393 return 0;
394 }
395
396 static int dl_proc_open_bb_a(struct inode *inode, struct file *file)
397 {
398 return single_open(file, rtl_proc_get_bb_a, GET_INODE_DATA(inode));
399 }
400
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,
406 };
407
408 static int rtl_proc_get_bb_b(struct seq_file *m, void *v)
409 {
410 struct ieee80211_hw *hw = m->private;
411 int i, n, page;
412 int max = 0xff;
413 page = 0xb00;
414
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));
420 }
421 seq_puts(m, "\n");
422 return 0;
423 }
424
425 static int dl_proc_open_bb_b(struct inode *inode, struct file *file)
426 {
427 return single_open(file, rtl_proc_get_bb_b, GET_INODE_DATA(inode));
428 }
429
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,
435 };
436
437 static int rtl_proc_get_bb_c(struct seq_file *m, void *v)
438 {
439 struct ieee80211_hw *hw = m->private;
440 int i, n, page;
441 int max = 0xff;
442 page = 0xc00;
443
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));
449 }
450 seq_puts(m, "\n");
451 return 0;
452 }
453
454 static int dl_proc_open_bb_c(struct inode *inode, struct file *file)
455 {
456 return single_open(file, rtl_proc_get_bb_c, GET_INODE_DATA(inode));
457 }
458
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,
464 };
465
466 static int rtl_proc_get_bb_d(struct seq_file *m, void *v)
467 {
468 struct ieee80211_hw *hw = m->private;
469 int i, n, page;
470 int max = 0xff;
471 page = 0xd00;
472
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));
478 }
479 seq_puts(m, "\n");
480 return 0;
481 }
482
483 static int dl_proc_open_bb_d(struct inode *inode, struct file *file)
484 {
485 return single_open(file, rtl_proc_get_bb_d, GET_INODE_DATA(inode));
486 }
487
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,
493 };
494
495 static int rtl_proc_get_bb_e(struct seq_file *m, void *v)
496 {
497 struct ieee80211_hw *hw = m->private;
498 int i, n, page;
499 int max = 0xff;
500 page = 0xe00;
501
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));
507 }
508 seq_puts(m, "\n");
509 return 0;
510 }
511
512 static int dl_proc_open_bb_e(struct inode *inode, struct file *file)
513 {
514 return single_open(file, rtl_proc_get_bb_e, GET_INODE_DATA(inode));
515 }
516
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,
522 };
523
524 static int rtl_proc_get_bb_f(struct seq_file *m, void *v)
525 {
526 struct ieee80211_hw *hw = m->private;
527 int i, n, page;
528 int max = 0xff;
529 page = 0xf00;
530
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));
536 }
537 seq_puts(m, "\n");
538 return 0;
539 }
540
541 static int dl_proc_open_bb_f(struct inode *inode, struct file *file)
542 {
543 return single_open(file, rtl_proc_get_bb_f, GET_INODE_DATA(inode));
544 }
545
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,
551 };
552
553 static int rtl_proc_get_reg_rf_a(struct seq_file *m, void *v)
554 {
555 struct ieee80211_hw *hw = m->private;
556 int i, n;
557 int max = 0x40;
558
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));
564 }
565 seq_puts(m, "\n");
566 return 0;
567 }
568
569 static int dl_proc_open_rf_a(struct inode *inode, struct file *file)
570 {
571 return single_open(file, rtl_proc_get_reg_rf_a, GET_INODE_DATA(inode));
572 }
573
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,
579 };
580
581 static int rtl_proc_get_reg_rf_b(struct seq_file *m, void *v)
582 {
583 struct ieee80211_hw *hw = m->private;
584 int i, n;
585 int max = 0x40;
586
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));
593 }
594 seq_puts(m, "\n");
595 return 0;
596 }
597
598 static int dl_proc_open_rf_b(struct inode *inode, struct file *file)
599 {
600 return single_open(file, rtl_proc_get_reg_rf_b, GET_INODE_DATA(inode));
601 }
602
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,
608 };
609
610 static int rtl_proc_get_cam_register_1(struct seq_file *m, void *v)
611 {
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;
619
620 /* This dump the current register page */
621 seq_puts(m,
622 "\n#################### SECURITY CAM (0-10) ##################\n ");
623
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);
630
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;
639 }
640 }
641
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);
647 }
648 }
649 seq_puts(m, "\n");
650 return 0;
651 }
652
653 static int dl_proc_open_cam_1(struct inode *inode, struct file *file)
654 {
655 return single_open(file, rtl_proc_get_cam_register_1,
656 GET_INODE_DATA(inode));
657 }
658
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,
664 };
665
666 static int rtl_proc_get_cam_register_2(struct seq_file *m, void *v)
667 {
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;
675
676 /* This dump the current register page */
677 seq_puts(m,
678 "\n################### SECURITY CAM (11-21) ##################\n ");
679
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);
685
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;
693 }
694 }
695
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);
701 }
702 }
703 seq_puts(m, "\n");
704 return 0;
705 }
706
707 static int dl_proc_open_cam_2(struct inode *inode, struct file *file)
708 {
709 return single_open(file, rtl_proc_get_cam_register_2,
710 GET_INODE_DATA(inode));
711 }
712
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,
718 };
719
720 static int rtl_proc_get_cam_register_3(struct seq_file *m, void *v)
721 {
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;
729
730 /* This dump the current register page */
731 seq_puts(m,
732 "\n################### SECURITY CAM (22-31) ##################\n ");
733
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);
739
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;
747 }
748 }
749
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);
755 }
756 }
757 seq_puts(m, "\n");
758 return 0;
759 }
760
761 static int dl_proc_open_cam_3(struct inode *inode, struct file *file)
762 {
763 return single_open(file, rtl_proc_get_cam_register_3,
764 GET_INODE_DATA(inode));
765 }
766
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,
772 };
773
774 void rtl_proc_add_one(struct ieee80211_hw *hw)
775 {
776 struct rtl_priv *rtlpriv = rtl_priv(hw);
777 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
778 struct proc_dir_entry *entry;
779
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]);
784
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;
791 }
792
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));
799
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));
806
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));
813
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));
820
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));
827
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));
834
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));
841
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));
848
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));
855
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));
862
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));
869
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));
876
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));
883
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));
890
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));
897
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));
904
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));
911
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));
918
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));
925
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));
932
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));
939 }
940
941 void rtl_proc_remove_one(struct ieee80211_hw *hw)
942 {
943 struct rtl_priv *rtlpriv = rtl_priv(hw);
944
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);
967
968 remove_proc_entry(rtlpriv->dbg.proc_name, proc_topdir);
969
970 rtlpriv->dbg.proc_dir = NULL;
971 }
972 }
973
974 void rtl_proc_add_topdir(void)
975 {
976 proc_topdir = proc_mkdir("rtlwifi", init_net.proc_net);
977 }
978
979 void rtl_proc_remove_topdir(void)
980 {
981 if (proc_topdir)
982 remove_proc_entry("rtlwifi", init_net.proc_net);
983 }
This page took 0.052137 seconds and 6 git commands to generate.