Linux Audio

Check our new training course

Loading...
  1/*
  2 *
  3 * Intel Management Engine Interface (Intel MEI) Linux driver
  4 * Copyright (c) 2003-2012, Intel Corporation.
  5 *
  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/*
 23 * Timeouts in Seconds
 24 */
 25#define MEI_HW_READY_TIMEOUT        2  /* Timeout on ready message */
 26#define MEI_CONNECT_TIMEOUT         3  /* HPS: at least 2 seconds */
 27
 28#define MEI_CL_CONNECT_TIMEOUT     15  /* HPS: Client Connect Timeout */
 29#define MEI_CLIENTS_INIT_TIMEOUT   15  /* HPS: Clients Enumeration Timeout */
 30
 31#define MEI_IAMTHIF_STALL_TIMER    12  /* HPS */
 32
 33#define MEI_PGI_TIMEOUT             1  /* PG Isolation time response 1 sec */
 34#define MEI_D0I3_TIMEOUT            5  /* D0i3 set/unset max response time */
 35#define MEI_HBM_TIMEOUT             1  /* 1 second */
 36
 37/*
 38 * MEI Version
 39 */
 40#define HBM_MINOR_VERSION                   0
 41#define HBM_MAJOR_VERSION                   2
 42
 43/*
 44 * MEI version with PGI support
 45 */
 46#define HBM_MINOR_VERSION_PGI               1
 47#define HBM_MAJOR_VERSION_PGI               1
 48
 49/*
 50 * MEI version with Dynamic clients support
 51 */
 52#define HBM_MINOR_VERSION_DC               0
 53#define HBM_MAJOR_VERSION_DC               2
 54
 55/*
 56 * MEI version with immediate reply to enum request support
 57 */
 58#define HBM_MINOR_VERSION_IE               0
 59#define HBM_MAJOR_VERSION_IE               2
 60
 61/*
 62 * MEI version with disconnect on connection timeout support
 63 */
 64#define HBM_MINOR_VERSION_DOT              0
 65#define HBM_MAJOR_VERSION_DOT              2
 66
 67/*
 68 * MEI version with notifcation support
 69 */
 70#define HBM_MINOR_VERSION_EV               0
 71#define HBM_MAJOR_VERSION_EV               2
 72
 73/*
 74 * MEI version with fixed address client support
 75 */
 76#define HBM_MINOR_VERSION_FA               0
 77#define HBM_MAJOR_VERSION_FA               2
 78
 79/*
 80 * MEI version with OS ver message support
 81 */
 82#define HBM_MINOR_VERSION_OS               0
 83#define HBM_MAJOR_VERSION_OS               2
 84
 85/* Host bus message command opcode */
 86#define MEI_HBM_CMD_OP_MSK                  0x7f
 87/* Host bus message command RESPONSE */
 88#define MEI_HBM_CMD_RES_MSK                 0x80
 89
 90/*
 91 * MEI Bus Message Command IDs
 92 */
 93#define HOST_START_REQ_CMD                  0x01
 94#define HOST_START_RES_CMD                  0x81
 95
 96#define HOST_STOP_REQ_CMD                   0x02
 97#define HOST_STOP_RES_CMD                   0x82
 98
 99#define ME_STOP_REQ_CMD                     0x03
100
101#define HOST_ENUM_REQ_CMD                   0x04
102#define HOST_ENUM_RES_CMD                   0x84
103
104#define HOST_CLIENT_PROPERTIES_REQ_CMD      0x05
105#define HOST_CLIENT_PROPERTIES_RES_CMD      0x85
106
107#define CLIENT_CONNECT_REQ_CMD              0x06
108#define CLIENT_CONNECT_RES_CMD              0x86
109
110#define CLIENT_DISCONNECT_REQ_CMD           0x07
111#define CLIENT_DISCONNECT_RES_CMD           0x87
112
113#define MEI_FLOW_CONTROL_CMD                0x08
114
115#define MEI_PG_ISOLATION_ENTRY_REQ_CMD      0x0a
116#define MEI_PG_ISOLATION_ENTRY_RES_CMD      0x8a
117#define MEI_PG_ISOLATION_EXIT_REQ_CMD       0x0b
118#define MEI_PG_ISOLATION_EXIT_RES_CMD       0x8b
119
120#define MEI_HBM_ADD_CLIENT_REQ_CMD          0x0f
121#define MEI_HBM_ADD_CLIENT_RES_CMD          0x8f
122
123#define MEI_HBM_NOTIFY_REQ_CMD              0x10
124#define MEI_HBM_NOTIFY_RES_CMD              0x90
125#define MEI_HBM_NOTIFICATION_CMD            0x11
126
127/*
128 * MEI Stop Reason
129 * used by hbm_host_stop_request.reason
130 */
131enum mei_stop_reason_types {
132	DRIVER_STOP_REQUEST = 0x00,
133	DEVICE_D1_ENTRY = 0x01,
134	DEVICE_D2_ENTRY = 0x02,
135	DEVICE_D3_ENTRY = 0x03,
136	SYSTEM_S1_ENTRY = 0x04,
137	SYSTEM_S2_ENTRY = 0x05,
138	SYSTEM_S3_ENTRY = 0x06,
139	SYSTEM_S4_ENTRY = 0x07,
140	SYSTEM_S5_ENTRY = 0x08
141};
142
143
144/**
145 * enum mei_hbm_status  - mei host bus messages return values
146 *
147 * @MEI_HBMS_SUCCESS           : status success
148 * @MEI_HBMS_CLIENT_NOT_FOUND  : client not found
149 * @MEI_HBMS_ALREADY_EXISTS    : connection already established
150 * @MEI_HBMS_REJECTED          : connection is rejected
151 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
152 * @MEI_HBMS_NOT_ALLOWED       : operation not allowed
153 * @MEI_HBMS_ALREADY_STARTED   : system is already started
154 * @MEI_HBMS_NOT_STARTED       : system not started
155 *
156 * @MEI_HBMS_MAX               : sentinel
157 */
158enum mei_hbm_status {
159	MEI_HBMS_SUCCESS           = 0,
160	MEI_HBMS_CLIENT_NOT_FOUND  = 1,
161	MEI_HBMS_ALREADY_EXISTS    = 2,
162	MEI_HBMS_REJECTED          = 3,
163	MEI_HBMS_INVALID_PARAMETER = 4,
164	MEI_HBMS_NOT_ALLOWED       = 5,
165	MEI_HBMS_ALREADY_STARTED   = 6,
166	MEI_HBMS_NOT_STARTED       = 7,
167
168	MEI_HBMS_MAX
169};
170
171
172/*
173 * Client Connect Status
174 * used by hbm_client_connect_response.status
175 */
176enum mei_cl_connect_status {
177	MEI_CL_CONN_SUCCESS          = MEI_HBMS_SUCCESS,
178	MEI_CL_CONN_NOT_FOUND        = MEI_HBMS_CLIENT_NOT_FOUND,
179	MEI_CL_CONN_ALREADY_STARTED  = MEI_HBMS_ALREADY_EXISTS,
180	MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
181	MEI_CL_CONN_MESSAGE_SMALL    = MEI_HBMS_INVALID_PARAMETER,
182	MEI_CL_CONN_NOT_ALLOWED      = MEI_HBMS_NOT_ALLOWED,
183};
184
185/*
186 * Client Disconnect Status
187 */
188enum  mei_cl_disconnect_status {
189	MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
190};
191
192/*
193 *  MEI BUS Interface Section
194 */
195struct mei_msg_hdr {
196	u32 me_addr:8;
197	u32 host_addr:8;
198	u32 length:9;
199	u32 reserved:5;
200	u32 internal:1;
201	u32 msg_complete:1;
202} __packed;
203
204
205struct mei_bus_message {
206	u8 hbm_cmd;
207	u8 data[0];
208} __packed;
209
210/**
211 * struct hbm_cl_cmd - client specific host bus command
212 *	CONNECT, DISCONNECT, and FlOW CONTROL
213 *
214 * @hbm_cmd: bus message command header
215 * @me_addr: address of the client in ME
216 * @host_addr: address of the client in the driver
217 * @data: generic data
218 */
219struct mei_hbm_cl_cmd {
220	u8 hbm_cmd;
221	u8 me_addr;
222	u8 host_addr;
223	u8 data;
224};
225
226struct hbm_version {
227	u8 minor_version;
228	u8 major_version;
229} __packed;
230
231struct hbm_host_version_request {
232	u8 hbm_cmd;
233	u8 reserved;
234	struct hbm_version host_version;
235} __packed;
236
237struct hbm_host_version_response {
238	u8 hbm_cmd;
239	u8 host_version_supported;
240	struct hbm_version me_max_version;
241} __packed;
242
243struct hbm_host_stop_request {
244	u8 hbm_cmd;
245	u8 reason;
246	u8 reserved[2];
247} __packed;
248
249struct hbm_host_stop_response {
250	u8 hbm_cmd;
251	u8 reserved[3];
252} __packed;
253
254struct hbm_me_stop_request {
255	u8 hbm_cmd;
256	u8 reason;
257	u8 reserved[2];
258} __packed;
259
260/**
261 * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0)
262 *
263 * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add
264 * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately
265 */
266enum hbm_host_enum_flags {
267	MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
268	MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
269};
270
271/**
272 * struct hbm_host_enum_request - enumeration request from host to fw
273 *
274 * @hbm_cmd : bus message command header
275 * @flags   : request flags
276 * @reserved: reserved
277 */
278struct hbm_host_enum_request {
279	u8 hbm_cmd;
280	u8 flags;
281	u8 reserved[2];
282} __packed;
283
284struct hbm_host_enum_response {
285	u8 hbm_cmd;
286	u8 reserved[3];
287	u8 valid_addresses[32];
288} __packed;
289
290struct mei_client_properties {
291	uuid_le protocol_name;
292	u8 protocol_version;
293	u8 max_number_of_connections;
294	u8 fixed_address;
295	u8 single_recv_buf;
296	u32 max_msg_length;
297} __packed;
298
299struct hbm_props_request {
300	u8 hbm_cmd;
301	u8 me_addr;
302	u8 reserved[2];
303} __packed;
304
305struct hbm_props_response {
306	u8 hbm_cmd;
307	u8 me_addr;
308	u8 status;
309	u8 reserved[1];
310	struct mei_client_properties client_properties;
311} __packed;
312
313/**
314 * struct hbm_add_client_request - request to add a client
315 *     might be sent by fw after enumeration has already completed
316 *
317 * @hbm_cmd: bus message command header
318 * @me_addr: address of the client in ME
319 * @reserved: reserved
320 * @client_properties: client properties
321 */
322struct hbm_add_client_request {
323	u8 hbm_cmd;
324	u8 me_addr;
325	u8 reserved[2];
326	struct mei_client_properties client_properties;
327} __packed;
328
329/**
330 * struct hbm_add_client_response - response to add a client
331 *     sent by the host to report client addition status to fw
332 *
333 * @hbm_cmd: bus message command header
334 * @me_addr: address of the client in ME
335 * @status: if HBMS_SUCCESS then the client can now accept connections.
336 * @reserved: reserved
337 */
338struct hbm_add_client_response {
339	u8 hbm_cmd;
340	u8 me_addr;
341	u8 status;
342	u8 reserved[1];
343} __packed;
344
345/**
346 * struct hbm_power_gate - power gate request/response
347 *
348 * @hbm_cmd: bus message command header
349 * @reserved: reserved
350 */
351struct hbm_power_gate {
352	u8 hbm_cmd;
353	u8 reserved[3];
354} __packed;
355
356/**
357 * struct hbm_client_connect_request - connect/disconnect request
358 *
359 * @hbm_cmd: bus message command header
360 * @me_addr: address of the client in ME
361 * @host_addr: address of the client in the driver
362 * @reserved: reserved
363 */
364struct hbm_client_connect_request {
365	u8 hbm_cmd;
366	u8 me_addr;
367	u8 host_addr;
368	u8 reserved;
369} __packed;
370
371/**
372 * struct hbm_client_connect_response - connect/disconnect response
373 *
374 * @hbm_cmd: bus message command header
375 * @me_addr: address of the client in ME
376 * @host_addr: address of the client in the driver
377 * @status: status of the request
378 */
379struct hbm_client_connect_response {
380	u8 hbm_cmd;
381	u8 me_addr;
382	u8 host_addr;
383	u8 status;
384} __packed;
385
386
387#define MEI_FC_MESSAGE_RESERVED_LENGTH           5
388
389struct hbm_flow_control {
390	u8 hbm_cmd;
391	u8 me_addr;
392	u8 host_addr;
393	u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
394} __packed;
395
396#define MEI_HBM_NOTIFICATION_START 1
397#define MEI_HBM_NOTIFICATION_STOP  0
398/**
399 * struct hbm_notification_request - start/stop notification request
400 *
401 * @hbm_cmd: bus message command header
402 * @me_addr: address of the client in ME
403 * @host_addr: address of the client in the driver
404 * @start:  start = 1 or stop = 0 asynchronous notifications
405 */
406struct hbm_notification_request {
407	u8 hbm_cmd;
408	u8 me_addr;
409	u8 host_addr;
410	u8 start;
411} __packed;
412
413/**
414 * struct hbm_notification_response - start/stop notification response
415 *
416 * @hbm_cmd: bus message command header
417 * @me_addr: address of the client in ME
418 * @host_addr: - address of the client in the driver
419 * @status: (mei_hbm_status) response status for the request
420 *  - MEI_HBMS_SUCCESS: successful stop/start
421 *  - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
422 *  - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
423 *                         started notification.
424 *  - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
425 *                         asynchronous notifications are currently disabled.
426 *
427 * @start:  start = 1 or stop = 0 asynchronous notifications
428 * @reserved: reserved
429 */
430struct hbm_notification_response {
431	u8 hbm_cmd;
432	u8 me_addr;
433	u8 host_addr;
434	u8 status;
435	u8 start;
436	u8 reserved[3];
437} __packed;
438
439/**
440 * struct hbm_notification - notification event
441 *
442 * @hbm_cmd: bus message command header
443 * @me_addr:  address of the client in ME
444 * @host_addr:  address of the client in the driver
445 * @reserved: reserved for alignment
446 */
447struct hbm_notification {
448	u8 hbm_cmd;
449	u8 me_addr;
450	u8 host_addr;
451	u8 reserved[1];
452} __packed;
453
454#endif