xref: /OK3568_Linux_fs/kernel/include/uapi/linux/mei.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright(c) 2003-2015 Intel Corporation. All rights reserved.
4*4882a593Smuzhiyun  * Intel Management Engine Interface (Intel MEI) Linux driver
5*4882a593Smuzhiyun  * Intel MEI Interface Header
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun #ifndef _LINUX_MEI_H
8*4882a593Smuzhiyun #define _LINUX_MEI_H
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #include <linux/uuid.h>
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun /*
13*4882a593Smuzhiyun  * This IOCTL is used to associate the current file descriptor with a
14*4882a593Smuzhiyun  * FW Client (given by UUID). This opens a communication channel
15*4882a593Smuzhiyun  * between a host client and a FW client. From this point every read and write
16*4882a593Smuzhiyun  * will communicate with the associated FW client.
17*4882a593Smuzhiyun  * Only in close() (file_operation release()) the communication between
18*4882a593Smuzhiyun  * the clients is disconnected
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  * The IOCTL argument is a struct with a union that contains
21*4882a593Smuzhiyun  * the input parameter and the output parameter for this IOCTL.
22*4882a593Smuzhiyun  *
23*4882a593Smuzhiyun  * The input parameter is UUID of the FW Client.
24*4882a593Smuzhiyun  * The output parameter is the properties of the FW client
25*4882a593Smuzhiyun  * (FW protocol version and max message size).
26*4882a593Smuzhiyun  *
27*4882a593Smuzhiyun  */
28*4882a593Smuzhiyun #define IOCTL_MEI_CONNECT_CLIENT \
29*4882a593Smuzhiyun 	_IOWR('H' , 0x01, struct mei_connect_client_data)
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun /*
32*4882a593Smuzhiyun  * Intel MEI client information struct
33*4882a593Smuzhiyun  */
34*4882a593Smuzhiyun struct mei_client {
35*4882a593Smuzhiyun 	__u32 max_msg_length;
36*4882a593Smuzhiyun 	__u8 protocol_version;
37*4882a593Smuzhiyun 	__u8 reserved[3];
38*4882a593Smuzhiyun };
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun /*
41*4882a593Smuzhiyun  * IOCTL Connect Client Data structure
42*4882a593Smuzhiyun  */
43*4882a593Smuzhiyun struct mei_connect_client_data {
44*4882a593Smuzhiyun 	union {
45*4882a593Smuzhiyun 		uuid_le in_client_uuid;
46*4882a593Smuzhiyun 		struct mei_client out_client_properties;
47*4882a593Smuzhiyun 	};
48*4882a593Smuzhiyun };
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun /**
51*4882a593Smuzhiyun  * DOC: set and unset event notification for a connected client
52*4882a593Smuzhiyun  *
53*4882a593Smuzhiyun  * The IOCTL argument is 1 for enabling event notification and 0 for
54*4882a593Smuzhiyun  * disabling the service
55*4882a593Smuzhiyun  * Return:  -EOPNOTSUPP if the devices doesn't support the feature
56*4882a593Smuzhiyun  */
57*4882a593Smuzhiyun #define IOCTL_MEI_NOTIFY_SET _IOW('H', 0x02, __u32)
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun /**
60*4882a593Smuzhiyun  * DOC: retrieve notification
61*4882a593Smuzhiyun  *
62*4882a593Smuzhiyun  * The IOCTL output argument is 1 if an event was is pending and 0 otherwise
63*4882a593Smuzhiyun  * the ioctl has to be called in order to acknowledge pending event
64*4882a593Smuzhiyun  *
65*4882a593Smuzhiyun  * Return:  -EOPNOTSUPP if the devices doesn't support the feature
66*4882a593Smuzhiyun  */
67*4882a593Smuzhiyun #define IOCTL_MEI_NOTIFY_GET _IOR('H', 0x03, __u32)
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun /**
70*4882a593Smuzhiyun  * struct mei_connect_client_vtag - mei client information struct with vtag
71*4882a593Smuzhiyun  *
72*4882a593Smuzhiyun  * @in_client_uuid: UUID of client to connect
73*4882a593Smuzhiyun  * @vtag: virtual tag
74*4882a593Smuzhiyun  * @reserved: reserved for future use
75*4882a593Smuzhiyun  */
76*4882a593Smuzhiyun struct mei_connect_client_vtag {
77*4882a593Smuzhiyun 	uuid_le in_client_uuid;
78*4882a593Smuzhiyun 	__u8 vtag;
79*4882a593Smuzhiyun 	__u8 reserved[3];
80*4882a593Smuzhiyun };
81*4882a593Smuzhiyun 
82*4882a593Smuzhiyun /**
83*4882a593Smuzhiyun  * struct mei_connect_client_data_vtag - IOCTL connect data union
84*4882a593Smuzhiyun  *
85*4882a593Smuzhiyun  * @connect: input connect data
86*4882a593Smuzhiyun  * @out_client_properties: output client data
87*4882a593Smuzhiyun  */
88*4882a593Smuzhiyun struct mei_connect_client_data_vtag {
89*4882a593Smuzhiyun 	union {
90*4882a593Smuzhiyun 		struct mei_connect_client_vtag connect;
91*4882a593Smuzhiyun 		struct mei_client out_client_properties;
92*4882a593Smuzhiyun 	};
93*4882a593Smuzhiyun };
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun /**
96*4882a593Smuzhiyun  * DOC:
97*4882a593Smuzhiyun  * This IOCTL is used to associate the current file descriptor with a
98*4882a593Smuzhiyun  * FW Client (given by UUID), and virtual tag (vtag).
99*4882a593Smuzhiyun  * The IOCTL opens a communication channel between a host client and
100*4882a593Smuzhiyun  * a FW client on a tagged channel. From this point on, every read
101*4882a593Smuzhiyun  * and write will communicate with the associated FW client with
102*4882a593Smuzhiyun  * on the tagged channel.
103*4882a593Smuzhiyun  * Upone close() the communication is terminated.
104*4882a593Smuzhiyun  *
105*4882a593Smuzhiyun  * The IOCTL argument is a struct with a union that contains
106*4882a593Smuzhiyun  * the input parameter and the output parameter for this IOCTL.
107*4882a593Smuzhiyun  *
108*4882a593Smuzhiyun  * The input parameter is UUID of the FW Client, a vtag [0,255]
109*4882a593Smuzhiyun  * The output parameter is the properties of the FW client
110*4882a593Smuzhiyun  * (FW protocool version and max message size).
111*4882a593Smuzhiyun  *
112*4882a593Smuzhiyun  * Clients that do not support tagged connection
113*4882a593Smuzhiyun  * will respond with -EOPNOTSUPP.
114*4882a593Smuzhiyun  */
115*4882a593Smuzhiyun #define IOCTL_MEI_CONNECT_CLIENT_VTAG \
116*4882a593Smuzhiyun 	_IOWR('H', 0x04, struct mei_connect_client_data_vtag)
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun #endif /* _LINUX_MEI_H  */
119