blob: 3f8901a503a6041f0218b445277fd81b905c4b24 [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 Winkler4d998772015-07-26 09:54:17 +030061/*
62 * MEI version with notifcation support
63 */
64#define HBM_MINOR_VERSION_EV 0
65#define HBM_MAJOR_VERSION_EV 2
66
Tomas Winkler1ca7e782012-02-26 23:18:57 +020067/* Host bus message command opcode */
68#define MEI_HBM_CMD_OP_MSK 0x7f
69/* Host bus message command RESPONSE */
70#define MEI_HBM_CMD_RES_MSK 0x80
71
Oren Weil5a6003f2011-05-15 13:43:45 +030072/*
73 * MEI Bus Message Command IDs
74 */
75#define HOST_START_REQ_CMD 0x01
76#define HOST_START_RES_CMD 0x81
77
78#define HOST_STOP_REQ_CMD 0x02
79#define HOST_STOP_RES_CMD 0x82
80
81#define ME_STOP_REQ_CMD 0x03
82
83#define HOST_ENUM_REQ_CMD 0x04
84#define HOST_ENUM_RES_CMD 0x84
85
86#define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
87#define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
88
89#define CLIENT_CONNECT_REQ_CMD 0x06
90#define CLIENT_CONNECT_RES_CMD 0x86
91
92#define CLIENT_DISCONNECT_REQ_CMD 0x07
93#define CLIENT_DISCONNECT_RES_CMD 0x87
94
Tomas Winkler1ca7e782012-02-26 23:18:57 +020095#define MEI_FLOW_CONTROL_CMD 0x08
Oren Weil5a6003f2011-05-15 13:43:45 +030096
Tomas Winkler4fcbc992014-03-18 22:51:55 +020097#define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
98#define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
99#define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
100#define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
101
Tomas Winkler70ef8352015-07-23 21:37:12 +0300102#define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f
103#define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f
Tomas Winklerd3c1c802015-07-26 09:54:15 +0300104
105#define MEI_HBM_NOTIFY_REQ_CMD 0x10
106#define MEI_HBM_NOTIFY_RES_CMD 0x90
107#define MEI_HBM_NOTIFICATION_CMD 0x11
108
Oren Weil5a6003f2011-05-15 13:43:45 +0300109/*
110 * MEI Stop Reason
111 * used by hbm_host_stop_request.reason
112 */
113enum mei_stop_reason_types {
114 DRIVER_STOP_REQUEST = 0x00,
115 DEVICE_D1_ENTRY = 0x01,
116 DEVICE_D2_ENTRY = 0x02,
117 DEVICE_D3_ENTRY = 0x03,
118 SYSTEM_S1_ENTRY = 0x04,
119 SYSTEM_S2_ENTRY = 0x05,
120 SYSTEM_S3_ENTRY = 0x06,
121 SYSTEM_S4_ENTRY = 0x07,
122 SYSTEM_S5_ENTRY = 0x08
123};
124
Tomas Winkler89778d62014-08-21 14:29:16 +0300125
126/**
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300127 * enum mei_hbm_status - mei host bus messages return values
Tomas Winkler89778d62014-08-21 14:29:16 +0300128 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300129 * @MEI_HBMS_SUCCESS : status success
130 * @MEI_HBMS_CLIENT_NOT_FOUND : client not found
131 * @MEI_HBMS_ALREADY_EXISTS : connection already established
132 * @MEI_HBMS_REJECTED : connection is rejected
133 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
134 * @MEI_HBMS_NOT_ALLOWED : operation not allowed
135 * @MEI_HBMS_ALREADY_STARTED : system is already started
136 * @MEI_HBMS_NOT_STARTED : system not started
Alexander Usyskince231392014-09-29 16:31:50 +0300137 *
138 * @MEI_HBMS_MAX : sentinel
Tomas Winkler89778d62014-08-21 14:29:16 +0300139 */
140enum mei_hbm_status {
141 MEI_HBMS_SUCCESS = 0,
142 MEI_HBMS_CLIENT_NOT_FOUND = 1,
143 MEI_HBMS_ALREADY_EXISTS = 2,
144 MEI_HBMS_REJECTED = 3,
145 MEI_HBMS_INVALID_PARAMETER = 4,
146 MEI_HBMS_NOT_ALLOWED = 5,
147 MEI_HBMS_ALREADY_STARTED = 6,
148 MEI_HBMS_NOT_STARTED = 7,
149
150 MEI_HBMS_MAX
151};
152
153
Oren Weil5a6003f2011-05-15 13:43:45 +0300154/*
155 * Client Connect Status
156 * used by hbm_client_connect_response.status
157 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200158enum mei_cl_connect_status {
Tomas Winkler89778d62014-08-21 14:29:16 +0300159 MEI_CL_CONN_SUCCESS = MEI_HBMS_SUCCESS,
160 MEI_CL_CONN_NOT_FOUND = MEI_HBMS_CLIENT_NOT_FOUND,
161 MEI_CL_CONN_ALREADY_STARTED = MEI_HBMS_ALREADY_EXISTS,
162 MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
163 MEI_CL_CONN_MESSAGE_SMALL = MEI_HBMS_INVALID_PARAMETER,
Oren Weil5a6003f2011-05-15 13:43:45 +0300164};
165
166/*
167 * Client Disconnect Status
168 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200169enum mei_cl_disconnect_status {
Tomas Winkler89778d62014-08-21 14:29:16 +0300170 MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
Oren Weil5a6003f2011-05-15 13:43:45 +0300171};
172
173/*
174 * MEI BUS Interface Section
175 */
176struct mei_msg_hdr {
177 u32 me_addr:8;
178 u32 host_addr:8;
179 u32 length:9;
Tomas Winkler479327f2013-12-17 15:56:56 +0200180 u32 reserved:5;
181 u32 internal:1;
Oren Weil5a6003f2011-05-15 13:43:45 +0300182 u32 msg_complete:1;
183} __packed;
184
185
Oren Weil5a6003f2011-05-15 13:43:45 +0300186struct mei_bus_message {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200187 u8 hbm_cmd;
188 u8 data[0];
Oren Weil5a6003f2011-05-15 13:43:45 +0300189} __packed;
190
Tomas Winklercd51ed62012-12-25 19:06:09 +0200191/**
192 * struct hbm_cl_cmd - client specific host bus command
193 * CONNECT, DISCONNECT, and FlOW CONTROL
194 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300195 * @hbm_cmd: bus message command header
196 * @me_addr: address of the client in ME
197 * @host_addr: address of the client in the driver
198 * @data: generic data
Tomas Winklercd51ed62012-12-25 19:06:09 +0200199 */
200struct mei_hbm_cl_cmd {
201 u8 hbm_cmd;
202 u8 me_addr;
203 u8 host_addr;
204 u8 data;
205};
206
Oren Weil5a6003f2011-05-15 13:43:45 +0300207struct hbm_version {
208 u8 minor_version;
209 u8 major_version;
210} __packed;
211
212struct hbm_host_version_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200213 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300214 u8 reserved;
215 struct hbm_version host_version;
216} __packed;
217
218struct hbm_host_version_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200219 u8 hbm_cmd;
Tomas Winkler4b007062012-02-23 21:52:55 +0200220 u8 host_version_supported;
Oren Weil5a6003f2011-05-15 13:43:45 +0300221 struct hbm_version me_max_version;
222} __packed;
223
224struct hbm_host_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200225 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300226 u8 reason;
227 u8 reserved[2];
228} __packed;
229
230struct hbm_host_stop_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200231 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300232 u8 reserved[3];
233} __packed;
234
235struct hbm_me_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200236 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300237 u8 reason;
238 u8 reserved[2];
239} __packed;
240
Tomas Winkler70ef8352015-07-23 21:37:12 +0300241/**
242 * struct hbm_host_enum_request - enumeration request from host to fw
243 *
244 * @hbm_cmd: bus message command header
245 * @allow_add: allow dynamic clients add HBM version >= 2.0
246 * @reserved: reserved
247 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300248struct hbm_host_enum_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200249 u8 hbm_cmd;
Tomas Winkler70ef8352015-07-23 21:37:12 +0300250 u8 allow_add;
251 u8 reserved[2];
Oren Weil5a6003f2011-05-15 13:43:45 +0300252} __packed;
253
254struct hbm_host_enum_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200255 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300256 u8 reserved[3];
257 u8 valid_addresses[32];
258} __packed;
259
260struct mei_client_properties {
261 uuid_le protocol_name;
262 u8 protocol_version;
263 u8 max_number_of_connections;
264 u8 fixed_address;
265 u8 single_recv_buf;
266 u32 max_msg_length;
267} __packed;
268
269struct hbm_props_request {
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 reserved[2];
273} __packed;
274
Oren Weil5a6003f2011-05-15 13:43:45 +0300275struct hbm_props_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200276 u8 hbm_cmd;
Tomas Winkler3438c1f2014-08-21 14:29:10 +0300277 u8 me_addr;
Oren Weil5a6003f2011-05-15 13:43:45 +0300278 u8 status;
279 u8 reserved[1];
280 struct mei_client_properties client_properties;
281} __packed;
282
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200283/**
Tomas Winkler70ef8352015-07-23 21:37:12 +0300284 * struct hbm_add_client_request - request to add a client
285 * might be sent by fw after enumeration has already completed
286 *
287 * @hbm_cmd: bus message command header
288 * @me_addr: address of the client in ME
289 * @reserved: reserved
290 * @client_properties: client properties
291 */
292struct hbm_add_client_request {
293 u8 hbm_cmd;
294 u8 me_addr;
295 u8 reserved[2];
296 struct mei_client_properties client_properties;
297} __packed;
298
299/**
300 * struct hbm_add_client_response - response to add a client
301 * sent by the host to report client addition status to fw
302 *
303 * @hbm_cmd: bus message command header
304 * @me_addr: address of the client in ME
305 * @status: if HBMS_SUCCESS then the client can now accept connections.
306 * @reserved: reserved
307 */
308struct hbm_add_client_response {
309 u8 hbm_cmd;
310 u8 me_addr;
311 u8 status;
312 u8 reserved[1];
313} __packed;
314
315/**
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200316 * struct hbm_power_gate - power gate request/response
317 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300318 * @hbm_cmd: bus message command header
319 * @reserved: reserved
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200320 */
321struct hbm_power_gate {
322 u8 hbm_cmd;
323 u8 reserved[3];
324} __packed;
325
326/**
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200327 * struct hbm_client_connect_request - connect/disconnect request
328 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300329 * @hbm_cmd: bus message command header
330 * @me_addr: address of the client in ME
331 * @host_addr: address of the client in the driver
332 * @reserved: reserved
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200333 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300334struct hbm_client_connect_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200335 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300336 u8 me_addr;
337 u8 host_addr;
338 u8 reserved;
339} __packed;
340
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200341/**
342 * struct hbm_client_connect_response - connect/disconnect response
343 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300344 * @hbm_cmd: bus message command header
345 * @me_addr: address of the client in ME
346 * @host_addr: address of the client in the driver
347 * @status: status of the request
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200348 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300349struct hbm_client_connect_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200350 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300351 u8 me_addr;
352 u8 host_addr;
353 u8 status;
354} __packed;
355
Oren Weil5a6003f2011-05-15 13:43:45 +0300356
357#define MEI_FC_MESSAGE_RESERVED_LENGTH 5
358
359struct hbm_flow_control {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200360 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300361 u8 me_addr;
362 u8 host_addr;
363 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
364} __packed;
365
Tomas Winklerd3c1c802015-07-26 09:54:15 +0300366#define MEI_HBM_NOTIFICATION_START 1
367#define MEI_HBM_NOTIFICATION_STOP 0
368/**
369 * struct hbm_notification_request - start/stop notification request
370 *
371 * @hbm_cmd: bus message command header
372 * @me_addr: address of the client in ME
373 * @host_addr: address of the client in the driver
374 * @start: start = 1 or stop = 0 asynchronous notifications
375 */
376struct hbm_notification_request {
377 u8 hbm_cmd;
378 u8 me_addr;
379 u8 host_addr;
380 u8 start;
381} __packed;
382
383/**
384 * struct hbm_notification_response - start/stop notification response
385 *
386 * @hbm_cmd: bus message command header
387 * @me_addr: address of the client in ME
388 * @host_addr: - address of the client in the driver
389 * @status: (mei_hbm_status) response status for the request
390 * - MEI_HBMS_SUCCESS: successful stop/start
391 * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
392 * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
393 * started notification.
394 * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
395 * asynchronous notifications are currently disabled.
396 *
397 * @start: start = 1 or stop = 0 asynchronous notifications
398 * @reserved: reserved
399 */
400struct hbm_notification_response {
401 u8 hbm_cmd;
402 u8 me_addr;
403 u8 host_addr;
404 u8 status;
405 u8 start;
406 u8 reserved[3];
407} __packed;
408
409/**
410 * struct hbm_notification - notification event
411 *
412 * @hbm_cmd: bus message command header
413 * @me_addr: address of the client in ME
414 * @host_addr: address of the client in the driver
415 * @reserved: reserved for alignment
416 */
417struct hbm_notification {
418 u8 hbm_cmd;
419 u8 me_addr;
420 u8 host_addr;
421 u8 reserved[1];
422} __packed;
Oren Weil5a6003f2011-05-15 13:43:45 +0300423
424#endif