blob: ec4a91a534e65369d36231b6dcf17b8e65dd634a [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 Winkler7d93e582014-01-14 23:10:10 +020034#define MEI_HBM_TIMEOUT 1 /* 1 second */
Oren Weil5a6003f2011-05-15 13:43:45 +030035
36/*
Oren Weil5a6003f2011-05-15 13:43:45 +030037 * MEI Version
38 */
39#define HBM_MINOR_VERSION 0
40#define HBM_MAJOR_VERSION 1
Oren Weil5a6003f2011-05-15 13:43:45 +030041
Tomas Winkleree7e5af2014-03-18 22:51:58 +020042/*
43 * MEI version with PGI support
44 */
45#define HBM_MINOR_VERSION_PGI 1
46#define HBM_MAJOR_VERSION_PGI 1
47
Tomas Winkler1ca7e782012-02-26 23:18:57 +020048/* Host bus message command opcode */
49#define MEI_HBM_CMD_OP_MSK 0x7f
50/* Host bus message command RESPONSE */
51#define MEI_HBM_CMD_RES_MSK 0x80
52
Oren Weil5a6003f2011-05-15 13:43:45 +030053/*
54 * MEI Bus Message Command IDs
55 */
56#define HOST_START_REQ_CMD 0x01
57#define HOST_START_RES_CMD 0x81
58
59#define HOST_STOP_REQ_CMD 0x02
60#define HOST_STOP_RES_CMD 0x82
61
62#define ME_STOP_REQ_CMD 0x03
63
64#define HOST_ENUM_REQ_CMD 0x04
65#define HOST_ENUM_RES_CMD 0x84
66
67#define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
68#define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
69
70#define CLIENT_CONNECT_REQ_CMD 0x06
71#define CLIENT_CONNECT_RES_CMD 0x86
72
73#define CLIENT_DISCONNECT_REQ_CMD 0x07
74#define CLIENT_DISCONNECT_RES_CMD 0x87
75
Tomas Winkler1ca7e782012-02-26 23:18:57 +020076#define MEI_FLOW_CONTROL_CMD 0x08
Oren Weil5a6003f2011-05-15 13:43:45 +030077
Tomas Winkler4fcbc992014-03-18 22:51:55 +020078#define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
79#define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
80#define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
81#define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
82
Oren Weil5a6003f2011-05-15 13:43:45 +030083/*
84 * MEI Stop Reason
85 * used by hbm_host_stop_request.reason
86 */
87enum mei_stop_reason_types {
88 DRIVER_STOP_REQUEST = 0x00,
89 DEVICE_D1_ENTRY = 0x01,
90 DEVICE_D2_ENTRY = 0x02,
91 DEVICE_D3_ENTRY = 0x03,
92 SYSTEM_S1_ENTRY = 0x04,
93 SYSTEM_S2_ENTRY = 0x05,
94 SYSTEM_S3_ENTRY = 0x06,
95 SYSTEM_S4_ENTRY = 0x07,
96 SYSTEM_S5_ENTRY = 0x08
97};
98
99/*
100 * Client Connect Status
101 * used by hbm_client_connect_response.status
102 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200103enum mei_cl_connect_status {
104 MEI_CL_CONN_SUCCESS = 0x00,
105 MEI_CL_CONN_NOT_FOUND = 0x01,
106 MEI_CL_CONN_ALREADY_STARTED = 0x02,
107 MEI_CL_CONN_OUT_OF_RESOURCES = 0x03,
108 MEI_CL_CONN_MESSAGE_SMALL = 0x04
Oren Weil5a6003f2011-05-15 13:43:45 +0300109};
110
111/*
112 * Client Disconnect Status
113 */
Alexander Usyskin285e2992014-02-17 15:13:20 +0200114enum mei_cl_disconnect_status {
115 MEI_CL_DISCONN_SUCCESS = 0x00
Oren Weil5a6003f2011-05-15 13:43:45 +0300116};
117
118/*
119 * MEI BUS Interface Section
120 */
121struct mei_msg_hdr {
122 u32 me_addr:8;
123 u32 host_addr:8;
124 u32 length:9;
Tomas Winkler479327f2013-12-17 15:56:56 +0200125 u32 reserved:5;
126 u32 internal:1;
Oren Weil5a6003f2011-05-15 13:43:45 +0300127 u32 msg_complete:1;
128} __packed;
129
130
Oren Weil5a6003f2011-05-15 13:43:45 +0300131struct mei_bus_message {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200132 u8 hbm_cmd;
133 u8 data[0];
Oren Weil5a6003f2011-05-15 13:43:45 +0300134} __packed;
135
Tomas Winklercd51ed62012-12-25 19:06:09 +0200136/**
137 * struct hbm_cl_cmd - client specific host bus command
138 * CONNECT, DISCONNECT, and FlOW CONTROL
139 *
140 * @hbm_cmd - bus message command header
141 * @me_addr - address of the client in ME
142 * @host_addr - address of the client in the driver
143 * @data
144 */
145struct mei_hbm_cl_cmd {
146 u8 hbm_cmd;
147 u8 me_addr;
148 u8 host_addr;
149 u8 data;
150};
151
Oren Weil5a6003f2011-05-15 13:43:45 +0300152struct hbm_version {
153 u8 minor_version;
154 u8 major_version;
155} __packed;
156
157struct hbm_host_version_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200158 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300159 u8 reserved;
160 struct hbm_version host_version;
161} __packed;
162
163struct hbm_host_version_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200164 u8 hbm_cmd;
Tomas Winkler4b007062012-02-23 21:52:55 +0200165 u8 host_version_supported;
Oren Weil5a6003f2011-05-15 13:43:45 +0300166 struct hbm_version me_max_version;
167} __packed;
168
169struct hbm_host_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200170 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300171 u8 reason;
172 u8 reserved[2];
173} __packed;
174
175struct hbm_host_stop_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200176 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300177 u8 reserved[3];
178} __packed;
179
180struct hbm_me_stop_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200181 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300182 u8 reason;
183 u8 reserved[2];
184} __packed;
185
186struct hbm_host_enum_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200187 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300188 u8 reserved[3];
189} __packed;
190
191struct hbm_host_enum_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200192 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300193 u8 reserved[3];
194 u8 valid_addresses[32];
195} __packed;
196
197struct mei_client_properties {
198 uuid_le protocol_name;
199 u8 protocol_version;
200 u8 max_number_of_connections;
201 u8 fixed_address;
202 u8 single_recv_buf;
203 u32 max_msg_length;
204} __packed;
205
206struct hbm_props_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200207 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300208 u8 address;
209 u8 reserved[2];
210} __packed;
211
212
213struct hbm_props_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200214 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300215 u8 address;
216 u8 status;
217 u8 reserved[1];
218 struct mei_client_properties client_properties;
219} __packed;
220
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200221/**
Tomas Winkler4fcbc992014-03-18 22:51:55 +0200222 * struct hbm_power_gate - power gate request/response
223 *
224 * @hbm_cmd - bus message command header
225 * @reserved[3]
226 */
227struct hbm_power_gate {
228 u8 hbm_cmd;
229 u8 reserved[3];
230} __packed;
231
232/**
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200233 * struct hbm_client_connect_request - connect/disconnect request
234 *
235 * @hbm_cmd - bus message command header
236 * @me_addr - address of the client in ME
237 * @host_addr - address of the client in the driver
238 * @reserved
239 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300240struct hbm_client_connect_request {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200241 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300242 u8 me_addr;
243 u8 host_addr;
244 u8 reserved;
245} __packed;
246
Tomas Winkleraeba4a02012-11-11 17:38:04 +0200247/**
248 * struct hbm_client_connect_response - connect/disconnect response
249 *
250 * @hbm_cmd - bus message command header
251 * @me_addr - address of the client in ME
252 * @host_addr - address of the client in the driver
253 * @status - status of the request
254 */
Oren Weil5a6003f2011-05-15 13:43:45 +0300255struct hbm_client_connect_response {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200256 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300257 u8 me_addr;
258 u8 host_addr;
259 u8 status;
260} __packed;
261
Oren Weil5a6003f2011-05-15 13:43:45 +0300262
263#define MEI_FC_MESSAGE_RESERVED_LENGTH 5
264
265struct hbm_flow_control {
Tomas Winkler1ca7e782012-02-26 23:18:57 +0200266 u8 hbm_cmd;
Oren Weil5a6003f2011-05-15 13:43:45 +0300267 u8 me_addr;
268 u8 host_addr;
269 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
270} __packed;
271
Oren Weil5a6003f2011-05-15 13:43:45 +0300272
273#endif