blob: a2c7aaba25d4f06d875e1d38f50bfeab8b0204bd [file] [log] [blame]
Oren Weil5a6003f2011-05-15 13:43:45 +03001/*
2 *
3 * Intel Management Engine Interface (Intel MEI) Linux driver
Tomas Winkler733ba912012-02-09 19:25:53 +02004 * Copyright (c) 2003-2012, Intel Corporation.
Oren Weil5a6003f2011-05-15 13:43:45 +03005 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 */
16
17#ifndef _MEI_HW_TYPES_H_
18#define _MEI_HW_TYPES_H_
19
20#include <linux/uuid.h>
21
22/*
Tomas Winkler3870c322012-11-01 21:17:14 +020023 * Timeouts in Seconds
Oren Weil5a6003f2011-05-15 13:43:45 +030024 */
Tomas Winkler7d93e582014-01-14 23:10:10 +020025#define MEI_HW_READY_TIMEOUT 2 /* Timeout on ready message */
Tomas Winkler3870c322012-11-01 21:17:14 +020026#define MEI_CONNECT_TIMEOUT 3 /* HPS: at least 2 seconds */
Oren Weil5a6003f2011-05-15 13:43:45 +030027
Tomas Winkler3870c322012-11-01 21:17:14 +020028#define MEI_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */
29#define MEI_CLIENTS_INIT_TIMEOUT 15 /* HPS: Clients Enumeration Timeout */
Oren Weil5a6003f2011-05-15 13:43:45 +030030
Tomas Winkler3870c322012-11-01 21:17:14 +020031#define MEI_IAMTHIF_STALL_TIMER 12 /* HPS */
32#define MEI_IAMTHIF_READ_TIMER 10 /* HPS */
Oren Weil5a6003f2011-05-15 13:43:45 +030033
Tomas Winklerba9cdd02014-03-18 22:52:00 +020034#define MEI_PGI_TIMEOUT 1 /* PG Isolation time response 1 sec */
Tomas Winkler7d93e582014-01-14 23:10:10 +020035#define MEI_HBM_TIMEOUT 1 /* 1 second */
Oren Weil5a6003f2011-05-15 13:43:45 +030036
37/*
Oren Weil5a6003f2011-05-15 13:43:45 +030038 * MEI Version
39 */
Tomas Winkler61a1aea72014-03-18 22:52:07 +020040#define HBM_MINOR_VERSION 1
Oren Weil5a6003f2011-05-15 13:43:45 +030041#define HBM_MAJOR_VERSION 1
Oren Weil5a6003f2011-05-15 13:43:45 +030042
Tomas Winkleree7e5af2014-03-18 22:51:58 +020043/*
44 * MEI version with PGI support
45 */
46#define HBM_MINOR_VERSION_PGI 1
47#define HBM_MAJOR_VERSION_PGI 1
48
Tomas Winkler70ef8352015-07-23 21:37:12 +030049/*
50 * MEI version with Dynamic clients support
51 */
52#define HBM_MINOR_VERSION_DC 0
53#define HBM_MAJOR_VERSION_DC 2
54
Alexander Usyskin18901352015-07-23 21:37:13 +030055/*
56 * MEI version with disconnect on connection timeout support
57 */
58#define HBM_MINOR_VERSION_DOT 0
59#define HBM_MAJOR_VERSION_DOT 2
60
Tomas Winkler1ca7e782012-02-26 23:18:57 +020061/* Host bus message command opcode */
62#define MEI_HBM_CMD_OP_MSK 0x7f
63/* Host bus message command RESPONSE */
64#define MEI_HBM_CMD_RES_MSK 0x80
65
Oren Weil5a6003f2011-05-15 13:43:45 +030066/*
67 * MEI Bus Message Command IDs
68 */
69#define HOST_START_REQ_CMD 0x01
70#define HOST_START_RES_CMD 0x81
71
72#define HOST_STOP_REQ_CMD 0x02
73#define HOST_STOP_RES_CMD 0x82
74
75#define ME_STOP_REQ_CMD 0x03
76
77#define HOST_ENUM_REQ_CMD 0x04
78#define HOST_ENUM_RES_CMD 0x84
79
80#define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
81#define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
82
83#define CLIENT_CONNECT_REQ_CMD 0x06
84#define CLIENT_CONNECT_RES_CMD 0x86
85
86#define CLIENT_DISCONNECT_REQ_CMD 0x07
87#define CLIENT_DISCONNECT_RES_CMD 0x87
88
Tomas Winkler1ca7e782012-02-26 23:18:57 +020089#define MEI_FLOW_CONTROL_CMD 0x08
Oren Weil5a6003f2011-05-15 13:43:45 +030090
Tomas Winkler4fcbc992014-03-18 22:51:55 +020091#define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
92#define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
93#define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
94#define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
95
Tomas Winkler70ef8352015-07-23 21:37:12 +030096#define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f
97#define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f
Tomas Winklerd3c1c802015-07-26 09:54:15 +030098
99#define MEI_HBM_NOTIFY_REQ_CMD 0x10
100#define MEI_HBM_NOTIFY_RES_CMD 0x90
101#define MEI_HBM_NOTIFICATION_CMD 0x11
102
Oren Weil5a6003f2011-05-15 13:43:45 +0300103/*
104 * MEI Stop Reason
105 * used by hbm_host_stop_request.reason
106 */
107enum mei_stop_reason_types {
108 DRIVER_STOP_REQUEST = 0x00,
109 DEVICE_D1_ENTRY = 0x01,
110 DEVICE_D2_ENTRY = 0x02,
111 DEVICE_D3_ENTRY = 0x03,
112 SYSTEM_S1_ENTRY = 0x04,
113 SYSTEM_S2_ENTRY = 0x05,
114 SYSTEM_S3_ENTRY = 0x06,
115 SYSTEM_S4_ENTRY = 0x07,
116 SYSTEM_S5_ENTRY = 0x08
117};
118
Tomas Winkler89778d62014-08-21 14:29:16 +0300119
120/**
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300121 * enum mei_hbm_status - mei host bus messages return values
Tomas Winkler89778d62014-08-21 14:29:16 +0300122 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300123 * @MEI_HBMS_SUCCESS : status success
124 * @MEI_HBMS_CLIENT_NOT_FOUND : client not found
125 * @MEI_HBMS_ALREADY_EXISTS : connection already established
126 * @MEI_HBMS_REJECTED : connection is rejected
127 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
128 * @MEI_HBMS_NOT_ALLOWED : operation not allowed
129 * @MEI_HBMS_ALREADY_STARTED : system is already started
130 * @MEI_HBMS_NOT_STARTED : system not started
Alexander Usyskince231392014-09-29 16:31:50 +0300131 *
132 * @MEI_HBMS_MAX : sentinel
Tomas Winkler89778d62014-08-21 14:29:16 +0300133 */
134enum mei_hbm_status {
135 MEI_HBMS_SUCCESS = 0,
136 MEI_HBMS_CLIENT_NOT_FOUND = 1,
137 MEI_HBMS_ALREADY_EXISTS = 2,
138 MEI_HBMS_REJECTED = 3,
139 MEI_HBMS_INVALID_PARAMETER = 4,
140 MEI_HBMS_NOT_ALLOWED = 5,
141 MEI_HBMS_ALREADY_STARTED = 6,
142 MEI_HBMS_NOT_STARTED = 7,
143
144 MEI_HBMS_MAX
145};
146
147
Oren Weil5a6003f2011-05-15 13:43:45 +0300148/*
149 * Client Connect Status
150 * used by hbm_client_connect_response.status
151 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200152enum mei_cl_connect_status {
Tomas Winkler89778d62014-08-21 14:29:16 +0300153 MEI_CL_CONN_SUCCESS = MEI_HBMS_SUCCESS,
154 MEI_CL_CONN_NOT_FOUND = MEI_HBMS_CLIENT_NOT_FOUND,
155 MEI_CL_CONN_ALREADY_STARTED = MEI_HBMS_ALREADY_EXISTS,
156 MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
157 MEI_CL_CONN_MESSAGE_SMALL = MEI_HBMS_INVALID_PARAMETER,
Oren Weil5a6003f2011-05-15 13:43:45 +0300158};
159
160/*
161 * Client Disconnect Status
162 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200163enum mei_cl_disconnect_status {
Tomas Winkler89778d62014-08-21 14:29:16 +0300164 MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
Oren Weil5a6003f2011-05-15 13:43:45 +0300165};
166
167/*
168 * MEI BUS Interface Section
169 */
170struct mei_msg_hdr {
171 u32 me_addr:8;
172 u32 host_addr:8;
173 u32 length:9;
Tomas Winkler479327f2013-12-17 15:56:56 +0200174 u32 reserved:5;
175 u32 internal:1;
Oren Weil5a6003f2011-05-15 13:43:45 +0300176 u32 msg_complete:1;
177} __packed;
178
179
Oren Weil5a6003f2011-05-15 13:43:45 +0300180struct mei_bus_message {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200181 u8 hbm_cmd;
182 u8 data[0];
Oren Weil5a6003f2011-05-15 13:43:45 +0300183} __packed;
184
Tomas Winklercd51ed62012-12-25 19:06:09 +0200185/**
186 * struct hbm_cl_cmd - client specific host bus command
187 * CONNECT, DISCONNECT, and FlOW CONTROL
188 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300189 * @hbm_cmd: bus message command header
190 * @me_addr: address of the client in ME
191 * @host_addr: address of the client in the driver
192 * @data: generic data
Tomas Winklercd51ed62012-12-25 19:06:09 +0200193 */
194struct mei_hbm_cl_cmd {
195 u8 hbm_cmd;
196 u8 me_addr;
197 u8 host_addr;
198 u8 data;
199};
200
Oren Weil5a6003f2011-05-15 13:43:45 +0300201struct hbm_version {
202 u8 minor_version;
203 u8 major_version;
204} __packed;
205
206struct hbm_host_version_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200207 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300208 u8 reserved;
209 struct hbm_version host_version;
210} __packed;
211
212struct hbm_host_version_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200213 u8 hbm_cmd;
Tomas Winkler4b007062012-02-23 21:52:55 +0200214 u8 host_version_supported;
Oren Weil5a6003f2011-05-15 13:43:45 +0300215 struct hbm_version me_max_version;
216} __packed;
217
218struct hbm_host_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200219 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300220 u8 reason;
221 u8 reserved[2];
222} __packed;
223
224struct hbm_host_stop_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200225 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300226 u8 reserved[3];
227} __packed;
228
229struct hbm_me_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200230 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300231 u8 reason;
232 u8 reserved[2];
233} __packed;
234
Tomas Winkler70ef8352015-07-23 21:37:12 +0300235/**
236 * struct hbm_host_enum_request - enumeration request from host to fw
237 *
238 * @hbm_cmd: bus message command header
239 * @allow_add: allow dynamic clients add HBM version >= 2.0
240 * @reserved: reserved
241 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300242struct hbm_host_enum_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200243 u8 hbm_cmd;
Tomas Winkler70ef8352015-07-23 21:37:12 +0300244 u8 allow_add;
245 u8 reserved[2];
Oren Weil5a6003f2011-05-15 13:43:45 +0300246} __packed;
247
248struct hbm_host_enum_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200249 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300250 u8 reserved[3];
251 u8 valid_addresses[32];
252} __packed;
253
254struct mei_client_properties {
255 uuid_le protocol_name;
256 u8 protocol_version;
257 u8 max_number_of_connections;
258 u8 fixed_address;
259 u8 single_recv_buf;
260 u32 max_msg_length;
261} __packed;
262
263struct hbm_props_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200264 u8 hbm_cmd;
Tomas Winkler3438c1f2014-08-21 14:29:10 +0300265 u8 me_addr;
Oren Weil5a6003f2011-05-15 13:43:45 +0300266 u8 reserved[2];
267} __packed;
268
Oren Weil5a6003f2011-05-15 13:43:45 +0300269struct hbm_props_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200270 u8 hbm_cmd;
Tomas Winkler3438c1f2014-08-21 14:29:10 +0300271 u8 me_addr;
Oren Weil5a6003f2011-05-15 13:43:45 +0300272 u8 status;
273 u8 reserved[1];
274 struct mei_client_properties client_properties;
275} __packed;
276
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200277/**
Tomas Winkler70ef8352015-07-23 21:37:12 +0300278 * struct hbm_add_client_request - request to add a client
279 * might be sent by fw after enumeration has already completed
280 *
281 * @hbm_cmd: bus message command header
282 * @me_addr: address of the client in ME
283 * @reserved: reserved
284 * @client_properties: client properties
285 */
286struct hbm_add_client_request {
287 u8 hbm_cmd;
288 u8 me_addr;
289 u8 reserved[2];
290 struct mei_client_properties client_properties;
291} __packed;
292
293/**
294 * struct hbm_add_client_response - response to add a client
295 * sent by the host to report client addition status to fw
296 *
297 * @hbm_cmd: bus message command header
298 * @me_addr: address of the client in ME
299 * @status: if HBMS_SUCCESS then the client can now accept connections.
300 * @reserved: reserved
301 */
302struct hbm_add_client_response {
303 u8 hbm_cmd;
304 u8 me_addr;
305 u8 status;
306 u8 reserved[1];
307} __packed;
308
309/**
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200310 * struct hbm_power_gate - power gate request/response
311 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300312 * @hbm_cmd: bus message command header
313 * @reserved: reserved
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200314 */
315struct hbm_power_gate {
316 u8 hbm_cmd;
317 u8 reserved[3];
318} __packed;
319
320/**
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200321 * struct hbm_client_connect_request - connect/disconnect request
322 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300323 * @hbm_cmd: bus message command header
324 * @me_addr: address of the client in ME
325 * @host_addr: address of the client in the driver
326 * @reserved: reserved
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200327 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300328struct hbm_client_connect_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200329 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300330 u8 me_addr;
331 u8 host_addr;
332 u8 reserved;
333} __packed;
334
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200335/**
336 * struct hbm_client_connect_response - connect/disconnect response
337 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300338 * @hbm_cmd: bus message command header
339 * @me_addr: address of the client in ME
340 * @host_addr: address of the client in the driver
341 * @status: status of the request
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200342 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300343struct hbm_client_connect_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200344 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300345 u8 me_addr;
346 u8 host_addr;
347 u8 status;
348} __packed;
349
Oren Weil5a6003f2011-05-15 13:43:45 +0300350
351#define MEI_FC_MESSAGE_RESERVED_LENGTH 5
352
353struct hbm_flow_control {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200354 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300355 u8 me_addr;
356 u8 host_addr;
357 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
358} __packed;
359
Tomas Winklerd3c1c802015-07-26 09:54:15 +0300360#define MEI_HBM_NOTIFICATION_START 1
361#define MEI_HBM_NOTIFICATION_STOP 0
362/**
363 * struct hbm_notification_request - start/stop notification request
364 *
365 * @hbm_cmd: bus message command header
366 * @me_addr: address of the client in ME
367 * @host_addr: address of the client in the driver
368 * @start: start = 1 or stop = 0 asynchronous notifications
369 */
370struct hbm_notification_request {
371 u8 hbm_cmd;
372 u8 me_addr;
373 u8 host_addr;
374 u8 start;
375} __packed;
376
377/**
378 * struct hbm_notification_response - start/stop notification response
379 *
380 * @hbm_cmd: bus message command header
381 * @me_addr: address of the client in ME
382 * @host_addr: - address of the client in the driver
383 * @status: (mei_hbm_status) response status for the request
384 * - MEI_HBMS_SUCCESS: successful stop/start
385 * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
386 * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
387 * started notification.
388 * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
389 * asynchronous notifications are currently disabled.
390 *
391 * @start: start = 1 or stop = 0 asynchronous notifications
392 * @reserved: reserved
393 */
394struct hbm_notification_response {
395 u8 hbm_cmd;
396 u8 me_addr;
397 u8 host_addr;
398 u8 status;
399 u8 start;
400 u8 reserved[3];
401} __packed;
402
403/**
404 * struct hbm_notification - notification event
405 *
406 * @hbm_cmd: bus message command header
407 * @me_addr: address of the client in ME
408 * @host_addr: address of the client in the driver
409 * @reserved: reserved for alignment
410 */
411struct hbm_notification {
412 u8 hbm_cmd;
413 u8 me_addr;
414 u8 host_addr;
415 u8 reserved[1];
416} __packed;
Oren Weil5a6003f2011-05-15 13:43:45 +0300417
418#endif