blob: dd448e58cc874e83b25e90d80f7b2cf5dd43f744 [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 Winkler1ca7e782012-02-26 23:18:57 +020049/* Host bus message command opcode */
50#define MEI_HBM_CMD_OP_MSK 0x7f
51/* Host bus message command RESPONSE */
52#define MEI_HBM_CMD_RES_MSK 0x80
53
Oren Weil5a6003f2011-05-15 13:43:45 +030054/*
55 * MEI Bus Message Command IDs
56 */
57#define HOST_START_REQ_CMD 0x01
58#define HOST_START_RES_CMD 0x81
59
60#define HOST_STOP_REQ_CMD 0x02
61#define HOST_STOP_RES_CMD 0x82
62
63#define ME_STOP_REQ_CMD 0x03
64
65#define HOST_ENUM_REQ_CMD 0x04
66#define HOST_ENUM_RES_CMD 0x84
67
68#define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
69#define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
70
71#define CLIENT_CONNECT_REQ_CMD 0x06
72#define CLIENT_CONNECT_RES_CMD 0x86
73
74#define CLIENT_DISCONNECT_REQ_CMD 0x07
75#define CLIENT_DISCONNECT_RES_CMD 0x87
76
Tomas Winkler1ca7e782012-02-26 23:18:57 +020077#define MEI_FLOW_CONTROL_CMD 0x08
Oren Weil5a6003f2011-05-15 13:43:45 +030078
Tomas Winkler4fcbc992014-03-18 22:51:55 +020079#define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
80#define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
81#define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
82#define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
83
Oren Weil5a6003f2011-05-15 13:43:45 +030084/*
85 * MEI Stop Reason
86 * used by hbm_host_stop_request.reason
87 */
88enum mei_stop_reason_types {
89 DRIVER_STOP_REQUEST = 0x00,
90 DEVICE_D1_ENTRY = 0x01,
91 DEVICE_D2_ENTRY = 0x02,
92 DEVICE_D3_ENTRY = 0x03,
93 SYSTEM_S1_ENTRY = 0x04,
94 SYSTEM_S2_ENTRY = 0x05,
95 SYSTEM_S3_ENTRY = 0x06,
96 SYSTEM_S4_ENTRY = 0x07,
97 SYSTEM_S5_ENTRY = 0x08
98};
99
100/*
101 * Client Connect Status
102 * used by hbm_client_connect_response.status
103 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200104enum mei_cl_connect_status {
105 MEI_CL_CONN_SUCCESS = 0x00,
106 MEI_CL_CONN_NOT_FOUND = 0x01,
107 MEI_CL_CONN_ALREADY_STARTED = 0x02,
108 MEI_CL_CONN_OUT_OF_RESOURCES = 0x03,
109 MEI_CL_CONN_MESSAGE_SMALL = 0x04
Oren Weil5a6003f2011-05-15 13:43:45 +0300110};
111
112/*
113 * Client Disconnect Status
114 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200115enum mei_cl_disconnect_status {
116 MEI_CL_DISCONN_SUCCESS = 0x00
Oren Weil5a6003f2011-05-15 13:43:45 +0300117};
118
119/*
120 * MEI BUS Interface Section
121 */
122struct mei_msg_hdr {
123 u32 me_addr:8;
124 u32 host_addr:8;
125 u32 length:9;
Tomas Winkler479327f2013-12-17 15:56:56 +0200126 u32 reserved:5;
127 u32 internal:1;
Oren Weil5a6003f2011-05-15 13:43:45 +0300128 u32 msg_complete:1;
129} __packed;
130
131
Oren Weil5a6003f2011-05-15 13:43:45 +0300132struct mei_bus_message {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200133 u8 hbm_cmd;
134 u8 data[0];
Oren Weil5a6003f2011-05-15 13:43:45 +0300135} __packed;
136
Tomas Winklercd51ed62012-12-25 19:06:09 +0200137/**
138 * struct hbm_cl_cmd - client specific host bus command
139 * CONNECT, DISCONNECT, and FlOW CONTROL
140 *
141 * @hbm_cmd - bus message command header
142 * @me_addr - address of the client in ME
143 * @host_addr - address of the client in the driver
144 * @data
145 */
146struct mei_hbm_cl_cmd {
147 u8 hbm_cmd;
148 u8 me_addr;
149 u8 host_addr;
150 u8 data;
151};
152
Oren Weil5a6003f2011-05-15 13:43:45 +0300153struct hbm_version {
154 u8 minor_version;
155 u8 major_version;
156} __packed;
157
158struct hbm_host_version_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200159 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300160 u8 reserved;
161 struct hbm_version host_version;
162} __packed;
163
164struct hbm_host_version_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200165 u8 hbm_cmd;
Tomas Winkler4b007062012-02-23 21:52:55 +0200166 u8 host_version_supported;
Oren Weil5a6003f2011-05-15 13:43:45 +0300167 struct hbm_version me_max_version;
168} __packed;
169
170struct hbm_host_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200171 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300172 u8 reason;
173 u8 reserved[2];
174} __packed;
175
176struct hbm_host_stop_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200177 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300178 u8 reserved[3];
179} __packed;
180
181struct hbm_me_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200182 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300183 u8 reason;
184 u8 reserved[2];
185} __packed;
186
187struct hbm_host_enum_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200188 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300189 u8 reserved[3];
190} __packed;
191
192struct hbm_host_enum_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200193 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300194 u8 reserved[3];
195 u8 valid_addresses[32];
196} __packed;
197
198struct mei_client_properties {
199 uuid_le protocol_name;
200 u8 protocol_version;
201 u8 max_number_of_connections;
202 u8 fixed_address;
203 u8 single_recv_buf;
204 u32 max_msg_length;
205} __packed;
206
207struct hbm_props_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200208 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300209 u8 address;
210 u8 reserved[2];
211} __packed;
212
213
214struct hbm_props_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200215 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300216 u8 address;
217 u8 status;
218 u8 reserved[1];
219 struct mei_client_properties client_properties;
220} __packed;
221
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200222/**
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200223 * struct hbm_power_gate - power gate request/response
224 *
225 * @hbm_cmd - bus message command header
226 * @reserved[3]
227 */
228struct hbm_power_gate {
229 u8 hbm_cmd;
230 u8 reserved[3];
231} __packed;
232
233/**
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200234 * struct hbm_client_connect_request - connect/disconnect request
235 *
236 * @hbm_cmd - bus message command header
237 * @me_addr - address of the client in ME
238 * @host_addr - address of the client in the driver
239 * @reserved
240 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300241struct hbm_client_connect_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200242 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300243 u8 me_addr;
244 u8 host_addr;
245 u8 reserved;
246} __packed;
247
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200248/**
249 * struct hbm_client_connect_response - connect/disconnect response
250 *
251 * @hbm_cmd - bus message command header
252 * @me_addr - address of the client in ME
253 * @host_addr - address of the client in the driver
254 * @status - status of the request
255 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300256struct hbm_client_connect_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200257 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300258 u8 me_addr;
259 u8 host_addr;
260 u8 status;
261} __packed;
262
Oren Weil5a6003f2011-05-15 13:43:45 +0300263
264#define MEI_FC_MESSAGE_RESERVED_LENGTH 5
265
266struct hbm_flow_control {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200267 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300268 u8 me_addr;
269 u8 host_addr;
270 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
271} __packed;
272
Oren Weil5a6003f2011-05-15 13:43:45 +0300273
274#endif