drivers/net/wireless/ath/ath11k/mhi.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath11k/mhi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath11k/mhi.c- Extension
.c- Size
- 11725 bytes
- Lines
- 505
- 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.
- 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.
- 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/msi.hlinux/pci.hlinux/firmware.hlinux/of.hlinux/of_address.hlinux/ioport.hcore.hdebug.hmhi.hpci.hpcic.h
Detected Declarations
function ath11k_mhi_set_mhictrl_resetfunction ath11k_mhi_reset_txvecdbfunction ath11k_mhi_reset_txvecstatusfunction ath11k_mhi_reset_rxvecdbfunction ath11k_mhi_reset_rxvecstatusfunction ath11k_mhi_clear_vectorfunction ath11k_mhi_get_msifunction ath11k_mhi_op_runtime_getfunction ath11k_mhi_op_runtime_putfunction ath11k_mhi_op_status_cbfunction ath11k_mhi_op_read_regfunction ath11k_mhi_op_write_regfunction ath11k_mhi_read_addr_from_dtfunction ath11k_mhi_registerfunction ath11k_mhi_unregisterfunction ath11k_mhi_startfunction ath11k_mhi_stopfunction ath11k_mhi_suspendfunction ath11k_mhi_resumefunction ath11k_mhi_coredump
Annotated Snippet
if (ab_pci->mhi_pre_cb == MHI_CB_EE_RDDM) {
ath11k_dbg(ab, ATH11K_DBG_BOOT,
"do not queue again for consecutive RDDM event\n");
break;
}
spin_lock_bh(&ab->base_lock);
if (!(test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags)))
queue_work(ab->workqueue_aux, &ab->reset_work);
spin_unlock_bh(&ab->base_lock);
break;
default:
break;
}
ab_pci->mhi_pre_cb = cb;
}
static int ath11k_mhi_op_read_reg(struct mhi_controller *mhi_cntrl,
void __iomem *addr,
u32 *out)
{
*out = readl(addr);
return 0;
}
static void ath11k_mhi_op_write_reg(struct mhi_controller *mhi_cntrl,
void __iomem *addr,
u32 val)
{
writel(val, addr);
}
static int ath11k_mhi_read_addr_from_dt(struct mhi_controller *mhi_ctrl)
{
struct device_node *np;
struct resource res;
int ret;
np = of_find_node_by_type(NULL, "memory");
if (!np)
return -ENOENT;
ret = of_address_to_resource(np, 0, &res);
of_node_put(np);
if (ret)
return ret;
mhi_ctrl->iova_start = res.start + 0x1000000;
mhi_ctrl->iova_stop = res.end;
return 0;
}
int ath11k_mhi_register(struct ath11k_pci *ab_pci)
{
struct ath11k_base *ab = ab_pci->ab;
struct mhi_controller *mhi_ctrl;
const struct mhi_controller_config *ath11k_mhi_config;
int ret;
mhi_ctrl = mhi_alloc_controller();
if (!mhi_ctrl)
return -ENOMEM;
ab_pci->mhi_ctrl = mhi_ctrl;
mhi_ctrl->cntrl_dev = ab->dev;
mhi_ctrl->regs = ab->mem;
mhi_ctrl->reg_len = ab->mem_len;
if (ab->fw.amss_data && ab->fw.amss_len > 0) {
/* use MHI firmware file from firmware-N.bin */
mhi_ctrl->fw_data = ab->fw.amss_data;
mhi_ctrl->fw_sz = ab->fw.amss_len;
} else {
/* use the old separate mhi.bin MHI firmware file */
ath11k_core_create_firmware_path(ab, ATH11K_AMSS_FILE,
ab_pci->amss_path,
sizeof(ab_pci->amss_path));
mhi_ctrl->fw_image = ab_pci->amss_path;
}
ret = ath11k_mhi_get_msi(ab_pci);
if (ret) {
ath11k_err(ab, "failed to get msi for mhi\n");
goto free_controller;
}
Annotation
- Immediate include surface: `linux/msi.h`, `linux/pci.h`, `linux/firmware.h`, `linux/of.h`, `linux/of_address.h`, `linux/ioport.h`, `core.h`, `debug.h`.
- Detected declarations: `function ath11k_mhi_set_mhictrl_reset`, `function ath11k_mhi_reset_txvecdb`, `function ath11k_mhi_reset_txvecstatus`, `function ath11k_mhi_reset_rxvecdb`, `function ath11k_mhi_reset_rxvecstatus`, `function ath11k_mhi_clear_vector`, `function ath11k_mhi_get_msi`, `function ath11k_mhi_op_runtime_get`, `function ath11k_mhi_op_runtime_put`, `function ath11k_mhi_op_status_cb`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.
- 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.