1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2003-2020, Intel Corporation. All rights reserved
4 * Intel Management Engine Interface (Intel MEI) Linux driver
7 #ifndef _MEI_HW_TYPES_H_
8 #define _MEI_HW_TYPES_H_
10 #include <linux/uuid.h>
15 #define MEI_HW_READY_TIMEOUT 2 /* Timeout on ready message */
16 #define MEI_CONNECT_TIMEOUT 3 /* HPS: at least 2 seconds */
18 #define MEI_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */
19 #define MEI_CLIENTS_INIT_TIMEOUT 15 /* HPS: Clients Enumeration Timeout */
21 #define MEI_PGI_TIMEOUT 1 /* PG Isolation time response 1 sec */
22 #define MEI_D0I3_TIMEOUT 5 /* D0i3 set/unset max response time */
23 #define MEI_HBM_TIMEOUT 1 /* 1 second */
28 #define HBM_MINOR_VERSION 1
29 #define HBM_MAJOR_VERSION 2
32 * MEI version with PGI support
34 #define HBM_MINOR_VERSION_PGI 1
35 #define HBM_MAJOR_VERSION_PGI 1
38 * MEI version with Dynamic clients support
40 #define HBM_MINOR_VERSION_DC 0
41 #define HBM_MAJOR_VERSION_DC 2
44 * MEI version with immediate reply to enum request support
46 #define HBM_MINOR_VERSION_IE 0
47 #define HBM_MAJOR_VERSION_IE 2
50 * MEI version with disconnect on connection timeout support
52 #define HBM_MINOR_VERSION_DOT 0
53 #define HBM_MAJOR_VERSION_DOT 2
56 * MEI version with notification support
58 #define HBM_MINOR_VERSION_EV 0
59 #define HBM_MAJOR_VERSION_EV 2
62 * MEI version with fixed address client support
64 #define HBM_MINOR_VERSION_FA 0
65 #define HBM_MAJOR_VERSION_FA 2
68 * MEI version with OS ver message support
70 #define HBM_MINOR_VERSION_OS 0
71 #define HBM_MAJOR_VERSION_OS 2
74 * MEI version with dma ring support
76 #define HBM_MINOR_VERSION_DR 1
77 #define HBM_MAJOR_VERSION_DR 2
79 /* Host bus message command opcode */
80 #define MEI_HBM_CMD_OP_MSK 0x7f
81 /* Host bus message command RESPONSE */
82 #define MEI_HBM_CMD_RES_MSK 0x80
85 * MEI Bus Message Command IDs
87 #define HOST_START_REQ_CMD 0x01
88 #define HOST_START_RES_CMD 0x81
90 #define HOST_STOP_REQ_CMD 0x02
91 #define HOST_STOP_RES_CMD 0x82
93 #define ME_STOP_REQ_CMD 0x03
95 #define HOST_ENUM_REQ_CMD 0x04
96 #define HOST_ENUM_RES_CMD 0x84
98 #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
99 #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
101 #define CLIENT_CONNECT_REQ_CMD 0x06
102 #define CLIENT_CONNECT_RES_CMD 0x86
104 #define CLIENT_DISCONNECT_REQ_CMD 0x07
105 #define CLIENT_DISCONNECT_RES_CMD 0x87
107 #define MEI_FLOW_CONTROL_CMD 0x08
109 #define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
110 #define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
111 #define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
112 #define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
114 #define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f
115 #define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f
117 #define MEI_HBM_NOTIFY_REQ_CMD 0x10
118 #define MEI_HBM_NOTIFY_RES_CMD 0x90
119 #define MEI_HBM_NOTIFICATION_CMD 0x11
121 #define MEI_HBM_DMA_SETUP_REQ_CMD 0x12
122 #define MEI_HBM_DMA_SETUP_RES_CMD 0x92
126 * used by hbm_host_stop_request.reason
128 enum mei_stop_reason_types {
129 DRIVER_STOP_REQUEST = 0x00,
130 DEVICE_D1_ENTRY = 0x01,
131 DEVICE_D2_ENTRY = 0x02,
132 DEVICE_D3_ENTRY = 0x03,
133 SYSTEM_S1_ENTRY = 0x04,
134 SYSTEM_S2_ENTRY = 0x05,
135 SYSTEM_S3_ENTRY = 0x06,
136 SYSTEM_S4_ENTRY = 0x07,
137 SYSTEM_S5_ENTRY = 0x08
142 * enum mei_hbm_status - mei host bus messages return values
144 * @MEI_HBMS_SUCCESS : status success
145 * @MEI_HBMS_CLIENT_NOT_FOUND : client not found
146 * @MEI_HBMS_ALREADY_EXISTS : connection already established
147 * @MEI_HBMS_REJECTED : connection is rejected
148 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
149 * @MEI_HBMS_NOT_ALLOWED : operation not allowed
150 * @MEI_HBMS_ALREADY_STARTED : system is already started
151 * @MEI_HBMS_NOT_STARTED : system not started
153 * @MEI_HBMS_MAX : sentinel
155 enum mei_hbm_status {
156 MEI_HBMS_SUCCESS = 0,
157 MEI_HBMS_CLIENT_NOT_FOUND = 1,
158 MEI_HBMS_ALREADY_EXISTS = 2,
159 MEI_HBMS_REJECTED = 3,
160 MEI_HBMS_INVALID_PARAMETER = 4,
161 MEI_HBMS_NOT_ALLOWED = 5,
162 MEI_HBMS_ALREADY_STARTED = 6,
163 MEI_HBMS_NOT_STARTED = 7,
170 * Client Connect Status
171 * used by hbm_client_connect_response.status
173 enum mei_cl_connect_status {
174 MEI_CL_CONN_SUCCESS = MEI_HBMS_SUCCESS,
175 MEI_CL_CONN_NOT_FOUND = MEI_HBMS_CLIENT_NOT_FOUND,
176 MEI_CL_CONN_ALREADY_STARTED = MEI_HBMS_ALREADY_EXISTS,
177 MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
178 MEI_CL_CONN_MESSAGE_SMALL = MEI_HBMS_INVALID_PARAMETER,
179 MEI_CL_CONN_NOT_ALLOWED = MEI_HBMS_NOT_ALLOWED,
183 * Client Disconnect Status
185 enum mei_cl_disconnect_status {
186 MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
190 * struct mei_msg_hdr - MEI BUS Interface Section
192 * @me_addr: device address
193 * @host_addr: host address
194 * @length: message length
195 * @reserved: reserved
196 * @dma_ring: message is on dma ring
197 * @internal: message is internal
198 * @msg_complete: last packet of the message
199 * @extension: extension of the header
212 /* The length is up to 9 bits */
213 #define MEI_MSG_MAX_LEN_MASK GENMASK(9, 0)
215 #define MEI_MSG_HDR_MAX 2
217 struct mei_bus_message {
223 * struct hbm_cl_cmd - client specific host bus command
224 * CONNECT, DISCONNECT, and FlOW CONTROL
226 * @hbm_cmd: bus message command header
227 * @me_addr: address of the client in ME
228 * @host_addr: address of the client in the driver
229 * @data: generic data
231 struct mei_hbm_cl_cmd {
243 struct hbm_host_version_request {
246 struct hbm_version host_version;
249 struct hbm_host_version_response {
251 u8 host_version_supported;
252 struct hbm_version me_max_version;
255 struct hbm_host_stop_request {
261 struct hbm_host_stop_response {
266 struct hbm_me_stop_request {
273 * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0)
275 * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add
276 * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately
278 enum hbm_host_enum_flags {
279 MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
280 MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
284 * struct hbm_host_enum_request - enumeration request from host to fw
286 * @hbm_cmd : bus message command header
287 * @flags : request flags
288 * @reserved: reserved
290 struct hbm_host_enum_request {
296 struct hbm_host_enum_response {
299 u8 valid_addresses[32];
302 struct mei_client_properties {
303 uuid_le protocol_name;
305 u8 max_number_of_connections;
307 u8 single_recv_buf:1;
312 struct hbm_props_request {
318 struct hbm_props_response {
323 struct mei_client_properties client_properties;
327 * struct hbm_add_client_request - request to add a client
328 * might be sent by fw after enumeration has already completed
330 * @hbm_cmd: bus message command header
331 * @me_addr: address of the client in ME
332 * @reserved: reserved
333 * @client_properties: client properties
335 struct hbm_add_client_request {
339 struct mei_client_properties client_properties;
343 * struct hbm_add_client_response - response to add a client
344 * sent by the host to report client addition status to fw
346 * @hbm_cmd: bus message command header
347 * @me_addr: address of the client in ME
348 * @status: if HBMS_SUCCESS then the client can now accept connections.
349 * @reserved: reserved
351 struct hbm_add_client_response {
359 * struct hbm_power_gate - power gate request/response
361 * @hbm_cmd: bus message command header
362 * @reserved: reserved
364 struct hbm_power_gate {
370 * struct hbm_client_connect_request - connect/disconnect request
372 * @hbm_cmd: bus message command header
373 * @me_addr: address of the client in ME
374 * @host_addr: address of the client in the driver
375 * @reserved: reserved
377 struct hbm_client_connect_request {
385 * struct hbm_client_connect_response - connect/disconnect response
387 * @hbm_cmd: bus message command header
388 * @me_addr: address of the client in ME
389 * @host_addr: address of the client in the driver
390 * @status: status of the request
392 struct hbm_client_connect_response {
400 #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
402 struct hbm_flow_control {
406 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
409 #define MEI_HBM_NOTIFICATION_START 1
410 #define MEI_HBM_NOTIFICATION_STOP 0
412 * struct hbm_notification_request - start/stop notification request
414 * @hbm_cmd: bus message command header
415 * @me_addr: address of the client in ME
416 * @host_addr: address of the client in the driver
417 * @start: start = 1 or stop = 0 asynchronous notifications
419 struct hbm_notification_request {
427 * struct hbm_notification_response - start/stop notification response
429 * @hbm_cmd: bus message command header
430 * @me_addr: address of the client in ME
431 * @host_addr: - address of the client in the driver
432 * @status: (mei_hbm_status) response status for the request
433 * - MEI_HBMS_SUCCESS: successful stop/start
434 * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
435 * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
436 * started notification.
437 * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
438 * asynchronous notifications are currently disabled.
440 * @start: start = 1 or stop = 0 asynchronous notifications
441 * @reserved: reserved
443 struct hbm_notification_response {
453 * struct hbm_notification - notification event
455 * @hbm_cmd: bus message command header
456 * @me_addr: address of the client in ME
457 * @host_addr: address of the client in the driver
458 * @reserved: reserved for alignment
460 struct hbm_notification {
468 * struct hbm_dma_mem_dscr - dma ring
470 * @addr_hi: the high 32bits of 64 bit address
471 * @addr_lo: the low 32bits of 64 bit address
472 * @size : size in bytes (must be power of 2)
474 struct hbm_dma_mem_dscr {
488 * struct hbm_dma_setup_request - dma setup request
490 * @hbm_cmd: bus message command header
491 * @reserved: reserved for alignment
492 * @dma_dscr: dma descriptor for HOST, DEVICE, and CTRL
494 struct hbm_dma_setup_request {
497 struct hbm_dma_mem_dscr dma_dscr[DMA_DSCR_NUM];
501 * struct hbm_dma_setup_response - dma setup response
503 * @hbm_cmd: bus message command header
504 * @status: 0 on success; otherwise DMA setup failed.
505 * @reserved: reserved for alignment
507 struct hbm_dma_setup_response {
514 * struct mei_dma_ring_ctrl - dma ring control block
516 * @hbuf_wr_idx: host circular buffer write index in slots
517 * @reserved1: reserved for alignment
518 * @hbuf_rd_idx: host circular buffer read index in slots
519 * @reserved2: reserved for alignment
520 * @dbuf_wr_idx: device circular buffer write index in slots
521 * @reserved3: reserved for alignment
522 * @dbuf_rd_idx: device circular buffer read index in slots
523 * @reserved4: reserved for alignment
525 struct hbm_dma_ring_ctrl {