drivers/misc/mei/bus-fixup.c
Source file repositories/reference/linux-study-clean/drivers/misc/mei/bus-fixup.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/mei/bus-fixup.c- Extension
.c- Size
- 14339 bytes
- Lines
- 591
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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/kernel.hlinux/sched.hlinux/module.hlinux/device.hlinux/slab.hlinux/mei.hlinux/mei_cl_bus.hmei_dev.hclient.hmkhi.hlinux/pci.hhw-me-regs.h
Detected Declarations
struct mei_os_verstruct mkhi_fw_ver_blockstruct mkhi_fw_verstruct mei_nfc_cmdstruct mei_nfc_replystruct mei_nfc_if_versionfunction number_of_connectionsfunction blacklistfunction whitelistfunction mei_gfx_memory_readyfunction mei_mkhi_fixfunction mei_gsc_mkhi_verfunction mei_gsc_mkhi_fix_verfunction mei_wdfunction mei_wdfunction mei_nfc_if_versionfunction mei_nfcfunction vt_supportfunction pxp_is_readyfunction mei_cl_bus_dev_fixup
Annotated Snippet
struct mei_os_ver {
__le16 build;
__le16 reserved1;
u8 os_type;
u8 major;
u8 minor;
u8 reserved2;
} __packed;
struct mkhi_fw_ver_block {
u16 minor;
u8 major;
u8 platform;
u16 buildno;
u16 hotfix;
} __packed;
struct mkhi_fw_ver {
struct mkhi_fw_ver_block ver[MEI_MAX_FW_VER_BLOCKS];
} __packed;
#define MKHI_OSVER_BUF_LEN (sizeof(struct mkhi_msg_hdr) + \
sizeof(struct mkhi_fwcaps) + \
sizeof(struct mei_os_ver))
static int mei_osver(struct mei_cl_device *cldev)
{
const size_t size = MKHI_OSVER_BUF_LEN;
u8 buf[MKHI_OSVER_BUF_LEN];
struct mkhi_msg *req;
struct mkhi_fwcaps *fwcaps;
struct mei_os_ver *os_ver;
unsigned int mode = MEI_CL_IO_TX_BLOCKING | MEI_CL_IO_TX_INTERNAL;
memset(buf, 0, size);
req = (struct mkhi_msg *)buf;
req->hdr.group_id = MKHI_FWCAPS_GROUP_ID;
req->hdr.command = MKHI_FWCAPS_SET_OS_VER_APP_RULE_CMD;
fwcaps = (struct mkhi_fwcaps *)req->data;
fwcaps->id.rule_type = 0x0;
fwcaps->id.feature_id = MKHI_FEATURE_PTT;
fwcaps->len = sizeof(*os_ver);
os_ver = (struct mei_os_ver *)fwcaps->data;
os_ver->os_type = OSTYPE_LINUX;
return __mei_cl_send_timeout(cldev->cl, buf, size, 0, mode, MKHI_SEND_MAX_TIMEOUT_MSEC);
}
#define MKHI_FWVER_BUF_LEN (sizeof(struct mkhi_msg_hdr) + \
sizeof(struct mkhi_fw_ver))
#define MKHI_FWVER_LEN(__num) (sizeof(struct mkhi_msg_hdr) + \
sizeof(struct mkhi_fw_ver_block) * (__num))
static int mei_fwver(struct mei_cl_device *cldev)
{
u8 buf[MKHI_FWVER_BUF_LEN];
struct mkhi_msg req;
struct mkhi_msg *rsp;
struct mkhi_fw_ver *fwver;
int bytes_recv, ret, i;
memset(buf, 0, sizeof(buf));
req.hdr.group_id = MKHI_GEN_GROUP_ID;
req.hdr.command = MKHI_GEN_GET_FW_VERSION_CMD;
ret = __mei_cl_send_timeout(cldev->cl, (u8 *)&req, sizeof(req), 0,
MEI_CL_IO_TX_BLOCKING, MKHI_SEND_MAX_TIMEOUT_MSEC);
if (ret < 0) {
dev_info(&cldev->dev, "Could not send ReqFWVersion cmd ret = %d\n", ret);
return ret;
}
ret = 0;
bytes_recv = __mei_cl_recv(cldev->cl, buf, sizeof(buf), NULL, 0,
cldev->bus->timeouts.mkhi_recv);
if (bytes_recv < 0 || (size_t)bytes_recv < MKHI_FWVER_LEN(1)) {
/*
* Should be at least one version block,
* error out if nothing found
*/
dev_info(&cldev->dev, "Could not read FW version ret = %d\n", bytes_recv);
return -EIO;
}
rsp = (struct mkhi_msg *)buf;
fwver = (struct mkhi_fw_ver *)rsp->data;
memset(cldev->bus->fw_ver, 0, sizeof(cldev->bus->fw_ver));
for (i = 0; i < MEI_MAX_FW_VER_BLOCKS; i++) {
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/sched.h`, `linux/module.h`, `linux/device.h`, `linux/slab.h`, `linux/mei.h`, `linux/mei_cl_bus.h`, `mei_dev.h`.
- Detected declarations: `struct mei_os_ver`, `struct mkhi_fw_ver_block`, `struct mkhi_fw_ver`, `struct mei_nfc_cmd`, `struct mei_nfc_reply`, `struct mei_nfc_if_version`, `function number_of_connections`, `function blacklist`, `function whitelist`, `function mei_gfx_memory_ready`.
- Atlas domain: Driver Families / drivers/misc.
- 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.