drivers/net/wireless/ath/wil6210/wmi.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/wil6210/wmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/wil6210/wmi.c- Extension
.c- Size
- 113374 bytes
- Lines
- 4049
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/moduleparam.hlinux/etherdevice.hlinux/if_arp.hwil6210.htxrx.hwmi.htrace.h
Detected Declarations
struct auth_no_hdrfunction wmi_addr_remapfunction wmi_read_hdrfunction __wmi_sendfunction test_bitfunction wmi_sendfunction wmi_evt_readyfunction wmi_evt_rx_mgmtfunction wmi_evt_tx_mgmtfunction wmi_evt_scan_completefunction wmi_evt_connectfunction wmi_evt_disconnectfunction wmi_evt_eapol_rxfunction wmi_evt_ring_enfunction wmi_evt_ba_statusfunction wmi_evt_addba_rx_reqfunction wmi_evt_delbafunction wmi_evt_sched_scan_resultfunction wil_link_stats_store_basicfunction wil_link_stats_store_globalfunction wmi_link_stats_parsefunction wmi_evt_link_statsfunction wil_find_cid_ringid_stafunction wmi_evt_auth_statusfunction wmi_evt_reassoc_statusfunction wmi_evt_link_monitorfunction wmi_evt_ignorefunction wmi_recv_cmdfunction wmi_callfunction wmi_echofunction wmi_set_mac_addressfunction wmi_led_cfgfunction wmi_rbufcap_cfgfunction wmi_pcp_startfunction wmi_pcp_stopfunction wmi_set_ssidfunction wmi_get_ssidfunction wmi_set_channelfunction wmi_get_channelfunction wmi_p2p_cfgfunction wmi_start_listenfunction wmi_start_searchfunction wmi_stop_discoveryfunction wmi_del_cipher_keyfunction wmi_add_cipher_keyfunction wmi_set_iefunction wmi_update_ft_iesfunction wmi_rxon
Annotated Snippet
struct auth_no_hdr {
__le16 auth_alg;
__le16 auth_transaction;
__le16 status_code;
/* possibly followed by Challenge text */
u8 variable[];
} __packed;
u8 led_polarity = LED_POLARITY_LOW_ACTIVE;
/**
* wmi_addr_remap - return AHB address for given firmware internal (linker) address
* @x: internal address
* If address have no valid AHB mapping, return 0
*/
static u32 wmi_addr_remap(u32 x)
{
uint i;
for (i = 0; i < ARRAY_SIZE(fw_mapping); i++) {
if (fw_mapping[i].fw &&
((x >= fw_mapping[i].from) && (x < fw_mapping[i].to)))
return x + fw_mapping[i].host - fw_mapping[i].from;
}
return 0;
}
/**
* wil_find_fw_mapping - find fw_mapping entry by section name
* @section: section name
*
* Return pointer to section or NULL if not found
*/
struct fw_map *wil_find_fw_mapping(const char *section)
{
int i;
for (i = 0; i < ARRAY_SIZE(fw_mapping); i++)
if (fw_mapping[i].name &&
!strcmp(section, fw_mapping[i].name))
return &fw_mapping[i];
return NULL;
}
/**
* wmi_buffer_block - Check address validity for WMI buffer; remap if needed
* @wil: driver data
* @ptr_: internal (linker) fw/ucode address
* @size: if non zero, validate the block does not
* exceed the device memory (bar)
*
* Valid buffer should be DWORD aligned
*
* return address for accessing buffer from the host;
* if buffer is not valid, return NULL.
*/
void __iomem *wmi_buffer_block(struct wil6210_priv *wil, __le32 ptr_, u32 size)
{
u32 off;
u32 ptr = le32_to_cpu(ptr_);
if (ptr % 4)
return NULL;
ptr = wmi_addr_remap(ptr);
if (ptr < WIL6210_FW_HOST_OFF)
return NULL;
off = HOSTADDR(ptr);
if (off > wil->bar_size - 4)
return NULL;
if (size && ((off + size > wil->bar_size) || (off + size < off)))
return NULL;
return wil->csr + off;
}
void __iomem *wmi_buffer(struct wil6210_priv *wil, __le32 ptr_)
{
return wmi_buffer_block(wil, ptr_, 0);
}
/* Check address validity */
void __iomem *wmi_addr(struct wil6210_priv *wil, u32 ptr)
{
u32 off;
if (ptr % 4)
Annotation
- Immediate include surface: `linux/moduleparam.h`, `linux/etherdevice.h`, `linux/if_arp.h`, `wil6210.h`, `txrx.h`, `wmi.h`, `trace.h`.
- Detected declarations: `struct auth_no_hdr`, `function wmi_addr_remap`, `function wmi_read_hdr`, `function __wmi_send`, `function test_bit`, `function wmi_send`, `function wmi_evt_ready`, `function wmi_evt_rx_mgmt`, `function wmi_evt_tx_mgmt`, `function wmi_evt_scan_complete`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- 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.