include/linux/cdx/mcdi.h
Source file repositories/reference/linux-study-clean/include/linux/cdx/mcdi.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/cdx/mcdi.h- Extension
.h- Size
- 6248 bytes
- Lines
- 200
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mutex.hlinux/kref.hlinux/rpmsg.hlinux/cdx/bitfield.h
Detected Declarations
struct cdx_mcdistruct cdx_mcdi_opsstruct cdx_mcdi_cmdstruct cdx_mcdi_ifacestruct cdx_mcdi_dataenum cdx_mcdi_modeenum cdx_mcdi_cmd_state
Annotated Snippet
struct cdx_mcdi {
/* MCDI interface */
struct cdx_mcdi_data *mcdi;
const struct cdx_mcdi_ops *mcdi_ops;
struct rproc *r5_rproc;
struct rpmsg_device *rpdev;
struct rpmsg_endpoint *ept;
struct work_struct work;
};
struct cdx_mcdi_ops {
void (*mcdi_request)(struct cdx_mcdi *cdx,
const struct cdx_dword *hdr, size_t hdr_len,
const struct cdx_dword *sdu, size_t sdu_len);
unsigned int (*mcdi_rpc_timeout)(struct cdx_mcdi *cdx, unsigned int cmd);
};
typedef void cdx_mcdi_async_completer(struct cdx_mcdi *cdx,
unsigned long cookie, int rc,
struct cdx_dword *outbuf,
size_t outlen_actual);
/**
* struct cdx_mcdi_cmd - An outstanding MCDI command
* @ref: Reference count. There will be one reference if the command is
* in the mcdi_iface cmd_list, another if it's on a cleanup list,
* and a third if it's queued in the work queue.
* @list: The data for this entry in mcdi->cmd_list
* @cleanup_list: The data for this entry in a cleanup list
* @work: The work item for this command, queued in mcdi->workqueue
* @mcdi: The mcdi_iface for this command
* @state: The state of this command
* @inlen: inbuf length
* @inbuf: Input buffer
* @quiet: Whether to silence errors
* @reboot_seen: Whether a reboot has been seen during this command,
* to prevent duplicates
* @seq: Sequence number
* @started: Jiffies this command was started at
* @cookie: Context for completion function
* @completer: Completion function
* @handle: Command handle
* @cmd: Command number
* @rc: Return code
* @outlen: Length of output buffer
* @outbuf: Output buffer
*/
struct cdx_mcdi_cmd {
struct kref ref;
struct list_head list;
struct list_head cleanup_list;
struct work_struct work;
struct cdx_mcdi_iface *mcdi;
enum cdx_mcdi_cmd_state state;
size_t inlen;
const struct cdx_dword *inbuf;
bool quiet;
bool reboot_seen;
u8 seq;
unsigned long started;
unsigned long cookie;
cdx_mcdi_async_completer *completer;
unsigned int handle;
unsigned int cmd;
int rc;
size_t outlen;
struct cdx_dword *outbuf;
/* followed by inbuf data if necessary */
};
/**
* struct cdx_mcdi_iface - MCDI protocol context
* @cdx: The associated NIC
* @iface_lock: Serialise access to this structure
* @outstanding_cleanups: Count of cleanups
* @cmd_list: List of outstanding and running commands
* @workqueue: Workqueue used for delayed processing
* @cmd_complete_wq: Waitqueue for command completion
* @db_held_by: Command the MC doorbell is in use by
* @seq_held_by: Command each sequence number is in use by
* @prev_handle: The last used command handle
* @mode: Poll for mcdi completion, or wait for an mcdi_event
* @prev_seq: The last used sequence number
* @new_epoch: Indicates start of day or start of MC reboot recovery
*/
struct cdx_mcdi_iface {
struct cdx_mcdi *cdx;
/* Serialise access */
struct mutex iface_lock;
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/kref.h`, `linux/rpmsg.h`, `linux/cdx/bitfield.h`.
- Detected declarations: `struct cdx_mcdi`, `struct cdx_mcdi_ops`, `struct cdx_mcdi_cmd`, `struct cdx_mcdi_iface`, `struct cdx_mcdi_data`, `enum cdx_mcdi_mode`, `enum cdx_mcdi_cmd_state`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
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.