drivers/net/wireless/ath/ath11k/qmi.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath11k/qmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath11k/qmi.c- Extension
.c- Size
- 86395 bytes
- Lines
- 3366
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/elf.hlinux/export.hqmi.hcore.hdebug.hhif.hlinux/of.hlinux/of_reserved_mem.hlinux/ioport.hlinux/firmware.hlinux/of_irq.h
Detected Declarations
function ath11k_qmi_host_cap_sendfunction ath11k_qmi_fw_ind_register_sendfunction ath11k_qmi_respond_fw_mem_requestfunction test_bitfunction ath11k_qmi_free_target_mem_chunkfunction ath11k_qmi_alloc_target_mem_chunkfunction ath11k_qmi_assign_target_mem_chunkfunction ath11k_qmi_request_device_infofunction ath11k_qmi_request_target_capfunction ath11k_qmi_load_file_target_memfunction ath11k_qmi_load_bdf_qmifunction ath11k_qmi_m3_loadfunction ath11k_qmi_m3_freefunction ath11k_qmi_wlanfw_m3_info_sendfunction ath11k_qmi_wlanfw_mode_sendfunction ath11k_qmi_wlanfw_wlan_cfg_sendfunction ath11k_qmi_wlanfw_wlan_ini_sendfunction ath11k_qmi_firmware_stopfunction ath11k_qmi_firmware_startfunction ath11k_qmi_fwreset_from_cold_bootfunction ath11k_qmi_process_coldboot_calibrationfunction ath11k_qmi_driver_event_postfunction ath11k_qmi_event_mem_requestfunction ath11k_qmi_event_load_bdffunction ath11k_qmi_event_server_arrivefunction ath11k_qmi_msg_mem_request_cbfunction ath11k_qmi_msg_mem_ready_cbfunction ath11k_qmi_msg_fw_ready_cbfunction ath11k_qmi_msg_cold_boot_cal_done_cbfunction ath11k_qmi_msg_fw_init_done_cbfunction ath11k_qmi_ops_new_serverfunction ath11k_qmi_ops_del_serverfunction ath11k_qmi_driver_event_workfunction ath11k_qmi_init_servicefunction ath11k_qmi_deinit_servicefunction ath11k_qmi_free_resourceexport ath11k_cold_boot_calexport ath11k_qmi_fwreset_from_cold_bootexport ath11k_qmi_deinit_service
Annotated Snippet
test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) {
iounmap(ab->qmi.target_mem[i].iaddr);
ab->qmi.target_mem[i].iaddr = NULL;
continue;
}
dma_free_coherent(ab->dev,
ab->qmi.target_mem[i].prev_size,
ab->qmi.target_mem[i].vaddr,
ab->qmi.target_mem[i].paddr);
ab->qmi.target_mem[i].vaddr = NULL;
}
}
static int ath11k_qmi_alloc_target_mem_chunk(struct ath11k_base *ab)
{
int i;
struct target_mem_chunk *chunk;
ab->qmi.target_mem_delayed = false;
for (i = 0; i < ab->qmi.mem_seg_count; i++) {
chunk = &ab->qmi.target_mem[i];
/* Firmware reloads in coldboot/firmware recovery.
* in such case, no need to allocate memory for FW again.
*/
if (chunk->vaddr) {
if (chunk->prev_type == chunk->type &&
chunk->prev_size == chunk->size)
continue;
if (ab->qmi.mem_seg_count <= ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT) {
ath11k_dbg(ab, ATH11K_DBG_QMI,
"size/type mismatch (current %d %u) (prev %d %u), try later with small size\n",
chunk->size, chunk->type,
chunk->prev_size, chunk->prev_type);
ab->qmi.target_mem_delayed = true;
return 0;
}
/* cannot reuse the existing chunk */
dma_free_coherent(ab->dev, chunk->prev_size,
chunk->vaddr, chunk->paddr);
chunk->vaddr = NULL;
}
chunk->vaddr = dma_alloc_coherent(ab->dev,
chunk->size,
&chunk->paddr,
GFP_KERNEL | __GFP_NOWARN);
if (!chunk->vaddr) {
if (ab->qmi.mem_seg_count <= ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT) {
ath11k_dbg(ab, ATH11K_DBG_QMI,
"dma allocation failed (%d B type %u), will try later with small size\n",
chunk->size,
chunk->type);
ath11k_qmi_free_target_mem_chunk(ab);
ab->qmi.target_mem_delayed = true;
return 0;
}
ath11k_err(ab, "failed to allocate dma memory for qmi (%d B type %u)\n",
chunk->size,
chunk->type);
return -EINVAL;
}
chunk->prev_type = chunk->type;
chunk->prev_size = chunk->size;
}
return 0;
}
static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
{
struct device *dev = ab->dev;
struct resource res = {};
u32 host_ddr_sz;
int i, idx, ret;
for (i = 0, idx = 0; i < ab->qmi.mem_seg_count; i++) {
switch (ab->qmi.target_mem[i].type) {
case HOST_DDR_REGION_TYPE:
ret = of_reserved_mem_region_to_resource(dev->of_node, 0, &res);
if (ret) {
ath11k_dbg(ab, ATH11K_DBG_QMI,
"fail to get reg from hremote\n");
return ret;
}
Annotation
- Immediate include surface: `linux/elf.h`, `linux/export.h`, `qmi.h`, `core.h`, `debug.h`, `hif.h`, `linux/of.h`, `linux/of_reserved_mem.h`.
- Detected declarations: `function ath11k_qmi_host_cap_send`, `function ath11k_qmi_fw_ind_register_send`, `function ath11k_qmi_respond_fw_mem_request`, `function test_bit`, `function ath11k_qmi_free_target_mem_chunk`, `function ath11k_qmi_alloc_target_mem_chunk`, `function ath11k_qmi_assign_target_mem_chunk`, `function ath11k_qmi_request_device_info`, `function ath11k_qmi_request_target_cap`, `function ath11k_qmi_load_file_target_mem`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.