drivers/platform/x86/intel/ishtp_eclite.c

Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/ishtp_eclite.c

File Facts

System
Linux kernel
Corpus path
drivers/platform/x86/intel/ishtp_eclite.c
Extension
.c
Size
17983 bytes
Lines
704
Domain
Driver Families
Bucket
drivers/platform
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct opregion_cmd {
	unsigned int command;
	unsigned int offset;
	unsigned int length;
	unsigned int event_id;
};

struct opregion_data {
	char data[ECL_DATA_OPR_BUFLEN];
};

struct opregion_context {
	struct opregion_cmd cmd_area;
	struct opregion_data data_area;
};

struct ecl_message_header {
	unsigned int version:2;
	unsigned int data_type:2;
	unsigned int request_type:2;
	unsigned int offset:9;
	unsigned int data_len:9;
	unsigned int event:8;
};

struct ecl_message {
	struct ecl_message_header header;
	char payload[ECL_DATA_OPR_BUFLEN];
};

struct ishtp_opregion_dev {
	struct opregion_context opr_context;
	struct ishtp_cl *ecl_ishtp_cl;
	struct ishtp_cl_device *cl_device;
	struct ishtp_fw_client *fw_client;
	struct ishtp_cl_rb *rb;
	struct acpi_device *adev;
	unsigned int dsm_event_id;
	unsigned int ish_link_ready;
	unsigned int ish_read_done;
	unsigned int acpi_init_done;
	wait_queue_head_t read_wait;
	struct work_struct event_work;
	struct work_struct reset_work;
	/* lock for opregion context */
	struct mutex lock;

};

/* eclite ishtp client UUID: 6a19cc4b-d760-4de3-b14d-f25ebd0fbcd9 */
static const struct ishtp_device_id ecl_ishtp_id_table[] = {
	{ .guid = GUID_INIT(0x6a19cc4b, 0xd760, 0x4de3,
		  0xb1, 0x4d, 0xf2, 0x5e, 0xbd, 0xf, 0xbc, 0xd9), },
	{ }
};
MODULE_DEVICE_TABLE(ishtp, ecl_ishtp_id_table);

/* ACPI DSM UUID: 91d936a7-1f01-49c6-a6b4-72f00ad8d8a5 */
static const guid_t ecl_acpi_guid =
	GUID_INIT(0x91d936a7, 0x1f01, 0x49c6, 0xa6,
		  0xb4, 0x72, 0xf0, 0x0a, 0xd8, 0xd8, 0xa5);

/**
 * ecl_ish_cl_read() - Read data from eclite FW
 *
 * @opr_dev:  pointer to opregion device
 *
 * This function issues a read request to eclite FW and waits until it
 * receives a response. When response is received the read data is copied to
 * opregion buffer.
 */
static int ecl_ish_cl_read(struct ishtp_opregion_dev *opr_dev)
{
	struct ecl_message_header header;
	int len, rv;

	if (!opr_dev->ish_link_ready)
		return -EIO;

	if ((opr_dev->opr_context.cmd_area.offset +
	     opr_dev->opr_context.cmd_area.length) > ECL_DATA_OPR_BUFLEN) {
		return -EINVAL;
	}

	header.version = ECL_ISH_HEADER_VERSION;
	header.data_type = ECL_MSG_DATA;
	header.request_type = ECL_ISH_READ;
	header.offset = opr_dev->opr_context.cmd_area.offset;
	header.data_len = opr_dev->opr_context.cmd_area.length;
	header.event = opr_dev->opr_context.cmd_area.event_id;

Annotation

Implementation Notes