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.

Dependency Surface

Detected Declarations

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

Implementation Notes