]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - drivers/misc/mei/hw.h
media: vb2: add waiting_in_dqbuf flag
[mirror_ubuntu-eoan-kernel.git] / drivers / misc / mei / hw.h
CommitLineData
5a6003f2
OW
1/*
2 *
3 * Intel Management Engine Interface (Intel MEI) Linux driver
733ba91c 4 * Copyright (c) 2003-2012, Intel Corporation.
5a6003f2
OW
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/*
3870c320 23 * Timeouts in Seconds
5a6003f2 24 */
7d93e58d 25#define MEI_HW_READY_TIMEOUT 2 /* Timeout on ready message */
3870c320 26#define MEI_CONNECT_TIMEOUT 3 /* HPS: at least 2 seconds */
5a6003f2 27
3870c320
TW
28#define MEI_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */
29#define MEI_CLIENTS_INIT_TIMEOUT 15 /* HPS: Clients Enumeration Timeout */
5a6003f2 30
859ef2ff
AU
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 */
5a6003f2
OW
34
35/*
36 * MEI Version
37 */
d2227583 38#define HBM_MINOR_VERSION 1
155718cf 39#define HBM_MAJOR_VERSION 2
5a6003f2 40
ee7e5afd
TW
41/*
42 * MEI version with PGI support
43 */
44#define HBM_MINOR_VERSION_PGI 1
45#define HBM_MAJOR_VERSION_PGI 1
46
70ef835c
TW
47/*
48 * MEI version with Dynamic clients support
49 */
50#define HBM_MINOR_VERSION_DC 0
51#define HBM_MAJOR_VERSION_DC 2
52
27f476ea
AU
53/*
54 * MEI version with immediate reply to enum request support
55 */
56#define HBM_MINOR_VERSION_IE 0
57#define HBM_MAJOR_VERSION_IE 2
58
18901357
AU
59/*
60 * MEI version with disconnect on connection timeout support
61 */
62#define HBM_MINOR_VERSION_DOT 0
63#define HBM_MAJOR_VERSION_DOT 2
64
4d99877d 65/*
b6a38565 66 * MEI version with notification support
4d99877d
TW
67 */
68#define HBM_MINOR_VERSION_EV 0
69#define HBM_MAJOR_VERSION_EV 2
70
f4e06246
AU
71/*
72 * MEI version with fixed address client support
73 */
74#define HBM_MINOR_VERSION_FA 0
75#define HBM_MAJOR_VERSION_FA 2
76
7ee7f45a
AU
77/*
78 * MEI version with OS ver message support
79 */
80#define HBM_MINOR_VERSION_OS 0
81#define HBM_MAJOR_VERSION_OS 2
82
c2bd9fc1
TW
83/*
84 * MEI version with dma ring support
85 */
86#define HBM_MINOR_VERSION_DR 1
87#define HBM_MAJOR_VERSION_DR 2
88
1ca7e782
TW
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
93
5a6003f2
OW
94/*
95 * MEI Bus Message Command IDs
96 */
97#define HOST_START_REQ_CMD 0x01
98#define HOST_START_RES_CMD 0x81
99
100#define HOST_STOP_REQ_CMD 0x02
101#define HOST_STOP_RES_CMD 0x82
102
103#define ME_STOP_REQ_CMD 0x03
104
105#define HOST_ENUM_REQ_CMD 0x04
106#define HOST_ENUM_RES_CMD 0x84
107
108#define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
109#define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
110
111#define CLIENT_CONNECT_REQ_CMD 0x06
112#define CLIENT_CONNECT_RES_CMD 0x86
113
114#define CLIENT_DISCONNECT_REQ_CMD 0x07
115#define CLIENT_DISCONNECT_RES_CMD 0x87
116
1ca7e782 117#define MEI_FLOW_CONTROL_CMD 0x08
5a6003f2 118
4fcbc99b
TW
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
123
70ef835c
TW
124#define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f
125#define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f
d3c1c809
TW
126
127#define MEI_HBM_NOTIFY_REQ_CMD 0x10
128#define MEI_HBM_NOTIFY_RES_CMD 0x90
129#define MEI_HBM_NOTIFICATION_CMD 0x11
130
ee7aba5a
TW
131#define MEI_HBM_DMA_SETUP_REQ_CMD 0x12
132#define MEI_HBM_DMA_SETUP_RES_CMD 0x92
133
5a6003f2
OW
134/*
135 * MEI Stop Reason
136 * used by hbm_host_stop_request.reason
137 */
138enum 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
148};
149
89778d6e
TW
150
151/**
a8605ea2 152 * enum mei_hbm_status - mei host bus messages return values
89778d6e 153 *
a8605ea2
AU
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
ce23139c
AU
162 *
163 * @MEI_HBMS_MAX : sentinel
89778d6e
TW
164 */
165enum 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,
174
175 MEI_HBMS_MAX
176};
177
178
5a6003f2
OW
179/*
180 * Client Connect Status
181 * used by hbm_client_connect_response.status
182 */
285e2996 183enum mei_cl_connect_status {
89778d6e
TW
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,
71e117f2 189 MEI_CL_CONN_NOT_ALLOWED = MEI_HBMS_NOT_ALLOWED,
5a6003f2
OW
190};
191
192/*
193 * Client Disconnect Status
194 */
285e2996 195enum mei_cl_disconnect_status {
89778d6e 196 MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
5a6003f2
OW
197};
198
9d89ddfc
TW
199/**
200 * struct mei_msg_hdr - MEI BUS Interface Section
201 *
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
6316321f 209 * @extension: extension of the header
5a6003f2
OW
210 */
211struct mei_msg_hdr {
212 u32 me_addr:8;
213 u32 host_addr:8;
214 u32 length:9;
9d89ddfc
TW
215 u32 reserved:4;
216 u32 dma_ring:1;
479327fc 217 u32 internal:1;
5a6003f2 218 u32 msg_complete:1;
6316321f 219 u32 extension[0];
5a6003f2
OW
220} __packed;
221
6316321f
TW
222#define MEI_MSG_HDR_MAX 2
223
5a6003f2 224struct mei_bus_message {
1ca7e782
TW
225 u8 hbm_cmd;
226 u8 data[0];
5a6003f2
OW
227} __packed;
228
cd51ed64
TW
229/**
230 * struct hbm_cl_cmd - client specific host bus command
231 * CONNECT, DISCONNECT, and FlOW CONTROL
232 *
a8605ea2
AU
233 * @hbm_cmd: bus message command header
234 * @me_addr: address of the client in ME
235 * @host_addr: address of the client in the driver
236 * @data: generic data
cd51ed64
TW
237 */
238struct mei_hbm_cl_cmd {
239 u8 hbm_cmd;
240 u8 me_addr;
241 u8 host_addr;
242 u8 data;
243};
244
5a6003f2
OW
245struct hbm_version {
246 u8 minor_version;
247 u8 major_version;
248} __packed;
249
250struct hbm_host_version_request {
1ca7e782 251 u8 hbm_cmd;
5a6003f2
OW
252 u8 reserved;
253 struct hbm_version host_version;
254} __packed;
255
256struct hbm_host_version_response {
1ca7e782 257 u8 hbm_cmd;
4b00706c 258 u8 host_version_supported;
5a6003f2
OW
259 struct hbm_version me_max_version;
260} __packed;
261
262struct hbm_host_stop_request {
1ca7e782 263 u8 hbm_cmd;
5a6003f2
OW
264 u8 reason;
265 u8 reserved[2];
266} __packed;
267
268struct hbm_host_stop_response {
1ca7e782 269 u8 hbm_cmd;
5a6003f2
OW
270 u8 reserved[3];
271} __packed;
272
273struct hbm_me_stop_request {
1ca7e782 274 u8 hbm_cmd;
5a6003f2
OW
275 u8 reason;
276 u8 reserved[2];
277} __packed;
278
70ef835c 279/**
27f476ea 280 * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0)
70ef835c 281 *
27f476ea
AU
282 * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add
283 * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately
284 */
285enum hbm_host_enum_flags {
286 MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
287 MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
288};
289
290/**
291 * struct hbm_host_enum_request - enumeration request from host to fw
292 *
293 * @hbm_cmd : bus message command header
294 * @flags : request flags
70ef835c
TW
295 * @reserved: reserved
296 */
5a6003f2 297struct hbm_host_enum_request {
1ca7e782 298 u8 hbm_cmd;
27f476ea 299 u8 flags;
70ef835c 300 u8 reserved[2];
5a6003f2
OW
301} __packed;
302
303struct hbm_host_enum_response {
1ca7e782 304 u8 hbm_cmd;
5a6003f2
OW
305 u8 reserved[3];
306 u8 valid_addresses[32];
307} __packed;
308
309struct mei_client_properties {
310 uuid_le protocol_name;
311 u8 protocol_version;
312 u8 max_number_of_connections;
313 u8 fixed_address;
4ad84cb5
AU
314 u8 single_recv_buf:1;
315 u8 reserved:7;
5a6003f2
OW
316 u32 max_msg_length;
317} __packed;
318
319struct hbm_props_request {
1ca7e782 320 u8 hbm_cmd;
3438c1f3 321 u8 me_addr;
5a6003f2
OW
322 u8 reserved[2];
323} __packed;
324
5a6003f2 325struct hbm_props_response {
1ca7e782 326 u8 hbm_cmd;
3438c1f3 327 u8 me_addr;
5a6003f2
OW
328 u8 status;
329 u8 reserved[1];
330 struct mei_client_properties client_properties;
331} __packed;
332
70ef835c
TW
333/**
334 * struct hbm_add_client_request - request to add a client
335 * might be sent by fw after enumeration has already completed
336 *
337 * @hbm_cmd: bus message command header
338 * @me_addr: address of the client in ME
339 * @reserved: reserved
340 * @client_properties: client properties
341 */
342struct hbm_add_client_request {
343 u8 hbm_cmd;
344 u8 me_addr;
345 u8 reserved[2];
346 struct mei_client_properties client_properties;
347} __packed;
348
349/**
350 * struct hbm_add_client_response - response to add a client
351 * sent by the host to report client addition status to fw
352 *
353 * @hbm_cmd: bus message command header
354 * @me_addr: address of the client in ME
355 * @status: if HBMS_SUCCESS then the client can now accept connections.
356 * @reserved: reserved
357 */
358struct hbm_add_client_response {
359 u8 hbm_cmd;
360 u8 me_addr;
361 u8 status;
362 u8 reserved[1];
363} __packed;
364
4fcbc99b
TW
365/**
366 * struct hbm_power_gate - power gate request/response
367 *
a8605ea2
AU
368 * @hbm_cmd: bus message command header
369 * @reserved: reserved
4fcbc99b
TW
370 */
371struct hbm_power_gate {
372 u8 hbm_cmd;
373 u8 reserved[3];
374} __packed;
375
aeba4a06
TW
376/**
377 * struct hbm_client_connect_request - connect/disconnect request
378 *
a8605ea2
AU
379 * @hbm_cmd: bus message command header
380 * @me_addr: address of the client in ME
381 * @host_addr: address of the client in the driver
382 * @reserved: reserved
aeba4a06 383 */
5a6003f2 384struct hbm_client_connect_request {
1ca7e782 385 u8 hbm_cmd;
5a6003f2
OW
386 u8 me_addr;
387 u8 host_addr;
388 u8 reserved;
389} __packed;
390
aeba4a06
TW
391/**
392 * struct hbm_client_connect_response - connect/disconnect response
393 *
a8605ea2
AU
394 * @hbm_cmd: bus message command header
395 * @me_addr: address of the client in ME
396 * @host_addr: address of the client in the driver
397 * @status: status of the request
aeba4a06 398 */
5a6003f2 399struct hbm_client_connect_response {
1ca7e782 400 u8 hbm_cmd;
5a6003f2
OW
401 u8 me_addr;
402 u8 host_addr;
403 u8 status;
404} __packed;
405
5a6003f2
OW
406
407#define MEI_FC_MESSAGE_RESERVED_LENGTH 5
408
409struct hbm_flow_control {
1ca7e782 410 u8 hbm_cmd;
5a6003f2
OW
411 u8 me_addr;
412 u8 host_addr;
413 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
414} __packed;
415
d3c1c809
TW
416#define MEI_HBM_NOTIFICATION_START 1
417#define MEI_HBM_NOTIFICATION_STOP 0
418/**
419 * struct hbm_notification_request - start/stop notification request
420 *
421 * @hbm_cmd: bus message command header
422 * @me_addr: address of the client in ME
423 * @host_addr: address of the client in the driver
424 * @start: start = 1 or stop = 0 asynchronous notifications
425 */
426struct hbm_notification_request {
427 u8 hbm_cmd;
428 u8 me_addr;
429 u8 host_addr;
430 u8 start;
431} __packed;
432
433/**
434 * struct hbm_notification_response - start/stop notification response
435 *
436 * @hbm_cmd: bus message command header
437 * @me_addr: address of the client in ME
438 * @host_addr: - address of the client in the driver
439 * @status: (mei_hbm_status) response status for the request
440 * - MEI_HBMS_SUCCESS: successful stop/start
441 * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
442 * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
443 * started notification.
444 * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
445 * asynchronous notifications are currently disabled.
446 *
447 * @start: start = 1 or stop = 0 asynchronous notifications
448 * @reserved: reserved
449 */
450struct hbm_notification_response {
451 u8 hbm_cmd;
452 u8 me_addr;
453 u8 host_addr;
454 u8 status;
455 u8 start;
456 u8 reserved[3];
457} __packed;
458
459/**
460 * struct hbm_notification - notification event
461 *
462 * @hbm_cmd: bus message command header
463 * @me_addr: address of the client in ME
464 * @host_addr: address of the client in the driver
465 * @reserved: reserved for alignment
466 */
467struct hbm_notification {
468 u8 hbm_cmd;
469 u8 me_addr;
470 u8 host_addr;
471 u8 reserved[1];
472} __packed;
5a6003f2 473
ee7aba5a
TW
474/**
475 * struct hbm_dma_mem_dscr - dma ring
476 *
477 * @addr_hi: the high 32bits of 64 bit address
478 * @addr_lo: the low 32bits of 64 bit address
479 * @size : size in bytes (must be power of 2)
480 */
481struct hbm_dma_mem_dscr {
482 u32 addr_hi;
483 u32 addr_lo;
484 u32 size;
485} __packed;
486
487enum {
488 DMA_DSCR_HOST = 0,
489 DMA_DSCR_DEVICE = 1,
490 DMA_DSCR_CTRL = 2,
491 DMA_DSCR_NUM,
492};
493
494/**
495 * struct hbm_dma_setup_request - dma setup request
496 *
497 * @hbm_cmd: bus message command header
498 * @reserved: reserved for alignment
499 * @dma_dscr: dma descriptor for HOST, DEVICE, and CTRL
500 */
501struct hbm_dma_setup_request {
502 u8 hbm_cmd;
503 u8 reserved[3];
504 struct hbm_dma_mem_dscr dma_dscr[DMA_DSCR_NUM];
505} __packed;
506
507/**
508 * struct hbm_dma_setup_response - dma setup response
509 *
510 * @hbm_cmd: bus message command header
511 * @status: 0 on success; otherwise DMA setup failed.
512 * @reserved: reserved for alignment
513 */
514struct hbm_dma_setup_response {
515 u8 hbm_cmd;
516 u8 status;
517 u8 reserved[2];
518} __packed;
519
2513eb0d
TW
520/**
521 * struct mei_dma_ring_ctrl - dma ring control block
522 *
523 * @hbuf_wr_idx: host circular buffer write index in slots
524 * @reserved1: reserved for alignment
525 * @hbuf_rd_idx: host circular buffer read index in slots
526 * @reserved2: reserved for alignment
527 * @dbuf_wr_idx: device circular buffer write index in slots
528 * @reserved3: reserved for alignment
529 * @dbuf_rd_idx: device circular buffer read index in slots
530 * @reserved4: reserved for alignment
531 */
532struct hbm_dma_ring_ctrl {
533 u32 hbuf_wr_idx;
534 u32 reserved1;
535 u32 hbuf_rd_idx;
536 u32 reserved2;
537 u32 dbuf_wr_idx;
538 u32 reserved3;
539 u32 dbuf_rd_idx;
540 u32 reserved4;
541} __packed;
542
5a6003f2 543#endif