blob: 815f40a604b923da610f870698357424534b4b7a [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
Tomas Winkler1ca7e782012-02-26 23:18:57 +020055/* Host bus message command opcode */
56#define MEI_HBM_CMD_OP_MSK 0x7f
57/* Host bus message command RESPONSE */
58#define MEI_HBM_CMD_RES_MSK 0x80
59
Oren Weil5a6003f2011-05-15 13:43:45 +030060/*
61 * MEI Bus Message Command IDs
62 */
63#define HOST_START_REQ_CMD 0x01
64#define HOST_START_RES_CMD 0x81
65
66#define HOST_STOP_REQ_CMD 0x02
67#define HOST_STOP_RES_CMD 0x82
68
69#define ME_STOP_REQ_CMD 0x03
70
71#define HOST_ENUM_REQ_CMD 0x04
72#define HOST_ENUM_RES_CMD 0x84
73
74#define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
75#define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
76
77#define CLIENT_CONNECT_REQ_CMD 0x06
78#define CLIENT_CONNECT_RES_CMD 0x86
79
80#define CLIENT_DISCONNECT_REQ_CMD 0x07
81#define CLIENT_DISCONNECT_RES_CMD 0x87
82
Tomas Winkler1ca7e782012-02-26 23:18:57 +020083#define MEI_FLOW_CONTROL_CMD 0x08
Oren Weil5a6003f2011-05-15 13:43:45 +030084
Tomas Winkler4fcbc992014-03-18 22:51:55 +020085#define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
86#define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
87#define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
88#define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
89
Tomas Winkler70ef8352015-07-23 21:37:12 +030090#define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f
91#define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f
Oren Weil5a6003f2011-05-15 13:43:45 +030092/*
93 * MEI Stop Reason
94 * used by hbm_host_stop_request.reason
95 */
96enum mei_stop_reason_types {
97 DRIVER_STOP_REQUEST = 0x00,
98 DEVICE_D1_ENTRY = 0x01,
99 DEVICE_D2_ENTRY = 0x02,
100 DEVICE_D3_ENTRY = 0x03,
101 SYSTEM_S1_ENTRY = 0x04,
102 SYSTEM_S2_ENTRY = 0x05,
103 SYSTEM_S3_ENTRY = 0x06,
104 SYSTEM_S4_ENTRY = 0x07,
105 SYSTEM_S5_ENTRY = 0x08
106};
107
Tomas Winkler89778d62014-08-21 14:29:16 +0300108
109/**
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300110 * enum mei_hbm_status - mei host bus messages return values
Tomas Winkler89778d62014-08-21 14:29:16 +0300111 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300112 * @MEI_HBMS_SUCCESS : status success
113 * @MEI_HBMS_CLIENT_NOT_FOUND : client not found
114 * @MEI_HBMS_ALREADY_EXISTS : connection already established
115 * @MEI_HBMS_REJECTED : connection is rejected
116 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
117 * @MEI_HBMS_NOT_ALLOWED : operation not allowed
118 * @MEI_HBMS_ALREADY_STARTED : system is already started
119 * @MEI_HBMS_NOT_STARTED : system not started
Alexander Usyskince231392014-09-29 16:31:50 +0300120 *
121 * @MEI_HBMS_MAX : sentinel
Tomas Winkler89778d62014-08-21 14:29:16 +0300122 */
123enum mei_hbm_status {
124 MEI_HBMS_SUCCESS = 0,
125 MEI_HBMS_CLIENT_NOT_FOUND = 1,
126 MEI_HBMS_ALREADY_EXISTS = 2,
127 MEI_HBMS_REJECTED = 3,
128 MEI_HBMS_INVALID_PARAMETER = 4,
129 MEI_HBMS_NOT_ALLOWED = 5,
130 MEI_HBMS_ALREADY_STARTED = 6,
131 MEI_HBMS_NOT_STARTED = 7,
132
133 MEI_HBMS_MAX
134};
135
136
Oren Weil5a6003f2011-05-15 13:43:45 +0300137/*
138 * Client Connect Status
139 * used by hbm_client_connect_response.status
140 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200141enum mei_cl_connect_status {
Tomas Winkler89778d62014-08-21 14:29:16 +0300142 MEI_CL_CONN_SUCCESS = MEI_HBMS_SUCCESS,
143 MEI_CL_CONN_NOT_FOUND = MEI_HBMS_CLIENT_NOT_FOUND,
144 MEI_CL_CONN_ALREADY_STARTED = MEI_HBMS_ALREADY_EXISTS,
145 MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
146 MEI_CL_CONN_MESSAGE_SMALL = MEI_HBMS_INVALID_PARAMETER,
Oren Weil5a6003f2011-05-15 13:43:45 +0300147};
148
149/*
150 * Client Disconnect Status
151 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200152enum mei_cl_disconnect_status {
Tomas Winkler89778d62014-08-21 14:29:16 +0300153 MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
Oren Weil5a6003f2011-05-15 13:43:45 +0300154};
155
156/*
157 * MEI BUS Interface Section
158 */
159struct mei_msg_hdr {
160 u32 me_addr:8;
161 u32 host_addr:8;
162 u32 length:9;
Tomas Winkler479327f2013-12-17 15:56:56 +0200163 u32 reserved:5;
164 u32 internal:1;
Oren Weil5a6003f2011-05-15 13:43:45 +0300165 u32 msg_complete:1;
166} __packed;
167
168
Oren Weil5a6003f2011-05-15 13:43:45 +0300169struct mei_bus_message {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200170 u8 hbm_cmd;
171 u8 data[0];
Oren Weil5a6003f2011-05-15 13:43:45 +0300172} __packed;
173
Tomas Winklercd51ed62012-12-25 19:06:09 +0200174/**
175 * struct hbm_cl_cmd - client specific host bus command
176 * CONNECT, DISCONNECT, and FlOW CONTROL
177 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300178 * @hbm_cmd: bus message command header
179 * @me_addr: address of the client in ME
180 * @host_addr: address of the client in the driver
181 * @data: generic data
Tomas Winklercd51ed62012-12-25 19:06:09 +0200182 */
183struct mei_hbm_cl_cmd {
184 u8 hbm_cmd;
185 u8 me_addr;
186 u8 host_addr;
187 u8 data;
188};
189
Oren Weil5a6003f2011-05-15 13:43:45 +0300190struct hbm_version {
191 u8 minor_version;
192 u8 major_version;
193} __packed;
194
195struct hbm_host_version_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200196 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300197 u8 reserved;
198 struct hbm_version host_version;
199} __packed;
200
201struct hbm_host_version_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200202 u8 hbm_cmd;
Tomas Winkler4b007062012-02-23 21:52:55 +0200203 u8 host_version_supported;
Oren Weil5a6003f2011-05-15 13:43:45 +0300204 struct hbm_version me_max_version;
205} __packed;
206
207struct hbm_host_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200208 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300209 u8 reason;
210 u8 reserved[2];
211} __packed;
212
213struct hbm_host_stop_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200214 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300215 u8 reserved[3];
216} __packed;
217
218struct hbm_me_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
Tomas Winkler70ef8352015-07-23 21:37:12 +0300224/**
225 * struct hbm_host_enum_request - enumeration request from host to fw
226 *
227 * @hbm_cmd: bus message command header
228 * @allow_add: allow dynamic clients add HBM version >= 2.0
229 * @reserved: reserved
230 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300231struct hbm_host_enum_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200232 u8 hbm_cmd;
Tomas Winkler70ef8352015-07-23 21:37:12 +0300233 u8 allow_add;
234 u8 reserved[2];
Oren Weil5a6003f2011-05-15 13:43:45 +0300235} __packed;
236
237struct hbm_host_enum_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200238 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300239 u8 reserved[3];
240 u8 valid_addresses[32];
241} __packed;
242
243struct mei_client_properties {
244 uuid_le protocol_name;
245 u8 protocol_version;
246 u8 max_number_of_connections;
247 u8 fixed_address;
248 u8 single_recv_buf;
249 u32 max_msg_length;
250} __packed;
251
252struct hbm_props_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200253 u8 hbm_cmd;
Tomas Winkler3438c1f2014-08-21 14:29:10 +0300254 u8 me_addr;
Oren Weil5a6003f2011-05-15 13:43:45 +0300255 u8 reserved[2];
256} __packed;
257
Oren Weil5a6003f2011-05-15 13:43:45 +0300258struct hbm_props_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200259 u8 hbm_cmd;
Tomas Winkler3438c1f2014-08-21 14:29:10 +0300260 u8 me_addr;
Oren Weil5a6003f2011-05-15 13:43:45 +0300261 u8 status;
262 u8 reserved[1];
263 struct mei_client_properties client_properties;
264} __packed;
265
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200266/**
Tomas Winkler70ef8352015-07-23 21:37:12 +0300267 * struct hbm_add_client_request - request to add a client
268 * might be sent by fw after enumeration has already completed
269 *
270 * @hbm_cmd: bus message command header
271 * @me_addr: address of the client in ME
272 * @reserved: reserved
273 * @client_properties: client properties
274 */
275struct hbm_add_client_request {
276 u8 hbm_cmd;
277 u8 me_addr;
278 u8 reserved[2];
279 struct mei_client_properties client_properties;
280} __packed;
281
282/**
283 * struct hbm_add_client_response - response to add a client
284 * sent by the host to report client addition status to fw
285 *
286 * @hbm_cmd: bus message command header
287 * @me_addr: address of the client in ME
288 * @status: if HBMS_SUCCESS then the client can now accept connections.
289 * @reserved: reserved
290 */
291struct hbm_add_client_response {
292 u8 hbm_cmd;
293 u8 me_addr;
294 u8 status;
295 u8 reserved[1];
296} __packed;
297
298/**
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200299 * struct hbm_power_gate - power gate request/response
300 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300301 * @hbm_cmd: bus message command header
302 * @reserved: reserved
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200303 */
304struct hbm_power_gate {
305 u8 hbm_cmd;
306 u8 reserved[3];
307} __packed;
308
309/**
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200310 * struct hbm_client_connect_request - connect/disconnect request
311 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300312 * @hbm_cmd: bus message command header
313 * @me_addr: address of the client in ME
314 * @host_addr: address of the client in the driver
315 * @reserved: reserved
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200316 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300317struct hbm_client_connect_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200318 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300319 u8 me_addr;
320 u8 host_addr;
321 u8 reserved;
322} __packed;
323
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200324/**
325 * struct hbm_client_connect_response - connect/disconnect response
326 *
Alexander Usyskina8605ea2014-09-29 16:31:49 +0300327 * @hbm_cmd: bus message command header
328 * @me_addr: address of the client in ME
329 * @host_addr: address of the client in the driver
330 * @status: status of the request
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200331 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300332struct hbm_client_connect_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200333 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300334 u8 me_addr;
335 u8 host_addr;
336 u8 status;
337} __packed;
338
Oren Weil5a6003f2011-05-15 13:43:45 +0300339
340#define MEI_FC_MESSAGE_RESERVED_LENGTH 5
341
342struct hbm_flow_control {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200343 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300344 u8 me_addr;
345 u8 host_addr;
346 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
347} __packed;
348
Oren Weil5a6003f2011-05-15 13:43:45 +0300349
350#endif