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
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
138 };
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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,
164
165 MEI_HBMS_MAX
166 };
167
168
169
170
171
172
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,
180 };
181
182
183
184
185 enum 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
201 struct 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 #define MEI_MSG_HDR_MAX 2
213
214 struct mei_bus_message {
215 u8 hbm_cmd;
216 u8 data[0];
217 } __packed;
218
219
220
221
222
223
224
225
226
227
228 struct mei_hbm_cl_cmd {
229 u8 hbm_cmd;
230 u8 me_addr;
231 u8 host_addr;
232 u8 data;
233 };
234
235 struct hbm_version {
236 u8 minor_version;
237 u8 major_version;
238 } __packed;
239
240 struct hbm_host_version_request {
241 u8 hbm_cmd;
242 u8 reserved;
243 struct hbm_version host_version;
244 } __packed;
245
246 struct hbm_host_version_response {
247 u8 hbm_cmd;
248 u8 host_version_supported;
249 struct hbm_version me_max_version;
250 } __packed;
251
252 struct hbm_host_stop_request {
253 u8 hbm_cmd;
254 u8 reason;
255 u8 reserved[2];
256 } __packed;
257
258 struct hbm_host_stop_response {
259 u8 hbm_cmd;
260 u8 reserved[3];
261 } __packed;
262
263 struct hbm_me_stop_request {
264 u8 hbm_cmd;
265 u8 reason;
266 u8 reserved[2];
267 } __packed;
268
269
270
271
272
273
274
275 enum hbm_host_enum_flags {
276 MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
277 MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
278 };
279
280
281
282
283
284
285
286
287 struct hbm_host_enum_request {
288 u8 hbm_cmd;
289 u8 flags;
290 u8 reserved[2];
291 } __packed;
292
293 struct hbm_host_enum_response {
294 u8 hbm_cmd;
295 u8 reserved[3];
296 u8 valid_addresses[32];
297 } __packed;
298
299 struct mei_client_properties {
300 uuid_le protocol_name;
301 u8 protocol_version;
302 u8 max_number_of_connections;
303 u8 fixed_address;
304 u8 single_recv_buf:1;
305 u8 reserved:7;
306 u32 max_msg_length;
307 } __packed;
308
309 struct hbm_props_request {
310 u8 hbm_cmd;
311 u8 me_addr;
312 u8 reserved[2];
313 } __packed;
314
315 struct hbm_props_response {
316 u8 hbm_cmd;
317 u8 me_addr;
318 u8 status;
319 u8 reserved[1];
320 struct mei_client_properties client_properties;
321 } __packed;
322
323
324
325
326
327
328
329
330
331
332 struct hbm_add_client_request {
333 u8 hbm_cmd;
334 u8 me_addr;
335 u8 reserved[2];
336 struct mei_client_properties client_properties;
337 } __packed;
338
339
340
341
342
343
344
345
346
347
348 struct hbm_add_client_response {
349 u8 hbm_cmd;
350 u8 me_addr;
351 u8 status;
352 u8 reserved[1];
353 } __packed;
354
355
356
357
358
359
360
361 struct hbm_power_gate {
362 u8 hbm_cmd;
363 u8 reserved[3];
364 } __packed;
365
366
367
368
369
370
371
372
373
374 struct hbm_client_connect_request {
375 u8 hbm_cmd;
376 u8 me_addr;
377 u8 host_addr;
378 u8 reserved;
379 } __packed;
380
381
382
383
384
385
386
387
388
389 struct hbm_client_connect_response {
390 u8 hbm_cmd;
391 u8 me_addr;
392 u8 host_addr;
393 u8 status;
394 } __packed;
395
396
397 #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
398
399 struct hbm_flow_control {
400 u8 hbm_cmd;
401 u8 me_addr;
402 u8 host_addr;
403 u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
404 } __packed;
405
406 #define MEI_HBM_NOTIFICATION_START 1
407 #define MEI_HBM_NOTIFICATION_STOP 0
408
409
410
411
412
413
414
415
416 struct hbm_notification_request {
417 u8 hbm_cmd;
418 u8 me_addr;
419 u8 host_addr;
420 u8 start;
421 } __packed;
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440 struct hbm_notification_response {
441 u8 hbm_cmd;
442 u8 me_addr;
443 u8 host_addr;
444 u8 status;
445 u8 start;
446 u8 reserved[3];
447 } __packed;
448
449
450
451
452
453
454
455
456
457 struct hbm_notification {
458 u8 hbm_cmd;
459 u8 me_addr;
460 u8 host_addr;
461 u8 reserved[1];
462 } __packed;
463
464
465
466
467
468
469
470
471 struct hbm_dma_mem_dscr {
472 u32 addr_hi;
473 u32 addr_lo;
474 u32 size;
475 } __packed;
476
477 enum {
478 DMA_DSCR_HOST = 0,
479 DMA_DSCR_DEVICE = 1,
480 DMA_DSCR_CTRL = 2,
481 DMA_DSCR_NUM,
482 };
483
484
485
486
487
488
489
490
491 struct hbm_dma_setup_request {
492 u8 hbm_cmd;
493 u8 reserved[3];
494 struct hbm_dma_mem_dscr dma_dscr[DMA_DSCR_NUM];
495 } __packed;
496
497
498
499
500
501
502
503
504 struct hbm_dma_setup_response {
505 u8 hbm_cmd;
506 u8 status;
507 u8 reserved[2];
508 } __packed;
509
510
511
512
513
514
515
516
517
518
519
520
521
522 struct hbm_dma_ring_ctrl {
523 u32 hbuf_wr_idx;
524 u32 reserved1;
525 u32 hbuf_rd_idx;
526 u32 reserved2;
527 u32 dbuf_wr_idx;
528 u32 reserved3;
529 u32 dbuf_rd_idx;
530 u32 reserved4;
531 } __packed;
532
533 #endif