drivers/misc/mei/hbm.c
Source file repositories/reference/linux-study-clean/drivers/misc/mei/hbm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/mei/hbm.c- Extension
.c- Size
- 40824 bytes
- Lines
- 1617
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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/export.hlinux/sched.hlinux/wait.hlinux/pm_runtime.hlinux/slab.hlinux/mei.hmei_dev.hhbm.hclient.h
Detected Declarations
function Copyrightfunction mei_cl_conn_status_to_errnofunction mei_hbm_write_messagefunction mei_hbm_idlefunction mei_hbm_resetfunction mei_hbm_hdrfunction mei_hbm_cl_hdrfunction mei_hbm_cl_writefunction mei_hbm_cl_addr_equalfunction mei_hbm_start_waitfunction mei_hbm_start_reqfunction mei_hbm_dma_setup_reqfunction mei_hbm_capabilities_reqfunction mei_hbm_enum_clients_reqfunction mei_hbm_me_cl_addfunction mei_hbm_add_cl_respfunction mei_hbm_fw_add_cl_reqfunction mei_hbm_cl_notify_reqfunction notify_res_to_fopfunction mei_hbm_cl_notify_start_resfunction mei_hbm_cl_notify_stop_resfunction mei_hbm_cl_notifyfunction mei_hbm_cl_dma_map_reqfunction mei_hbm_cl_dma_unmap_reqfunction mei_hbm_cl_dma_map_resfunction mei_hbm_cl_dma_unmap_resfunction mei_hbm_prop_reqfunction mei_hbm_pgfunction mei_hbm_stop_reqfunction mei_hbm_cl_flow_control_reqfunction mei_hbm_add_single_tx_flow_ctrl_credsfunction mei_hbm_cl_tx_flow_ctrl_creds_resfunction mei_hbm_cl_disconnect_reqfunction mei_hbm_cl_disconnect_rspfunction mei_hbm_cl_disconnect_resfunction mei_hbm_cl_connect_reqfunction mei_hbm_cl_connect_resfunction mei_hbm_cl_resfunction mei_hbm_fw_disconnect_reqfunction mei_hbm_pg_enter_resfunction mei_hbm_pg_resumefunction mei_hbm_pg_exit_resfunction mei_hbm_config_featuresfunction mei_hbm_version_is_supportedfunction mei_hbm_dispatchexport mei_hbm_pgexport mei_hbm_pg_resume
Annotated Snippet
if (rs->status == MEI_CL_CONN_NOT_FOUND) {
mei_me_cl_del(dev, cl->me_cl);
if (dev->dev_state == MEI_DEV_ENABLED)
schedule_work(&dev->bus_rescan_work);
}
}
cl->status = mei_cl_conn_status_to_errno(rs->status);
}
/**
* mei_hbm_cl_res - process hbm response received on behalf
* an client
*
* @dev: the device structure
* @rs: hbm client message
* @fop_type: file operation type
*/
static void mei_hbm_cl_res(struct mei_device *dev,
struct mei_hbm_cl_cmd *rs,
enum mei_cb_file_ops fop_type)
{
struct mei_cl *cl;
struct mei_cl_cb *cb, *next;
cl = NULL;
list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) {
cl = cb->cl;
if (cb->fop_type != fop_type)
continue;
if (mei_hbm_cl_addr_equal(cl, rs)) {
list_del_init(&cb->list);
break;
}
}
if (!cl)
return;
switch (fop_type) {
case MEI_FOP_CONNECT:
mei_hbm_cl_connect_res(dev, cl, rs);
break;
case MEI_FOP_DISCONNECT:
mei_hbm_cl_disconnect_res(dev, cl, rs);
break;
case MEI_FOP_NOTIFY_START:
mei_hbm_cl_notify_start_res(dev, cl, rs);
break;
case MEI_FOP_NOTIFY_STOP:
mei_hbm_cl_notify_stop_res(dev, cl, rs);
break;
default:
return;
}
cl->timer_count = 0;
wake_up(&cl->wait);
}
/**
* mei_hbm_fw_disconnect_req - disconnect request initiated by ME firmware
* host sends disconnect response
*
* @dev: the device structure.
* @disconnect_req: disconnect request bus message from the me
*
* Return: -ENOMEM on allocation failure
*/
static int mei_hbm_fw_disconnect_req(struct mei_device *dev,
struct hbm_client_connect_request *disconnect_req)
{
struct mei_cl *cl;
struct mei_cl_cb *cb;
cl = mei_hbm_cl_find_by_cmd(dev, disconnect_req);
if (cl) {
cl_warn(dev, cl, "fw disconnect request received\n");
cl->state = MEI_FILE_DISCONNECTING;
cl->timer_count = 0;
cb = mei_cl_enqueue_ctrl_wr_cb(cl, 0, MEI_FOP_DISCONNECT_RSP,
NULL);
if (!cb)
return -ENOMEM;
}
return 0;
Annotation
- Immediate include surface: `linux/export.h`, `linux/sched.h`, `linux/wait.h`, `linux/pm_runtime.h`, `linux/slab.h`, `linux/mei.h`, `mei_dev.h`, `hbm.h`.
- Detected declarations: `function Copyright`, `function mei_cl_conn_status_to_errno`, `function mei_hbm_write_message`, `function mei_hbm_idle`, `function mei_hbm_reset`, `function mei_hbm_hdr`, `function mei_hbm_cl_hdr`, `function mei_hbm_cl_write`, `function mei_hbm_cl_addr_equal`, `function mei_hbm_start_wait`.
- Atlas domain: Driver Families / drivers/misc.
- 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.