drivers/misc/mei/platform-vsc.c
Source file repositories/reference/linux-study-clean/drivers/misc/mei/platform-vsc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/mei/platform-vsc.c- Extension
.c- Size
- 10234 bytes
- Lines
- 460
- 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/align.hlinux/cache.hlinux/cleanup.hlinux/iopoll.hlinux/list.hlinux/mei.hlinux/module.hlinux/mutex.hlinux/overflow.hlinux/platform_device.hlinux/pm_runtime.hlinux/timekeeping.hlinux/types.hasm-generic/bug.hlinux/unaligned.hmei_dev.hvsc-tp.h
Detected Declarations
struct mei_vsc_host_timestampstruct mei_vsc_hwfunction mei_vsc_read_helperfunction mei_vsc_write_helperfunction mei_vsc_fw_statusfunction mei_vsc_pg_statefunction mei_vsc_intr_enablefunction mei_vsc_intr_disablefunction mei_vsc_intr_clearfunction mei_vsc_hw_configfunction mei_vsc_host_is_readyfunction mei_vsc_hw_is_readyfunction mei_vsc_hw_startfunction mei_vsc_hbuf_is_readyfunction mei_vsc_hbuf_empty_slotsfunction mei_vsc_hbuf_depthfunction mei_vsc_writefunction mei_vsc_readfunction mei_vsc_count_full_read_slotsfunction mei_vsc_read_slotsfunction mei_vsc_pg_in_transitionfunction mei_vsc_pg_is_enabledfunction mei_vsc_hw_resetfunction mei_vsc_event_cbfunction mei_vsc_probefunction mei_vsc_removefunction mei_vsc_suspendfunction mei_vsc_resume
Annotated Snippet
struct mei_vsc_host_timestamp {
u64 realtime;
u64 boottime;
};
struct mei_vsc_hw {
struct vsc_tp *tp;
bool fw_ready;
bool host_ready;
atomic_t write_lock_cnt;
u32 rx_len;
u32 rx_hdr;
/* buffer for tx */
char tx_buf[MEI_VSC_MAX_MSG_SIZE + sizeof(struct mei_msg_hdr)] ____cacheline_aligned;
/* buffer for rx */
char rx_buf[MEI_VSC_MAX_MSG_SIZE + sizeof(struct mei_msg_hdr)] ____cacheline_aligned;
};
static int mei_vsc_read_helper(struct mei_vsc_hw *hw, u8 *buf,
u32 max_len)
{
struct mei_vsc_host_timestamp ts = {
.realtime = ktime_to_ns(ktime_get_real()),
.boottime = ktime_to_ns(ktime_get_boottime()),
};
return vsc_tp_xfer(hw->tp, VSC_TP_CMD_READ, &ts, sizeof(ts),
buf, max_len);
}
static int mei_vsc_write_helper(struct mei_vsc_hw *hw, u8 *buf, u32 len)
{
u8 status;
return vsc_tp_xfer(hw->tp, VSC_TP_CMD_WRITE, buf, len, &status,
sizeof(status));
}
static int mei_vsc_fw_status(struct mei_device *mei_dev,
struct mei_fw_status *fw_status)
{
if (!fw_status)
return -EINVAL;
fw_status->count = 0;
return 0;
}
static inline enum mei_pg_state mei_vsc_pg_state(struct mei_device *mei_dev)
{
return MEI_PG_OFF;
}
static void mei_vsc_intr_enable(struct mei_device *mei_dev)
{
struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
vsc_tp_intr_enable(hw->tp);
}
static void mei_vsc_intr_disable(struct mei_device *mei_dev)
{
struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
vsc_tp_intr_disable(hw->tp);
}
/* mei framework requires this ops */
static void mei_vsc_intr_clear(struct mei_device *mei_dev)
{
}
/* wait for pending irq handler */
static void mei_vsc_synchronize_irq(struct mei_device *mei_dev)
{
struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
vsc_tp_intr_synchronize(hw->tp);
}
static int mei_vsc_hw_config(struct mei_device *mei_dev)
{
return 0;
}
Annotation
- Immediate include surface: `linux/align.h`, `linux/cache.h`, `linux/cleanup.h`, `linux/iopoll.h`, `linux/list.h`, `linux/mei.h`, `linux/module.h`, `linux/mutex.h`.
- Detected declarations: `struct mei_vsc_host_timestamp`, `struct mei_vsc_hw`, `function mei_vsc_read_helper`, `function mei_vsc_write_helper`, `function mei_vsc_fw_status`, `function mei_vsc_pg_state`, `function mei_vsc_intr_enable`, `function mei_vsc_intr_disable`, `function mei_vsc_intr_clear`, `function mei_vsc_hw_config`.
- 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.