blob: c262d0bd5bd5e23c64d694df37d4b00096eeb679 [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,
Alexander Usyskin71e117f2015-07-29 14:59:33 +0300164 MEI_CL_CONN_NOT_ALLOWED = MEI_HBMS_NOT_ALLOWED,
Oren Weil5a6003f2011-05-15 13:43:45 +0300165};
166
167/*
168 * Client Disconnect Status
169 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200170enum mei_cl_disconnect_status {
Tomas Winkler89778d62014-08-21 14:29:16 +0300171 MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
Oren Weil5a6003f2011-05-15 13:43:45 +0300172};
173
174/*
175 * MEI BUS Interface Section
176 */
177struct mei_msg_hdr {
178 u32 me_addr:8;
179 u32 host_addr:8;
180 u32 length:9;
Tomas Winkler479327f2013-12-17 15:56:56 +0200181 u32 reserved:5;
182 u32 internal:1;
Oren Weil5a6003f2011-05-15 13:43:45 +0300183 u32 msg_complete:1;
184} __packed;
185
186
Oren Weil5a6003f2011-05-15 13:43:45 +0300187struct mei_bus_message {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200188 u8 hbm_cmd;
189 u8 data[0];
Oren Weil5a6003f2011-05-15 13:43:45 +0300190} __packed;
191
Tomas Winklercd51ed62012-12-25 19:06:09 +0200192/**
193 * struct hbm_cl_cmd - client specific host bus command
194 * CONNECT, DISCONNECT, and FlOW CONTROL
195 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300196 * @hbm_cmd: bus message command header
197 * @me_addr: address of the client in ME
198 * @host_addr: address of the client in the driver
199 * @data: generic data
Tomas Winklercd51ed62012-12-25 19:06:09 +0200200 */
201struct mei_hbm_cl_cmd {
202 u8 hbm_cmd;
203 u8 me_addr;
204 u8 host_addr;
205 u8 data;
206};
207
Oren Weil5a6003f2011-05-15 13:43:45 +0300208struct hbm_version {
209 u8 minor_version;
210 u8 major_version;
211} __packed;
212
213struct hbm_host_version_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200214 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300215 u8 reserved;
216 struct hbm_version host_version;
217} __packed;
218
219struct hbm_host_version_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200220 u8 hbm_cmd;
Tomas Winkler4b007062012-02-23 21:52:55 +0200221 u8 host_version_supported;
Oren Weil5a6003f2011-05-15 13:43:45 +0300222 struct hbm_version me_max_version;
223} __packed;
224
225struct hbm_host_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200226 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300227 u8 reason;
228 u8 reserved[2];
229} __packed;
230
231struct hbm_host_stop_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200232 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300233 u8 reserved[3];
234} __packed;
235
236struct hbm_me_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200237 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300238 u8 reason;
239 u8 reserved[2];
240} __packed;
241
Tomas Winkler70ef8352015-07-23 21:37:12 +0300242/**
243 * struct hbm_host_enum_request - enumeration request from host to fw
244 *
245 * @hbm_cmd: bus message command header
246 * @allow_add: allow dynamic clients add HBM version >= 2.0
247 * @reserved: reserved
248 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300249struct hbm_host_enum_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200250 u8 hbm_cmd;
Tomas Winkler70ef8352015-07-23 21:37:12 +0300251 u8 allow_add;
252 u8 reserved[2];
Oren Weil5a6003f2011-05-15 13:43:45 +0300253} __packed;
254
255struct hbm_host_enum_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200256 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300257 u8 reserved[3];
258 u8 valid_addresses[32];
259} __packed;
260
261struct mei_client_properties {
262 uuid_le protocol_name;
263 u8 protocol_version;
264 u8 max_number_of_connections;
265 u8 fixed_address;
266 u8 single_recv_buf;
267 u32 max_msg_length;
268} __packed;
269
270struct hbm_props_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200271 u8 hbm_cmd;
Tomas Winkler3438c1f2014-08-21 14:29:10 +0300272 u8 me_addr;
Oren Weil5a6003f2011-05-15 13:43:45 +0300273 u8 reserved[2];
274} __packed;
275
Oren Weil5a6003f2011-05-15 13:43:45 +0300276struct hbm_props_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200277 u8 hbm_cmd;
Tomas Winkler3438c1f2014-08-21 14:29:10 +0300278 u8 me_addr;
Oren Weil5a6003f2011-05-15 13:43:45 +0300279 u8 status;
280 u8 reserved[1];
281 struct mei_client_properties client_properties;
282} __packed;
283
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200284/**
Tomas Winkler70ef8352015-07-23 21:37:12 +0300285 * struct hbm_add_client_request - request to add a client
286 * might be sent by fw after enumeration has already completed
287 *
288 * @hbm_cmd: bus message command header
289 * @me_addr: address of the client in ME
290 * @reserved: reserved
291 * @client_properties: client properties
292 */
293struct hbm_add_client_request {
294 u8 hbm_cmd;
295 u8 me_addr;
296 u8 reserved[2];
297 struct mei_client_properties client_properties;
298} __packed;
299
300/**
301 * struct hbm_add_client_response - response to add a client
302 * sent by the host to report client addition status to fw
303 *
304 * @hbm_cmd: bus message command header
305 * @me_addr: address of the client in ME
306 * @status: if HBMS_SUCCESS then the client can now accept connections.
307 * @reserved: reserved
308 */
309struct hbm_add_client_response {
310 u8 hbm_cmd;
311 u8 me_addr;
312 u8 status;
313 u8 reserved[1];
314} __packed;
315
316/**
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200317 * struct hbm_power_gate - power gate request/response
318 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300319 * @hbm_cmd: bus message command header
320 * @reserved: reserved
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200321 */
322struct hbm_power_gate {
323 u8 hbm_cmd;
324 u8 reserved[3];
325} __packed;
326
327/**
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200328 * struct hbm_client_connect_request - connect/disconnect request
329 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300330 * @hbm_cmd: bus message command header
331 * @me_addr: address of the client in ME
332 * @host_addr: address of the client in the driver
333 * @reserved: reserved
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200334 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300335struct hbm_client_connect_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200336 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300337 u8 me_addr;
338 u8 host_addr;
339 u8 reserved;
340} __packed;
341
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200342/**
343 * struct hbm_client_connect_response - connect/disconnect response
344 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300345 * @hbm_cmd: bus message command header
346 * @me_addr: address of the client in ME
347 * @host_addr: address of the client in the driver
348 * @status: status of the request
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200349 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300350struct hbm_client_connect_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200351 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300352 u8 me_addr;
353 u8 host_addr;
354 u8 status;
355} __packed;
356
Oren Weil5a6003f2011-05-15 13:43:45 +0300357
358#define MEI_FC_MESSAGE_RESERVED_LENGTH 5
359
360struct hbm_flow_control {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200361 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300362 u8 me_addr;
363 u8 host_addr;
364 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
365} __packed;
366
Tomas Winklerd3c1c802015-07-26 09:54:15 +0300367#define MEI_HBM_NOTIFICATION_START 1
368#define MEI_HBM_NOTIFICATION_STOP 0
369/**
370 * struct hbm_notification_request - start/stop notification request
371 *
372 * @hbm_cmd: bus message command header
373 * @me_addr: address of the client in ME
374 * @host_addr: address of the client in the driver
375 * @start: start = 1 or stop = 0 asynchronous notifications
376 */
377struct hbm_notification_request {
378 u8 hbm_cmd;
379 u8 me_addr;
380 u8 host_addr;
381 u8 start;
382} __packed;
383
384/**
385 * struct hbm_notification_response - start/stop notification response
386 *
387 * @hbm_cmd: bus message command header
388 * @me_addr: address of the client in ME
389 * @host_addr: - address of the client in the driver
390 * @status: (mei_hbm_status) response status for the request
391 * - MEI_HBMS_SUCCESS: successful stop/start
392 * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
393 * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
394 * started notification.
395 * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
396 * asynchronous notifications are currently disabled.
397 *
398 * @start: start = 1 or stop = 0 asynchronous notifications
399 * @reserved: reserved
400 */
401struct hbm_notification_response {
402 u8 hbm_cmd;
403 u8 me_addr;
404 u8 host_addr;
405 u8 status;
406 u8 start;
407 u8 reserved[3];
408} __packed;
409
410/**
411 * struct hbm_notification - notification event
412 *
413 * @hbm_cmd: bus message command header
414 * @me_addr: address of the client in ME
415 * @host_addr: address of the client in the driver
416 * @reserved: reserved for alignment
417 */
418struct hbm_notification {
419 u8 hbm_cmd;
420 u8 me_addr;
421 u8 host_addr;
422 u8 reserved[1];
423} __packed;
Oren Weil5a6003f2011-05-15 13:43:45 +0300424
425#endif