drivers/net/wireless/realtek/rtlwifi/debug.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/debug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtlwifi/debug.c- Extension
.c- Size
- 13050 bytes
- Lines
- 515
- 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.
- 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
wifi.hcam.hlinux/moduleparam.hlinux/vmalloc.h
Detected Declarations
struct rtl_debugfs_privfunction _rtl_dbg_printfunction _rtl_dbg_print_datafunction rtl_debug_get_commonfunction dl_debug_open_commonfunction rtl_debug_get_mac_pagefunction rtl_debug_get_bb_pagefunction rtl_debug_get_reg_rffunction rtl_debug_get_cam_registerfunction rtl_debug_get_btcoexfunction rtl_debugfs_set_write_regfunction rtl_debugfs_set_write_h2cfunction rtl_debugfs_set_write_rfregfunction rtl_debugfs_closefunction rtl_debugfs_common_writefunction RTL_DEBUGFS_ADD_COREfunction rtl_debug_remove_onefunction rtl_debugfs_add_topdirfunction rtl_debugfs_remove_topdirexport _rtl_dbg_printexport _rtl_dbg_print_dataexport rtl_debug_add_oneexport rtl_debug_remove_one
Annotated Snippet
static const struct file_operations file_ops_common = {
.open = dl_debug_open_common,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int rtl_debug_get_mac_page(struct seq_file *m, void *v)
{
struct rtl_debugfs_priv *debugfs_priv = m->private;
struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
u32 page = debugfs_priv->cb_data;
int i, n;
int max = 0xff;
for (n = 0; n <= max; ) {
seq_printf(m, "\n%8.8x ", n + page);
for (i = 0; i < 4 && n <= max; i++, n += 4)
seq_printf(m, "%8.8x ",
rtl_read_dword(rtlpriv, (page | n)));
}
seq_puts(m, "\n");
return 0;
}
#define RTL_DEBUG_IMPL_MAC_SERIES(page, addr) \
static struct rtl_debugfs_priv rtl_debug_priv_mac_ ##page = { \
.cb_read = rtl_debug_get_mac_page, \
.cb_data = addr, \
}
RTL_DEBUG_IMPL_MAC_SERIES(0, 0x0000);
RTL_DEBUG_IMPL_MAC_SERIES(1, 0x0100);
RTL_DEBUG_IMPL_MAC_SERIES(2, 0x0200);
RTL_DEBUG_IMPL_MAC_SERIES(3, 0x0300);
RTL_DEBUG_IMPL_MAC_SERIES(4, 0x0400);
RTL_DEBUG_IMPL_MAC_SERIES(5, 0x0500);
RTL_DEBUG_IMPL_MAC_SERIES(6, 0x0600);
RTL_DEBUG_IMPL_MAC_SERIES(7, 0x0700);
RTL_DEBUG_IMPL_MAC_SERIES(10, 0x1000);
RTL_DEBUG_IMPL_MAC_SERIES(11, 0x1100);
RTL_DEBUG_IMPL_MAC_SERIES(12, 0x1200);
RTL_DEBUG_IMPL_MAC_SERIES(13, 0x1300);
RTL_DEBUG_IMPL_MAC_SERIES(14, 0x1400);
RTL_DEBUG_IMPL_MAC_SERIES(15, 0x1500);
RTL_DEBUG_IMPL_MAC_SERIES(16, 0x1600);
RTL_DEBUG_IMPL_MAC_SERIES(17, 0x1700);
static int rtl_debug_get_bb_page(struct seq_file *m, void *v)
{
struct rtl_debugfs_priv *debugfs_priv = m->private;
struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
struct ieee80211_hw *hw = rtlpriv->hw;
u32 page = debugfs_priv->cb_data;
int i, n;
int max = 0xff;
for (n = 0; n <= max; ) {
seq_printf(m, "\n%8.8x ", n + page);
for (i = 0; i < 4 && n <= max; i++, n += 4)
seq_printf(m, "%8.8x ",
rtl_get_bbreg(hw, (page | n), 0xffffffff));
}
seq_puts(m, "\n");
return 0;
}
#define RTL_DEBUG_IMPL_BB_SERIES(page, addr) \
static struct rtl_debugfs_priv rtl_debug_priv_bb_ ##page = { \
.cb_read = rtl_debug_get_bb_page, \
.cb_data = addr, \
}
RTL_DEBUG_IMPL_BB_SERIES(8, 0x0800);
RTL_DEBUG_IMPL_BB_SERIES(9, 0x0900);
RTL_DEBUG_IMPL_BB_SERIES(a, 0x0a00);
RTL_DEBUG_IMPL_BB_SERIES(b, 0x0b00);
RTL_DEBUG_IMPL_BB_SERIES(c, 0x0c00);
RTL_DEBUG_IMPL_BB_SERIES(d, 0x0d00);
RTL_DEBUG_IMPL_BB_SERIES(e, 0x0e00);
RTL_DEBUG_IMPL_BB_SERIES(f, 0x0f00);
RTL_DEBUG_IMPL_BB_SERIES(18, 0x1800);
RTL_DEBUG_IMPL_BB_SERIES(19, 0x1900);
RTL_DEBUG_IMPL_BB_SERIES(1a, 0x1a00);
RTL_DEBUG_IMPL_BB_SERIES(1b, 0x1b00);
RTL_DEBUG_IMPL_BB_SERIES(1c, 0x1c00);
RTL_DEBUG_IMPL_BB_SERIES(1d, 0x1d00);
RTL_DEBUG_IMPL_BB_SERIES(1e, 0x1e00);
RTL_DEBUG_IMPL_BB_SERIES(1f, 0x1f00);
Annotation
- Immediate include surface: `wifi.h`, `cam.h`, `linux/moduleparam.h`, `linux/vmalloc.h`.
- Detected declarations: `struct rtl_debugfs_priv`, `function _rtl_dbg_print`, `function _rtl_dbg_print_data`, `function rtl_debug_get_common`, `function dl_debug_open_common`, `function rtl_debug_get_mac_page`, `function rtl_debug_get_bb_page`, `function rtl_debug_get_reg_rf`, `function rtl_debug_get_cam_register`, `function rtl_debug_get_btcoex`.
- 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.
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.