1
2
3
4
5
6
7#ifndef _MEI_HW_TYPES_H_
8#define _MEI_HW_TYPES_H_
9
10#include <linux/uuid.h>
11
12
13
14
15#define MEI_HW_READY_TIMEOUT 2
16#define MEI_CONNECT_TIMEOUT 3
17
18#define MEI_CL_CONNECT_TIMEOUT 15
19#define MEI_CLIENTS_INIT_TIMEOUT 15
20
21#define MEI_PGI_TIMEOUT 1
22#define MEI_D0I3_TIMEOUT 5
23#define MEI_HBM_TIMEOUT 1
24
25
26
27
28#define HBM_MINOR_VERSION 1
29#define HBM_MAJOR_VERSION 2
30
31
32
33
34#define HBM_MINOR_VERSION_PGI 1
35#define HBM_MAJOR_VERSION_PGI 1
36
37
38
39
40#define HBM_MINOR_VERSION_DC 0
41#define HBM_MAJOR_VERSION_DC 2
42
43
44
45
46#define HBM_MINOR_VERSION_IE 0
47#define HBM_MAJOR_VERSION_IE 2
48
49
50
51
52#define HBM_MINOR_VERSION_DOT 0
53#define HBM_MAJOR_VERSION_DOT 2
54
55
56
57
58#define HBM_MINOR_VERSION_EV 0
59#define HBM_MAJOR_VERSION_EV 2
60
61
62
63
64#define HBM_MINOR_VERSION_FA 0
65#define HBM_MAJOR_VERSION_FA 2
66
67
68
69
70#define HBM_MINOR_VERSION_OS 0
71#define HBM_MAJOR_VERSION_OS 2
72
73
74
75
76#define HBM_MINOR_VERSION_DR 1
77#define HBM_MAJOR_VERSION_DR 2
78
79
80#define MEI_HBM_CMD_OP_MSK 0x7f
81
82#define MEI_HBM_CMD_RES_MSK 0x80
83
84
85
86
87#define HOST_START_REQ_CMD 0x01
88#define HOST_START_RES_CMD 0x81
89
90#define HOST_STOP_REQ_CMD 0x02
91#define HOST_STOP_RES_CMD 0x82
92
93#define ME_STOP_REQ_CMD 0x03
94
95#define HOST_ENUM_REQ_CMD 0x04
96#define HOST_ENUM_RES_CMD 0x84
97
98#define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
99#define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
100
101#define CLIENT_CONNECT_REQ_CMD 0x06
102#define CLIENT_CONNECT_RES_CMD 0x86
103
104#define CLIENT_DISCONNECT_REQ_CMD 0x07
105#define CLIENT_DISCONNECT_RES_CMD 0x87
106
107#define MEI_FLOW_CONTROL_CMD 0x08
108
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
113
114#define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f
115#define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f
116
117#define MEI_HBM_NOTIFY_REQ_CMD 0x10
118#define MEI_HBM_NOTIFY_RES_CMD 0x90
119#define MEI_HBM_NOTIFICATION_CMD 0x11
120
121#define MEI_HBM_DMA_SETUP_REQ_CMD 0x12
122#define MEI_HBM_DMA_SETUP_RES_CMD 0x92
123
124
125
126
127
128enum 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
138};
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155enum 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,
164
165 MEI_HBMS_MAX
166};
167
168
169
170
171
172
173enum 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,
180};
181
182
183
184
185enum mei_cl_disconnect_status {
186 MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
187};
188
189
190
191
192
193
194
195
196
197
198
199
200
201struct mei_msg_hdr {
202 u32 me_addr:8;
203 u32 host_addr:8;
204 u32 length:9;
205 u32 reserved:4;
206 u32 dma_ring:1;
207 u32 internal:1;
208 u32 msg_complete:1;
209 u32 extension[0];
210} __packed;
211
212
213#define MEI_MSG_MAX_LEN_MASK GENMASK(9, 0)
214
215#define MEI_MSG_HDR_MAX 2
216
217struct mei_bus_message {
218 u8 hbm_cmd;
219 u8 data[];
220} __packed;
221
222
223
224
225
226
227
228
229
230
231struct mei_hbm_cl_cmd {
232 u8 hbm_cmd;
233 u8 me_addr;
234 u8 host_addr;
235 u8 data;
236};
237
238struct hbm_version {
239 u8 minor_version;
240 u8 major_version;
241} __packed;
242
243struct hbm_host_version_request {
244 u8 hbm_cmd;
245 u8 reserved;
246 struct hbm_version host_version;
247} __packed;
248
249struct hbm_host_version_response {
250 u8 hbm_cmd;
251 u8 host_version_supported;
252 struct hbm_version me_max_version;
253} __packed;
254
255struct hbm_host_stop_request {
256 u8 hbm_cmd;
257 u8 reason;
258 u8 reserved[2];
259} __packed;
260
261struct hbm_host_stop_response {
262 u8 hbm_cmd;
263 u8 reserved[3];
264} __packed;
265
266struct hbm_me_stop_request {
267 u8 hbm_cmd;
268 u8 reason;
269 u8 reserved[2];
270} __packed;
271
272
273
274
275
276
277
278enum hbm_host_enum_flags {
279 MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
280 MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
281};
282
283
284
285
286
287
288
289
290struct hbm_host_enum_request {
291 u8 hbm_cmd;
292 u8 flags;
293 u8 reserved[2];
294} __packed;
295
296struct hbm_host_enum_response {
297 u8 hbm_cmd;
298 u8 reserved[3];
299 u8 valid_addresses[32];
300} __packed;
301
302struct mei_client_properties {
303 uuid_le protocol_name;
304 u8 protocol_version;
305 u8 max_number_of_connections;
306 u8 fixed_address;
307 u8 single_recv_buf:1;
308 u8 reserved:7;
309 u32 max_msg_length;
310} __packed;
311
312struct hbm_props_request {
313 u8 hbm_cmd;
314 u8 me_addr;
315 u8 reserved[2];
316} __packed;
317
318struct hbm_props_response {
319 u8 hbm_cmd;
320 u8 me_addr;
321 u8 status;
322 u8 reserved;
323 struct mei_client_properties client_properties;
324} __packed;
325
326
327
328
329
330
331
332
333
334
335struct hbm_add_client_request {
336 u8 hbm_cmd;
337 u8 me_addr;
338 u8 reserved[2];
339 struct mei_client_properties client_properties;
340} __packed;
341
342
343
344
345
346
347
348
349
350
351struct hbm_add_client_response {
352 u8 hbm_cmd;
353 u8 me_addr;
354 u8 status;
355 u8 reserved;
356} __packed;
357
358
359
360
361
362
363
364struct hbm_power_gate {
365 u8 hbm_cmd;
366 u8 reserved[3];
367} __packed;
368
369
370
371
372
373
374
375
376
377struct hbm_client_connect_request {
378 u8 hbm_cmd;
379 u8 me_addr;
380 u8 host_addr;
381 u8 reserved;
382} __packed;
383
384
385
386
387
388
389
390
391
392struct hbm_client_connect_response {
393 u8 hbm_cmd;
394 u8 me_addr;
395 u8 host_addr;
396 u8 status;
397} __packed;
398
399
400#define MEI_FC_MESSAGE_RESERVED_LENGTH 5
401
402struct hbm_flow_control {
403 u8 hbm_cmd;
404 u8 me_addr;
405 u8 host_addr;
406 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
407} __packed;
408
409#define MEI_HBM_NOTIFICATION_START 1
410#define MEI_HBM_NOTIFICATION_STOP 0
411
412
413
414
415
416
417
418
419struct hbm_notification_request {
420 u8 hbm_cmd;
421 u8 me_addr;
422 u8 host_addr;
423 u8 start;
424} __packed;
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443struct hbm_notification_response {
444 u8 hbm_cmd;
445 u8 me_addr;
446 u8 host_addr;
447 u8 status;
448 u8 start;
449 u8 reserved[3];
450} __packed;
451
452
453
454
455
456
457
458
459
460struct hbm_notification {
461 u8 hbm_cmd;
462 u8 me_addr;
463 u8 host_addr;
464 u8 reserved;
465} __packed;
466
467
468
469
470
471
472
473
474struct hbm_dma_mem_dscr {
475 u32 addr_hi;
476 u32 addr_lo;
477 u32 size;
478} __packed;
479
480enum {
481 DMA_DSCR_HOST = 0,
482 DMA_DSCR_DEVICE = 1,
483 DMA_DSCR_CTRL = 2,
484 DMA_DSCR_NUM,
485};
486
487
488
489
490
491
492
493
494struct hbm_dma_setup_request {
495 u8 hbm_cmd;
496 u8 reserved[3];
497 struct hbm_dma_mem_dscr dma_dscr[DMA_DSCR_NUM];
498} __packed;
499
500
501
502
503
504
505
506
507struct hbm_dma_setup_response {
508 u8 hbm_cmd;
509 u8 status;
510 u8 reserved[2];
511} __packed;
512
513
514
515
516
517
518
519
520
521
522
523
524
525struct hbm_dma_ring_ctrl {
526 u32 hbuf_wr_idx;
527 u32 reserved1;
528 u32 hbuf_rd_idx;
529 u32 reserved2;
530 u32 dbuf_wr_idx;
531 u32 reserved3;
532 u32 dbuf_rd_idx;
533 u32 reserved4;
534} __packed;
535
536#endif
537