3 * Intel Management Engine Interface (Intel MEI) Linux driver
4 * Copyright (c) 2003-2012, Intel Corporation.
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.
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
17 #ifndef _MEI_HW_TYPES_H_
18 #define _MEI_HW_TYPES_H_
20 #include <linux/uuid.h>
25 #define MEI_HW_READY_TIMEOUT 2 /* Timeout on ready message */
26 #define MEI_CONNECT_TIMEOUT 3 /* HPS: at least 2 seconds */
28 #define MEI_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */
29 #define MEI_CLIENTS_INIT_TIMEOUT 15 /* HPS: Clients Enumeration Timeout */
31 #define MEI_PGI_TIMEOUT 1 /* PG Isolation time response 1 sec */
32 #define MEI_D0I3_TIMEOUT 5 /* D0i3 set/unset max response time */
33 #define MEI_HBM_TIMEOUT 1 /* 1 second */
38 #define HBM_MINOR_VERSION 0
39 #define HBM_MAJOR_VERSION 2
42 * MEI version with PGI support
44 #define HBM_MINOR_VERSION_PGI 1
45 #define HBM_MAJOR_VERSION_PGI 1
48 * MEI version with Dynamic clients support
50 #define HBM_MINOR_VERSION_DC 0
51 #define HBM_MAJOR_VERSION_DC 2
54 * MEI version with immediate reply to enum request support
56 #define HBM_MINOR_VERSION_IE 0
57 #define HBM_MAJOR_VERSION_IE 2
60 * MEI version with disconnect on connection timeout support
62 #define HBM_MINOR_VERSION_DOT 0
63 #define HBM_MAJOR_VERSION_DOT 2
66 * MEI version with notification support
68 #define HBM_MINOR_VERSION_EV 0
69 #define HBM_MAJOR_VERSION_EV 2
72 * MEI version with fixed address client support
74 #define HBM_MINOR_VERSION_FA 0
75 #define HBM_MAJOR_VERSION_FA 2
78 * MEI version with OS ver message support
80 #define HBM_MINOR_VERSION_OS 0
81 #define HBM_MAJOR_VERSION_OS 2
84 * MEI version with dma ring support
86 #define HBM_MINOR_VERSION_DR 1
87 #define HBM_MAJOR_VERSION_DR 2
89 /* Host bus message command opcode */
90 #define MEI_HBM_CMD_OP_MSK 0x7f
91 /* Host bus message command RESPONSE */
92 #define MEI_HBM_CMD_RES_MSK 0x80
95 * MEI Bus Message Command IDs
97 #define HOST_START_REQ_CMD 0x01
98 #define HOST_START_RES_CMD 0x81
100 #define HOST_STOP_REQ_CMD 0x02
101 #define HOST_STOP_RES_CMD 0x82
103 #define ME_STOP_REQ_CMD 0x03
105 #define HOST_ENUM_REQ_CMD 0x04
106 #define HOST_ENUM_RES_CMD 0x84
108 #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
109 #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
111 #define CLIENT_CONNECT_REQ_CMD 0x06
112 #define CLIENT_CONNECT_RES_CMD 0x86
114 #define CLIENT_DISCONNECT_REQ_CMD 0x07
115 #define CLIENT_DISCONNECT_RES_CMD 0x87
117 #define MEI_FLOW_CONTROL_CMD 0x08
119 #define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
120 #define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
121 #define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
122 #define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
124 #define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f
125 #define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f
127 #define MEI_HBM_NOTIFY_REQ_CMD 0x10
128 #define MEI_HBM_NOTIFY_RES_CMD 0x90
129 #define MEI_HBM_NOTIFICATION_CMD 0x11
131 #define MEI_HBM_DMA_SETUP_REQ_CMD 0x12
132 #define MEI_HBM_DMA_SETUP_RES_CMD 0x92
136 * used by hbm_host_stop_request.reason
138 enum mei_stop_reason_types
{
139 DRIVER_STOP_REQUEST
= 0x00,
140 DEVICE_D1_ENTRY
= 0x01,
141 DEVICE_D2_ENTRY
= 0x02,
142 DEVICE_D3_ENTRY
= 0x03,
143 SYSTEM_S1_ENTRY
= 0x04,
144 SYSTEM_S2_ENTRY
= 0x05,
145 SYSTEM_S3_ENTRY
= 0x06,
146 SYSTEM_S4_ENTRY
= 0x07,
147 SYSTEM_S5_ENTRY
= 0x08
152 * enum mei_hbm_status - mei host bus messages return values
154 * @MEI_HBMS_SUCCESS : status success
155 * @MEI_HBMS_CLIENT_NOT_FOUND : client not found
156 * @MEI_HBMS_ALREADY_EXISTS : connection already established
157 * @MEI_HBMS_REJECTED : connection is rejected
158 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
159 * @MEI_HBMS_NOT_ALLOWED : operation not allowed
160 * @MEI_HBMS_ALREADY_STARTED : system is already started
161 * @MEI_HBMS_NOT_STARTED : system not started
163 * @MEI_HBMS_MAX : sentinel
165 enum mei_hbm_status
{
166 MEI_HBMS_SUCCESS
= 0,
167 MEI_HBMS_CLIENT_NOT_FOUND
= 1,
168 MEI_HBMS_ALREADY_EXISTS
= 2,
169 MEI_HBMS_REJECTED
= 3,
170 MEI_HBMS_INVALID_PARAMETER
= 4,
171 MEI_HBMS_NOT_ALLOWED
= 5,
172 MEI_HBMS_ALREADY_STARTED
= 6,
173 MEI_HBMS_NOT_STARTED
= 7,
180 * Client Connect Status
181 * used by hbm_client_connect_response.status
183 enum mei_cl_connect_status
{
184 MEI_CL_CONN_SUCCESS
= MEI_HBMS_SUCCESS
,
185 MEI_CL_CONN_NOT_FOUND
= MEI_HBMS_CLIENT_NOT_FOUND
,
186 MEI_CL_CONN_ALREADY_STARTED
= MEI_HBMS_ALREADY_EXISTS
,
187 MEI_CL_CONN_OUT_OF_RESOURCES
= MEI_HBMS_REJECTED
,
188 MEI_CL_CONN_MESSAGE_SMALL
= MEI_HBMS_INVALID_PARAMETER
,
189 MEI_CL_CONN_NOT_ALLOWED
= MEI_HBMS_NOT_ALLOWED
,
193 * Client Disconnect Status
195 enum mei_cl_disconnect_status
{
196 MEI_CL_DISCONN_SUCCESS
= MEI_HBMS_SUCCESS
200 * struct mei_msg_hdr - MEI BUS Interface Section
202 * @me_addr: device address
203 * @host_addr: host address
204 * @length: message length
205 * @reserved: reserved
206 * @dma_ring: message is on dma ring
207 * @internal: message is internal
208 * @msg_complete: last packet of the message
220 struct mei_bus_message
{
226 * struct hbm_cl_cmd - client specific host bus command
227 * CONNECT, DISCONNECT, and FlOW CONTROL
229 * @hbm_cmd: bus message command header
230 * @me_addr: address of the client in ME
231 * @host_addr: address of the client in the driver
232 * @data: generic data
234 struct mei_hbm_cl_cmd
{
246 struct hbm_host_version_request
{
249 struct hbm_version host_version
;
252 struct hbm_host_version_response
{
254 u8 host_version_supported
;
255 struct hbm_version me_max_version
;
258 struct hbm_host_stop_request
{
264 struct hbm_host_stop_response
{
269 struct hbm_me_stop_request
{
276 * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0)
278 * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add
279 * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately
281 enum hbm_host_enum_flags
{
282 MEI_HBM_ENUM_F_ALLOW_ADD
= BIT(0),
283 MEI_HBM_ENUM_F_IMMEDIATE_ENUM
= BIT(1),
287 * struct hbm_host_enum_request - enumeration request from host to fw
289 * @hbm_cmd : bus message command header
290 * @flags : request flags
291 * @reserved: reserved
293 struct hbm_host_enum_request
{
299 struct hbm_host_enum_response
{
302 u8 valid_addresses
[32];
305 struct mei_client_properties
{
306 uuid_le protocol_name
;
308 u8 max_number_of_connections
;
314 struct hbm_props_request
{
320 struct hbm_props_response
{
325 struct mei_client_properties client_properties
;
329 * struct hbm_add_client_request - request to add a client
330 * might be sent by fw after enumeration has already completed
332 * @hbm_cmd: bus message command header
333 * @me_addr: address of the client in ME
334 * @reserved: reserved
335 * @client_properties: client properties
337 struct hbm_add_client_request
{
341 struct mei_client_properties client_properties
;
345 * struct hbm_add_client_response - response to add a client
346 * sent by the host to report client addition status to fw
348 * @hbm_cmd: bus message command header
349 * @me_addr: address of the client in ME
350 * @status: if HBMS_SUCCESS then the client can now accept connections.
351 * @reserved: reserved
353 struct hbm_add_client_response
{
361 * struct hbm_power_gate - power gate request/response
363 * @hbm_cmd: bus message command header
364 * @reserved: reserved
366 struct hbm_power_gate
{
372 * struct hbm_client_connect_request - connect/disconnect request
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 * @reserved: reserved
379 struct hbm_client_connect_request
{
387 * struct hbm_client_connect_response - connect/disconnect response
389 * @hbm_cmd: bus message command header
390 * @me_addr: address of the client in ME
391 * @host_addr: address of the client in the driver
392 * @status: status of the request
394 struct hbm_client_connect_response
{
402 #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
404 struct hbm_flow_control
{
408 u8 reserved
[MEI_FC_MESSAGE_RESERVED_LENGTH
];
411 #define MEI_HBM_NOTIFICATION_START 1
412 #define MEI_HBM_NOTIFICATION_STOP 0
414 * struct hbm_notification_request - start/stop notification request
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 * @start: start = 1 or stop = 0 asynchronous notifications
421 struct hbm_notification_request
{
429 * struct hbm_notification_response - start/stop notification response
431 * @hbm_cmd: bus message command header
432 * @me_addr: address of the client in ME
433 * @host_addr: - address of the client in the driver
434 * @status: (mei_hbm_status) response status for the request
435 * - MEI_HBMS_SUCCESS: successful stop/start
436 * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
437 * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
438 * started notification.
439 * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
440 * asynchronous notifications are currently disabled.
442 * @start: start = 1 or stop = 0 asynchronous notifications
443 * @reserved: reserved
445 struct hbm_notification_response
{
455 * struct hbm_notification - notification event
457 * @hbm_cmd: bus message command header
458 * @me_addr: address of the client in ME
459 * @host_addr: address of the client in the driver
460 * @reserved: reserved for alignment
462 struct hbm_notification
{
470 * struct hbm_dma_mem_dscr - dma ring
472 * @addr_hi: the high 32bits of 64 bit address
473 * @addr_lo: the low 32bits of 64 bit address
474 * @size : size in bytes (must be power of 2)
476 struct hbm_dma_mem_dscr
{
490 * struct hbm_dma_setup_request - dma setup request
492 * @hbm_cmd: bus message command header
493 * @reserved: reserved for alignment
494 * @dma_dscr: dma descriptor for HOST, DEVICE, and CTRL
496 struct hbm_dma_setup_request
{
499 struct hbm_dma_mem_dscr dma_dscr
[DMA_DSCR_NUM
];
503 * struct hbm_dma_setup_response - dma setup response
505 * @hbm_cmd: bus message command header
506 * @status: 0 on success; otherwise DMA setup failed.
507 * @reserved: reserved for alignment
509 struct hbm_dma_setup_response
{