drivers/net/wireless/intel/iwlwifi/mei/main.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mei/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/mei/main.c- Extension
.c- Size
- 57758 bytes
- Lines
- 2217
- 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.
- 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/etherdevice.hlinux/netdevice.hlinux/ieee80211.hlinux/rtnetlink.hlinux/module.hlinux/moduleparam.hlinux/mei_cl_bus.hlinux/rcupdate.hlinux/debugfs.hlinux/skbuff.hlinux/wait.hlinux/slab.hlinux/mm.hnet/cfg80211.hinternal.hiwl-mei.htrace.htrace-data.hsap.h
Detected Declarations
struct iwl_sap_q_ctrl_blkstruct iwl_sap_dirstruct iwl_sap_shared_mem_ctrl_blkstruct iwl_mei_shared_mem_ptrsstruct iwl_mei_filtersstruct iwl_meistruct iwl_mei_cacheenum iwl_mei_status_bitsenum iwl_sap_q_idxenum iwl_sap_dir_idxfunction iwl_mei_is_connectedfunction iwl_mei_free_shared_memfunction iwl_mei_alloc_mem_for_versionfunction iwl_mei_alloc_shared_memfunction iwl_mei_init_shared_memfunction iwl_mei_write_cyclic_buffunction iwl_mei_host_to_me_data_pendingfunction iwl_mei_send_check_shared_areafunction iwl_mei_csa_throttle_end_wkfunction iwl_mei_send_sap_msg_payloadfunction iwl_mei_add_data_to_ringfunction iwl_mei_send_sap_msgfunction iwl_mei_send_csa_msg_wkfunction iwl_mei_rx_handlerfunction removefunction iwl_mei_netdev_workfunction iwl_mei_handle_rx_start_okfunction iwl_mei_handle_csme_filtersfunction iwl_mei_handle_conn_statusfunction iwl_mei_set_init_conffunction iwl_mei_handle_amt_statefunction iwl_mei_handle_nic_ownerfunction iwl_mei_handle_can_release_ownershipfunction iwl_mei_handle_csme_taking_ownershipfunction iwl_mei_handle_nvmfunction iwl_mei_handle_rx_host_own_reqfunction iwl_mei_handle_pldr_ackfunction iwl_mei_handle_pingfunction iwl_mei_handle_sap_msgfunction iwl_mei_read_from_qfunction iwl_mei_handle_sap_rx_cmdfunction iwl_mei_handle_sap_rxfunction iwl_mei_handle_check_shared_areafunction iwl_mei_rxfunction iwl_mei_send_startfunction iwl_mei_enablefunction iwl_mei_pldr_reqfunction iwl_mei_get_ownership
Annotated Snippet
static const struct file_operations iwl_mei_dbgfs_send_start_message_ops = {
.write = iwl_mei_dbgfs_send_start_message_write,
.open = simple_open,
.llseek = default_llseek,
};
static ssize_t iwl_mei_dbgfs_req_ownership_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
iwl_mei_get_ownership();
return count;
}
static const struct file_operations iwl_mei_dbgfs_req_ownership_ops = {
.write = iwl_mei_dbgfs_req_ownership_write,
.open = simple_open,
.llseek = default_llseek,
};
static void iwl_mei_dbgfs_register(struct iwl_mei *mei)
{
mei->dbgfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
if (!mei->dbgfs_dir)
return;
debugfs_create_ulong("status", S_IRUSR,
mei->dbgfs_dir, &iwl_mei_status);
debugfs_create_file("send_start_message", S_IWUSR, mei->dbgfs_dir,
mei, &iwl_mei_dbgfs_send_start_message_ops);
debugfs_create_file("req_ownership", S_IWUSR, mei->dbgfs_dir,
mei, &iwl_mei_dbgfs_req_ownership_ops);
}
static void iwl_mei_dbgfs_unregister(struct iwl_mei *mei)
{
debugfs_remove_recursive(mei->dbgfs_dir);
mei->dbgfs_dir = NULL;
}
#else
static void iwl_mei_dbgfs_register(struct iwl_mei *mei) {}
static void iwl_mei_dbgfs_unregister(struct iwl_mei *mei) {}
#endif /* CONFIG_DEBUG_FS */
static void iwl_mei_ownership_dwork(struct work_struct *wk)
{
iwl_mei_get_ownership();
}
#define ALLOC_SHARED_MEM_RETRY_MAX_NUM 3
/*
* iwl_mei_probe - the probe function called by the mei bus enumeration
*
* This allocates the data needed by iwlmei and sets a pointer to this data
* into the mei_cl_device's drvdata.
* It starts the SAP protocol by sending the SAP_ME_MSG_START without
* waiting for the answer. The answer will be caught later by the Rx callback.
*/
static int iwl_mei_probe(struct mei_cl_device *cldev,
const struct mei_cl_device_id *id)
{
int alloc_retry = ALLOC_SHARED_MEM_RETRY_MAX_NUM;
struct iwl_mei *mei;
int ret;
mei = devm_kzalloc(&cldev->dev, sizeof(*mei), GFP_KERNEL);
if (!mei)
return -ENOMEM;
init_waitqueue_head(&mei->get_nvm_wq);
INIT_WORK(&mei->send_csa_msg_wk, iwl_mei_send_csa_msg_wk);
INIT_DELAYED_WORK(&mei->csa_throttle_end_wk,
iwl_mei_csa_throttle_end_wk);
init_waitqueue_head(&mei->get_ownership_wq);
init_waitqueue_head(&mei->pldr_wq);
spin_lock_init(&mei->data_q_lock);
INIT_WORK(&mei->netdev_work, iwl_mei_netdev_work);
INIT_DELAYED_WORK(&mei->ownership_dwork, iwl_mei_ownership_dwork);
mei_cldev_set_drvdata(cldev, mei);
mei->cldev = cldev;
mei->device_down = true;
do {
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/netdevice.h`, `linux/ieee80211.h`, `linux/rtnetlink.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/mei_cl_bus.h`, `linux/rcupdate.h`.
- Detected declarations: `struct iwl_sap_q_ctrl_blk`, `struct iwl_sap_dir`, `struct iwl_sap_shared_mem_ctrl_blk`, `struct iwl_mei_shared_mem_ptrs`, `struct iwl_mei_filters`, `struct iwl_mei`, `struct iwl_mei_cache`, `enum iwl_mei_status_bits`, `enum iwl_sap_q_idx`, `enum iwl_sap_dir_idx`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.