xref: /linux/include/uapi/linux/mei.h (revision f0b7a0d1d46625db5b0e631c05ae96d78eda6c70)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
29fff0425STomas Winkler /*
31e55b609STomas Winkler  * Copyright(c) 2003-2015 Intel Corporation. All rights reserved.
4607ca46eSDavid Howells  * Intel Management Engine Interface (Intel MEI) Linux driver
5607ca46eSDavid Howells  * Intel MEI Interface Header
69fff0425STomas Winkler  */
7607ca46eSDavid Howells #ifndef _LINUX_MEI_H
8607ca46eSDavid Howells #define _LINUX_MEI_H
9607ca46eSDavid Howells 
101fb1ea0dSAndy Shevchenko #include <linux/mei_uuid.h>
11607ca46eSDavid Howells 
12607ca46eSDavid Howells /*
13607ca46eSDavid Howells  * This IOCTL is used to associate the current file descriptor with a
14607ca46eSDavid Howells  * FW Client (given by UUID). This opens a communication channel
15607ca46eSDavid Howells  * between a host client and a FW client. From this point every read and write
16607ca46eSDavid Howells  * will communicate with the associated FW client.
17bd4da04cSRandy Dunlap  * Only in close() (file_operation release()) is the communication between
18bd4da04cSRandy Dunlap  * the clients disconnected.
19607ca46eSDavid Howells  *
20607ca46eSDavid Howells  * The IOCTL argument is a struct with a union that contains
21607ca46eSDavid Howells  * the input parameter and the output parameter for this IOCTL.
22607ca46eSDavid Howells  *
23607ca46eSDavid Howells  * The input parameter is UUID of the FW Client.
24607ca46eSDavid Howells  * The output parameter is the properties of the FW client
25607ca46eSDavid Howells  * (FW protocol version and max message size).
26607ca46eSDavid Howells  *
27607ca46eSDavid Howells  */
28607ca46eSDavid Howells #define IOCTL_MEI_CONNECT_CLIENT \
29607ca46eSDavid Howells 	_IOWR('H' , 0x01, struct mei_connect_client_data)
30607ca46eSDavid Howells 
31607ca46eSDavid Howells /*
32607ca46eSDavid Howells  * Intel MEI client information struct
33607ca46eSDavid Howells  */
34607ca46eSDavid Howells struct mei_client {
35607ca46eSDavid Howells 	__u32 max_msg_length;
36607ca46eSDavid Howells 	__u8 protocol_version;
37607ca46eSDavid Howells 	__u8 reserved[3];
38607ca46eSDavid Howells };
39607ca46eSDavid Howells 
40607ca46eSDavid Howells /*
41607ca46eSDavid Howells  * IOCTL Connect Client Data structure
42607ca46eSDavid Howells  */
43607ca46eSDavid Howells struct mei_connect_client_data {
44607ca46eSDavid Howells 	union {
45607ca46eSDavid Howells 		uuid_le in_client_uuid;
46607ca46eSDavid Howells 		struct mei_client out_client_properties;
47607ca46eSDavid Howells 	};
48607ca46eSDavid Howells };
49607ca46eSDavid Howells 
503c7c8468STomas Winkler /**
513c7c8468STomas Winkler  * DOC: set and unset event notification for a connected client
523c7c8468STomas Winkler  *
533c7c8468STomas Winkler  * The IOCTL argument is 1 for enabling event notification and 0 for
54bd4da04cSRandy Dunlap  * disabling the service.
553c7c8468STomas Winkler  * Return:  -EOPNOTSUPP if the devices doesn't support the feature
563c7c8468STomas Winkler  */
573c7c8468STomas Winkler #define IOCTL_MEI_NOTIFY_SET _IOW('H', 0x02, __u32)
583c7c8468STomas Winkler 
593c7c8468STomas Winkler /**
603c7c8468STomas Winkler  * DOC: retrieve notification
613c7c8468STomas Winkler  *
62bd4da04cSRandy Dunlap  * The IOCTL output argument is 1 if an event was pending and 0 otherwise.
63bd4da04cSRandy Dunlap  * The ioctl has to be called in order to acknowledge pending event.
643c7c8468STomas Winkler  *
653c7c8468STomas Winkler  * Return:  -EOPNOTSUPP if the devices doesn't support the feature
663c7c8468STomas Winkler  */
673c7c8468STomas Winkler #define IOCTL_MEI_NOTIFY_GET _IOR('H', 0x03, __u32)
683c7c8468STomas Winkler 
69aa207a05SAlexander Usyskin /**
70aa207a05SAlexander Usyskin  * struct mei_connect_client_vtag - mei client information struct with vtag
71aa207a05SAlexander Usyskin  *
72aa207a05SAlexander Usyskin  * @in_client_uuid: UUID of client to connect
73aa207a05SAlexander Usyskin  * @vtag: virtual tag
74aa207a05SAlexander Usyskin  * @reserved: reserved for future use
75aa207a05SAlexander Usyskin  */
76aa207a05SAlexander Usyskin struct mei_connect_client_vtag {
77aa207a05SAlexander Usyskin 	uuid_le in_client_uuid;
78aa207a05SAlexander Usyskin 	__u8 vtag;
79aa207a05SAlexander Usyskin 	__u8 reserved[3];
80aa207a05SAlexander Usyskin };
81aa207a05SAlexander Usyskin 
82aa207a05SAlexander Usyskin /**
83aa207a05SAlexander Usyskin  * struct mei_connect_client_data_vtag - IOCTL connect data union
84aa207a05SAlexander Usyskin  *
85aa207a05SAlexander Usyskin  * @connect: input connect data
86aa207a05SAlexander Usyskin  * @out_client_properties: output client data
87aa207a05SAlexander Usyskin  */
88aa207a05SAlexander Usyskin struct mei_connect_client_data_vtag {
89aa207a05SAlexander Usyskin 	union {
90aa207a05SAlexander Usyskin 		struct mei_connect_client_vtag connect;
91aa207a05SAlexander Usyskin 		struct mei_client out_client_properties;
92aa207a05SAlexander Usyskin 	};
93aa207a05SAlexander Usyskin };
94aa207a05SAlexander Usyskin 
95aa207a05SAlexander Usyskin /**
96aa207a05SAlexander Usyskin  * DOC:
97aa207a05SAlexander Usyskin  * This IOCTL is used to associate the current file descriptor with a
98aa207a05SAlexander Usyskin  * FW Client (given by UUID), and virtual tag (vtag).
99aa207a05SAlexander Usyskin  * The IOCTL opens a communication channel between a host client and
100aa207a05SAlexander Usyskin  * a FW client on a tagged channel. From this point on, every read
101bd4da04cSRandy Dunlap  * and write will communicate with the associated FW client
102aa207a05SAlexander Usyskin  * on the tagged channel.
103*a7565fc8SRandy Dunlap  * Upon close() the communication is terminated.
104aa207a05SAlexander Usyskin  *
105aa207a05SAlexander Usyskin  * The IOCTL argument is a struct with a union that contains
106aa207a05SAlexander Usyskin  * the input parameter and the output parameter for this IOCTL.
107aa207a05SAlexander Usyskin  *
108bd4da04cSRandy Dunlap  * The input parameter is UUID of the FW Client, a vtag [0,255].
109aa207a05SAlexander Usyskin  * The output parameter is the properties of the FW client
110*a7565fc8SRandy Dunlap  * (FW protocol version and max message size).
111aa207a05SAlexander Usyskin  *
112aa207a05SAlexander Usyskin  * Clients that do not support tagged connection
113aa207a05SAlexander Usyskin  * will respond with -EOPNOTSUPP.
114aa207a05SAlexander Usyskin  */
115aa207a05SAlexander Usyskin #define IOCTL_MEI_CONNECT_CLIENT_VTAG \
116aa207a05SAlexander Usyskin 	_IOWR('H', 0x04, struct mei_connect_client_data_vtag)
117aa207a05SAlexander Usyskin 
118607ca46eSDavid Howells #endif /* _LINUX_MEI_H  */
119