drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c- Extension
.c- Size
- 78259 bytes
- Lines
- 2384
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/kernel.hlinux/module.hlinux/debugfs.hlinux/ieee80211.hnet/mac80211.hiwl-debug.hiwl-trans.hiwl-io.hdev.hagn.h
Detected Declarations
function iwl_dbgfs_sram_readfunction iwl_dbgfs_sram_writefunction iwl_dbgfs_wowlan_sram_readfunction iwl_dbgfs_stations_readfunction iwl_dbgfs_nvm_readfunction iwl_dbgfs_channels_readfunction iwl_dbgfs_status_readfunction iwl_dbgfs_rx_handlers_readfunction iwl_dbgfs_rx_handlers_writefunction iwl_dbgfs_qos_readfunction for_each_contextfunction iwl_dbgfs_thermal_throttling_readfunction iwl_dbgfs_disable_ht40_writefunction iwl_dbgfs_disable_ht40_readfunction iwl_dbgfs_temperature_readfunction iwl_dbgfs_sleep_level_override_writefunction iwl_dbgfs_sleep_level_override_readfunction iwl_dbgfs_current_sleep_command_readfunction iwl_statistics_flagfunction iwl_dbgfs_ucode_rx_stats_readfunction iwl_dbgfs_ucode_tx_stats_readfunction iwl_dbgfs_ucode_general_stats_readfunction iwl_dbgfs_ucode_bt_stats_readfunction iwl_dbgfs_reply_tx_error_readfunction iwl_dbgfs_sensitivity_readfunction iwl_dbgfs_chain_noise_readfunction iwl_dbgfs_power_save_status_readfunction iwl_dbgfs_clear_ucode_statistics_writefunction iwl_dbgfs_ucode_tracing_readfunction iwl_dbgfs_ucode_tracing_writefunction iwl_dbgfs_rxon_flags_readfunction iwl_dbgfs_rxon_filter_flags_readfunction iwl_dbgfs_missed_beacon_readfunction iwl_dbgfs_missed_beacon_writefunction iwl_dbgfs_plcp_delta_readfunction iwl_dbgfs_plcp_delta_writefunction iwl_dbgfs_rf_reset_readfunction iwl_dbgfs_rf_reset_writefunction iwl_dbgfs_txfifo_flush_writefunction iwl_dbgfs_bt_traffic_readfunction iwl_dbgfs_protection_mode_readfunction iwl_dbgfs_protection_mode_writefunction iwl_cmd_echo_testfunction iwl_dbgfs_echo_test_writefunction iwl_dbgfs_log_event_readfunction iwl_dbgfs_log_event_writefunction iwl_dbgfs_calib_disabled_readfunction iwl_dbgfs_calib_disabled_write
Annotated Snippet
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.read = iwl_dbgfs_##name##_read, \
.open = simple_open, \
.llseek = generic_file_llseek, \
};
#define DEBUGFS_WRITE_FILE_OPS(name) \
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.write = iwl_dbgfs_##name##_write, \
.open = simple_open, \
.llseek = generic_file_llseek, \
};
#define DEBUGFS_READ_WRITE_FILE_OPS(name) \
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.write = iwl_dbgfs_##name##_write, \
.read = iwl_dbgfs_##name##_read, \
.open = simple_open, \
.llseek = generic_file_llseek, \
};
static ssize_t iwl_dbgfs_sram_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
u32 val = 0;
char *buf;
ssize_t ret;
int i = 0;
bool device_format = false;
int offset = 0;
int len = 0;
int pos = 0;
int sram;
struct iwl_priv *priv = file->private_data;
const struct fw_img *img;
size_t bufsz;
if (!iwl_is_ready_rf(priv))
return -EAGAIN;
/* default is to dump the entire data segment */
if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) {
priv->dbgfs_sram_offset = 0x800000;
if (!priv->ucode_loaded)
return -EINVAL;
img = &priv->fw->img[priv->cur_ucode];
priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len;
}
len = priv->dbgfs_sram_len;
if (len == -4) {
device_format = true;
len = 4;
}
bufsz = 50 + len * 4;
buf = kmalloc(bufsz, GFP_KERNEL);
if (!buf)
return -ENOMEM;
pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n",
len);
pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n",
priv->dbgfs_sram_offset);
/* adjust sram address since reads are only on even u32 boundaries */
offset = priv->dbgfs_sram_offset & 0x3;
sram = priv->dbgfs_sram_offset & ~0x3;
/* read the first u32 from sram */
val = iwl_trans_read_mem32(priv->trans, sram);
for (; len; len--) {
/* put the address at the start of every line */
if (i == 0)
pos += scnprintf(buf + pos, bufsz - pos,
"%08X: ", sram + offset);
if (device_format)
pos += scnprintf(buf + pos, bufsz - pos,
"%02x", (val >> (8 * (3 - offset))) & 0xff);
else
pos += scnprintf(buf + pos, bufsz - pos,
"%02x ", (val >> (8 * offset)) & 0xff);
/* if all bytes processed, read the next u32 from sram */
if (++offset == 4) {
sram += 4;
Annotation
- Immediate include surface: `linux/slab.h`, `linux/kernel.h`, `linux/module.h`, `linux/debugfs.h`, `linux/ieee80211.h`, `net/mac80211.h`, `iwl-debug.h`, `iwl-trans.h`.
- Detected declarations: `function iwl_dbgfs_sram_read`, `function iwl_dbgfs_sram_write`, `function iwl_dbgfs_wowlan_sram_read`, `function iwl_dbgfs_stations_read`, `function iwl_dbgfs_nvm_read`, `function iwl_dbgfs_channels_read`, `function iwl_dbgfs_status_read`, `function iwl_dbgfs_rx_handlers_read`, `function iwl_dbgfs_rx_handlers_write`, `function iwl_dbgfs_qos_read`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.