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