1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 
6 #ifndef _INTEL_GSC_UC_HECI_CMD_SUBMIT_H_
7 #define _INTEL_GSC_UC_HECI_CMD_SUBMIT_H_
8 
9 #include <linux/types.h>
10 
11 struct intel_gsc_uc;
12 struct intel_gsc_mtl_header {
13 	u32 validity_marker;
14 #define GSC_HECI_VALIDITY_MARKER 0xA578875A
15 
16 	u8 heci_client_id;
17 #define HECI_MEADDRESS_PXP 17
18 #define HECI_MEADDRESS_HDCP 18
19 
20 	u8 reserved1;
21 
22 	u16 header_version;
23 #define MTL_GSC_HEADER_VERSION 1
24 
25 	/*
26 	 * FW allows host to decide host_session handle
27 	 * as it sees fit.
28 	 * For intertracebility reserving select bits(60-63)
29 	 * to differentiate caller-target subsystem
30 	 * 0000 - HDCP
31 	 * 0001 - PXP Single Session
32 	 */
33 	u64 host_session_handle;
34 #define HOST_SESSION_MASK	REG_GENMASK64(63, 60)
35 #define HOST_SESSION_PXP_SINGLE BIT_ULL(60)
36 	u64 gsc_message_handle;
37 
38 	u32 message_size; /* lower 20 bits only, upper 12 are reserved */
39 
40 	/*
41 	 * Flags mask:
42 	 * Bit 0: Pending
43 	 * Bit 1: Session Cleanup;
44 	 * Bits 2-15: Flags
45 	 * Bits 16-31: Extension Size
46 	 * According to internal spec flags are either input or output
47 	 * we distinguish the flags using OUTFLAG or INFLAG
48 	 */
49 	u32 flags;
50 #define GSC_OUTFLAG_MSG_PENDING	1
51 
52 	u32 status;
53 } __packed;
54 
55 int intel_gsc_uc_heci_cmd_submit_packet(struct intel_gsc_uc *gsc,
56 					u64 addr_in, u32 size_in,
57 					u64 addr_out, u32 size_out);
58 void intel_gsc_uc_heci_cmd_emit_mtl_header(struct intel_gsc_mtl_header *header,
59 					   u8 heci_client_id, u32 message_size,
60 					   u64 host_session_id);
61 #endif
62