// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2003-2018, Intel Corporation. All rights reserved. * Intel Management Engine Interface (Intel MEI) Linux driver */ #include <linux/export.h> #include <linux/kthread.h> #include <linux/interrupt.h> #include <linux/fs.h> #include <linux/jiffies.h> #include <linux/slab.h> #include <linux/pm_runtime.h> #include <linux/mei.h> #include "mei_dev.h" #include "hbm.h" #include "client.h" /** * mei_irq_compl_handler - dispatch complete handlers * for the completed callbacks * * @dev: mei device * @cmpl_list: list of completed cbs */ void mei_irq_compl_handler(struct mei_device *dev, struct list_head *cmpl_list) { … } EXPORT_SYMBOL_GPL(…); /** * mei_cl_hbm_equal - check if hbm is addressed to the client * * @cl: host client * @mei_hdr: header of mei client message * * Return: true if matches, false otherwise */ static inline int mei_cl_hbm_equal(struct mei_cl *cl, struct mei_msg_hdr *mei_hdr) { … } /** * mei_irq_discard_msg - discard received message * * @dev: mei device * @hdr: message header * @discard_len: the length of the message to discard (excluding header) */ static void mei_irq_discard_msg(struct mei_device *dev, struct mei_msg_hdr *hdr, size_t discard_len) { … } /** * mei_cl_irq_read_msg - process client message * * @cl: reading client * @mei_hdr: header of mei client message * @meta: extend meta header * @cmpl_list: completion list * * Return: always 0 */ static int mei_cl_irq_read_msg(struct mei_cl *cl, struct mei_msg_hdr *mei_hdr, struct mei_ext_meta_hdr *meta, struct list_head *cmpl_list) { … } /** * mei_cl_irq_disconnect_rsp - send disconnection response message * * @cl: client * @cb: callback block. * @cmpl_list: complete list. * * Return: 0, OK; otherwise, error. */ static int mei_cl_irq_disconnect_rsp(struct mei_cl *cl, struct mei_cl_cb *cb, struct list_head *cmpl_list) { … } /** * mei_cl_irq_read - processes client read related operation from the * interrupt thread context - request for flow control credits * * @cl: client * @cb: callback block. * @cmpl_list: complete list. * * Return: 0, OK; otherwise, error. */ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb, struct list_head *cmpl_list) { … } static inline bool hdr_is_hbm(struct mei_msg_hdr *mei_hdr) { … } static inline bool hdr_is_fixed(struct mei_msg_hdr *mei_hdr) { … } static inline int hdr_is_valid(u32 msg_hdr) { … } /** * mei_irq_read_handler - bottom half read routine after ISR to * handle the read processing. * * @dev: the device structure * @cmpl_list: An instance of our list structure * @slots: slots to read. * * Return: 0 on success, <0 on failure. */ int mei_irq_read_handler(struct mei_device *dev, struct list_head *cmpl_list, s32 *slots) { … } EXPORT_SYMBOL_GPL(…); /** * mei_irq_write_handler - dispatch write requests * after irq received * * @dev: the device structure * @cmpl_list: An instance of our list structure * * Return: 0 on success, <0 on failure. */ int mei_irq_write_handler(struct mei_device *dev, struct list_head *cmpl_list) { … } EXPORT_SYMBOL_GPL(…); /** * mei_connect_timeout - connect/disconnect timeouts * * @cl: host client */ static void mei_connect_timeout(struct mei_cl *cl) { … } #define MEI_STALL_TIMER_FREQ … /** * mei_schedule_stall_timer - re-arm stall_timer work * * @dev: the device structure * * Schedule stall timer */ void mei_schedule_stall_timer(struct mei_device *dev) { … } /** * mei_timer - timer function. * * @work: pointer to the work_struct structure * */ void mei_timer(struct work_struct *work) { … }