Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2003-2018, Intel Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Intel Management Engine Interface (Intel MEI) Linux driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #ifndef _MEI_CLIENT_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #define _MEI_CLIENT_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/poll.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/mei.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "mei_dev.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * reference counting base function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) void mei_me_cl_init(struct mei_me_client *me_cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) void mei_me_cl_put(struct mei_me_client *me_cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) struct mei_me_client *mei_me_cl_get(struct mei_me_client *me_cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) void mei_me_cl_add(struct mei_device *dev, struct mei_me_client *me_cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) void mei_me_cl_del(struct mei_device *dev, struct mei_me_client *me_cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) struct mei_me_client *mei_me_cl_by_uuid(struct mei_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 					const uuid_le *uuid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) struct mei_me_client *mei_me_cl_by_id(struct mei_device *dev, u8 client_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) struct mei_me_client *mei_me_cl_by_uuid_id(struct mei_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 					   const uuid_le *uuid, u8 client_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) void mei_me_cl_rm_by_uuid(struct mei_device *dev, const uuid_le *uuid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) void mei_me_cl_rm_by_uuid_id(struct mei_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 			     const uuid_le *uuid, u8 id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) void mei_me_cl_rm_all(struct mei_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  * mei_me_cl_is_active - check whether me client is active in the fw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * @me_cl: me client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * Return: true if the me client is active in the firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static inline bool mei_me_cl_is_active(const struct mei_me_client *me_cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	return !list_empty_careful(&me_cl->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * mei_me_cl_uuid - return me client protocol name (uuid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  * @me_cl: me client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  * Return: me client protocol name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) static inline const uuid_le *mei_me_cl_uuid(const struct mei_me_client *me_cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	return &me_cl->props.protocol_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * mei_me_cl_ver - return me client protocol version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * @me_cl: me client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * Return: me client protocol version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	return me_cl->props.protocol_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * mei_me_cl_max_conn - return me client max number of connections
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  * @me_cl: me client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  * Return: me client max number of connections
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) static inline u8 mei_me_cl_max_conn(const struct mei_me_client *me_cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	return me_cl->props.max_number_of_connections;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * mei_me_cl_fixed - return me client fixed address, if any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * @me_cl: me client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * Return: me client fixed address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static inline u8 mei_me_cl_fixed(const struct mei_me_client *me_cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	return me_cl->props.fixed_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  * mei_me_cl_vt - return me client vtag supported status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  * @me_cl: me client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * Return: true if me client supports vt tagging
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) static inline bool mei_me_cl_vt(const struct mei_me_client *me_cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	return me_cl->props.vt_supported == 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * mei_me_cl_max_len - return me client max msg length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  * @me_cl: me client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  * Return: me client max msg length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) static inline u32 mei_me_cl_max_len(const struct mei_me_client *me_cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	return me_cl->props.max_msg_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * MEI IO Functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) void mei_io_cb_free(struct mei_cl_cb *priv_cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  * MEI Host Client Functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct mei_cl *mei_cl_allocate(struct mei_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) int mei_cl_link(struct mei_cl *cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) int mei_cl_unlink(struct mei_cl *cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) struct mei_cl *mei_cl_alloc_linked(struct mei_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) struct mei_cl_cb *mei_cl_read_cb(struct mei_cl *cl, const struct file *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) void mei_cl_add_rd_completed(struct mei_cl *cl, struct mei_cl_cb *cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) void mei_cl_del_rd_completed(struct mei_cl *cl, struct mei_cl_cb *cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 				  enum mei_cb_file_ops type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 				  const struct file *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) struct mei_cl_cb *mei_cl_enqueue_ctrl_wr_cb(struct mei_cl *cl, size_t length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 					    enum mei_cb_file_ops type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 					    const struct file *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) int mei_cl_flush_queues(struct mei_cl *cl, const struct file *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct mei_cl_vtag *mei_cl_vtag_alloc(struct file *fp, u8 vtag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) const struct file *mei_cl_fp_by_vtag(const struct mei_cl *cl, u8 vtag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) int mei_cl_vt_support_check(const struct mei_cl *cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  *  MEI input output function prototype
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * mei_cl_is_connected - host client is connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * @cl: host client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * Return: true if the host client is connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) static inline bool mei_cl_is_connected(struct mei_cl *cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	return  cl->state == MEI_FILE_CONNECTED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  * mei_cl_me_id - me client id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  * @cl: host client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  * Return: me client id or 0 if client is not connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) static inline u8 mei_cl_me_id(const struct mei_cl *cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	return cl->me_cl ? cl->me_cl->client_id : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  * mei_cl_mtu - maximal message that client can send and receive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * @cl: host client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  * Return: mtu or 0 if client is not connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) static inline size_t mei_cl_mtu(const struct mei_cl *cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	return cl->me_cl ? cl->me_cl->props.max_msg_length : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  * mei_cl_is_fixed_address - check whether the me client uses fixed address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  * @cl: host client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  * Return: true if the client is connected and it has fixed me address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) static inline bool mei_cl_is_fixed_address(const struct mei_cl *cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	return cl->me_cl && cl->me_cl->props.fixed_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  * mei_cl_is_single_recv_buf- check whether the me client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  *       uses single receiving buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * @cl: host client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * Return: true if single_recv_buf == 1; 0 otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static inline bool mei_cl_is_single_recv_buf(const struct mei_cl *cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	return cl->me_cl->props.single_recv_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)  * mei_cl_uuid -  client's uuid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)  * @cl: host client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)  * Return: return uuid of connected me client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) static inline const uuid_le *mei_cl_uuid(const struct mei_cl *cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	return mei_me_cl_uuid(cl->me_cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  * mei_cl_host_addr - client's host address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * @cl: host client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  * Return: 0 for fixed address client, host address for dynamic client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static inline u8 mei_cl_host_addr(const struct mei_cl *cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	return  mei_cl_is_fixed_address(cl) ? 0 : cl->host_client_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) int mei_cl_disconnect(struct mei_cl *cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 			  struct list_head *cmpl_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		   const struct file *file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 		       struct list_head *cmpl_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) int mei_cl_read_start(struct mei_cl *cl, size_t length, const struct file *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		     struct list_head *cmpl_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) void mei_cl_complete(struct mei_cl *cl, struct mei_cl_cb *cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) void mei_host_client_init(struct mei_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) u8 mei_cl_notify_fop2req(enum mei_cb_file_ops fop);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) enum mei_cb_file_ops mei_cl_notify_req2fop(u8 request);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) int mei_cl_notify_request(struct mei_cl *cl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 			  const struct file *file, u8 request);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		      struct list_head *cmpl_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) int mei_cl_notify_get(struct mei_cl *cl, bool block, bool *notify_ev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) void mei_cl_notify(struct mei_cl *cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) void mei_cl_all_disconnect(struct mei_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) #define MEI_CL_FMT "cl:host=%02d me=%02d "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) #define MEI_CL_PRM(cl) (cl)->host_client_id, mei_cl_me_id(cl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #define cl_dbg(dev, cl, format, arg...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	dev_dbg((dev)->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) #define cl_warn(dev, cl, format, arg...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	dev_warn((dev)->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) #define cl_err(dev, cl, format, arg...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	dev_err((dev)->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) #endif /* _MEI_CLIENT_H_ */