Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / drivers / staging / rtl8192ee / 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 * 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.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25
26 #include "wifi.h"
27 #include "cam.h"
28
29 #define GET_INODE_DATA(__node) PDE_DATA(__node)
30
31
32 void rtl92e_dbgp_flag_init(struct ieee80211_hw *hw)
33 {
34 struct rtl_priv *rtlpriv = rtl_priv(hw);
35 u8 i;
36
37 rtlpriv->dbg.global_debuglevel = DBG_DMESG;
38
39 rtlpriv->dbg.global_debugcomponents =
40 COMP_ERR |
41 COMP_FW |
42 COMP_INIT |
43 COMP_RECV |
44 COMP_SEND |
45 COMP_MLME |
46 COMP_SCAN |
47 COMP_INTR |
48 COMP_LED |
49 COMP_SEC |
50 COMP_BEACON |
51 COMP_RATE |
52 COMP_RXDESC |
53 COMP_DIG |
54 COMP_TXAGC |
55 COMP_POWER |
56 COMP_POWER_TRACKING |
57 COMP_BB_POWERSAVING |
58 COMP_SWAS |
59 COMP_RF |
60 COMP_TURBO |
61 COMP_RATR |
62 COMP_CMD |
63 COMP_EASY_CONCURRENT |
64 COMP_EFUSE |
65 COMP_QOS | COMP_MAC80211 | COMP_REGD |
66 COMP_CHAN |
67 COMP_BT_COEXIST |
68 COMP_IQK |
69 0;
70
71 for (i = 0; i < DBGP_TYPE_MAX; i++)
72 rtlpriv->dbg.dbgp_type[i] = 0;
73
74 /*Init Debug flag enable condition */
75 }
76
77 static struct proc_dir_entry *proc_topdir;
78
79 static int rtl_proc_get_mac_0(struct seq_file *m, void *v)
80 {
81 struct ieee80211_hw *hw = m->private;
82 struct rtl_priv *rtlpriv = rtl_priv(hw);
83 int i, n, page;
84 int max = 0xff;
85 page = 0x000;
86
87 for (n = 0; n <= max; ) {
88 seq_printf(m, "\n%8.8x ", n + page);
89 for (i = 0; i < 4 && n <= max; i++, n += 4)
90 seq_printf(m, "%8.8x ",
91 rtl_read_dword(rtlpriv, (page | n)));
92 }
93 seq_puts(m, "\n");
94 return 0;
95 }
96
97 static int dl_proc_open_mac_0(struct inode *inode, struct file *file)
98 {
99 return single_open(file, rtl_proc_get_mac_0, GET_INODE_DATA(inode));
100 }
101
102 static const struct file_operations file_ops_mac_0 = {
103 .open = dl_proc_open_mac_0,
104 .read = seq_read,
105 .llseek = seq_lseek,
106 .release = seq_release,
107 };
108
109 static int rtl_proc_get_mac_1(struct seq_file *m, void *v)
110 {
111 struct ieee80211_hw *hw = m->private;
112 struct rtl_priv *rtlpriv = rtl_priv(hw);
113 int i, n, page;
114 int max = 0xff;
115 page = 0x100;
116
117 for (n = 0; n <= max; ) {
118 seq_printf(m, "\n%8.8x ", n + page);
119 for (i = 0; i < 4 && n <= max; i++, n += 4)
120 seq_printf(m, "%8.8x ",
121 rtl_read_dword(rtlpriv, (page | n)));
122 }
123 seq_puts(m, "\n");
124 return 0;
125 }
126
127 static int dl_proc_open_mac_1(struct inode *inode, struct file *file)
128 {
129 return single_open(file, rtl_proc_get_mac_1, GET_INODE_DATA(inode));
130 }
131
132 static const struct file_operations file_ops_mac_1 = {
133 .open = dl_proc_open_mac_1,
134 .read = seq_read,
135 .llseek = seq_lseek,
136 .release = seq_release,
137 };
138
139 static int rtl_proc_get_mac_2(struct seq_file *m, void *v)
140 {
141 struct ieee80211_hw *hw = m->private;
142 struct rtl_priv *rtlpriv = rtl_priv(hw);
143 int i, n, page;
144 int max = 0xff;
145 page = 0x200;
146
147 for (n = 0; n <= max; ) {
148 seq_printf(m, "\n%8.8x ", n + page);
149 for (i = 0; i < 4 && n <= max; i++, n += 4)
150 seq_printf(m, "%8.8x ",
151 rtl_read_dword(rtlpriv, (page | n)));
152 }
153 seq_puts(m, "\n");
154 return 0;
155 }
156
157 static int dl_proc_open_mac_2(struct inode *inode, struct file *file)
158 {
159 return single_open(file, rtl_proc_get_mac_2, GET_INODE_DATA(inode));
160 }
161
162 static const struct file_operations file_ops_mac_2 = {
163 .open = dl_proc_open_mac_2,
164 .read = seq_read,
165 .llseek = seq_lseek,
166 .release = seq_release,
167 };
168
169 static int rtl_proc_get_mac_3(struct seq_file *m, void *v)
170 {
171 struct ieee80211_hw *hw = m->private;
172 struct rtl_priv *rtlpriv = rtl_priv(hw);
173 int i, n, page;
174 int max = 0xff;
175 page = 0x300;
176
177 for (n = 0; n <= max; ) {
178 seq_printf(m, "\n%8.8x ", n + page);
179 for (i = 0; i < 4 && n <= max; i++, n += 4)
180 seq_printf(m, "%8.8x ",
181 rtl_read_dword(rtlpriv, (page | n)));
182 }
183 seq_puts(m, "\n");
184 return 0;
185 }
186
187 static int dl_proc_open_mac_3(struct inode *inode, struct file *file)
188 {
189 return single_open(file, rtl_proc_get_mac_3, GET_INODE_DATA(inode));
190 }
191
192 static const struct file_operations file_ops_mac_3 = {
193 .open = dl_proc_open_mac_3,
194 .read = seq_read,
195 .llseek = seq_lseek,
196 .release = seq_release,
197 };
198
199 static int rtl_proc_get_mac_4(struct seq_file *m, void *v)
200 {
201 struct ieee80211_hw *hw = m->private;
202 struct rtl_priv *rtlpriv = rtl_priv(hw);
203 int i, n, page;
204 int max = 0xff;
205 page = 0x400;
206
207 for (n = 0; n <= max; ) {
208 seq_printf(m, "\n%8.8x ", n + page);
209 for (i = 0; i < 4 && n <= max; i++, n += 4)
210 seq_printf(m, "%8.8x ",
211 rtl_read_dword(rtlpriv, (page | n)));
212 }
213 seq_puts(m, "\n");
214 return 0;
215 }
216
217 static int dl_proc_open_mac_4(struct inode *inode, struct file *file)
218 {
219 return single_open(file, rtl_proc_get_mac_4, GET_INODE_DATA(inode));
220 }
221
222 static const struct file_operations file_ops_mac_4 = {
223 .open = dl_proc_open_mac_4,
224 .read = seq_read,
225 .llseek = seq_lseek,
226 .release = seq_release,
227 };
228
229 static int rtl_proc_get_mac_5(struct seq_file *m, void *v)
230 {
231 struct ieee80211_hw *hw = m->private;
232 struct rtl_priv *rtlpriv = rtl_priv(hw);
233 int i, n, page;
234 int max = 0xff;
235 page = 0x500;
236
237 for (n = 0; n <= max; ) {
238 seq_printf(m, "\n%8.8x ", n + page);
239 for (i = 0; i < 4 && n <= max; i++, n += 4)
240 seq_printf(m, "%8.8x ",
241 rtl_read_dword(rtlpriv, (page | n)));
242 }
243 seq_puts(m, "\n");
244 return 0;
245 }
246
247 static int dl_proc_open_mac_5(struct inode *inode, struct file *file)
248 {
249 return single_open(file, rtl_proc_get_mac_5, GET_INODE_DATA(inode));
250 }
251
252 static const struct file_operations file_ops_mac_5 = {
253 .open = dl_proc_open_mac_5,
254 .read = seq_read,
255 .llseek = seq_lseek,
256 .release = seq_release,
257 };
258
259 static int rtl_proc_get_mac_6(struct seq_file *m, void *v)
260 {
261 struct ieee80211_hw *hw = m->private;
262 struct rtl_priv *rtlpriv = rtl_priv(hw);
263 int i, n, page;
264 int max = 0xff;
265 page = 0x600;
266
267 for (n = 0; n <= max; ) {
268 seq_printf(m, "\n%8.8x ", n + page);
269 for (i = 0; i < 4 && n <= max; i++, n += 4)
270 seq_printf(m, "%8.8x ",
271 rtl_read_dword(rtlpriv, (page | n)));
272 }
273 seq_puts(m, "\n");
274 return 0;
275 }
276
277 static int dl_proc_open_mac_6(struct inode *inode, struct file *file)
278 {
279 return single_open(file, rtl_proc_get_mac_6, GET_INODE_DATA(inode));
280 }
281
282 static const struct file_operations file_ops_mac_6 = {
283 .open = dl_proc_open_mac_6,
284 .read = seq_read,
285 .llseek = seq_lseek,
286 .release = seq_release,
287 };
288
289 static int rtl_proc_get_mac_7(struct seq_file *m, void *v)
290 {
291 struct ieee80211_hw *hw = m->private;
292 struct rtl_priv *rtlpriv = rtl_priv(hw);
293 int i, n, page;
294 int max = 0xff;
295 page = 0x700;
296
297 for (n = 0; n <= max; ) {
298 seq_printf(m, "\n%8.8x ", n + page);
299 for (i = 0; i < 4 && n <= max; i++, n += 4)
300 seq_printf(m, "%8.8x ",
301 rtl_read_dword(rtlpriv, (page | n)));
302 }
303 seq_puts(m, "\n");
304 return 0;
305 }
306
307 static int dl_proc_open_mac_7(struct inode *inode, struct file *file)
308 {
309 return single_open(file, rtl_proc_get_mac_7, GET_INODE_DATA(inode));
310 }
311
312 static const struct file_operations file_ops_mac_7 = {
313 .open = dl_proc_open_mac_7,
314 .read = seq_read,
315 .llseek = seq_lseek,
316 .release = seq_release,
317 };
318
319 static int rtl_proc_get_bb_8(struct seq_file *m, void *v)
320 {
321 struct ieee80211_hw *hw = m->private;
322 int i, n, page;
323 int max = 0xff;
324 page = 0x800;
325
326 for (n = 0; n <= max; ) {
327 seq_printf(m, "\n%8.8x ", n + page);
328 for (i = 0; i < 4 && n <= max; i++, n += 4)
329 seq_printf(m, "%8.8x ",
330 rtl_get_bbreg(hw, (page | n), 0xffffffff));
331 }
332 seq_puts(m, "\n");
333 return 0;
334 }
335
336 static int dl_proc_open_bb_8(struct inode *inode, struct file *file)
337 {
338 return single_open(file, rtl_proc_get_bb_8, GET_INODE_DATA(inode));
339 }
340
341 static const struct file_operations file_ops_bb_8 = {
342 .open = dl_proc_open_bb_8,
343 .read = seq_read,
344 .llseek = seq_lseek,
345 .release = seq_release,
346 };
347
348 static int rtl_proc_get_bb_9(struct seq_file *m, void *v)
349 {
350 struct ieee80211_hw *hw = m->private;
351 int i, n, page;
352 int max = 0xff;
353 page = 0x900;
354
355 for (n = 0; n <= max; ) {
356 seq_printf(m, "\n%8.8x ", n + page);
357 for (i = 0; i < 4 && n <= max; i++, n += 4)
358 seq_printf(m, "%8.8x ",
359 rtl_get_bbreg(hw, (page | n), 0xffffffff));
360 }
361 seq_puts(m, "\n");
362 return 0;
363 }
364
365 static int dl_proc_open_bb_9(struct inode *inode, struct file *file)
366 {
367 return single_open(file, rtl_proc_get_bb_9, GET_INODE_DATA(inode));
368 }
369
370 static const struct file_operations file_ops_bb_9 = {
371 .open = dl_proc_open_bb_9,
372 .read = seq_read,
373 .llseek = seq_lseek,
374 .release = seq_release,
375 };
376
377 static int rtl_proc_get_bb_a(struct seq_file *m, void *v)
378 {
379 struct ieee80211_hw *hw = m->private;
380 int i, n, page;
381 int max = 0xff;
382 page = 0xa00;
383
384 for (n = 0; n <= max; ) {
385 seq_printf(m, "\n%8.8x ", n + page);
386 for (i = 0; i < 4 && n <= max; i++, n += 4)
387 seq_printf(m, "%8.8x ",
388 rtl_get_bbreg(hw, (page | n), 0xffffffff));
389 }
390 seq_puts(m, "\n");
391 return 0;
392 }
393
394 static int dl_proc_open_bb_a(struct inode *inode, struct file *file)
395 {
396 return single_open(file, rtl_proc_get_bb_a, GET_INODE_DATA(inode));
397 }
398
399 static const struct file_operations file_ops_bb_a = {
400 .open = dl_proc_open_bb_a,
401 .read = seq_read,
402 .llseek = seq_lseek,
403 .release = seq_release,
404 };
405
406 static int rtl_proc_get_bb_b(struct seq_file *m, void *v)
407 {
408 struct ieee80211_hw *hw = m->private;
409 int i, n, page;
410 int max = 0xff;
411 page = 0xb00;
412
413 for (n = 0; n <= max; ) {
414 seq_printf(m, "\n%8.8x ", n + page);
415 for (i = 0; i < 4 && n <= max; i++, n += 4)
416 seq_printf(m, "%8.8x ",
417 rtl_get_bbreg(hw, (page | n), 0xffffffff));
418 }
419 seq_puts(m, "\n");
420 return 0;
421 }
422
423 static int dl_proc_open_bb_b(struct inode *inode, struct file *file)
424 {
425 return single_open(file, rtl_proc_get_bb_b, GET_INODE_DATA(inode));
426 }
427
428 static const struct file_operations file_ops_bb_b = {
429 .open = dl_proc_open_bb_b,
430 .read = seq_read,
431 .llseek = seq_lseek,
432 .release = seq_release,
433 };
434
435 static int rtl_proc_get_bb_c(struct seq_file *m, void *v)
436 {
437 struct ieee80211_hw *hw = m->private;
438 int i, n, page;
439 int max = 0xff;
440 page = 0xc00;
441
442 for (n = 0; n <= max; ) {
443 seq_printf(m, "\n%8.8x ", n + page);
444 for (i = 0; i < 4 && n <= max; i++, n += 4)
445 seq_printf(m, "%8.8x ",
446 rtl_get_bbreg(hw, (page | n), 0xffffffff));
447 }
448 seq_puts(m, "\n");
449 return 0;
450 }
451
452 static int dl_proc_open_bb_c(struct inode *inode, struct file *file)
453 {
454 return single_open(file, rtl_proc_get_bb_c, GET_INODE_DATA(inode));
455 }
456
457 static const struct file_operations file_ops_bb_c = {
458 .open = dl_proc_open_bb_c,
459 .read = seq_read,
460 .llseek = seq_lseek,
461 .release = seq_release,
462 };
463
464 static int rtl_proc_get_bb_d(struct seq_file *m, void *v)
465 {
466 struct ieee80211_hw *hw = m->private;
467 int i, n, page;
468 int max = 0xff;
469 page = 0xd00;
470
471 for (n = 0; n <= max; ) {
472 seq_printf(m, "\n%8.8x ", n + page);
473 for (i = 0; i < 4 && n <= max; i++, n += 4)
474 seq_printf(m, "%8.8x ",
475 rtl_get_bbreg(hw, (page | n), 0xffffffff));
476 }
477 seq_puts(m, "\n");
478 return 0;
479 }
480
481 static int dl_proc_open_bb_d(struct inode *inode, struct file *file)
482 {
483 return single_open(file, rtl_proc_get_bb_d, GET_INODE_DATA(inode));
484 }
485
486 static const struct file_operations file_ops_bb_d = {
487 .open = dl_proc_open_bb_d,
488 .read = seq_read,
489 .llseek = seq_lseek,
490 .release = seq_release,
491 };
492
493 static int rtl_proc_get_bb_e(struct seq_file *m, void *v)
494 {
495 struct ieee80211_hw *hw = m->private;
496 int i, n, page;
497 int max = 0xff;
498 page = 0xe00;
499
500 for (n = 0; n <= max; ) {
501 seq_printf(m, "\n%8.8x ", n + page);
502 for (i = 0; i < 4 && n <= max; i++, n += 4)
503 seq_printf(m, "%8.8x ",
504 rtl_get_bbreg(hw, (page | n), 0xffffffff));
505 }
506 seq_puts(m, "\n");
507 return 0;
508 }
509
510 static int dl_proc_open_bb_e(struct inode *inode, struct file *file)
511 {
512 return single_open(file, rtl_proc_get_bb_e, GET_INODE_DATA(inode));
513 }
514
515 static const struct file_operations file_ops_bb_e = {
516 .open = dl_proc_open_bb_e,
517 .read = seq_read,
518 .llseek = seq_lseek,
519 .release = seq_release,
520 };
521
522 static int rtl_proc_get_bb_f(struct seq_file *m, void *v)
523 {
524 struct ieee80211_hw *hw = m->private;
525 int i, n, page;
526 int max = 0xff;
527 page = 0xf00;
528
529 for (n = 0; n <= max; ) {
530 seq_printf(m, "\n%8.8x ", n + page);
531 for (i = 0; i < 4 && n <= max; i++, n += 4)
532 seq_printf(m, "%8.8x ",
533 rtl_get_bbreg(hw, (page | n), 0xffffffff));
534 }
535 seq_puts(m, "\n");
536 return 0;
537 }
538
539 static int dl_proc_open_bb_f(struct inode *inode, struct file *file)
540 {
541 return single_open(file, rtl_proc_get_bb_f, GET_INODE_DATA(inode));
542 }
543
544 static const struct file_operations file_ops_bb_f = {
545 .open = dl_proc_open_bb_f,
546 .read = seq_read,
547 .llseek = seq_lseek,
548 .release = seq_release,
549 };
550
551 static int rtl_proc_get_reg_rf_a(struct seq_file *m, void *v)
552 {
553 struct ieee80211_hw *hw = m->private;
554 int i, n;
555 int max = 0x40;
556
557 for (n = 0; n <= max; ) {
558 seq_printf(m, "\n%8.8x ", n);
559 for (i = 0; i < 4 && n <= max; n += 1, i++)
560 seq_printf(m, "%8.8x ",
561 rtl_get_rfreg(hw, RF90_PATH_A, n, 0xffffffff));
562 }
563 seq_puts(m, "\n");
564 return 0;
565 }
566
567 static int dl_proc_open_rf_a(struct inode *inode, struct file *file)
568 {
569 return single_open(file, rtl_proc_get_reg_rf_a, GET_INODE_DATA(inode));
570 }
571
572 static const struct file_operations file_ops_rf_a = {
573 .open = dl_proc_open_rf_a,
574 .read = seq_read,
575 .llseek = seq_lseek,
576 .release = seq_release,
577 };
578
579 static int rtl_proc_get_reg_rf_b(struct seq_file *m, void *v)
580 {
581 struct ieee80211_hw *hw = m->private;
582 int i, n;
583 int max = 0x40;
584
585 for (n = 0; n <= max; ) {
586 seq_printf(m, "\n%8.8x ", n);
587 for (i = 0; i < 4 && n <= max; n += 1, i++)
588 seq_printf(m, "%8.8x ",
589 rtl_get_rfreg(hw, RF90_PATH_B, n,
590 0xffffffff));
591 }
592 seq_puts(m, "\n");
593 return 0;
594 }
595
596 static int dl_proc_open_rf_b(struct inode *inode, struct file *file)
597 {
598 return single_open(file, rtl_proc_get_reg_rf_b, GET_INODE_DATA(inode));
599 }
600
601 static const struct file_operations file_ops_rf_b = {
602 .open = dl_proc_open_rf_b,
603 .read = seq_read,
604 .llseek = seq_lseek,
605 .release = seq_release,
606 };
607
608 static int rtl_proc_get_cam_register_1(struct seq_file *m, void *v)
609 {
610 struct ieee80211_hw *hw = m->private;
611 struct rtl_priv *rtlpriv = rtl_priv(hw);
612 u32 target_cmd = 0;
613 u32 target_val = 0;
614 u8 entry_i = 0;
615 u32 ulstatus;
616 int i = 100, j = 0;
617
618 /* This dump the current register page */
619 seq_puts(m,
620 "\n#################### SECURITY CAM (0-10) ##################\n ");
621
622 for (j = 0; j < 11; j++) {
623 seq_printf(m, "\nD: %2x > ", j);
624 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
625 /* polling bit, and No Write enable, and address */
626 target_cmd = entry_i + CAM_CONTENT_COUNT * j;
627 target_cmd = target_cmd | BIT(31);
628
629 /* Check polling bit is clear */
630 while ((i--) >= 0) {
631 ulstatus = rtl_read_dword(rtlpriv,
632 rtlpriv->cfg->maps[RWCAM]);
633 if (ulstatus & BIT(31))
634 continue;
635 else
636 break;
637 }
638
639 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
640 target_cmd);
641 target_val = rtl_read_dword(rtlpriv,
642 rtlpriv->cfg->maps[RCAMO]);
643 seq_printf(m, "%8.8x ", target_val);
644 }
645 }
646 seq_puts(m, "\n");
647 return 0;
648 }
649
650 static int dl_proc_open_cam_1(struct inode *inode, struct file *file)
651 {
652 return single_open(file, rtl_proc_get_cam_register_1,
653 GET_INODE_DATA(inode));
654 }
655
656 static const struct file_operations file_ops_cam_1 = {
657 .open = dl_proc_open_cam_1,
658 .read = seq_read,
659 .llseek = seq_lseek,
660 .release = seq_release,
661 };
662
663 static int rtl_proc_get_cam_register_2(struct seq_file *m, void *v)
664 {
665 struct ieee80211_hw *hw = m->private;
666 struct rtl_priv *rtlpriv = rtl_priv(hw);
667 u32 target_cmd = 0;
668 u32 target_val = 0;
669 u8 entry_i = 0;
670 u32 ulstatus;
671 int i = 100, j = 0;
672
673 /* This dump the current register page */
674 seq_puts(m,
675 "\n################### SECURITY CAM (11-21) ##################\n ");
676
677 for (j = 11; j < 22; j++) {
678 seq_printf(m, "\nD: %2x > ", j);
679 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
680 target_cmd = entry_i + CAM_CONTENT_COUNT * j;
681 target_cmd = target_cmd | BIT(31);
682
683 while ((i--) >= 0) {
684 ulstatus = rtl_read_dword(rtlpriv,
685 rtlpriv->cfg->maps[RWCAM]);
686 if (ulstatus & BIT(31))
687 continue;
688 else
689 break;
690 }
691
692 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
693 target_cmd);
694 target_val = rtl_read_dword(rtlpriv,
695 rtlpriv->cfg->maps[RCAMO]);
696 seq_printf(m, "%8.8x ", target_val);
697 }
698 }
699 seq_puts(m, "\n");
700 return 0;
701 }
702
703 static int dl_proc_open_cam_2(struct inode *inode, struct file *file)
704 {
705 return single_open(file, rtl_proc_get_cam_register_2,
706 GET_INODE_DATA(inode));
707 }
708
709 static const struct file_operations file_ops_cam_2 = {
710 .open = dl_proc_open_cam_2,
711 .read = seq_read,
712 .llseek = seq_lseek,
713 .release = seq_release,
714 };
715
716 static int rtl_proc_get_cam_register_3(struct seq_file *m, void *v)
717 {
718 struct ieee80211_hw *hw = m->private;
719 struct rtl_priv *rtlpriv = rtl_priv(hw);
720 u32 target_cmd = 0;
721 u32 target_val = 0;
722 u8 entry_i = 0;
723 u32 ulstatus;
724 int i = 100, j = 0;
725
726 /* This dump the current register page */
727 seq_puts(m,
728 "\n################### SECURITY CAM (22-31) ##################\n ");
729
730 for (j = 22; j < TOTAL_CAM_ENTRY; j++) {
731 seq_printf(m, "\nD: %2x > ", j);
732 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
733 target_cmd = entry_i+CAM_CONTENT_COUNT*j;
734 target_cmd = target_cmd | BIT(31);
735
736 while ((i--) >= 0) {
737 ulstatus = rtl_read_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM]);
738 if (ulstatus & BIT(31))
739 continue;
740 else
741 break;
742 }
743
744 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
745 target_cmd);
746 target_val = rtl_read_dword(rtlpriv,
747 rtlpriv->cfg->maps[RCAMO]);
748 seq_printf(m, "%8.8x ", target_val);
749 }
750 }
751 seq_puts(m, "\n");
752 return 0;
753 }
754
755 static int dl_proc_open_cam_3(struct inode *inode, struct file *file)
756 {
757 return single_open(file, rtl_proc_get_cam_register_3,
758 GET_INODE_DATA(inode));
759 }
760
761 static const struct file_operations file_ops_cam_3 = {
762 .open = dl_proc_open_cam_3,
763 .read = seq_read,
764 .llseek = seq_lseek,
765 .release = seq_release,
766 };
767
768 void rtl_proc_add_one(struct ieee80211_hw *hw)
769 {
770 struct rtl_priv *rtlpriv = rtl_priv(hw);
771 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
772 struct proc_dir_entry *entry;
773
774 snprintf(rtlpriv->dbg.proc_name, 18, "%x-%x-%x-%x-%x-%x",
775 rtlefuse->dev_addr[0], rtlefuse->dev_addr[1],
776 rtlefuse->dev_addr[2], rtlefuse->dev_addr[3],
777 rtlefuse->dev_addr[4], rtlefuse->dev_addr[5]);
778
779 rtlpriv->dbg.proc_dir = proc_mkdir(rtlpriv->dbg.proc_name, proc_topdir);
780 if (!rtlpriv->dbg.proc_dir) {
781 RT_TRACE(COMP_INIT, DBG_EMERG,
782 ("Unable to init /proc/net/%s/%s\n",
783 rtlpriv->cfg->name,
784 rtlpriv->dbg.proc_name));
785 return;
786 }
787
788 entry = proc_create_data("mac-0", S_IFREG | S_IRUGO,
789 rtlpriv->dbg.proc_dir, &file_ops_mac_0, hw);
790 if (!entry)
791 RT_TRACE(COMP_INIT, DBG_EMERG,
792 ("Unable to initialize /proc/net/%s/%s/mac-0\n",
793 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
794
795 entry = proc_create_data("mac-1", S_IFREG | S_IRUGO,
796 rtlpriv->dbg.proc_dir, &file_ops_mac_1, hw);
797 if (!entry)
798 RT_TRACE(COMP_INIT, COMP_ERR,
799 ("Unable to initialize /proc/net/%s/%s/mac-1\n",
800 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
801
802 entry = proc_create_data("mac-2", S_IFREG | S_IRUGO,
803 rtlpriv->dbg.proc_dir, &file_ops_mac_2, hw);
804 if (!entry)
805 RT_TRACE(COMP_INIT, COMP_ERR,
806 ("Unable to initialize /proc/net/%s/%s/mac-2\n",
807 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
808
809 entry = proc_create_data("mac-3", S_IFREG | S_IRUGO,
810 rtlpriv->dbg.proc_dir, &file_ops_mac_3, hw);
811 if (!entry)
812 RT_TRACE(COMP_INIT, COMP_ERR,
813 ("Unable to initialize /proc/net/%s/%s/mac-3\n",
814 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
815
816 entry = proc_create_data("mac-4", S_IFREG | S_IRUGO,
817 rtlpriv->dbg.proc_dir, &file_ops_mac_4, hw);
818 if (!entry)
819 RT_TRACE(COMP_INIT, COMP_ERR,
820 ("Unable to initialize /proc/net/%s/%s/mac-4\n",
821 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
822
823 entry = proc_create_data("mac-5", S_IFREG | S_IRUGO,
824 rtlpriv->dbg.proc_dir, &file_ops_mac_5, hw);
825 if (!entry)
826 RT_TRACE(COMP_INIT, COMP_ERR,
827 ("Unable to initialize /proc/net/%s/%s/mac-5\n",
828 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
829
830 entry = proc_create_data("mac-6", S_IFREG | S_IRUGO,
831 rtlpriv->dbg.proc_dir, &file_ops_mac_6, hw);
832 if (!entry)
833 RT_TRACE(COMP_INIT, COMP_ERR,
834 ("Unable to initialize /proc/net/%s/%s/mac-6\n",
835 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
836
837 entry = proc_create_data("mac-7", S_IFREG | S_IRUGO,
838 rtlpriv->dbg.proc_dir, &file_ops_mac_7, hw);
839 if (!entry)
840 RT_TRACE(COMP_INIT, COMP_ERR,
841 ("Unable to initialize /proc/net/%s/%s/mac-7\n",
842 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
843
844 entry = proc_create_data("bb-8", S_IFREG | S_IRUGO,
845 rtlpriv->dbg.proc_dir, &file_ops_bb_8, hw);
846 if (!entry)
847 RT_TRACE(COMP_INIT, COMP_ERR,
848 ("Unable to initialize /proc/net/%s/%s/bb-8\n",
849 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
850
851 entry = proc_create_data("bb-9", S_IFREG | S_IRUGO,
852 rtlpriv->dbg.proc_dir, &file_ops_bb_9, hw);
853 if (!entry)
854 RT_TRACE(COMP_INIT, COMP_ERR,
855 ("Unable to initialize /proc/net/%s/%s/bb-9\n",
856 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
857
858 entry = proc_create_data("bb-a", S_IFREG | S_IRUGO,
859 rtlpriv->dbg.proc_dir, &file_ops_bb_a, hw);
860 if (!entry)
861 RT_TRACE(COMP_INIT, COMP_ERR,
862 ("Unable to initialize /proc/net/%s/%s/bb-a\n",
863 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
864
865 entry = proc_create_data("bb-b", S_IFREG | S_IRUGO,
866 rtlpriv->dbg.proc_dir, &file_ops_bb_b, hw);
867 if (!entry)
868 RT_TRACE(COMP_INIT, COMP_ERR,
869 ("Unable to initialize /proc/net/%s/%s/bb-b\n",
870 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
871
872 entry = proc_create_data("bb-c", S_IFREG | S_IRUGO,
873 rtlpriv->dbg.proc_dir, &file_ops_bb_c, hw);
874 if (!entry)
875 RT_TRACE(COMP_INIT, COMP_ERR,
876 ("Unable to initialize /proc/net/%s/%s/bb-c\n",
877 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
878
879 entry = proc_create_data("bb-d", S_IFREG | S_IRUGO,
880 rtlpriv->dbg.proc_dir, &file_ops_bb_d, hw);
881 if (!entry)
882 RT_TRACE(COMP_INIT, COMP_ERR,
883 ("Unable to initialize /proc/net/%s/%s/bb-d\n",
884 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
885
886 entry = proc_create_data("bb-e", S_IFREG | S_IRUGO,
887 rtlpriv->dbg.proc_dir, &file_ops_bb_e, hw);
888 if (!entry)
889 RT_TRACE(COMP_INIT, COMP_ERR,
890 ("Unable to initialize /proc/net/%s/%s/bb-e\n",
891 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
892
893 entry = proc_create_data("bb-f", S_IFREG | S_IRUGO,
894 rtlpriv->dbg.proc_dir, &file_ops_bb_f, hw);
895 if (!entry)
896 RT_TRACE(COMP_INIT, COMP_ERR,
897 ("Unable to initialize /proc/net/%s/%s/bb-f\n",
898 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
899
900 entry = proc_create_data("rf-a", S_IFREG | S_IRUGO,
901 rtlpriv->dbg.proc_dir, &file_ops_rf_a, hw);
902 if (!entry)
903 RT_TRACE(COMP_INIT, COMP_ERR,
904 ("Unable to initialize /proc/net/%s/%s/rf-a\n",
905 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
906
907 entry = proc_create_data("rf-b", S_IFREG | S_IRUGO,
908 rtlpriv->dbg.proc_dir, &file_ops_rf_b, hw);
909 if (!entry)
910 RT_TRACE(COMP_INIT, COMP_ERR,
911 ("Unable to initialize /proc/net/%s/%s/rf-b\n",
912 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
913
914 entry = proc_create_data("cam-1", S_IFREG | S_IRUGO,
915 rtlpriv->dbg.proc_dir, &file_ops_cam_1, hw);
916 if (!entry)
917 RT_TRACE(COMP_INIT, COMP_ERR,
918 ("Unable to initialize /proc/net/%s/%s/cam-1\n",
919 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
920
921 entry = proc_create_data("cam-2", S_IFREG | S_IRUGO,
922 rtlpriv->dbg.proc_dir, &file_ops_cam_2, hw);
923 if (!entry)
924 RT_TRACE(COMP_INIT, COMP_ERR,
925 ("Unable to initialize /proc/net/%s/%s/cam-2\n",
926 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
927
928 entry = proc_create_data("cam-3", S_IFREG | S_IRUGO,
929 rtlpriv->dbg.proc_dir, &file_ops_cam_3, hw);
930 if (!entry)
931 RT_TRACE(COMP_INIT, COMP_ERR,
932 ("Unable to initialize /proc/net/%s/%s/cam-3\n",
933 rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
934 }
935
936 void rtl_proc_remove_one(struct ieee80211_hw *hw)
937 {
938 struct rtl_priv *rtlpriv = rtl_priv(hw);
939
940 if (rtlpriv->dbg.proc_dir) {
941 remove_proc_entry("mac-0", rtlpriv->dbg.proc_dir);
942 remove_proc_entry("mac-1", rtlpriv->dbg.proc_dir);
943 remove_proc_entry("mac-2", rtlpriv->dbg.proc_dir);
944 remove_proc_entry("mac-3", rtlpriv->dbg.proc_dir);
945 remove_proc_entry("mac-4", rtlpriv->dbg.proc_dir);
946 remove_proc_entry("mac-5", rtlpriv->dbg.proc_dir);
947 remove_proc_entry("mac-6", rtlpriv->dbg.proc_dir);
948 remove_proc_entry("mac-7", rtlpriv->dbg.proc_dir);
949 remove_proc_entry("bb-8", rtlpriv->dbg.proc_dir);
950 remove_proc_entry("bb-9", rtlpriv->dbg.proc_dir);
951 remove_proc_entry("bb-a", rtlpriv->dbg.proc_dir);
952 remove_proc_entry("bb-b", rtlpriv->dbg.proc_dir);
953 remove_proc_entry("bb-c", rtlpriv->dbg.proc_dir);
954 remove_proc_entry("bb-d", rtlpriv->dbg.proc_dir);
955 remove_proc_entry("bb-e", rtlpriv->dbg.proc_dir);
956 remove_proc_entry("bb-f", rtlpriv->dbg.proc_dir);
957 remove_proc_entry("rf-a", rtlpriv->dbg.proc_dir);
958 remove_proc_entry("rf-b", rtlpriv->dbg.proc_dir);
959 remove_proc_entry("cam-1", rtlpriv->dbg.proc_dir);
960 remove_proc_entry("cam-2", rtlpriv->dbg.proc_dir);
961 remove_proc_entry("cam-3", rtlpriv->dbg.proc_dir);
962
963 remove_proc_entry(rtlpriv->dbg.proc_name, proc_topdir);
964
965 rtlpriv->dbg.proc_dir = NULL;
966 }
967 }
968
969 void rtl_proc_add_topdir(void)
970 {
971 proc_topdir = proc_mkdir("rtlwifi", init_net.proc_net);
972 }
973
974 void rtl_proc_remove_topdir(void)
975 {
976 if (proc_topdir)
977 remove_proc_entry("rtlwifi", init_net.proc_net);
978 }
This page took 0.050868 seconds and 5 git commands to generate.