blob: c800d8e5f422a8794fbe299df61c2ffd1d3cd592 [file] [log] [blame]
Tomas Winkler7e527e12019-06-03 12:14:00 +03001.. SPDX-License-Identifier: GPL-2.0
Oren Weil6624fc22011-05-15 13:43:39 +03002
3Introduction
Julian Brostcfba6782015-01-12 00:58:06 +01004============
Oren Weil6624fc22011-05-15 13:43:39 +03005
Justin P. Mattock5f9092f32012-03-12 07:18:09 -07006The Intel Management Engine (Intel ME) is an isolated and protected computing
Oren Weil463ac7f2011-12-06 23:25:18 +02007resource (Co-processor) residing inside certain Intel chipsets. The Intel ME
Tomas Winklerd0a17802019-06-06 16:31:08 +03008provides support for computer/IT management and security features.
9The actual feature set depends on the Intel chipset SKU.
Oren Weil6624fc22011-05-15 13:43:39 +030010
Oren Weil463ac7f2011-12-06 23:25:18 +020011The Intel Management Engine Interface (Intel MEI, previously known as HECI)
12is the interface between the Host and Intel ME. This interface is exposed
Tomas Winklerd0a17802019-06-06 16:31:08 +030013to the host as a PCI device, actually multiple PCI devices might be exposed.
14The Intel MEI Driver is in charge of the communication channel between
15a host application and the Intel ME features.
Oren Weil6624fc22011-05-15 13:43:39 +030016
Tomas Winklerd0a17802019-06-06 16:31:08 +030017Each Intel ME feature, or Intel ME Client is addressed by a unique GUID and
Oren Weil463ac7f2011-12-06 23:25:18 +020018each client has its own protocol. The protocol is message-based with a
Tomas Winklerd0a17802019-06-06 16:31:08 +030019header and payload up to maximal number of bytes advertised by the client,
20upon connection.
Oren Weil6624fc22011-05-15 13:43:39 +030021
Oren Weil463ac7f2011-12-06 23:25:18 +020022Intel MEI Driver
Julian Brostcfba6782015-01-12 00:58:06 +010023================
Oren Weil6624fc22011-05-15 13:43:39 +030024
Tomas Winklerd0a17802019-06-06 16:31:08 +030025The driver exposes a character device with device nodes /dev/meiX.
Oren Weil6624fc22011-05-15 13:43:39 +030026
Oren Weil463ac7f2011-12-06 23:25:18 +020027An application maintains communication with an Intel ME feature while
Tomas Winklerd0a17802019-06-06 16:31:08 +030028/dev/meiX is open. The binding to a specific feature is performed by calling
29:c:macro:`MEI_CONNECT_CLIENT_IOCTL`, which passes the desired GUID.
Oren Weil463ac7f2011-12-06 23:25:18 +020030The number of instances of an Intel ME feature that can be opened
31at the same time depends on the Intel ME feature, but most of the
Oren Weil6624fc22011-05-15 13:43:39 +030032features allow only a single instance.
33
Tomas Winklerf6a4e492012-05-29 16:39:09 +030034The driver is transparent to data that are passed between firmware feature
Oren Weil463ac7f2011-12-06 23:25:18 +020035and host application.
Oren Weil6624fc22011-05-15 13:43:39 +030036
Oren Weil463ac7f2011-12-06 23:25:18 +020037Because some of the Intel ME features can change the system
38configuration, the driver by default allows only a privileged
Oren Weil6624fc22011-05-15 13:43:39 +030039user to access it.
40
Tomas Winklerd0a17802019-06-06 16:31:08 +030041The session is terminated calling :c:func:`close(int fd)`.
42
Tomas Winklerf6a4e492012-05-29 16:39:09 +030043A code snippet for an application communicating with Intel AMTHI client:
44
Tomas Winkler7e527e12019-06-03 12:14:00 +030045.. code-block:: C
46
Oren Weil6624fc22011-05-15 13:43:39 +030047 struct mei_connect_client_data data;
48 fd = open(MEI_DEVICE);
49
Tomas Winklerd0a17802019-06-06 16:31:08 +030050 data.d.in_client_uuid = AMTHI_GUID;
Oren Weil6624fc22011-05-15 13:43:39 +030051
52 ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &data);
53
Oren Weil463ac7f2011-12-06 23:25:18 +020054 printf("Ver=%d, MaxLen=%ld\n",
Tomas Winklerd0a17802019-06-06 16:31:08 +030055 data.d.in_client_uuid.protocol_version,
56 data.d.in_client_uuid.max_msg_length);
Oren Weil6624fc22011-05-15 13:43:39 +030057
58 [...]
59
60 write(fd, amthi_req_data, amthi_req_data_len);
61
62 [...]
63
64 read(fd, &amthi_res_data, amthi_res_data_len);
65
66 [...]
67 close(fd);
68
Julian Brostcfba6782015-01-12 00:58:06 +010069
Tomas Winklerd0a17802019-06-06 16:31:08 +030070User space API
71
72IOCTLs:
73=======
Julian Brostcfba6782015-01-12 00:58:06 +010074
Tomas Winkler3c7c8462015-07-26 09:54:20 +030075The Intel MEI Driver supports the following IOCTL commands:
Oren Weil463ac7f2011-12-06 23:25:18 +020076
Tomas Winklerd0a17802019-06-06 16:31:08 +030077IOCTL_MEI_CONNECT_CLIENT
78-------------------------
79Connect to firmware Feature/Client.
Oren Weil463ac7f2011-12-06 23:25:18 +020080
Tomas Winklerd0a17802019-06-06 16:31:08 +030081.. code-block:: none
Oren Weil463ac7f2011-12-06 23:25:18 +020082
Tomas Winklerd0a17802019-06-06 16:31:08 +030083 Usage:
84
85 struct mei_connect_client_data client_data;
86
87 ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &client_data);
88
89 Inputs:
90
91 struct mei_connect_client_data - contain the following
92 Input field:
93
94 in_client_uuid - GUID of the FW Feature that needs
Oren Weil463ac7f2011-12-06 23:25:18 +020095 to connect to.
Tomas Winklerd0a17802019-06-06 16:31:08 +030096 Outputs:
Oren Weil463ac7f2011-12-06 23:25:18 +020097 out_client_properties - Client Properties: MTU and Protocol Version.
98
Tomas Winklerd0a17802019-06-06 16:31:08 +030099 Error returns:
100
101 ENOTTY No such client (i.e. wrong GUID) or connection is not allowed.
Oren Weil463ac7f2011-12-06 23:25:18 +0200102 EINVAL Wrong IOCTL Number
Tomas Winklerd0a17802019-06-06 16:31:08 +0300103 ENODEV Device or Connection is not initialized or ready.
Oren Weil463ac7f2011-12-06 23:25:18 +0200104 ENOMEM Unable to allocate memory to client internal data.
105 EFAULT Fatal Error (e.g. Unable to access user input data)
106 EBUSY Connection Already Open
107
Tomas Winklerd0a17802019-06-06 16:31:08 +0300108:Note:
Oren Weil463ac7f2011-12-06 23:25:18 +0200109 max_msg_length (MTU) in client properties describes the maximum
110 data that can be sent or received. (e.g. if MTU=2K, can send
Anatol Pomozovf884ab12013-05-08 16:56:16 -0700111 requests up to bytes 2k and received responses up to 2k bytes).
Oren Weil463ac7f2011-12-06 23:25:18 +0200112
Tomas Winklerd0a17802019-06-06 16:31:08 +0300113
114IOCTL_MEI_NOTIFY_SET
115---------------------
116Enable or disable event notifications.
117
118
119.. code-block:: none
Tomas Winkler3c7c8462015-07-26 09:54:20 +0300120
121 Usage:
Tomas Winklerd0a17802019-06-06 16:31:08 +0300122
Tomas Winkler3c7c8462015-07-26 09:54:20 +0300123 uint32_t enable;
Tomas Winklerd0a17802019-06-06 16:31:08 +0300124
Tomas Winkler3c7c8462015-07-26 09:54:20 +0300125 ioctl(fd, IOCTL_MEI_NOTIFY_SET, &enable);
126
Tomas Winklerd0a17802019-06-06 16:31:08 +0300127
Tomas Winkler3c7c8462015-07-26 09:54:20 +0300128 uint32_t enable = 1;
129 or
130 uint32_t enable[disable] = 0;
131
132 Error returns:
Tomas Winklerd0a17802019-06-06 16:31:08 +0300133
134
Tomas Winkler3c7c8462015-07-26 09:54:20 +0300135 EINVAL Wrong IOCTL Number
136 ENODEV Device is not initialized or the client not connected
137 ENOMEM Unable to allocate memory to client internal data.
138 EFAULT Fatal Error (e.g. Unable to access user input data)
139 EOPNOTSUPP if the device doesn't support the feature
140
Tomas Winklerd0a17802019-06-06 16:31:08 +0300141:Note:
Tomas Winkler3c7c8462015-07-26 09:54:20 +0300142 The client must be connected in order to enable notification events
143
144
Tomas Winklerd0a17802019-06-06 16:31:08 +0300145IOCTL_MEI_NOTIFY_GET
146--------------------
147Retrieve event
148
149.. code-block:: none
Tomas Winkler3c7c8462015-07-26 09:54:20 +0300150
151 Usage:
152 uint32_t event;
153 ioctl(fd, IOCTL_MEI_NOTIFY_GET, &event);
154
155 Outputs:
156 1 - if an event is pending
157 0 - if there is no even pending
158
159 Error returns:
160 EINVAL Wrong IOCTL Number
161 ENODEV Device is not initialized or the client not connected
162 ENOMEM Unable to allocate memory to client internal data.
163 EFAULT Fatal Error (e.g. Unable to access user input data)
164 EOPNOTSUPP if the device doesn't support the feature
165
Tomas Winklerd0a17802019-06-06 16:31:08 +0300166:Note:
Tomas Winkler3c7c8462015-07-26 09:54:20 +0300167 The client must be connected and event notification has to be enabled
168 in order to receive an event
169
Julian Brostcfba6782015-01-12 00:58:06 +0100170
Oren Weil6624fc22011-05-15 13:43:39 +0300171
Julian Brostcfba6782015-01-12 00:58:06 +0100172Supported Chipsets
Oren Weil6624fc22011-05-15 13:43:39 +0300173==================
Tomas Winkler7e527e12019-06-03 12:14:00 +030017482X38/X48 Express and newer
Julian Brostcfba6782015-01-12 00:58:06 +0100175
Oren Weil6624fc22011-05-15 13:43:39 +0300176linux-mei@linux.intel.com