Linux Audio

Check our new training course

Loading...
v6.13.7
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Copyright (c) 2003-2022, Intel Corporation. All rights reserved
  4 * Intel Management Engine Interface (Intel MEI) Linux driver
 
 
 
 
 
 
 
 
 
 
 
  5 */
  6
  7#ifndef _MEI_HW_TYPES_H_
  8#define _MEI_HW_TYPES_H_
  9
 10#include <linux/mei.h>
 11
 12/*
 13 * Timeouts in Seconds
 14 */
 15#define MEI_HW_READY_TIMEOUT        2  /* Timeout on ready message */
 16#define MEI_CONNECT_TIMEOUT         3  /* HPS: at least 2 seconds */
 17
 18#define MEI_CL_CONNECT_TIMEOUT     15  /* HPS: Client Connect Timeout */
 19#define MEI_CL_CONNECT_TIMEOUT_SLOW 30 /* HPS: Client Connect Timeout, slow FW */
 20#define MEI_CLIENTS_INIT_TIMEOUT   15  /* HPS: Clients Enumeration Timeout */
 21
 
 
 22#define MEI_PGI_TIMEOUT             1  /* PG Isolation time response 1 sec */
 23#define MEI_D0I3_TIMEOUT            5  /* D0i3 set/unset max response time */
 24#define MEI_HBM_TIMEOUT             1  /* 1 second */
 25#define MEI_HBM_TIMEOUT_SLOW        5  /* 5 second, slow FW */
 26
 27#define MKHI_RCV_TIMEOUT 500 /* receive timeout in msec */
 28#define MKHI_RCV_TIMEOUT_SLOW 10000 /* receive timeout in msec, slow FW */
 29
 30/*
 31 * FW page size for DMA allocations
 32 */
 33#define MEI_FW_PAGE_SIZE 4096UL
 34
 35/*
 36 * MEI Version
 37 */
 38#define HBM_MINOR_VERSION                   2
 39#define HBM_MAJOR_VERSION                   2
 40
 41/*
 42 * MEI version with PGI support
 43 */
 44#define HBM_MINOR_VERSION_PGI               1
 45#define HBM_MAJOR_VERSION_PGI               1
 46
 47/*
 48 * MEI version with Dynamic clients support
 49 */
 50#define HBM_MINOR_VERSION_DC               0
 51#define HBM_MAJOR_VERSION_DC               2
 52
 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
 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
 65/*
 66 * MEI version with notification support
 67 */
 68#define HBM_MINOR_VERSION_EV               0
 69#define HBM_MAJOR_VERSION_EV               2
 70
 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
 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
 83/*
 84 * MEI version with dma ring support
 85 */
 86#define HBM_MINOR_VERSION_DR               1
 87#define HBM_MAJOR_VERSION_DR               2
 88
 89/*
 90 * MEI version with vm tag support
 91 */
 92#define HBM_MINOR_VERSION_VT               2
 93#define HBM_MAJOR_VERSION_VT               2
 94
 95/*
 96 * MEI version with GSC support
 97 */
 98#define HBM_MINOR_VERSION_GSC              2
 99#define HBM_MAJOR_VERSION_GSC              2
100
101/*
102 * MEI version with capabilities message support
103 */
104#define HBM_MINOR_VERSION_CAP              2
105#define HBM_MAJOR_VERSION_CAP              2
106
107/*
108 * MEI version with client DMA support
109 */
110#define HBM_MINOR_VERSION_CD               2
111#define HBM_MAJOR_VERSION_CD               2
112
113/* Host bus message command opcode */
114#define MEI_HBM_CMD_OP_MSK                  0x7f
115/* Host bus message command RESPONSE */
116#define MEI_HBM_CMD_RES_MSK                 0x80
117
118/*
119 * MEI Bus Message Command IDs
120 */
121#define HOST_START_REQ_CMD                  0x01
122#define HOST_START_RES_CMD                  0x81
123
124#define HOST_STOP_REQ_CMD                   0x02
125#define HOST_STOP_RES_CMD                   0x82
126
127#define ME_STOP_REQ_CMD                     0x03
128
129#define HOST_ENUM_REQ_CMD                   0x04
130#define HOST_ENUM_RES_CMD                   0x84
131
132#define HOST_CLIENT_PROPERTIES_REQ_CMD      0x05
133#define HOST_CLIENT_PROPERTIES_RES_CMD      0x85
134
135#define CLIENT_CONNECT_REQ_CMD              0x06
136#define CLIENT_CONNECT_RES_CMD              0x86
137
138#define CLIENT_DISCONNECT_REQ_CMD           0x07
139#define CLIENT_DISCONNECT_RES_CMD           0x87
140
141#define MEI_FLOW_CONTROL_CMD                0x08
142
143#define MEI_PG_ISOLATION_ENTRY_REQ_CMD      0x0a
144#define MEI_PG_ISOLATION_ENTRY_RES_CMD      0x8a
145#define MEI_PG_ISOLATION_EXIT_REQ_CMD       0x0b
146#define MEI_PG_ISOLATION_EXIT_RES_CMD       0x8b
147
148#define MEI_HBM_ADD_CLIENT_REQ_CMD          0x0f
149#define MEI_HBM_ADD_CLIENT_RES_CMD          0x8f
150
151#define MEI_HBM_NOTIFY_REQ_CMD              0x10
152#define MEI_HBM_NOTIFY_RES_CMD              0x90
153#define MEI_HBM_NOTIFICATION_CMD            0x11
154
155#define MEI_HBM_DMA_SETUP_REQ_CMD           0x12
156#define MEI_HBM_DMA_SETUP_RES_CMD           0x92
157
158#define MEI_HBM_CAPABILITIES_REQ_CMD        0x13
159#define MEI_HBM_CAPABILITIES_RES_CMD        0x93
160
161#define MEI_HBM_CLIENT_DMA_MAP_REQ_CMD      0x14
162#define MEI_HBM_CLIENT_DMA_MAP_RES_CMD      0x94
163
164#define MEI_HBM_CLIENT_DMA_UNMAP_REQ_CMD    0x15
165#define MEI_HBM_CLIENT_DMA_UNMAP_RES_CMD    0x95
166
167/*
168 * MEI Stop Reason
169 * used by hbm_host_stop_request.reason
170 */
171enum mei_stop_reason_types {
172	DRIVER_STOP_REQUEST = 0x00,
173	DEVICE_D1_ENTRY = 0x01,
174	DEVICE_D2_ENTRY = 0x02,
175	DEVICE_D3_ENTRY = 0x03,
176	SYSTEM_S1_ENTRY = 0x04,
177	SYSTEM_S2_ENTRY = 0x05,
178	SYSTEM_S3_ENTRY = 0x06,
179	SYSTEM_S4_ENTRY = 0x07,
180	SYSTEM_S5_ENTRY = 0x08
181};
182
183
184/**
185 * enum mei_hbm_status  - mei host bus messages return values
186 *
187 * @MEI_HBMS_SUCCESS           : status success
188 * @MEI_HBMS_CLIENT_NOT_FOUND  : client not found
189 * @MEI_HBMS_ALREADY_EXISTS    : connection already established
190 * @MEI_HBMS_REJECTED          : connection is rejected
191 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
192 * @MEI_HBMS_NOT_ALLOWED       : operation not allowed
193 * @MEI_HBMS_ALREADY_STARTED   : system is already started
194 * @MEI_HBMS_NOT_STARTED       : system not started
195 *
196 * @MEI_HBMS_MAX               : sentinel
197 */
198enum mei_hbm_status {
199	MEI_HBMS_SUCCESS           = 0,
200	MEI_HBMS_CLIENT_NOT_FOUND  = 1,
201	MEI_HBMS_ALREADY_EXISTS    = 2,
202	MEI_HBMS_REJECTED          = 3,
203	MEI_HBMS_INVALID_PARAMETER = 4,
204	MEI_HBMS_NOT_ALLOWED       = 5,
205	MEI_HBMS_ALREADY_STARTED   = 6,
206	MEI_HBMS_NOT_STARTED       = 7,
207
208	MEI_HBMS_MAX
209};
210
211
212/*
213 * Client Connect Status
214 * used by hbm_client_connect_response.status
215 */
216enum mei_cl_connect_status {
217	MEI_CL_CONN_SUCCESS          = MEI_HBMS_SUCCESS,
218	MEI_CL_CONN_NOT_FOUND        = MEI_HBMS_CLIENT_NOT_FOUND,
219	MEI_CL_CONN_ALREADY_STARTED  = MEI_HBMS_ALREADY_EXISTS,
220	MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
221	MEI_CL_CONN_MESSAGE_SMALL    = MEI_HBMS_INVALID_PARAMETER,
222	MEI_CL_CONN_NOT_ALLOWED      = MEI_HBMS_NOT_ALLOWED,
223};
224
225/*
226 * Client Disconnect Status
227 */
228enum mei_cl_disconnect_status {
229	MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
230};
231
232/**
233 * enum mei_ext_hdr_type - extended header type used in
234 *    extended header TLV
235 *
236 * @MEI_EXT_HDR_NONE: sentinel
237 * @MEI_EXT_HDR_VTAG: vtag header
238 * @MEI_EXT_HDR_GSC: gsc header
239 */
240enum mei_ext_hdr_type {
241	MEI_EXT_HDR_NONE = 0,
242	MEI_EXT_HDR_VTAG = 1,
243	MEI_EXT_HDR_GSC = 2,
244};
245
246/**
247 * struct mei_ext_hdr - extend header descriptor (TLV)
248 * @type: enum mei_ext_hdr_type
249 * @length: length excluding descriptor
250 */
251struct mei_ext_hdr {
252	u8 type;
253	u8 length;
254} __packed;
255
256/**
257 * struct mei_ext_meta_hdr - extend header meta data
258 * @count: number of headers
259 * @size: total size of the extended header list excluding meta header
260 * @reserved: reserved
261 * @hdrs: extended headers TLV list
262 */
263struct mei_ext_meta_hdr {
264	u8 count;
265	u8 size;
266	u8 reserved[2];
267	u8 hdrs[];
268} __packed;
269
270/**
271 * struct mei_ext_hdr_vtag - extend header for vtag
272 *
273 * @hdr: standard extend header
274 * @vtag: virtual tag
275 * @reserved: reserved
276 */
277struct mei_ext_hdr_vtag {
278	struct mei_ext_hdr hdr;
279	u8 vtag;
280	u8 reserved;
281} __packed;
282
283/*
284 * Extended header iterator functions
285 */
286/**
287 * mei_ext_begin - extended header iterator begin
288 *
289 * @meta: meta header of the extended header list
290 *
291 * Return: The first extended header
292 */
293static inline struct mei_ext_hdr *mei_ext_begin(struct mei_ext_meta_hdr *meta)
294{
295	return (struct mei_ext_hdr *)meta->hdrs;
296}
297
298/**
299 * mei_ext_last - check if the ext is the last one in the TLV list
300 *
301 * @meta: meta header of the extended header list
302 * @ext: a meta header on the list
303 *
304 * Return: true if ext is the last header on the list
305 */
306static inline bool mei_ext_last(struct mei_ext_meta_hdr *meta,
307				struct mei_ext_hdr *ext)
308{
309	return (u8 *)ext >= (u8 *)meta + sizeof(*meta) + (meta->size * 4);
310}
311
312struct mei_gsc_sgl {
313	u32 low;
314	u32 high;
315	u32 length;
316} __packed;
317
318#define GSC_HECI_MSG_KERNEL 0
319#define GSC_HECI_MSG_USER   1
320
321#define GSC_ADDRESS_TYPE_GTT   0
322#define GSC_ADDRESS_TYPE_PPGTT 1
323#define GSC_ADDRESS_TYPE_PHYSICAL_CONTINUOUS 2 /* max of 64K */
324#define GSC_ADDRESS_TYPE_PHYSICAL_SGL 3
325
326/**
327 * struct mei_ext_hdr_gsc_h2f - extended header: gsc host to firmware interface
328 *
329 * @hdr: extended header
330 * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER
331 * @addr_type: GSC_ADDRESS_TYPE_{GTT, PPGTT, PHYSICAL_CONTINUOUS, PHYSICAL_SGL}
332 * @fence_id: synchronization marker
333 * @input_address_count: number of input sgl buffers
334 * @output_address_count: number of output sgl buffers
335 * @reserved: reserved
336 * @sgl: sg list
337 */
338struct mei_ext_hdr_gsc_h2f {
339	struct mei_ext_hdr hdr;
340	u8                 client_id;
341	u8                 addr_type;
342	u32                fence_id;
343	u8                 input_address_count;
344	u8                 output_address_count;
345	u8                 reserved[2];
346	struct mei_gsc_sgl sgl[];
347} __packed;
348
349/**
350 * struct mei_ext_hdr_gsc_f2h - gsc firmware to host interface
351 *
352 * @hdr: extended header
353 * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER
354 * @reserved: reserved
355 * @fence_id: synchronization marker
356 * @written: number of bytes written to firmware
357 */
358struct mei_ext_hdr_gsc_f2h {
359	struct mei_ext_hdr hdr;
360	u8                 client_id;
361	u8                 reserved;
362	u32                fence_id;
363	u32                written;
364} __packed;
365
366/**
367 * mei_ext_next - following extended header on the TLV list
368 *
369 * @ext: current extend header
370 *
371 * Context: The function does not check for the overflows,
372 *          one should call mei_ext_last before.
373 *
374 * Return: The following extend header after @ext
375 */
376static inline struct mei_ext_hdr *mei_ext_next(struct mei_ext_hdr *ext)
377{
378	return (struct mei_ext_hdr *)((u8 *)ext + (ext->length * 4));
379}
380
381/**
382 * mei_ext_hdr_len - get ext header length in bytes
383 *
384 * @ext: extend header
385 *
386 * Return: extend header length in bytes
387 */
388static inline u32 mei_ext_hdr_len(const struct mei_ext_hdr *ext)
389{
390	if (!ext)
391		return 0;
392
393	return ext->length * sizeof(u32);
394}
395
396/**
397 * struct mei_msg_hdr - MEI BUS Interface Section
398 *
399 * @me_addr: device address
400 * @host_addr: host address
401 * @length: message length
402 * @reserved: reserved
403 * @extended: message has extended header
404 * @dma_ring: message is on dma ring
405 * @internal: message is internal
406 * @msg_complete: last packet of the message
407 * @extension: extension of the header
408 */
409struct mei_msg_hdr {
410	u32 me_addr:8;
411	u32 host_addr:8;
412	u32 length:9;
413	u32 reserved:3;
414	u32 extended:1;
415	u32 dma_ring:1;
416	u32 internal:1;
417	u32 msg_complete:1;
418	u32 extension[];
419} __packed;
420
421/* The length is up to 9 bits */
422#define MEI_MSG_MAX_LEN_MASK GENMASK(9, 0)
423
424struct mei_bus_message {
425	u8 hbm_cmd;
426	u8 data[];
427} __packed;
428
429/**
430 * struct mei_hbm_cl_cmd - client specific host bus command
431 *	CONNECT, DISCONNECT, and FlOW CONTROL
432 *
433 * @hbm_cmd: bus message command header
434 * @me_addr: address of the client in ME
435 * @host_addr: address of the client in the driver
436 * @data: generic data
437 */
438struct mei_hbm_cl_cmd {
439	u8 hbm_cmd;
440	u8 me_addr;
441	u8 host_addr;
442	u8 data;
443};
444
445struct hbm_version {
446	u8 minor_version;
447	u8 major_version;
448} __packed;
449
450struct hbm_host_version_request {
451	u8 hbm_cmd;
452	u8 reserved;
453	struct hbm_version host_version;
454} __packed;
455
456struct hbm_host_version_response {
457	u8 hbm_cmd;
458	u8 host_version_supported;
459	struct hbm_version me_max_version;
460} __packed;
461
462struct hbm_host_stop_request {
463	u8 hbm_cmd;
464	u8 reason;
465	u8 reserved[2];
466} __packed;
467
468struct hbm_host_stop_response {
469	u8 hbm_cmd;
470	u8 reserved[3];
471} __packed;
472
473struct hbm_me_stop_request {
474	u8 hbm_cmd;
475	u8 reason;
476	u8 reserved[2];
477} __packed;
478
479/**
480 * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0)
481 *
482 * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add
483 * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately
484 */
485enum hbm_host_enum_flags {
486	MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
487	MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
488};
489
490/**
491 * struct hbm_host_enum_request - enumeration request from host to fw
492 *
493 * @hbm_cmd : bus message command header
494 * @flags   : request flags
495 * @reserved: reserved
496 */
497struct hbm_host_enum_request {
498	u8 hbm_cmd;
499	u8 flags;
500	u8 reserved[2];
501} __packed;
502
503struct hbm_host_enum_response {
504	u8 hbm_cmd;
505	u8 reserved[3];
506	u8 valid_addresses[32];
507} __packed;
508
509/**
510 * struct mei_client_properties - mei client properties
511 *
512 * @protocol_name: guid of the client
513 * @protocol_version: client protocol version
514 * @max_number_of_connections: number of possible connections.
515 * @fixed_address: fixed me address (0 if the client is dynamic)
516 * @single_recv_buf: 1 if all connections share a single receive buffer.
517 * @vt_supported: the client support vtag
518 * @reserved: reserved
519 * @max_msg_length: MTU of the client
520 */
521struct mei_client_properties {
522	uuid_le protocol_name;
523	u8 protocol_version;
524	u8 max_number_of_connections;
525	u8 fixed_address;
526	u8 single_recv_buf:1;
527	u8 vt_supported:1;
528	u8 reserved:6;
529	u32 max_msg_length;
530} __packed;
531
532struct hbm_props_request {
533	u8 hbm_cmd;
534	u8 me_addr;
535	u8 reserved[2];
536} __packed;
537
538struct hbm_props_response {
539	u8 hbm_cmd;
540	u8 me_addr;
541	u8 status;
542	u8 reserved;
543	struct mei_client_properties client_properties;
544} __packed;
545
546/**
547 * struct hbm_add_client_request - request to add a client
548 *     might be sent by fw after enumeration has already completed
549 *
550 * @hbm_cmd: bus message command header
551 * @me_addr: address of the client in ME
552 * @reserved: reserved
553 * @client_properties: client properties
554 */
555struct hbm_add_client_request {
556	u8 hbm_cmd;
557	u8 me_addr;
558	u8 reserved[2];
559	struct mei_client_properties client_properties;
560} __packed;
561
562/**
563 * struct hbm_add_client_response - response to add a client
564 *     sent by the host to report client addition status to fw
565 *
566 * @hbm_cmd: bus message command header
567 * @me_addr: address of the client in ME
568 * @status: if HBMS_SUCCESS then the client can now accept connections.
569 * @reserved: reserved
570 */
571struct hbm_add_client_response {
572	u8 hbm_cmd;
573	u8 me_addr;
574	u8 status;
575	u8 reserved;
576} __packed;
577
578/**
579 * struct hbm_power_gate - power gate request/response
580 *
581 * @hbm_cmd: bus message command header
582 * @reserved: reserved
583 */
584struct hbm_power_gate {
585	u8 hbm_cmd;
586	u8 reserved[3];
587} __packed;
588
589/**
590 * struct hbm_client_connect_request - connect/disconnect request
591 *
592 * @hbm_cmd: bus message command header
593 * @me_addr: address of the client in ME
594 * @host_addr: address of the client in the driver
595 * @reserved: reserved
596 */
597struct hbm_client_connect_request {
598	u8 hbm_cmd;
599	u8 me_addr;
600	u8 host_addr;
601	u8 reserved;
602} __packed;
603
604/**
605 * struct hbm_client_connect_response - connect/disconnect response
606 *
607 * @hbm_cmd: bus message command header
608 * @me_addr: address of the client in ME
609 * @host_addr: address of the client in the driver
610 * @status: status of the request
611 */
612struct hbm_client_connect_response {
613	u8 hbm_cmd;
614	u8 me_addr;
615	u8 host_addr;
616	u8 status;
617} __packed;
618
619
620#define MEI_FC_MESSAGE_RESERVED_LENGTH           5
621
622struct hbm_flow_control {
623	u8 hbm_cmd;
624	u8 me_addr;
625	u8 host_addr;
626	u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
627} __packed;
628
629#define MEI_HBM_NOTIFICATION_START 1
630#define MEI_HBM_NOTIFICATION_STOP  0
631/**
632 * struct hbm_notification_request - start/stop notification request
633 *
634 * @hbm_cmd: bus message command header
635 * @me_addr: address of the client in ME
636 * @host_addr: address of the client in the driver
637 * @start:  start = 1 or stop = 0 asynchronous notifications
638 */
639struct hbm_notification_request {
640	u8 hbm_cmd;
641	u8 me_addr;
642	u8 host_addr;
643	u8 start;
644} __packed;
645
646/**
647 * struct hbm_notification_response - start/stop notification response
648 *
649 * @hbm_cmd: bus message command header
650 * @me_addr: address of the client in ME
651 * @host_addr: - address of the client in the driver
652 * @status: (mei_hbm_status) response status for the request
653 *  - MEI_HBMS_SUCCESS: successful stop/start
654 *  - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
655 *  - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
656 *                         started notification.
657 *  - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
658 *                         asynchronous notifications are currently disabled.
659 *
660 * @start:  start = 1 or stop = 0 asynchronous notifications
661 * @reserved: reserved
662 */
663struct hbm_notification_response {
664	u8 hbm_cmd;
665	u8 me_addr;
666	u8 host_addr;
667	u8 status;
668	u8 start;
669	u8 reserved[3];
670} __packed;
671
672/**
673 * struct hbm_notification - notification event
674 *
675 * @hbm_cmd: bus message command header
676 * @me_addr:  address of the client in ME
677 * @host_addr:  address of the client in the driver
678 * @reserved: reserved for alignment
679 */
680struct hbm_notification {
681	u8 hbm_cmd;
682	u8 me_addr;
683	u8 host_addr;
684	u8 reserved;
685} __packed;
686
687/**
688 * struct hbm_dma_mem_dscr - dma ring
689 *
690 * @addr_hi: the high 32bits of 64 bit address
691 * @addr_lo: the low  32bits of 64 bit address
692 * @size   : size in bytes (must be power of 2)
693 */
694struct hbm_dma_mem_dscr {
695	u32 addr_hi;
696	u32 addr_lo;
697	u32 size;
698} __packed;
699
700enum {
701	DMA_DSCR_HOST = 0,
702	DMA_DSCR_DEVICE = 1,
703	DMA_DSCR_CTRL = 2,
704	DMA_DSCR_NUM,
705};
706
707/**
708 * struct hbm_dma_setup_request - dma setup request
709 *
710 * @hbm_cmd: bus message command header
711 * @reserved: reserved for alignment
712 * @dma_dscr: dma descriptor for HOST, DEVICE, and CTRL
713 */
714struct hbm_dma_setup_request {
715	u8 hbm_cmd;
716	u8 reserved[3];
717	struct hbm_dma_mem_dscr dma_dscr[DMA_DSCR_NUM];
718} __packed;
719
720/**
721 * struct hbm_dma_setup_response - dma setup response
722 *
723 * @hbm_cmd: bus message command header
724 * @status: 0 on success; otherwise DMA setup failed.
725 * @reserved: reserved for alignment
726 */
727struct hbm_dma_setup_response {
728	u8 hbm_cmd;
729	u8 status;
730	u8 reserved[2];
731} __packed;
732
733/**
734 * struct hbm_dma_ring_ctrl - dma ring control block
735 *
736 * @hbuf_wr_idx: host circular buffer write index in slots
737 * @reserved1: reserved for alignment
738 * @hbuf_rd_idx: host circular buffer read index in slots
739 * @reserved2: reserved for alignment
740 * @dbuf_wr_idx: device circular buffer write index in slots
741 * @reserved3: reserved for alignment
742 * @dbuf_rd_idx: device circular buffer read index in slots
743 * @reserved4: reserved for alignment
744 */
745struct hbm_dma_ring_ctrl {
746	u32 hbuf_wr_idx;
747	u32 reserved1;
748	u32 hbuf_rd_idx;
749	u32 reserved2;
750	u32 dbuf_wr_idx;
751	u32 reserved3;
752	u32 dbuf_rd_idx;
753	u32 reserved4;
754} __packed;
755
756/* virtual tag supported */
757#define HBM_CAP_VT BIT(0)
758
759/* gsc extended header support */
760#define HBM_CAP_GSC BIT(1)
761
762/* client dma supported */
763#define HBM_CAP_CD BIT(2)
764
765/**
766 * struct hbm_capability_request - capability request from host to fw
767 *
768 * @hbm_cmd : bus message command header
769 * @capability_requested: bitmask of capabilities requested by host
770 */
771struct hbm_capability_request {
772	u8 hbm_cmd;
773	u8 capability_requested[3];
774} __packed;
775
776/**
777 * struct hbm_capability_response - capability response from fw to host
778 *
779 * @hbm_cmd : bus message command header
780 * @capability_granted: bitmask of capabilities granted by FW
781 */
782struct hbm_capability_response {
783	u8 hbm_cmd;
784	u8 capability_granted[3];
785} __packed;
786
787/**
788 * struct hbm_client_dma_map_request - client dma map request from host to fw
789 *
790 * @hbm_cmd: bus message command header
791 * @client_buffer_id: client buffer id
792 * @reserved: reserved
793 * @address_lsb: DMA address LSB
794 * @address_msb: DMA address MSB
795 * @size: DMA size
796 */
797struct hbm_client_dma_map_request {
798	u8 hbm_cmd;
799	u8 client_buffer_id;
800	u8 reserved[2];
801	u32 address_lsb;
802	u32 address_msb;
803	u32 size;
804} __packed;
805
806/**
807 * struct hbm_client_dma_unmap_request - client dma unmap request
808 *        from the host to the firmware
809 *
810 * @hbm_cmd: bus message command header
811 * @status: unmap status
812 * @client_buffer_id: client buffer id
813 * @reserved: reserved
814 */
815struct hbm_client_dma_unmap_request {
816	u8 hbm_cmd;
817	u8 status;
818	u8 client_buffer_id;
819	u8 reserved;
820} __packed;
821
822/**
823 * struct hbm_client_dma_response - client dma unmap response
824 *        from the firmware to the host
825 *
826 * @hbm_cmd: bus message command header
827 * @status: command status
828 */
829struct hbm_client_dma_response {
830	u8 hbm_cmd;
831	u8 status;
832} __packed;
833
834#endif
v4.17
 
  1/*
  2 *
  3 * Intel Management Engine Interface (Intel MEI) Linux driver
  4 * Copyright (c) 2003-2012, Intel Corporation.
  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/*
 23 * Timeouts in Seconds
 24 */
 25#define MEI_HW_READY_TIMEOUT        2  /* Timeout on ready message */
 26#define MEI_CONNECT_TIMEOUT         3  /* HPS: at least 2 seconds */
 27
 28#define MEI_CL_CONNECT_TIMEOUT     15  /* HPS: Client Connect Timeout */
 
 29#define MEI_CLIENTS_INIT_TIMEOUT   15  /* HPS: Clients Enumeration Timeout */
 30
 31#define MEI_IAMTHIF_STALL_TIMER    12  /* HPS */
 32
 33#define MEI_PGI_TIMEOUT             1  /* PG Isolation time response 1 sec */
 34#define MEI_D0I3_TIMEOUT            5  /* D0i3 set/unset max response time */
 35#define MEI_HBM_TIMEOUT             1  /* 1 second */
 
 
 
 
 
 
 
 
 
 36
 37/*
 38 * MEI Version
 39 */
 40#define HBM_MINOR_VERSION                   0
 41#define HBM_MAJOR_VERSION                   2
 42
 43/*
 44 * MEI version with PGI support
 45 */
 46#define HBM_MINOR_VERSION_PGI               1
 47#define HBM_MAJOR_VERSION_PGI               1
 48
 49/*
 50 * MEI version with Dynamic clients support
 51 */
 52#define HBM_MINOR_VERSION_DC               0
 53#define HBM_MAJOR_VERSION_DC               2
 54
 55/*
 56 * MEI version with immediate reply to enum request support
 57 */
 58#define HBM_MINOR_VERSION_IE               0
 59#define HBM_MAJOR_VERSION_IE               2
 60
 61/*
 62 * MEI version with disconnect on connection timeout support
 63 */
 64#define HBM_MINOR_VERSION_DOT              0
 65#define HBM_MAJOR_VERSION_DOT              2
 66
 67/*
 68 * MEI version with notification support
 69 */
 70#define HBM_MINOR_VERSION_EV               0
 71#define HBM_MAJOR_VERSION_EV               2
 72
 73/*
 74 * MEI version with fixed address client support
 75 */
 76#define HBM_MINOR_VERSION_FA               0
 77#define HBM_MAJOR_VERSION_FA               2
 78
 79/*
 80 * MEI version with OS ver message support
 81 */
 82#define HBM_MINOR_VERSION_OS               0
 83#define HBM_MAJOR_VERSION_OS               2
 84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 85/* Host bus message command opcode */
 86#define MEI_HBM_CMD_OP_MSK                  0x7f
 87/* Host bus message command RESPONSE */
 88#define MEI_HBM_CMD_RES_MSK                 0x80
 89
 90/*
 91 * MEI Bus Message Command IDs
 92 */
 93#define HOST_START_REQ_CMD                  0x01
 94#define HOST_START_RES_CMD                  0x81
 95
 96#define HOST_STOP_REQ_CMD                   0x02
 97#define HOST_STOP_RES_CMD                   0x82
 98
 99#define ME_STOP_REQ_CMD                     0x03
100
101#define HOST_ENUM_REQ_CMD                   0x04
102#define HOST_ENUM_RES_CMD                   0x84
103
104#define HOST_CLIENT_PROPERTIES_REQ_CMD      0x05
105#define HOST_CLIENT_PROPERTIES_RES_CMD      0x85
106
107#define CLIENT_CONNECT_REQ_CMD              0x06
108#define CLIENT_CONNECT_RES_CMD              0x86
109
110#define CLIENT_DISCONNECT_REQ_CMD           0x07
111#define CLIENT_DISCONNECT_RES_CMD           0x87
112
113#define MEI_FLOW_CONTROL_CMD                0x08
114
115#define MEI_PG_ISOLATION_ENTRY_REQ_CMD      0x0a
116#define MEI_PG_ISOLATION_ENTRY_RES_CMD      0x8a
117#define MEI_PG_ISOLATION_EXIT_REQ_CMD       0x0b
118#define MEI_PG_ISOLATION_EXIT_RES_CMD       0x8b
119
120#define MEI_HBM_ADD_CLIENT_REQ_CMD          0x0f
121#define MEI_HBM_ADD_CLIENT_RES_CMD          0x8f
122
123#define MEI_HBM_NOTIFY_REQ_CMD              0x10
124#define MEI_HBM_NOTIFY_RES_CMD              0x90
125#define MEI_HBM_NOTIFICATION_CMD            0x11
126
 
 
 
 
 
 
 
 
 
 
 
 
127/*
128 * MEI Stop Reason
129 * used by hbm_host_stop_request.reason
130 */
131enum mei_stop_reason_types {
132	DRIVER_STOP_REQUEST = 0x00,
133	DEVICE_D1_ENTRY = 0x01,
134	DEVICE_D2_ENTRY = 0x02,
135	DEVICE_D3_ENTRY = 0x03,
136	SYSTEM_S1_ENTRY = 0x04,
137	SYSTEM_S2_ENTRY = 0x05,
138	SYSTEM_S3_ENTRY = 0x06,
139	SYSTEM_S4_ENTRY = 0x07,
140	SYSTEM_S5_ENTRY = 0x08
141};
142
143
144/**
145 * enum mei_hbm_status  - mei host bus messages return values
146 *
147 * @MEI_HBMS_SUCCESS           : status success
148 * @MEI_HBMS_CLIENT_NOT_FOUND  : client not found
149 * @MEI_HBMS_ALREADY_EXISTS    : connection already established
150 * @MEI_HBMS_REJECTED          : connection is rejected
151 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
152 * @MEI_HBMS_NOT_ALLOWED       : operation not allowed
153 * @MEI_HBMS_ALREADY_STARTED   : system is already started
154 * @MEI_HBMS_NOT_STARTED       : system not started
155 *
156 * @MEI_HBMS_MAX               : sentinel
157 */
158enum mei_hbm_status {
159	MEI_HBMS_SUCCESS           = 0,
160	MEI_HBMS_CLIENT_NOT_FOUND  = 1,
161	MEI_HBMS_ALREADY_EXISTS    = 2,
162	MEI_HBMS_REJECTED          = 3,
163	MEI_HBMS_INVALID_PARAMETER = 4,
164	MEI_HBMS_NOT_ALLOWED       = 5,
165	MEI_HBMS_ALREADY_STARTED   = 6,
166	MEI_HBMS_NOT_STARTED       = 7,
167
168	MEI_HBMS_MAX
169};
170
171
172/*
173 * Client Connect Status
174 * used by hbm_client_connect_response.status
175 */
176enum mei_cl_connect_status {
177	MEI_CL_CONN_SUCCESS          = MEI_HBMS_SUCCESS,
178	MEI_CL_CONN_NOT_FOUND        = MEI_HBMS_CLIENT_NOT_FOUND,
179	MEI_CL_CONN_ALREADY_STARTED  = MEI_HBMS_ALREADY_EXISTS,
180	MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
181	MEI_CL_CONN_MESSAGE_SMALL    = MEI_HBMS_INVALID_PARAMETER,
182	MEI_CL_CONN_NOT_ALLOWED      = MEI_HBMS_NOT_ALLOWED,
183};
184
185/*
186 * Client Disconnect Status
187 */
188enum  mei_cl_disconnect_status {
189	MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
190};
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192/*
193 *  MEI BUS Interface Section
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194 */
195struct mei_msg_hdr {
196	u32 me_addr:8;
197	u32 host_addr:8;
198	u32 length:9;
199	u32 reserved:5;
 
 
200	u32 internal:1;
201	u32 msg_complete:1;
 
202} __packed;
203
 
 
204
205struct mei_bus_message {
206	u8 hbm_cmd;
207	u8 data[0];
208} __packed;
209
210/**
211 * struct hbm_cl_cmd - client specific host bus command
212 *	CONNECT, DISCONNECT, and FlOW CONTROL
213 *
214 * @hbm_cmd: bus message command header
215 * @me_addr: address of the client in ME
216 * @host_addr: address of the client in the driver
217 * @data: generic data
218 */
219struct mei_hbm_cl_cmd {
220	u8 hbm_cmd;
221	u8 me_addr;
222	u8 host_addr;
223	u8 data;
224};
225
226struct hbm_version {
227	u8 minor_version;
228	u8 major_version;
229} __packed;
230
231struct hbm_host_version_request {
232	u8 hbm_cmd;
233	u8 reserved;
234	struct hbm_version host_version;
235} __packed;
236
237struct hbm_host_version_response {
238	u8 hbm_cmd;
239	u8 host_version_supported;
240	struct hbm_version me_max_version;
241} __packed;
242
243struct hbm_host_stop_request {
244	u8 hbm_cmd;
245	u8 reason;
246	u8 reserved[2];
247} __packed;
248
249struct hbm_host_stop_response {
250	u8 hbm_cmd;
251	u8 reserved[3];
252} __packed;
253
254struct hbm_me_stop_request {
255	u8 hbm_cmd;
256	u8 reason;
257	u8 reserved[2];
258} __packed;
259
260/**
261 * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0)
262 *
263 * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add
264 * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately
265 */
266enum hbm_host_enum_flags {
267	MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
268	MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
269};
270
271/**
272 * struct hbm_host_enum_request - enumeration request from host to fw
273 *
274 * @hbm_cmd : bus message command header
275 * @flags   : request flags
276 * @reserved: reserved
277 */
278struct hbm_host_enum_request {
279	u8 hbm_cmd;
280	u8 flags;
281	u8 reserved[2];
282} __packed;
283
284struct hbm_host_enum_response {
285	u8 hbm_cmd;
286	u8 reserved[3];
287	u8 valid_addresses[32];
288} __packed;
289
 
 
 
 
 
 
 
 
 
 
 
 
290struct mei_client_properties {
291	uuid_le protocol_name;
292	u8 protocol_version;
293	u8 max_number_of_connections;
294	u8 fixed_address;
295	u8 single_recv_buf;
 
 
296	u32 max_msg_length;
297} __packed;
298
299struct hbm_props_request {
300	u8 hbm_cmd;
301	u8 me_addr;
302	u8 reserved[2];
303} __packed;
304
305struct hbm_props_response {
306	u8 hbm_cmd;
307	u8 me_addr;
308	u8 status;
309	u8 reserved[1];
310	struct mei_client_properties client_properties;
311} __packed;
312
313/**
314 * struct hbm_add_client_request - request to add a client
315 *     might be sent by fw after enumeration has already completed
316 *
317 * @hbm_cmd: bus message command header
318 * @me_addr: address of the client in ME
319 * @reserved: reserved
320 * @client_properties: client properties
321 */
322struct hbm_add_client_request {
323	u8 hbm_cmd;
324	u8 me_addr;
325	u8 reserved[2];
326	struct mei_client_properties client_properties;
327} __packed;
328
329/**
330 * struct hbm_add_client_response - response to add a client
331 *     sent by the host to report client addition status to fw
332 *
333 * @hbm_cmd: bus message command header
334 * @me_addr: address of the client in ME
335 * @status: if HBMS_SUCCESS then the client can now accept connections.
336 * @reserved: reserved
337 */
338struct hbm_add_client_response {
339	u8 hbm_cmd;
340	u8 me_addr;
341	u8 status;
342	u8 reserved[1];
343} __packed;
344
345/**
346 * struct hbm_power_gate - power gate request/response
347 *
348 * @hbm_cmd: bus message command header
349 * @reserved: reserved
350 */
351struct hbm_power_gate {
352	u8 hbm_cmd;
353	u8 reserved[3];
354} __packed;
355
356/**
357 * struct hbm_client_connect_request - connect/disconnect request
358 *
359 * @hbm_cmd: bus message command header
360 * @me_addr: address of the client in ME
361 * @host_addr: address of the client in the driver
362 * @reserved: reserved
363 */
364struct hbm_client_connect_request {
365	u8 hbm_cmd;
366	u8 me_addr;
367	u8 host_addr;
368	u8 reserved;
369} __packed;
370
371/**
372 * struct hbm_client_connect_response - connect/disconnect response
373 *
374 * @hbm_cmd: bus message command header
375 * @me_addr: address of the client in ME
376 * @host_addr: address of the client in the driver
377 * @status: status of the request
378 */
379struct hbm_client_connect_response {
380	u8 hbm_cmd;
381	u8 me_addr;
382	u8 host_addr;
383	u8 status;
384} __packed;
385
386
387#define MEI_FC_MESSAGE_RESERVED_LENGTH           5
388
389struct hbm_flow_control {
390	u8 hbm_cmd;
391	u8 me_addr;
392	u8 host_addr;
393	u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
394} __packed;
395
396#define MEI_HBM_NOTIFICATION_START 1
397#define MEI_HBM_NOTIFICATION_STOP  0
398/**
399 * struct hbm_notification_request - start/stop notification request
400 *
401 * @hbm_cmd: bus message command header
402 * @me_addr: address of the client in ME
403 * @host_addr: address of the client in the driver
404 * @start:  start = 1 or stop = 0 asynchronous notifications
405 */
406struct hbm_notification_request {
407	u8 hbm_cmd;
408	u8 me_addr;
409	u8 host_addr;
410	u8 start;
411} __packed;
412
413/**
414 * struct hbm_notification_response - start/stop notification response
415 *
416 * @hbm_cmd: bus message command header
417 * @me_addr: address of the client in ME
418 * @host_addr: - address of the client in the driver
419 * @status: (mei_hbm_status) response status for the request
420 *  - MEI_HBMS_SUCCESS: successful stop/start
421 *  - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
422 *  - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
423 *                         started notification.
424 *  - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
425 *                         asynchronous notifications are currently disabled.
426 *
427 * @start:  start = 1 or stop = 0 asynchronous notifications
428 * @reserved: reserved
429 */
430struct hbm_notification_response {
431	u8 hbm_cmd;
432	u8 me_addr;
433	u8 host_addr;
434	u8 status;
435	u8 start;
436	u8 reserved[3];
437} __packed;
438
439/**
440 * struct hbm_notification - notification event
441 *
442 * @hbm_cmd: bus message command header
443 * @me_addr:  address of the client in ME
444 * @host_addr:  address of the client in the driver
445 * @reserved: reserved for alignment
446 */
447struct hbm_notification {
448	u8 hbm_cmd;
449	u8 me_addr;
450	u8 host_addr;
451	u8 reserved[1];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452} __packed;
453
454#endif