1 /******************************************************************************
5 * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
29 #include <linux/slab.h>
30 #include <linux/kernel.h>
31 #include <linux/module.h>
32 #include <linux/debugfs.h>
34 #include <linux/ieee80211.h>
35 #include <net/mac80211.h>
39 #include "iwl-debug.h"
43 /* create and remove of files */
44 #define DEBUGFS_ADD_FILE(name, parent, mode) do { \
45 if (!debugfs_create_file(#name, mode, parent, priv, \
46 &iwl_dbgfs_##name##_ops)) \
50 #define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \
51 struct dentry *__tmp; \
52 __tmp = debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \
54 if (IS_ERR(__tmp) || !__tmp) \
58 #define DEBUGFS_ADD_X32(name, parent, ptr) do { \
59 struct dentry *__tmp; \
60 __tmp = debugfs_create_x32(#name, S_IWUSR | S_IRUSR, \
62 if (IS_ERR(__tmp) || !__tmp) \
67 #define DEBUGFS_READ_FUNC(name) \
68 static ssize_t iwl_dbgfs_##name##_read(struct file *file, \
69 char __user *user_buf, \
70 size_t count, loff_t *ppos);
72 #define DEBUGFS_WRITE_FUNC(name) \
73 static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
74 const char __user *user_buf, \
75 size_t count, loff_t *ppos);
78 static int iwl_dbgfs_open_file_generic(struct inode
*inode
, struct file
*file
)
80 file
->private_data
= inode
->i_private
;
84 #define DEBUGFS_READ_FILE_OPS(name) \
85 DEBUGFS_READ_FUNC(name); \
86 static const struct file_operations iwl_dbgfs_##name##_ops = { \
87 .read = iwl_dbgfs_##name##_read, \
88 .open = iwl_dbgfs_open_file_generic, \
89 .llseek = generic_file_llseek, \
92 #define DEBUGFS_WRITE_FILE_OPS(name) \
93 DEBUGFS_WRITE_FUNC(name); \
94 static const struct file_operations iwl_dbgfs_##name##_ops = { \
95 .write = iwl_dbgfs_##name##_write, \
96 .open = iwl_dbgfs_open_file_generic, \
97 .llseek = generic_file_llseek, \
101 #define DEBUGFS_READ_WRITE_FILE_OPS(name) \
102 DEBUGFS_READ_FUNC(name); \
103 DEBUGFS_WRITE_FUNC(name); \
104 static const struct file_operations iwl_dbgfs_##name##_ops = { \
105 .write = iwl_dbgfs_##name##_write, \
106 .read = iwl_dbgfs_##name##_read, \
107 .open = iwl_dbgfs_open_file_generic, \
108 .llseek = generic_file_llseek, \
111 static ssize_t
iwl_dbgfs_tx_statistics_read(struct file
*file
,
112 char __user
*user_buf
,
113 size_t count
, loff_t
*ppos
) {
115 struct iwl_priv
*priv
= file
->private_data
;
121 const size_t bufsz
= 100 +
122 sizeof(char) * 50 * (MANAGEMENT_MAX
+ CONTROL_MAX
);
123 buf
= kzalloc(bufsz
, GFP_KERNEL
);
126 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Management:\n");
127 for (cnt
= 0; cnt
< MANAGEMENT_MAX
; cnt
++) {
128 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
130 get_mgmt_string(cnt
),
131 priv
->tx_stats
.mgmt
[cnt
]);
133 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Control\n");
134 for (cnt
= 0; cnt
< CONTROL_MAX
; cnt
++) {
135 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
137 get_ctrl_string(cnt
),
138 priv
->tx_stats
.ctrl
[cnt
]);
140 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Data:\n");
141 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tcnt: %u\n",
142 priv
->tx_stats
.data_cnt
);
143 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tbytes: %llu\n",
144 priv
->tx_stats
.data_bytes
);
145 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
150 static ssize_t
iwl_dbgfs_clear_traffic_statistics_write(struct file
*file
,
151 const char __user
*user_buf
,
152 size_t count
, loff_t
*ppos
)
154 struct iwl_priv
*priv
= file
->private_data
;
159 memset(buf
, 0, sizeof(buf
));
160 buf_size
= min(count
, sizeof(buf
) - 1);
161 if (copy_from_user(buf
, user_buf
, buf_size
))
163 if (sscanf(buf
, "%x", &clear_flag
) != 1)
165 iwl_clear_traffic_stats(priv
);
170 static ssize_t
iwl_dbgfs_rx_statistics_read(struct file
*file
,
171 char __user
*user_buf
,
172 size_t count
, loff_t
*ppos
) {
174 struct iwl_priv
*priv
= file
->private_data
;
179 const size_t bufsz
= 100 +
180 sizeof(char) * 50 * (MANAGEMENT_MAX
+ CONTROL_MAX
);
181 buf
= kzalloc(bufsz
, GFP_KERNEL
);
185 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Management:\n");
186 for (cnt
= 0; cnt
< MANAGEMENT_MAX
; cnt
++) {
187 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
189 get_mgmt_string(cnt
),
190 priv
->rx_stats
.mgmt
[cnt
]);
192 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Control:\n");
193 for (cnt
= 0; cnt
< CONTROL_MAX
; cnt
++) {
194 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
196 get_ctrl_string(cnt
),
197 priv
->rx_stats
.ctrl
[cnt
]);
199 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Data:\n");
200 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tcnt: %u\n",
201 priv
->rx_stats
.data_cnt
);
202 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tbytes: %llu\n",
203 priv
->rx_stats
.data_bytes
);
205 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
210 #define BYTE1_MASK 0x000000ff;
211 #define BYTE2_MASK 0x0000ffff;
212 #define BYTE3_MASK 0x00ffffff;
213 static ssize_t
iwl_dbgfs_sram_read(struct file
*file
,
214 char __user
*user_buf
,
215 size_t count
, loff_t
*ppos
)
222 struct iwl_priv
*priv
= file
->private_data
;
225 /* default is to dump the entire data segment */
226 if (!priv
->dbgfs_sram_offset
&& !priv
->dbgfs_sram_len
) {
227 priv
->dbgfs_sram_offset
= 0x800000;
228 if (priv
->ucode_type
== UCODE_INIT
)
229 priv
->dbgfs_sram_len
= priv
->ucode_init_data
.len
;
231 priv
->dbgfs_sram_len
= priv
->ucode_data
.len
;
233 bufsz
= 30 + priv
->dbgfs_sram_len
* sizeof(char) * 10;
234 buf
= kmalloc(bufsz
, GFP_KERNEL
);
237 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "sram_len: 0x%x\n",
238 priv
->dbgfs_sram_len
);
239 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "sram_offset: 0x%x\n",
240 priv
->dbgfs_sram_offset
);
241 for (i
= priv
->dbgfs_sram_len
; i
> 0; i
-= 4) {
242 val
= iwl_read_targ_mem(priv
, priv
->dbgfs_sram_offset
+ \
243 priv
->dbgfs_sram_len
- i
);
258 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
259 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "0x%08x ", val
);
261 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
263 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
268 static ssize_t
iwl_dbgfs_sram_write(struct file
*file
,
269 const char __user
*user_buf
,
270 size_t count
, loff_t
*ppos
)
272 struct iwl_priv
*priv
= file
->private_data
;
277 memset(buf
, 0, sizeof(buf
));
278 buf_size
= min(count
, sizeof(buf
) - 1);
279 if (copy_from_user(buf
, user_buf
, buf_size
))
282 if (sscanf(buf
, "%x,%x", &offset
, &len
) == 2) {
283 priv
->dbgfs_sram_offset
= offset
;
284 priv
->dbgfs_sram_len
= len
;
286 priv
->dbgfs_sram_offset
= 0;
287 priv
->dbgfs_sram_len
= 0;
293 static ssize_t
iwl_dbgfs_stations_read(struct file
*file
, char __user
*user_buf
,
294 size_t count
, loff_t
*ppos
)
296 struct iwl_priv
*priv
= file
->private_data
;
297 struct iwl_station_entry
*station
;
298 int max_sta
= priv
->hw_params
.max_stations
;
302 /* Add 30 for initial string */
303 const size_t bufsz
= 30 + sizeof(char) * 500 * (priv
->num_stations
);
305 buf
= kmalloc(bufsz
, GFP_KERNEL
);
309 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "num of stations: %d\n\n",
312 for (i
= 0; i
< max_sta
; i
++) {
313 station
= &priv
->stations
[i
];
316 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
317 "station %d - addr: %pM, flags: %#x\n",
318 i
, station
->sta
.sta
.addr
,
319 station
->sta
.station_flags_msk
);
320 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
321 "TID\tseq_num\ttxq_id\tframes\ttfds\t");
322 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
323 "start_idx\tbitmap\t\t\trate_n_flags\n");
325 for (j
= 0; j
< MAX_TID_COUNT
; j
++) {
326 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
327 "%d:\t%#x\t%#x\t%u\t%u\t%u\t\t%#.16llx\t%#x",
328 j
, station
->tid
[j
].seq_number
,
329 station
->tid
[j
].agg
.txq_id
,
330 station
->tid
[j
].agg
.frame_count
,
331 station
->tid
[j
].tfds_in_queue
,
332 station
->tid
[j
].agg
.start_idx
,
333 station
->tid
[j
].agg
.bitmap
,
334 station
->tid
[j
].agg
.rate_n_flags
);
336 if (station
->tid
[j
].agg
.wait_for_ba
)
337 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
339 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
342 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
345 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
350 static ssize_t
iwl_dbgfs_nvm_read(struct file
*file
,
351 char __user
*user_buf
,
356 struct iwl_priv
*priv
= file
->private_data
;
357 int pos
= 0, ofs
= 0, buf_size
= 0;
361 size_t eeprom_len
= priv
->cfg
->base_params
->eeprom_size
;
362 buf_size
= 4 * eeprom_len
+ 256;
364 if (eeprom_len
% 16) {
365 IWL_ERR(priv
, "NVM size is not multiple of 16.\n");
371 IWL_ERR(priv
, "Invalid EEPROM/OTP memory\n");
375 /* 4 characters for byte 0xYY */
376 buf
= kzalloc(buf_size
, GFP_KERNEL
);
378 IWL_ERR(priv
, "Can not allocate Buffer\n");
381 eeprom_ver
= iwl_eeprom_query16(priv
, EEPROM_VERSION
);
382 pos
+= scnprintf(buf
+ pos
, buf_size
- pos
, "NVM Type: %s, "
384 (priv
->nvm_device_type
== NVM_DEVICE_TYPE_OTP
)
385 ? "OTP" : "EEPROM", eeprom_ver
);
386 for (ofs
= 0 ; ofs
< eeprom_len
; ofs
+= 16) {
387 pos
+= scnprintf(buf
+ pos
, buf_size
- pos
, "0x%.4x ", ofs
);
388 hex_dump_to_buffer(ptr
+ ofs
, 16 , 16, 2, buf
+ pos
,
390 pos
+= strlen(buf
+ pos
);
391 if (buf_size
- pos
> 0)
395 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
400 static ssize_t
iwl_dbgfs_log_event_read(struct file
*file
,
401 char __user
*user_buf
,
402 size_t count
, loff_t
*ppos
)
404 struct iwl_priv
*priv
= file
->private_data
;
407 ssize_t ret
= -ENOMEM
;
409 ret
= pos
= priv
->cfg
->ops
->lib
->dump_nic_event_log(
410 priv
, true, &buf
, true);
412 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
418 static ssize_t
iwl_dbgfs_log_event_write(struct file
*file
,
419 const char __user
*user_buf
,
420 size_t count
, loff_t
*ppos
)
422 struct iwl_priv
*priv
= file
->private_data
;
427 memset(buf
, 0, sizeof(buf
));
428 buf_size
= min(count
, sizeof(buf
) - 1);
429 if (copy_from_user(buf
, user_buf
, buf_size
))
431 if (sscanf(buf
, "%d", &event_log_flag
) != 1)
433 if (event_log_flag
== 1)
434 priv
->cfg
->ops
->lib
->dump_nic_event_log(priv
, true,
442 static ssize_t
iwl_dbgfs_channels_read(struct file
*file
, char __user
*user_buf
,
443 size_t count
, loff_t
*ppos
)
445 struct iwl_priv
*priv
= file
->private_data
;
446 struct ieee80211_channel
*channels
= NULL
;
447 const struct ieee80211_supported_band
*supp_band
= NULL
;
448 int pos
= 0, i
, bufsz
= PAGE_SIZE
;
452 if (!test_bit(STATUS_GEO_CONFIGURED
, &priv
->status
))
455 buf
= kzalloc(bufsz
, GFP_KERNEL
);
457 IWL_ERR(priv
, "Can not allocate Buffer\n");
461 supp_band
= iwl_get_hw_mode(priv
, IEEE80211_BAND_2GHZ
);
463 channels
= supp_band
->channels
;
465 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
466 "Displaying %d channels in 2.4GHz band 802.11bg):\n",
467 supp_band
->n_channels
);
469 for (i
= 0; i
< supp_band
->n_channels
; i
++)
470 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
471 "%d: %ddBm: BSS%s%s, %s.\n",
472 channels
[i
].hw_value
,
473 channels
[i
].max_power
,
474 channels
[i
].flags
& IEEE80211_CHAN_RADAR
?
475 " (IEEE 802.11h required)" : "",
476 ((channels
[i
].flags
& IEEE80211_CHAN_NO_IBSS
)
477 || (channels
[i
].flags
&
478 IEEE80211_CHAN_RADAR
)) ? "" :
481 IEEE80211_CHAN_PASSIVE_SCAN
?
482 "passive only" : "active/passive");
484 supp_band
= iwl_get_hw_mode(priv
, IEEE80211_BAND_5GHZ
);
486 channels
= supp_band
->channels
;
488 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
489 "Displaying %d channels in 5.2GHz band (802.11a)\n",
490 supp_band
->n_channels
);
492 for (i
= 0; i
< supp_band
->n_channels
; i
++)
493 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
494 "%d: %ddBm: BSS%s%s, %s.\n",
495 channels
[i
].hw_value
,
496 channels
[i
].max_power
,
497 channels
[i
].flags
& IEEE80211_CHAN_RADAR
?
498 " (IEEE 802.11h required)" : "",
499 ((channels
[i
].flags
& IEEE80211_CHAN_NO_IBSS
)
500 || (channels
[i
].flags
&
501 IEEE80211_CHAN_RADAR
)) ? "" :
504 IEEE80211_CHAN_PASSIVE_SCAN
?
505 "passive only" : "active/passive");
507 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
512 static ssize_t
iwl_dbgfs_status_read(struct file
*file
,
513 char __user
*user_buf
,
514 size_t count
, loff_t
*ppos
) {
516 struct iwl_priv
*priv
= file
->private_data
;
519 const size_t bufsz
= sizeof(buf
);
521 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_HCMD_ACTIVE:\t %d\n",
522 test_bit(STATUS_HCMD_ACTIVE
, &priv
->status
));
523 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_INT_ENABLED:\t %d\n",
524 test_bit(STATUS_INT_ENABLED
, &priv
->status
));
525 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_RF_KILL_HW:\t %d\n",
526 test_bit(STATUS_RF_KILL_HW
, &priv
->status
));
527 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_CT_KILL:\t\t %d\n",
528 test_bit(STATUS_CT_KILL
, &priv
->status
));
529 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_INIT:\t\t %d\n",
530 test_bit(STATUS_INIT
, &priv
->status
));
531 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_ALIVE:\t\t %d\n",
532 test_bit(STATUS_ALIVE
, &priv
->status
));
533 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_READY:\t\t %d\n",
534 test_bit(STATUS_READY
, &priv
->status
));
535 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_TEMPERATURE:\t %d\n",
536 test_bit(STATUS_TEMPERATURE
, &priv
->status
));
537 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_GEO_CONFIGURED:\t %d\n",
538 test_bit(STATUS_GEO_CONFIGURED
, &priv
->status
));
539 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_EXIT_PENDING:\t %d\n",
540 test_bit(STATUS_EXIT_PENDING
, &priv
->status
));
541 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_STATISTICS:\t %d\n",
542 test_bit(STATUS_STATISTICS
, &priv
->status
));
543 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_SCANNING:\t %d\n",
544 test_bit(STATUS_SCANNING
, &priv
->status
));
545 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_SCAN_ABORTING:\t %d\n",
546 test_bit(STATUS_SCAN_ABORTING
, &priv
->status
));
547 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_SCAN_HW:\t\t %d\n",
548 test_bit(STATUS_SCAN_HW
, &priv
->status
));
549 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_POWER_PMI:\t %d\n",
550 test_bit(STATUS_POWER_PMI
, &priv
->status
));
551 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_FW_ERROR:\t %d\n",
552 test_bit(STATUS_FW_ERROR
, &priv
->status
));
553 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
556 static ssize_t
iwl_dbgfs_interrupt_read(struct file
*file
,
557 char __user
*user_buf
,
558 size_t count
, loff_t
*ppos
) {
560 struct iwl_priv
*priv
= file
->private_data
;
564 int bufsz
= 24 * 64; /* 24 items * 64 char per item */
567 buf
= kzalloc(bufsz
, GFP_KERNEL
);
569 IWL_ERR(priv
, "Can not allocate Buffer\n");
573 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
574 "Interrupt Statistics Report:\n");
576 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "HW Error:\t\t\t %u\n",
578 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "SW Error:\t\t\t %u\n",
580 if (priv
->isr_stats
.sw
|| priv
->isr_stats
.hw
) {
581 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
582 "\tLast Restarting Code: 0x%X\n",
583 priv
->isr_stats
.err_code
);
585 #ifdef CONFIG_IWLWIFI_DEBUG
586 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Frame transmitted:\t\t %u\n",
587 priv
->isr_stats
.sch
);
588 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Alive interrupt:\t\t %u\n",
589 priv
->isr_stats
.alive
);
591 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
592 "HW RF KILL switch toggled:\t %u\n",
593 priv
->isr_stats
.rfkill
);
595 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "CT KILL:\t\t\t %u\n",
596 priv
->isr_stats
.ctkill
);
598 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Wakeup Interrupt:\t\t %u\n",
599 priv
->isr_stats
.wakeup
);
601 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
602 "Rx command responses:\t\t %u\n",
604 for (cnt
= 0; cnt
< REPLY_MAX
; cnt
++) {
605 if (priv
->isr_stats
.rx_handlers
[cnt
] > 0)
606 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
607 "\tRx handler[%36s]:\t\t %u\n",
609 priv
->isr_stats
.rx_handlers
[cnt
]);
612 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Tx/FH interrupt:\t\t %u\n",
615 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Unexpected INTA:\t\t %u\n",
616 priv
->isr_stats
.unhandled
);
618 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
623 static ssize_t
iwl_dbgfs_interrupt_write(struct file
*file
,
624 const char __user
*user_buf
,
625 size_t count
, loff_t
*ppos
)
627 struct iwl_priv
*priv
= file
->private_data
;
632 memset(buf
, 0, sizeof(buf
));
633 buf_size
= min(count
, sizeof(buf
) - 1);
634 if (copy_from_user(buf
, user_buf
, buf_size
))
636 if (sscanf(buf
, "%x", &reset_flag
) != 1)
639 iwl_clear_isr_stats(priv
);
644 static ssize_t
iwl_dbgfs_qos_read(struct file
*file
, char __user
*user_buf
,
645 size_t count
, loff_t
*ppos
)
647 struct iwl_priv
*priv
= file
->private_data
;
648 struct iwl_rxon_context
*ctx
;
650 char buf
[256 * NUM_IWL_RXON_CTX
];
651 const size_t bufsz
= sizeof(buf
);
653 for_each_context(priv
, ctx
) {
654 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "context %d:\n",
656 for (i
= 0; i
< AC_NUM
; i
++) {
657 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
658 "\tcw_min\tcw_max\taifsn\ttxop\n");
659 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
660 "AC[%d]\t%u\t%u\t%u\t%u\n", i
,
661 ctx
->qos_data
.def_qos_parm
.ac
[i
].cw_min
,
662 ctx
->qos_data
.def_qos_parm
.ac
[i
].cw_max
,
663 ctx
->qos_data
.def_qos_parm
.ac
[i
].aifsn
,
664 ctx
->qos_data
.def_qos_parm
.ac
[i
].edca_txop
);
666 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
668 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
671 static ssize_t
iwl_dbgfs_led_read(struct file
*file
, char __user
*user_buf
,
672 size_t count
, loff_t
*ppos
)
674 struct iwl_priv
*priv
= file
->private_data
;
677 const size_t bufsz
= sizeof(buf
);
679 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
680 "allow blinking: %s\n",
681 (priv
->allow_blinking
) ? "True" : "False");
682 if (priv
->allow_blinking
) {
683 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
684 "Led blinking rate: %u\n",
685 priv
->last_blink_rate
);
686 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
687 "Last blink time: %lu\n",
688 priv
->last_blink_time
);
691 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
694 static ssize_t
iwl_dbgfs_thermal_throttling_read(struct file
*file
,
695 char __user
*user_buf
,
696 size_t count
, loff_t
*ppos
)
698 struct iwl_priv
*priv
= file
->private_data
;
699 struct iwl_tt_mgmt
*tt
= &priv
->thermal_throttle
;
700 struct iwl_tt_restriction
*restriction
;
703 const size_t bufsz
= sizeof(buf
);
705 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
706 "Thermal Throttling Mode: %s\n",
707 tt
->advanced_tt
? "Advance" : "Legacy");
708 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
709 "Thermal Throttling State: %d\n",
711 if (tt
->advanced_tt
) {
712 restriction
= tt
->restriction
+ tt
->state
;
713 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
715 restriction
->tx_stream
);
716 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
718 restriction
->rx_stream
);
719 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
723 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
726 static ssize_t
iwl_dbgfs_disable_ht40_write(struct file
*file
,
727 const char __user
*user_buf
,
728 size_t count
, loff_t
*ppos
)
730 struct iwl_priv
*priv
= file
->private_data
;
735 memset(buf
, 0, sizeof(buf
));
736 buf_size
= min(count
, sizeof(buf
) - 1);
737 if (copy_from_user(buf
, user_buf
, buf_size
))
739 if (sscanf(buf
, "%d", &ht40
) != 1)
741 if (!iwl_is_any_associated(priv
))
742 priv
->disable_ht40
= ht40
? true : false;
744 IWL_ERR(priv
, "Sta associated with AP - "
745 "Change to 40MHz channel support is not allowed\n");
752 static ssize_t
iwl_dbgfs_disable_ht40_read(struct file
*file
,
753 char __user
*user_buf
,
754 size_t count
, loff_t
*ppos
)
756 struct iwl_priv
*priv
= file
->private_data
;
759 const size_t bufsz
= sizeof(buf
);
761 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
762 "11n 40MHz Mode: %s\n",
763 priv
->disable_ht40
? "Disabled" : "Enabled");
764 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
767 static ssize_t
iwl_dbgfs_sleep_level_override_write(struct file
*file
,
768 const char __user
*user_buf
,
769 size_t count
, loff_t
*ppos
)
771 struct iwl_priv
*priv
= file
->private_data
;
776 memset(buf
, 0, sizeof(buf
));
777 buf_size
= min(count
, sizeof(buf
) - 1);
778 if (copy_from_user(buf
, user_buf
, buf_size
))
781 if (sscanf(buf
, "%d", &value
) != 1)
785 * Our users expect 0 to be "CAM", but 0 isn't actually
786 * valid here. However, let's not confuse them and present
787 * IWL_POWER_INDEX_1 as "1", not "0".
794 if (value
!= -1 && (value
< 0 || value
>= IWL_POWER_NUM
))
797 if (!iwl_is_ready_rf(priv
))
800 priv
->power_data
.debug_sleep_level_override
= value
;
802 mutex_lock(&priv
->mutex
);
803 iwl_power_update_mode(priv
, true);
804 mutex_unlock(&priv
->mutex
);
809 static ssize_t
iwl_dbgfs_sleep_level_override_read(struct file
*file
,
810 char __user
*user_buf
,
811 size_t count
, loff_t
*ppos
)
813 struct iwl_priv
*priv
= file
->private_data
;
816 const size_t bufsz
= sizeof(buf
);
818 /* see the write function */
819 value
= priv
->power_data
.debug_sleep_level_override
;
823 pos
= scnprintf(buf
, bufsz
, "%d\n", value
);
824 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
827 static ssize_t
iwl_dbgfs_current_sleep_command_read(struct file
*file
,
828 char __user
*user_buf
,
829 size_t count
, loff_t
*ppos
)
831 struct iwl_priv
*priv
= file
->private_data
;
834 const size_t bufsz
= sizeof(buf
);
835 struct iwl_powertable_cmd
*cmd
= &priv
->power_data
.sleep_cmd
;
837 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
838 "flags: %#.2x\n", le16_to_cpu(cmd
->flags
));
839 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
840 "RX/TX timeout: %d/%d usec\n",
841 le32_to_cpu(cmd
->rx_data_timeout
),
842 le32_to_cpu(cmd
->tx_data_timeout
));
843 for (i
= 0; i
< IWL_POWER_VEC_SIZE
; i
++)
844 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
845 "sleep_interval[%d]: %d\n", i
,
846 le32_to_cpu(cmd
->sleep_interval
[i
]));
848 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
851 DEBUGFS_READ_WRITE_FILE_OPS(sram
);
852 DEBUGFS_READ_WRITE_FILE_OPS(log_event
);
853 DEBUGFS_READ_FILE_OPS(nvm
);
854 DEBUGFS_READ_FILE_OPS(stations
);
855 DEBUGFS_READ_FILE_OPS(channels
);
856 DEBUGFS_READ_FILE_OPS(status
);
857 DEBUGFS_READ_WRITE_FILE_OPS(interrupt
);
858 DEBUGFS_READ_FILE_OPS(qos
);
859 DEBUGFS_READ_FILE_OPS(led
);
860 DEBUGFS_READ_FILE_OPS(thermal_throttling
);
861 DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40
);
862 DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override
);
863 DEBUGFS_READ_FILE_OPS(current_sleep_command
);
865 static ssize_t
iwl_dbgfs_traffic_log_read(struct file
*file
,
866 char __user
*user_buf
,
867 size_t count
, loff_t
*ppos
)
869 struct iwl_priv
*priv
= file
->private_data
;
870 int pos
= 0, ofs
= 0;
872 struct iwl_tx_queue
*txq
;
874 struct iwl_rx_queue
*rxq
= &priv
->rxq
;
876 int bufsz
= ((IWL_TRAFFIC_ENTRIES
* IWL_TRAFFIC_ENTRY_SIZE
* 64) * 2) +
877 (priv
->cfg
->base_params
->num_of_queues
* 32 * 8) + 400;
882 IWL_ERR(priv
, "txq not ready\n");
885 buf
= kzalloc(bufsz
, GFP_KERNEL
);
887 IWL_ERR(priv
, "Can not allocate buffer\n");
890 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Tx Queue\n");
891 for (cnt
= 0; cnt
< priv
->hw_params
.max_txq_num
; cnt
++) {
892 txq
= &priv
->txq
[cnt
];
894 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
895 "q[%d]: read_ptr: %u, write_ptr: %u\n",
896 cnt
, q
->read_ptr
, q
->write_ptr
);
898 if (priv
->tx_traffic
&& (iwl_debug_level
& IWL_DL_TX
)) {
899 ptr
= priv
->tx_traffic
;
900 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
901 "Tx Traffic idx: %u\n", priv
->tx_traffic_idx
);
902 for (cnt
= 0, ofs
= 0; cnt
< IWL_TRAFFIC_ENTRIES
; cnt
++) {
903 for (entry
= 0; entry
< IWL_TRAFFIC_ENTRY_SIZE
/ 16;
904 entry
++, ofs
+= 16) {
905 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
907 hex_dump_to_buffer(ptr
+ ofs
, 16, 16, 2,
908 buf
+ pos
, bufsz
- pos
, 0);
909 pos
+= strlen(buf
+ pos
);
916 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Rx Queue\n");
917 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
918 "read: %u, write: %u\n",
919 rxq
->read
, rxq
->write
);
921 if (priv
->rx_traffic
&& (iwl_debug_level
& IWL_DL_RX
)) {
922 ptr
= priv
->rx_traffic
;
923 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
924 "Rx Traffic idx: %u\n", priv
->rx_traffic_idx
);
925 for (cnt
= 0, ofs
= 0; cnt
< IWL_TRAFFIC_ENTRIES
; cnt
++) {
926 for (entry
= 0; entry
< IWL_TRAFFIC_ENTRY_SIZE
/ 16;
927 entry
++, ofs
+= 16) {
928 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
930 hex_dump_to_buffer(ptr
+ ofs
, 16, 16, 2,
931 buf
+ pos
, bufsz
- pos
, 0);
932 pos
+= strlen(buf
+ pos
);
939 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
944 static ssize_t
iwl_dbgfs_traffic_log_write(struct file
*file
,
945 const char __user
*user_buf
,
946 size_t count
, loff_t
*ppos
)
948 struct iwl_priv
*priv
= file
->private_data
;
953 memset(buf
, 0, sizeof(buf
));
954 buf_size
= min(count
, sizeof(buf
) - 1);
955 if (copy_from_user(buf
, user_buf
, buf_size
))
957 if (sscanf(buf
, "%d", &traffic_log
) != 1)
959 if (traffic_log
== 0)
960 iwl_reset_traffic_log(priv
);
965 static ssize_t
iwl_dbgfs_tx_queue_read(struct file
*file
,
966 char __user
*user_buf
,
967 size_t count
, loff_t
*ppos
) {
969 struct iwl_priv
*priv
= file
->private_data
;
970 struct iwl_tx_queue
*txq
;
976 const size_t bufsz
= sizeof(char) * 64 *
977 priv
->cfg
->base_params
->num_of_queues
;
980 IWL_ERR(priv
, "txq not ready\n");
983 buf
= kzalloc(bufsz
, GFP_KERNEL
);
987 for (cnt
= 0; cnt
< priv
->hw_params
.max_txq_num
; cnt
++) {
988 txq
= &priv
->txq
[cnt
];
990 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
991 "hwq %.2d: read=%u write=%u stop=%d"
992 " swq_id=%#.2x (ac %d/hwq %d)\n",
993 cnt
, q
->read_ptr
, q
->write_ptr
,
994 !!test_bit(cnt
, priv
->queue_stopped
),
995 txq
->swq_id
, txq
->swq_id
& 3,
996 (txq
->swq_id
>> 2) & 0x1f);
999 /* for the ACs, display the stop count too */
1000 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1001 " stop-count: %d\n",
1002 atomic_read(&priv
->queue_stop_count
[cnt
]));
1004 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1009 static ssize_t
iwl_dbgfs_rx_queue_read(struct file
*file
,
1010 char __user
*user_buf
,
1011 size_t count
, loff_t
*ppos
) {
1013 struct iwl_priv
*priv
= file
->private_data
;
1014 struct iwl_rx_queue
*rxq
= &priv
->rxq
;
1017 const size_t bufsz
= sizeof(buf
);
1019 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "read: %u\n",
1021 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "write: %u\n",
1023 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "free_count: %u\n",
1026 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "closed_rb_num: %u\n",
1027 le16_to_cpu(rxq
->rb_stts
->closed_rb_num
) & 0x0FFF);
1029 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1030 "closed_rb_num: Not Allocated\n");
1032 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1035 static ssize_t
iwl_dbgfs_ucode_rx_stats_read(struct file
*file
,
1036 char __user
*user_buf
,
1037 size_t count
, loff_t
*ppos
)
1039 struct iwl_priv
*priv
= file
->private_data
;
1040 return priv
->cfg
->ops
->lib
->debugfs_ops
.rx_stats_read(file
,
1041 user_buf
, count
, ppos
);
1044 static ssize_t
iwl_dbgfs_ucode_tx_stats_read(struct file
*file
,
1045 char __user
*user_buf
,
1046 size_t count
, loff_t
*ppos
)
1048 struct iwl_priv
*priv
= file
->private_data
;
1049 return priv
->cfg
->ops
->lib
->debugfs_ops
.tx_stats_read(file
,
1050 user_buf
, count
, ppos
);
1053 static ssize_t
iwl_dbgfs_ucode_general_stats_read(struct file
*file
,
1054 char __user
*user_buf
,
1055 size_t count
, loff_t
*ppos
)
1057 struct iwl_priv
*priv
= file
->private_data
;
1058 return priv
->cfg
->ops
->lib
->debugfs_ops
.general_stats_read(file
,
1059 user_buf
, count
, ppos
);
1062 static ssize_t
iwl_dbgfs_sensitivity_read(struct file
*file
,
1063 char __user
*user_buf
,
1064 size_t count
, loff_t
*ppos
) {
1066 struct iwl_priv
*priv
= file
->private_data
;
1070 int bufsz
= sizeof(struct iwl_sensitivity_data
) * 4 + 100;
1072 struct iwl_sensitivity_data
*data
;
1074 data
= &priv
->sensitivity_data
;
1075 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1077 IWL_ERR(priv
, "Can not allocate Buffer\n");
1081 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_ofdm:\t\t\t %u\n",
1082 data
->auto_corr_ofdm
);
1083 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1084 "auto_corr_ofdm_mrc:\t\t %u\n",
1085 data
->auto_corr_ofdm_mrc
);
1086 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_ofdm_x1:\t\t %u\n",
1087 data
->auto_corr_ofdm_x1
);
1088 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1089 "auto_corr_ofdm_mrc_x1:\t\t %u\n",
1090 data
->auto_corr_ofdm_mrc_x1
);
1091 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_cck:\t\t\t %u\n",
1092 data
->auto_corr_cck
);
1093 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_cck_mrc:\t\t %u\n",
1094 data
->auto_corr_cck_mrc
);
1095 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1096 "last_bad_plcp_cnt_ofdm:\t\t %u\n",
1097 data
->last_bad_plcp_cnt_ofdm
);
1098 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "last_fa_cnt_ofdm:\t\t %u\n",
1099 data
->last_fa_cnt_ofdm
);
1100 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1101 "last_bad_plcp_cnt_cck:\t\t %u\n",
1102 data
->last_bad_plcp_cnt_cck
);
1103 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "last_fa_cnt_cck:\t\t %u\n",
1104 data
->last_fa_cnt_cck
);
1105 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_curr_state:\t\t\t %u\n",
1106 data
->nrg_curr_state
);
1107 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_prev_state:\t\t\t %u\n",
1108 data
->nrg_prev_state
);
1109 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_value:\t\t\t");
1110 for (cnt
= 0; cnt
< 10; cnt
++) {
1111 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1112 data
->nrg_value
[cnt
]);
1114 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1115 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_silence_rssi:\t\t");
1116 for (cnt
= 0; cnt
< NRG_NUM_PREV_STAT_L
; cnt
++) {
1117 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1118 data
->nrg_silence_rssi
[cnt
]);
1120 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1121 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_silence_ref:\t\t %u\n",
1122 data
->nrg_silence_ref
);
1123 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_energy_idx:\t\t\t %u\n",
1124 data
->nrg_energy_idx
);
1125 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_silence_idx:\t\t %u\n",
1126 data
->nrg_silence_idx
);
1127 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_th_cck:\t\t\t %u\n",
1129 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1130 "nrg_auto_corr_silence_diff:\t %u\n",
1131 data
->nrg_auto_corr_silence_diff
);
1132 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "num_in_cck_no_fa:\t\t %u\n",
1133 data
->num_in_cck_no_fa
);
1134 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_th_ofdm:\t\t\t %u\n",
1137 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1143 static ssize_t
iwl_dbgfs_chain_noise_read(struct file
*file
,
1144 char __user
*user_buf
,
1145 size_t count
, loff_t
*ppos
) {
1147 struct iwl_priv
*priv
= file
->private_data
;
1151 int bufsz
= sizeof(struct iwl_chain_noise_data
) * 4 + 100;
1153 struct iwl_chain_noise_data
*data
;
1155 data
= &priv
->chain_noise_data
;
1156 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1158 IWL_ERR(priv
, "Can not allocate Buffer\n");
1162 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "active_chains:\t\t\t %u\n",
1163 data
->active_chains
);
1164 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_noise_a:\t\t\t %u\n",
1165 data
->chain_noise_a
);
1166 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_noise_b:\t\t\t %u\n",
1167 data
->chain_noise_b
);
1168 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_noise_c:\t\t\t %u\n",
1169 data
->chain_noise_c
);
1170 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_signal_a:\t\t\t %u\n",
1171 data
->chain_signal_a
);
1172 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_signal_b:\t\t\t %u\n",
1173 data
->chain_signal_b
);
1174 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_signal_c:\t\t\t %u\n",
1175 data
->chain_signal_c
);
1176 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "beacon_count:\t\t\t %u\n",
1177 data
->beacon_count
);
1179 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "disconn_array:\t\t\t");
1180 for (cnt
= 0; cnt
< NUM_RX_CHAINS
; cnt
++) {
1181 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1182 data
->disconn_array
[cnt
]);
1184 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1185 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "delta_gain_code:\t\t");
1186 for (cnt
= 0; cnt
< NUM_RX_CHAINS
; cnt
++) {
1187 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1188 data
->delta_gain_code
[cnt
]);
1190 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1191 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "radio_write:\t\t\t %u\n",
1193 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "state:\t\t\t\t %u\n",
1196 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1201 static ssize_t
iwl_dbgfs_power_save_status_read(struct file
*file
,
1202 char __user
*user_buf
,
1203 size_t count
, loff_t
*ppos
)
1205 struct iwl_priv
*priv
= file
->private_data
;
1208 const size_t bufsz
= sizeof(buf
);
1211 pwrsave_status
= iwl_read32(priv
, CSR_GP_CNTRL
) &
1212 CSR_GP_REG_POWER_SAVE_STATUS_MSK
;
1214 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Power Save Status: ");
1215 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s\n",
1216 (pwrsave_status
== CSR_GP_REG_NO_POWER_SAVE
) ? "none" :
1217 (pwrsave_status
== CSR_GP_REG_MAC_POWER_SAVE
) ? "MAC" :
1218 (pwrsave_status
== CSR_GP_REG_PHY_POWER_SAVE
) ? "PHY" :
1221 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1224 static ssize_t
iwl_dbgfs_clear_ucode_statistics_write(struct file
*file
,
1225 const char __user
*user_buf
,
1226 size_t count
, loff_t
*ppos
)
1228 struct iwl_priv
*priv
= file
->private_data
;
1233 memset(buf
, 0, sizeof(buf
));
1234 buf_size
= min(count
, sizeof(buf
) - 1);
1235 if (copy_from_user(buf
, user_buf
, buf_size
))
1237 if (sscanf(buf
, "%d", &clear
) != 1)
1240 /* make request to uCode to retrieve statistics information */
1241 mutex_lock(&priv
->mutex
);
1242 iwl_send_statistics_request(priv
, CMD_SYNC
, true);
1243 mutex_unlock(&priv
->mutex
);
1248 static ssize_t
iwl_dbgfs_csr_write(struct file
*file
,
1249 const char __user
*user_buf
,
1250 size_t count
, loff_t
*ppos
)
1252 struct iwl_priv
*priv
= file
->private_data
;
1257 memset(buf
, 0, sizeof(buf
));
1258 buf_size
= min(count
, sizeof(buf
) - 1);
1259 if (copy_from_user(buf
, user_buf
, buf_size
))
1261 if (sscanf(buf
, "%d", &csr
) != 1)
1264 if (priv
->cfg
->ops
->lib
->dump_csr
)
1265 priv
->cfg
->ops
->lib
->dump_csr(priv
);
1270 static ssize_t
iwl_dbgfs_ucode_tracing_read(struct file
*file
,
1271 char __user
*user_buf
,
1272 size_t count
, loff_t
*ppos
) {
1274 struct iwl_priv
*priv
= file
->private_data
;
1277 const size_t bufsz
= sizeof(buf
);
1279 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "ucode trace timer is %s\n",
1280 priv
->event_log
.ucode_trace
? "On" : "Off");
1281 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "non_wraps_count:\t\t %u\n",
1282 priv
->event_log
.non_wraps_count
);
1283 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "wraps_once_count:\t\t %u\n",
1284 priv
->event_log
.wraps_once_count
);
1285 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "wraps_more_count:\t\t %u\n",
1286 priv
->event_log
.wraps_more_count
);
1288 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1291 static ssize_t
iwl_dbgfs_ucode_tracing_write(struct file
*file
,
1292 const char __user
*user_buf
,
1293 size_t count
, loff_t
*ppos
)
1295 struct iwl_priv
*priv
= file
->private_data
;
1300 memset(buf
, 0, sizeof(buf
));
1301 buf_size
= min(count
, sizeof(buf
) - 1);
1302 if (copy_from_user(buf
, user_buf
, buf_size
))
1304 if (sscanf(buf
, "%d", &trace
) != 1)
1308 priv
->event_log
.ucode_trace
= true;
1309 /* schedule the ucode timer to occur in UCODE_TRACE_PERIOD */
1310 mod_timer(&priv
->ucode_trace
,
1311 jiffies
+ msecs_to_jiffies(UCODE_TRACE_PERIOD
));
1313 priv
->event_log
.ucode_trace
= false;
1314 del_timer_sync(&priv
->ucode_trace
);
1320 static ssize_t
iwl_dbgfs_rxon_flags_read(struct file
*file
,
1321 char __user
*user_buf
,
1322 size_t count
, loff_t
*ppos
) {
1324 struct iwl_priv
*priv
= file
->private_data
;
1328 len
= sprintf(buf
, "0x%04X\n",
1329 le32_to_cpu(priv
->contexts
[IWL_RXON_CTX_BSS
].active
.flags
));
1330 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1333 static ssize_t
iwl_dbgfs_rxon_filter_flags_read(struct file
*file
,
1334 char __user
*user_buf
,
1335 size_t count
, loff_t
*ppos
) {
1337 struct iwl_priv
*priv
= file
->private_data
;
1341 len
= sprintf(buf
, "0x%04X\n",
1342 le32_to_cpu(priv
->contexts
[IWL_RXON_CTX_BSS
].active
.filter_flags
));
1343 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1346 static ssize_t
iwl_dbgfs_fh_reg_read(struct file
*file
,
1347 char __user
*user_buf
,
1348 size_t count
, loff_t
*ppos
)
1350 struct iwl_priv
*priv
= file
->private_data
;
1353 ssize_t ret
= -EFAULT
;
1355 if (priv
->cfg
->ops
->lib
->dump_fh
) {
1356 ret
= pos
= priv
->cfg
->ops
->lib
->dump_fh(priv
, &buf
, true);
1358 ret
= simple_read_from_buffer(user_buf
,
1359 count
, ppos
, buf
, pos
);
1367 static ssize_t
iwl_dbgfs_missed_beacon_read(struct file
*file
,
1368 char __user
*user_buf
,
1369 size_t count
, loff_t
*ppos
) {
1371 struct iwl_priv
*priv
= file
->private_data
;
1374 const size_t bufsz
= sizeof(buf
);
1376 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%d\n",
1377 priv
->missed_beacon_threshold
);
1379 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1382 static ssize_t
iwl_dbgfs_missed_beacon_write(struct file
*file
,
1383 const char __user
*user_buf
,
1384 size_t count
, loff_t
*ppos
)
1386 struct iwl_priv
*priv
= file
->private_data
;
1391 memset(buf
, 0, sizeof(buf
));
1392 buf_size
= min(count
, sizeof(buf
) - 1);
1393 if (copy_from_user(buf
, user_buf
, buf_size
))
1395 if (sscanf(buf
, "%d", &missed
) != 1)
1398 if (missed
< IWL_MISSED_BEACON_THRESHOLD_MIN
||
1399 missed
> IWL_MISSED_BEACON_THRESHOLD_MAX
)
1400 priv
->missed_beacon_threshold
=
1401 IWL_MISSED_BEACON_THRESHOLD_DEF
;
1403 priv
->missed_beacon_threshold
= missed
;
1408 static ssize_t
iwl_dbgfs_plcp_delta_read(struct file
*file
,
1409 char __user
*user_buf
,
1410 size_t count
, loff_t
*ppos
) {
1412 struct iwl_priv
*priv
= file
->private_data
;
1415 const size_t bufsz
= sizeof(buf
);
1417 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%u\n",
1418 priv
->cfg
->base_params
->plcp_delta_threshold
);
1420 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1423 static ssize_t
iwl_dbgfs_plcp_delta_write(struct file
*file
,
1424 const char __user
*user_buf
,
1425 size_t count
, loff_t
*ppos
) {
1427 struct iwl_priv
*priv
= file
->private_data
;
1432 memset(buf
, 0, sizeof(buf
));
1433 buf_size
= min(count
, sizeof(buf
) - 1);
1434 if (copy_from_user(buf
, user_buf
, buf_size
))
1436 if (sscanf(buf
, "%d", &plcp
) != 1)
1438 if ((plcp
< IWL_MAX_PLCP_ERR_THRESHOLD_MIN
) ||
1439 (plcp
> IWL_MAX_PLCP_ERR_THRESHOLD_MAX
))
1440 priv
->cfg
->base_params
->plcp_delta_threshold
=
1441 IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE
;
1443 priv
->cfg
->base_params
->plcp_delta_threshold
= plcp
;
1447 static ssize_t
iwl_dbgfs_force_reset_read(struct file
*file
,
1448 char __user
*user_buf
,
1449 size_t count
, loff_t
*ppos
) {
1451 struct iwl_priv
*priv
= file
->private_data
;
1454 const size_t bufsz
= sizeof(buf
);
1455 struct iwl_force_reset
*force_reset
;
1457 for (i
= 0; i
< IWL_MAX_FORCE_RESET
; i
++) {
1458 force_reset
= &priv
->force_reset
[i
];
1459 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1460 "Force reset method %d\n", i
);
1461 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1462 "\tnumber of reset request: %d\n",
1463 force_reset
->reset_request_count
);
1464 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1465 "\tnumber of reset request success: %d\n",
1466 force_reset
->reset_success_count
);
1467 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1468 "\tnumber of reset request reject: %d\n",
1469 force_reset
->reset_reject_count
);
1470 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1471 "\treset duration: %lu\n",
1472 force_reset
->reset_duration
);
1474 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1477 static ssize_t
iwl_dbgfs_force_reset_write(struct file
*file
,
1478 const char __user
*user_buf
,
1479 size_t count
, loff_t
*ppos
) {
1481 struct iwl_priv
*priv
= file
->private_data
;
1486 memset(buf
, 0, sizeof(buf
));
1487 buf_size
= min(count
, sizeof(buf
) - 1);
1488 if (copy_from_user(buf
, user_buf
, buf_size
))
1490 if (sscanf(buf
, "%d", &reset
) != 1)
1495 ret
= iwl_force_reset(priv
, reset
, true);
1500 return ret
? ret
: count
;
1503 static ssize_t
iwl_dbgfs_txfifo_flush_write(struct file
*file
,
1504 const char __user
*user_buf
,
1505 size_t count
, loff_t
*ppos
) {
1507 struct iwl_priv
*priv
= file
->private_data
;
1512 memset(buf
, 0, sizeof(buf
));
1513 buf_size
= min(count
, sizeof(buf
) - 1);
1514 if (copy_from_user(buf
, user_buf
, buf_size
))
1516 if (sscanf(buf
, "%d", &flush
) != 1)
1519 if (iwl_is_rfkill(priv
))
1522 priv
->cfg
->ops
->lib
->dev_txfifo_flush(priv
, IWL_DROP_ALL
);
1527 static ssize_t
iwl_dbgfs_ucode_bt_stats_read(struct file
*file
,
1528 char __user
*user_buf
,
1529 size_t count
, loff_t
*ppos
)
1531 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
1533 return priv
->cfg
->ops
->lib
->debugfs_ops
.bt_stats_read(file
,
1534 user_buf
, count
, ppos
);
1537 static ssize_t
iwl_dbgfs_wd_timeout_write(struct file
*file
,
1538 const char __user
*user_buf
,
1539 size_t count
, loff_t
*ppos
) {
1541 struct iwl_priv
*priv
= file
->private_data
;
1546 memset(buf
, 0, sizeof(buf
));
1547 buf_size
= min(count
, sizeof(buf
) - 1);
1548 if (copy_from_user(buf
, user_buf
, buf_size
))
1550 if (sscanf(buf
, "%d", &timeout
) != 1)
1552 if (timeout
< 0 || timeout
> IWL_MAX_WD_TIMEOUT
)
1553 timeout
= IWL_DEF_WD_TIMEOUT
;
1555 priv
->cfg
->base_params
->wd_timeout
= timeout
;
1556 iwl_setup_watchdog(priv
);
1560 static ssize_t
iwl_dbgfs_bt_traffic_read(struct file
*file
,
1561 char __user
*user_buf
,
1562 size_t count
, loff_t
*ppos
) {
1564 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
1567 const size_t bufsz
= sizeof(buf
);
1570 if (!priv
->bt_enable_flag
) {
1571 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT coex disabled\n");
1572 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1575 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT enable flag: 0x%x\n",
1576 priv
->bt_enable_flag
);
1577 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT in %s mode\n",
1578 priv
->bt_full_concurrent
? "full concurrency" : "3-wire");
1579 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT status: %s, "
1580 "last traffic notif: %d\n",
1581 priv
->bt_status
? "On" : "Off", priv
->last_bt_traffic_load
);
1582 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "ch_announcement: %d, "
1583 "sco_active: %d, kill_ack_mask: %x, "
1584 "kill_cts_mask: %x\n",
1585 priv
->bt_ch_announce
, priv
->bt_sco_active
,
1586 priv
->kill_ack_mask
, priv
->kill_cts_mask
);
1588 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "bluetooth traffic load: ");
1589 switch (priv
->bt_traffic_load
) {
1590 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS
:
1591 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Continuous\n");
1593 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH
:
1594 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "High\n");
1596 case IWL_BT_COEX_TRAFFIC_LOAD_LOW
:
1597 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Low\n");
1599 case IWL_BT_COEX_TRAFFIC_LOAD_NONE
:
1601 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "None\n");
1605 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1609 static ssize_t
iwl_dbgfs_protection_mode_read(struct file
*file
,
1610 char __user
*user_buf
,
1611 size_t count
, loff_t
*ppos
)
1613 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
1617 const size_t bufsz
= sizeof(buf
);
1619 if (priv
->cfg
->ht_params
)
1620 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1621 "use %s for aggregation\n",
1622 (priv
->cfg
->ht_params
->use_rts_for_aggregation
) ?
1623 "rts/cts" : "cts-to-self");
1625 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "N/A");
1627 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1630 static ssize_t
iwl_dbgfs_protection_mode_write(struct file
*file
,
1631 const char __user
*user_buf
,
1632 size_t count
, loff_t
*ppos
) {
1634 struct iwl_priv
*priv
= file
->private_data
;
1639 if (!priv
->cfg
->ht_params
)
1642 memset(buf
, 0, sizeof(buf
));
1643 buf_size
= min(count
, sizeof(buf
) - 1);
1644 if (copy_from_user(buf
, user_buf
, buf_size
))
1646 if (sscanf(buf
, "%d", &rts
) != 1)
1649 priv
->cfg
->ht_params
->use_rts_for_aggregation
= true;
1651 priv
->cfg
->ht_params
->use_rts_for_aggregation
= false;
1655 static ssize_t
iwl_dbgfs_reply_tx_error_read(struct file
*file
,
1656 char __user
*user_buf
,
1657 size_t count
, loff_t
*ppos
)
1659 struct iwl_priv
*priv
= file
->private_data
;
1661 if (priv
->cfg
->ops
->lib
->debugfs_ops
.reply_tx_error
)
1662 return priv
->cfg
->ops
->lib
->debugfs_ops
.reply_tx_error(
1663 file
, user_buf
, count
, ppos
);
1667 DEBUGFS_READ_FILE_OPS(rx_statistics
);
1668 DEBUGFS_READ_FILE_OPS(tx_statistics
);
1669 DEBUGFS_READ_WRITE_FILE_OPS(traffic_log
);
1670 DEBUGFS_READ_FILE_OPS(rx_queue
);
1671 DEBUGFS_READ_FILE_OPS(tx_queue
);
1672 DEBUGFS_READ_FILE_OPS(ucode_rx_stats
);
1673 DEBUGFS_READ_FILE_OPS(ucode_tx_stats
);
1674 DEBUGFS_READ_FILE_OPS(ucode_general_stats
);
1675 DEBUGFS_READ_FILE_OPS(sensitivity
);
1676 DEBUGFS_READ_FILE_OPS(chain_noise
);
1677 DEBUGFS_READ_FILE_OPS(power_save_status
);
1678 DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics
);
1679 DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics
);
1680 DEBUGFS_WRITE_FILE_OPS(csr
);
1681 DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing
);
1682 DEBUGFS_READ_FILE_OPS(fh_reg
);
1683 DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon
);
1684 DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta
);
1685 DEBUGFS_READ_WRITE_FILE_OPS(force_reset
);
1686 DEBUGFS_READ_FILE_OPS(rxon_flags
);
1687 DEBUGFS_READ_FILE_OPS(rxon_filter_flags
);
1688 DEBUGFS_WRITE_FILE_OPS(txfifo_flush
);
1689 DEBUGFS_READ_FILE_OPS(ucode_bt_stats
);
1690 DEBUGFS_WRITE_FILE_OPS(wd_timeout
);
1691 DEBUGFS_READ_FILE_OPS(bt_traffic
);
1692 DEBUGFS_READ_WRITE_FILE_OPS(protection_mode
);
1693 DEBUGFS_READ_FILE_OPS(reply_tx_error
);
1696 * Create the debugfs files and directories
1699 int iwl_dbgfs_register(struct iwl_priv
*priv
, const char *name
)
1701 struct dentry
*phyd
= priv
->hw
->wiphy
->debugfsdir
;
1702 struct dentry
*dir_drv
, *dir_data
, *dir_rf
, *dir_debug
;
1704 dir_drv
= debugfs_create_dir(name
, phyd
);
1708 priv
->debugfs_dir
= dir_drv
;
1710 dir_data
= debugfs_create_dir("data", dir_drv
);
1713 dir_rf
= debugfs_create_dir("rf", dir_drv
);
1716 dir_debug
= debugfs_create_dir("debug", dir_drv
);
1720 DEBUGFS_ADD_FILE(nvm
, dir_data
, S_IRUSR
);
1721 DEBUGFS_ADD_FILE(sram
, dir_data
, S_IWUSR
| S_IRUSR
);
1722 DEBUGFS_ADD_FILE(log_event
, dir_data
, S_IWUSR
| S_IRUSR
);
1723 DEBUGFS_ADD_FILE(stations
, dir_data
, S_IRUSR
);
1724 DEBUGFS_ADD_FILE(channels
, dir_data
, S_IRUSR
);
1725 DEBUGFS_ADD_FILE(status
, dir_data
, S_IRUSR
);
1726 DEBUGFS_ADD_FILE(interrupt
, dir_data
, S_IWUSR
| S_IRUSR
);
1727 DEBUGFS_ADD_FILE(qos
, dir_data
, S_IRUSR
);
1728 DEBUGFS_ADD_FILE(led
, dir_data
, S_IRUSR
);
1729 if (!priv
->cfg
->base_params
->broken_powersave
) {
1730 DEBUGFS_ADD_FILE(sleep_level_override
, dir_data
,
1732 DEBUGFS_ADD_FILE(current_sleep_command
, dir_data
, S_IRUSR
);
1734 DEBUGFS_ADD_FILE(thermal_throttling
, dir_data
, S_IRUSR
);
1735 DEBUGFS_ADD_FILE(disable_ht40
, dir_data
, S_IWUSR
| S_IRUSR
);
1736 DEBUGFS_ADD_FILE(rx_statistics
, dir_debug
, S_IRUSR
);
1737 DEBUGFS_ADD_FILE(tx_statistics
, dir_debug
, S_IRUSR
);
1738 DEBUGFS_ADD_FILE(traffic_log
, dir_debug
, S_IWUSR
| S_IRUSR
);
1739 DEBUGFS_ADD_FILE(rx_queue
, dir_debug
, S_IRUSR
);
1740 DEBUGFS_ADD_FILE(tx_queue
, dir_debug
, S_IRUSR
);
1741 DEBUGFS_ADD_FILE(power_save_status
, dir_debug
, S_IRUSR
);
1742 DEBUGFS_ADD_FILE(clear_ucode_statistics
, dir_debug
, S_IWUSR
);
1743 DEBUGFS_ADD_FILE(clear_traffic_statistics
, dir_debug
, S_IWUSR
);
1744 DEBUGFS_ADD_FILE(csr
, dir_debug
, S_IWUSR
);
1745 DEBUGFS_ADD_FILE(fh_reg
, dir_debug
, S_IRUSR
);
1746 DEBUGFS_ADD_FILE(missed_beacon
, dir_debug
, S_IWUSR
);
1747 DEBUGFS_ADD_FILE(plcp_delta
, dir_debug
, S_IWUSR
| S_IRUSR
);
1748 DEBUGFS_ADD_FILE(force_reset
, dir_debug
, S_IWUSR
| S_IRUSR
);
1749 DEBUGFS_ADD_FILE(ucode_rx_stats
, dir_debug
, S_IRUSR
);
1750 DEBUGFS_ADD_FILE(ucode_tx_stats
, dir_debug
, S_IRUSR
);
1751 DEBUGFS_ADD_FILE(ucode_general_stats
, dir_debug
, S_IRUSR
);
1752 if (priv
->cfg
->ops
->lib
->dev_txfifo_flush
)
1753 DEBUGFS_ADD_FILE(txfifo_flush
, dir_debug
, S_IWUSR
);
1754 DEBUGFS_ADD_FILE(protection_mode
, dir_debug
, S_IWUSR
| S_IRUSR
);
1756 if (priv
->cfg
->base_params
->sensitivity_calib_by_driver
)
1757 DEBUGFS_ADD_FILE(sensitivity
, dir_debug
, S_IRUSR
);
1758 if (priv
->cfg
->base_params
->chain_noise_calib_by_driver
)
1759 DEBUGFS_ADD_FILE(chain_noise
, dir_debug
, S_IRUSR
);
1760 if (priv
->cfg
->base_params
->ucode_tracing
)
1761 DEBUGFS_ADD_FILE(ucode_tracing
, dir_debug
, S_IWUSR
| S_IRUSR
);
1762 if (priv
->cfg
->bt_params
&& priv
->cfg
->bt_params
->bt_statistics
)
1763 DEBUGFS_ADD_FILE(ucode_bt_stats
, dir_debug
, S_IRUSR
);
1764 DEBUGFS_ADD_FILE(reply_tx_error
, dir_debug
, S_IRUSR
);
1765 DEBUGFS_ADD_FILE(rxon_flags
, dir_debug
, S_IWUSR
);
1766 DEBUGFS_ADD_FILE(rxon_filter_flags
, dir_debug
, S_IWUSR
);
1767 DEBUGFS_ADD_FILE(wd_timeout
, dir_debug
, S_IWUSR
);
1768 if (priv
->cfg
->bt_params
&& priv
->cfg
->bt_params
->advanced_bt_coexist
)
1769 DEBUGFS_ADD_FILE(bt_traffic
, dir_debug
, S_IRUSR
);
1770 if (priv
->cfg
->base_params
->sensitivity_calib_by_driver
)
1771 DEBUGFS_ADD_BOOL(disable_sensitivity
, dir_rf
,
1772 &priv
->disable_sens_cal
);
1773 if (priv
->cfg
->base_params
->chain_noise_calib_by_driver
)
1774 DEBUGFS_ADD_BOOL(disable_chain_noise
, dir_rf
,
1775 &priv
->disable_chain_noise_cal
);
1776 if (priv
->cfg
->base_params
->tx_power_by_driver
)
1777 DEBUGFS_ADD_BOOL(disable_tx_power
, dir_rf
,
1778 &priv
->disable_tx_power_cal
);
1782 IWL_ERR(priv
, "Can't create the debugfs directory\n");
1783 iwl_dbgfs_unregister(priv
);
1786 EXPORT_SYMBOL(iwl_dbgfs_register
);
1789 * Remove the debugfs files and directories
1792 void iwl_dbgfs_unregister(struct iwl_priv
*priv
)
1794 if (!priv
->debugfs_dir
)
1797 debugfs_remove_recursive(priv
->debugfs_dir
);
1798 priv
->debugfs_dir
= NULL
;
1800 EXPORT_SYMBOL(iwl_dbgfs_unregister
);