Tomas Winkler | 7e527e1 | 2019-06-03 12:14:00 +0300 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0 |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 2 | |
| 3 | Introduction |
Julian Brost | cfba678 | 2015-01-12 00:58:06 +0100 | [diff] [blame] | 4 | ============ |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 5 | |
Justin P. Mattock | 5f9092f3 | 2012-03-12 07:18:09 -0700 | [diff] [blame] | 6 | The Intel Management Engine (Intel ME) is an isolated and protected computing |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 7 | resource (Co-processor) residing inside certain Intel chipsets. The Intel ME |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 8 | provides support for computer/IT management and security features. |
| 9 | The actual feature set depends on the Intel chipset SKU. |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 10 | |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 11 | The Intel Management Engine Interface (Intel MEI, previously known as HECI) |
| 12 | is the interface between the Host and Intel ME. This interface is exposed |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 13 | to the host as a PCI device, actually multiple PCI devices might be exposed. |
| 14 | The Intel MEI Driver is in charge of the communication channel between |
| 15 | a host application and the Intel ME features. |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 16 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 17 | Each Intel ME feature, or Intel ME Client is addressed by a unique GUID and |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 18 | each client has its own protocol. The protocol is message-based with a |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 19 | header and payload up to maximal number of bytes advertised by the client, |
| 20 | upon connection. |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 21 | |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 22 | Intel MEI Driver |
Julian Brost | cfba678 | 2015-01-12 00:58:06 +0100 | [diff] [blame] | 23 | ================ |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 24 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 25 | The driver exposes a character device with device nodes /dev/meiX. |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 26 | |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 27 | An application maintains communication with an Intel ME feature while |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 28 | /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 Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 30 | The number of instances of an Intel ME feature that can be opened |
| 31 | at the same time depends on the Intel ME feature, but most of the |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 32 | features allow only a single instance. |
| 33 | |
Tomas Winkler | f6a4e49 | 2012-05-29 16:39:09 +0300 | [diff] [blame] | 34 | The driver is transparent to data that are passed between firmware feature |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 35 | and host application. |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 36 | |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 37 | Because some of the Intel ME features can change the system |
| 38 | configuration, the driver by default allows only a privileged |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 39 | user to access it. |
| 40 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 41 | The session is terminated calling :c:func:`close(int fd)`. |
| 42 | |
Tomas Winkler | f6a4e49 | 2012-05-29 16:39:09 +0300 | [diff] [blame] | 43 | A code snippet for an application communicating with Intel AMTHI client: |
| 44 | |
Tomas Winkler | 7e527e1 | 2019-06-03 12:14:00 +0300 | [diff] [blame] | 45 | .. code-block:: C |
| 46 | |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 47 | struct mei_connect_client_data data; |
| 48 | fd = open(MEI_DEVICE); |
| 49 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 50 | data.d.in_client_uuid = AMTHI_GUID; |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 51 | |
| 52 | ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &data); |
| 53 | |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 54 | printf("Ver=%d, MaxLen=%ld\n", |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 55 | data.d.in_client_uuid.protocol_version, |
| 56 | data.d.in_client_uuid.max_msg_length); |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 57 | |
| 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 Brost | cfba678 | 2015-01-12 00:58:06 +0100 | [diff] [blame] | 69 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 70 | User space API |
| 71 | |
| 72 | IOCTLs: |
| 73 | ======= |
Julian Brost | cfba678 | 2015-01-12 00:58:06 +0100 | [diff] [blame] | 74 | |
Tomas Winkler | 3c7c846 | 2015-07-26 09:54:20 +0300 | [diff] [blame] | 75 | The Intel MEI Driver supports the following IOCTL commands: |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 76 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 77 | IOCTL_MEI_CONNECT_CLIENT |
| 78 | ------------------------- |
| 79 | Connect to firmware Feature/Client. |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 80 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 81 | .. code-block:: none |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 82 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 83 | 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 Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 95 | to connect to. |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 96 | Outputs: |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 97 | out_client_properties - Client Properties: MTU and Protocol Version. |
| 98 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 99 | Error returns: |
| 100 | |
| 101 | ENOTTY No such client (i.e. wrong GUID) or connection is not allowed. |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 102 | EINVAL Wrong IOCTL Number |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 103 | ENODEV Device or Connection is not initialized or ready. |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 104 | 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 Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 108 | :Note: |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 109 | 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 Pomozov | f884ab1 | 2013-05-08 16:56:16 -0700 | [diff] [blame] | 111 | requests up to bytes 2k and received responses up to 2k bytes). |
Oren Weil | 463ac7f | 2011-12-06 23:25:18 +0200 | [diff] [blame] | 112 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 113 | |
| 114 | IOCTL_MEI_NOTIFY_SET |
| 115 | --------------------- |
| 116 | Enable or disable event notifications. |
| 117 | |
| 118 | |
| 119 | .. code-block:: none |
Tomas Winkler | 3c7c846 | 2015-07-26 09:54:20 +0300 | [diff] [blame] | 120 | |
| 121 | Usage: |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 122 | |
Tomas Winkler | 3c7c846 | 2015-07-26 09:54:20 +0300 | [diff] [blame] | 123 | uint32_t enable; |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 124 | |
Tomas Winkler | 3c7c846 | 2015-07-26 09:54:20 +0300 | [diff] [blame] | 125 | ioctl(fd, IOCTL_MEI_NOTIFY_SET, &enable); |
| 126 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 127 | |
Tomas Winkler | 3c7c846 | 2015-07-26 09:54:20 +0300 | [diff] [blame] | 128 | uint32_t enable = 1; |
| 129 | or |
| 130 | uint32_t enable[disable] = 0; |
| 131 | |
| 132 | Error returns: |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 133 | |
| 134 | |
Tomas Winkler | 3c7c846 | 2015-07-26 09:54:20 +0300 | [diff] [blame] | 135 | 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 Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 141 | :Note: |
Tomas Winkler | 3c7c846 | 2015-07-26 09:54:20 +0300 | [diff] [blame] | 142 | The client must be connected in order to enable notification events |
| 143 | |
| 144 | |
Tomas Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 145 | IOCTL_MEI_NOTIFY_GET |
| 146 | -------------------- |
| 147 | Retrieve event |
| 148 | |
| 149 | .. code-block:: none |
Tomas Winkler | 3c7c846 | 2015-07-26 09:54:20 +0300 | [diff] [blame] | 150 | |
| 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 Winkler | d0a1780 | 2019-06-06 16:31:08 +0300 | [diff] [blame] | 166 | :Note: |
Tomas Winkler | 3c7c846 | 2015-07-26 09:54:20 +0300 | [diff] [blame] | 167 | The client must be connected and event notification has to be enabled |
| 168 | in order to receive an event |
| 169 | |
Julian Brost | cfba678 | 2015-01-12 00:58:06 +0100 | [diff] [blame] | 170 | |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 171 | |
Julian Brost | cfba678 | 2015-01-12 00:58:06 +0100 | [diff] [blame] | 172 | Supported Chipsets |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 173 | ================== |
Tomas Winkler | 7e527e1 | 2019-06-03 12:14:00 +0300 | [diff] [blame] | 174 | 82X38/X48 Express and newer |
Julian Brost | cfba678 | 2015-01-12 00:58:06 +0100 | [diff] [blame] | 175 | |
Oren Weil | 6624fc2 | 2011-05-15 13:43:39 +0300 | [diff] [blame] | 176 | linux-mei@linux.intel.com |