1 /*
2  * Copyright 2019 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25 
26 #ifndef MODULES_HDCP_HDCP_PSP_H_
27 #define MODULES_HDCP_HDCP_PSP_H_
28 
29 /*
30  * NOTE: These parameters are a one-to-one copy of the
31  * parameters required by PSP
32  */
33 enum bgd_security_hdcp_encryption_level {
34 	HDCP_ENCRYPTION_LEVEL__INVALID = 0,
35 	HDCP_ENCRYPTION_LEVEL__OFF,
36 	HDCP_ENCRYPTION_LEVEL__ON
37 };
38 
39 enum bgd_security_hdcp2_content_type {
40 	HDCP2_CONTENT_TYPE__INVALID = 0,
41 	HDCP2_CONTENT_TYPE__TYPE0,
42 	HDCP2_CONTENT_TYPE__TYPE1
43 };
44 enum ta_dtm_command {
45 	TA_DTM_COMMAND__UNUSED_1 = 1,
46 	TA_DTM_COMMAND__TOPOLOGY_UPDATE_V2,
47 	TA_DTM_COMMAND__TOPOLOGY_ASSR_ENABLE
48 };
49 
50 /* DTM related enumerations */
51 /**********************************************************/
52 
53 enum ta_dtm_status {
54 	TA_DTM_STATUS__SUCCESS = 0x00,
55 	TA_DTM_STATUS__GENERIC_FAILURE = 0x01,
56 	TA_DTM_STATUS__INVALID_PARAMETER = 0x02,
57 	TA_DTM_STATUS__NULL_POINTER = 0x3
58 };
59 
60 /* input/output structures for DTM commands */
61 /**********************************************************/
62 /**
63  * Input structures
64  */
65 enum ta_dtm_hdcp_version_max_supported {
66 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__NONE = 0,
67 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__1_x = 10,
68 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__2_0 = 20,
69 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__2_1 = 21,
70 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__2_2 = 22,
71 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__2_3 = 23
72 };
73 
74 struct ta_dtm_topology_update_input_v2 {
75 	/* display handle is unique across the driver and is used to identify a display */
76 	/* for all security interfaces which reference displays such as HDCP */
77 	uint32_t display_handle;
78 	uint32_t is_active;
79 	uint32_t is_miracast;
80 	uint32_t controller;
81 	uint32_t ddc_line;
82 	uint32_t dig_be;
83 	uint32_t dig_fe;
84 	uint32_t dp_mst_vcid;
85 	uint32_t is_assr;
86 	uint32_t max_hdcp_supported_version;
87 };
88 
89 struct ta_dtm_topology_assr_enable {
90 	uint32_t display_topology_dig_be_index;
91 };
92 
93 /**
94  * Output structures
95  */
96 
97 /* No output structures yet */
98 
99 union ta_dtm_cmd_input {
100 	struct ta_dtm_topology_update_input_v2 topology_update_v2;
101 	struct ta_dtm_topology_assr_enable topology_assr_enable;
102 };
103 
104 union ta_dtm_cmd_output {
105 	uint32_t reserved;
106 };
107 
108 struct ta_dtm_shared_memory {
109 	uint32_t cmd_id;
110 	uint32_t resp_id;
111 	enum ta_dtm_status dtm_status;
112 	uint32_t reserved;
113 	union ta_dtm_cmd_input dtm_in_message;
114 	union ta_dtm_cmd_output dtm_out_message;
115 };
116 
117 int psp_cmd_submit_buf(struct psp_context *psp, struct amdgpu_firmware_info *ucode, struct psp_gfx_cmd_resp *cmd,
118 		uint64_t fence_mc_addr);
119 
120 enum { PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE = 5120 };
121 
122 enum ta_hdcp_command {
123 	TA_HDCP_COMMAND__INITIALIZE,
124 	TA_HDCP_COMMAND__HDCP1_CREATE_SESSION,
125 	TA_HDCP_COMMAND__HDCP1_DESTROY_SESSION,
126 	TA_HDCP_COMMAND__HDCP1_FIRST_PART_AUTHENTICATION,
127 	TA_HDCP_COMMAND__HDCP1_SECOND_PART_AUTHENTICATION,
128 	TA_HDCP_COMMAND__HDCP1_ENABLE_ENCRYPTION,
129 	TA_HDCP_COMMAND__HDCP1_ENABLE_DP_STREAM_ENCRYPTION,
130 	TA_HDCP_COMMAND__HDCP1_GET_ENCRYPTION_STATUS,
131 	TA_HDCP_COMMAND__UNUSED_1,
132 	TA_HDCP_COMMAND__HDCP2_DESTROY_SESSION,
133 	TA_HDCP_COMMAND__UNUSED_2,
134 	TA_HDCP_COMMAND__HDCP2_SET_ENCRYPTION,
135 	TA_HDCP_COMMAND__HDCP2_GET_ENCRYPTION_STATUS,
136 	TA_HDCP_COMMAND__UNUSED_3,
137 	TA_HDCP_COMMAND__HDCP2_CREATE_SESSION_V2,
138 	TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2,
139 	TA_HDCP_COMMAND__HDCP2_ENABLE_DP_STREAM_ENCRYPTION,
140 	TA_HDCP_COMMAND__HDCP_DESTROY_ALL_SESSIONS,
141 	TA_HDCP_COMMAND__HDCP_SET_SRM,
142 	TA_HDCP_COMMAND__HDCP_GET_SRM
143 };
144 
145 enum ta_hdcp2_msg_id {
146 	TA_HDCP_HDCP2_MSG_ID__NULL_MESSAGE = 1,
147 	TA_HDCP_HDCP2_MSG_ID__AKE_INIT = 2,
148 	TA_HDCP_HDCP2_MSG_ID__AKE_SEND_CERT = 3,
149 	TA_HDCP_HDCP2_MSG_ID__AKE_NO_STORED_KM = 4,
150 	TA_HDCP_HDCP2_MSG_ID__AKE_STORED_KM = 5,
151 	TA_HDCP_HDCP2_MSG_ID__AKE_SEND_RRX = 6,
152 	TA_HDCP_HDCP2_MSG_ID__AKE_SEND_H_PRIME = 7,
153 	TA_HDCP_HDCP2_MSG_ID__AKE_SEND_PAIRING_INFO = 8,
154 	TA_HDCP_HDCP2_MSG_ID__LC_INIT = 9,
155 	TA_HDCP_HDCP2_MSG_ID__LC_SEND_L_PRIME = 10,
156 	TA_HDCP_HDCP2_MSG_ID__SKE_SEND_EKS = 11,
157 	TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_SEND_RECEIVERID_LIST = 12,
158 	TA_HDCP_HDCP2_MSG_ID__RTT_READY = 13,
159 	TA_HDCP_HDCP2_MSG_ID__RTT_CHALLENGE = 14,
160 	TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_SEND_ACK = 15,
161 	TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_STREAM_MANAGE = 16,
162 	TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_STREAM_READY = 17,
163 	TA_HDCP_HDCP2_MSG_ID__RECEIVER_AUTH_STATUS = 18,
164 	TA_HDCP_HDCP2_MSG_ID__AKE_TRANSMITTER_INFO = 19,
165 	TA_HDCP_HDCP2_MSG_ID__AKE_RECEIVER_INFO = 20,
166 	TA_HDCP_HDCP2_MSG_ID__SIGNAL_CONTENT_STREAM_TYPE_DP = 129
167 };
168 
169 enum ta_hdcp2_hdcp2_msg_id_max_size {
170 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__NULL_MESSAGE = 0,
171 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_INIT = 12,
172 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_CERT = 534,
173 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_NO_STORED_KM = 129,
174 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_STORED_KM = 33,
175 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_RRX = 9,
176 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_H_PRIME = 33,
177 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_PAIRING_INFO = 17,
178 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__LC_INIT = 9,
179 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__LC_SEND_L_PRIME = 33,
180 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__SKE_SEND_EKS = 25,
181 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__REPEATERAUTH_SEND_RECEIVERID_LIST = 181,
182 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__RTT_READY = 1,
183 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__RTT_CHALLENGE = 17,
184 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__REPEATERAUTH_SEND_RACK = 17,
185 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__REPEATERAUTH_STREAM_MANAGE = 13,
186 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__REPEATERAUTH_STREAM_READY = 33,
187 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__RECEIVER_AUTH_STATUS = 4,
188 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_TRANSMITTER_INFO = 6,
189 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_RECEIVER_INFO = 6,
190 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__SIGNAL_CONTENT_STREAM_TYPE_DP = 1
191 };
192 
193 /* HDCP related enumerations */
194 /**********************************************************/
195 #define TA_HDCP__INVALID_SESSION 0xFFFF
196 #define TA_HDCP__HDCP1_AN_SIZE 8
197 #define TA_HDCP__HDCP1_KSV_SIZE 5
198 #define TA_HDCP__HDCP1_KSV_LIST_MAX_ENTRIES 127
199 #define TA_HDCP__HDCP1_V_PRIME_SIZE 20
200 #define TA_HDCP__HDCP2_TX_BUF_MAX_SIZE                                                                                 \
201 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_NO_STORED_KM + TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_STORED_KM + 6
202 
203 // 64 bits boundaries
204 #define TA_HDCP__HDCP2_RX_BUF_MAX_SIZE                                                                                 \
205 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_CERT + TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_RECEIVER_INFO + 4
206 
207 enum ta_hdcp_status {
208 	TA_HDCP_STATUS__SUCCESS = 0x00,
209 	TA_HDCP_STATUS__GENERIC_FAILURE = 0x01,
210 	TA_HDCP_STATUS__NULL_POINTER = 0x02,
211 	TA_HDCP_STATUS__FAILED_ALLOCATING_SESSION = 0x03,
212 	TA_HDCP_STATUS__FAILED_SETUP_TX = 0x04,
213 	TA_HDCP_STATUS__INVALID_PARAMETER = 0x05,
214 	TA_HDCP_STATUS__VHX_ERROR = 0x06,
215 	TA_HDCP_STATUS__SESSION_NOT_CLOSED_PROPERLY = 0x07,
216 	TA_HDCP_STATUS__SRM_FAILURE = 0x08,
217 	TA_HDCP_STATUS__MST_AUTHENTICATED_ALREADY_STARTED = 0x09,
218 	TA_HDCP_STATUS__AKE_SEND_CERT_FAILURE = 0x0A,
219 	TA_HDCP_STATUS__AKE_NO_STORED_KM_FAILURE = 0x0B,
220 	TA_HDCP_STATUS__AKE_SEND_HPRIME_FAILURE = 0x0C,
221 	TA_HDCP_STATUS__LC_SEND_LPRIME_FAILURE = 0x0D,
222 	TA_HDCP_STATUS__SKE_SEND_EKS_FAILURE = 0x0E,
223 	TA_HDCP_STATUS__REPAUTH_SEND_RXIDLIST_FAILURE = 0x0F,
224 	TA_HDCP_STATUS__REPAUTH_STREAM_READY_FAILURE = 0x10,
225 	TA_HDCP_STATUS__ASD_GENERIC_FAILURE = 0x11,
226 	TA_HDCP_STATUS__UNWRAP_SECRET_FAILURE = 0x12,
227 	TA_HDCP_STATUS__ENABLE_ENCR_FAILURE = 0x13,
228 	TA_HDCP_STATUS__DISABLE_ENCR_FAILURE = 0x14,
229 	TA_HDCP_STATUS__NOT_ENOUGH_MEMORY_FAILURE = 0x15,
230 	TA_HDCP_STATUS__UNKNOWN_MESSAGE = 0x16,
231 	TA_HDCP_STATUS__TOO_MANY_STREAM = 0x17
232 };
233 
234 enum ta_hdcp_authentication_status {
235 	TA_HDCP_AUTHENTICATION_STATUS__NOT_STARTED = 0x00,
236 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_FIRST_PART_FAILED = 0x01,
237 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_FIRST_PART_COMPLETE = 0x02,
238 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_SECOND_PART_FAILED = 0x03,
239 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_AUTHENTICATED = 0x04,
240 	TA_HDCP_AUTHENTICATION_STATUS__HDCP22_AUTHENTICATION_PENDING = 0x06,
241 	TA_HDCP_AUTHENTICATION_STATUS__HDCP22_AUTHENTICATION_FAILED = 0x07,
242 	TA_HDCP_AUTHENTICATION_STATUS__HDCP22_AUTHENTICATED = 0x08,
243 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_KSV_VALIDATION_FAILED = 0x09,
244 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_KSV_REVOKED = 0x0A
245 };
246 
247 enum ta_hdcp2_msg_authentication_status {
248 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__SUCCESS = 0,
249 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__KM_NOT_AVAILABLE,
250 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__UNUSED,
251 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID = 100, // everything above does not fail the request
252 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__NOT_ENOUGH_MEMORY,
253 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__NOT_EXPECTED_MSG,
254 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__SIGNATURE_CERTIFICAT_ERROR,
255 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INCORRECT_HDCP_VERSION,
256 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__UNKNOWN_MESSAGE,
257 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_HMAC,
258 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_TOPOLOGY,
259 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_SEQ_NUM,
260 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_SIZE,
261 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_LENGTH,
262 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__REAUTH_REQUEST,
263 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__RECEIVERID_REVOKED
264 };
265 
266 enum ta_hdcp_content_type {
267 	TA_HDCP2_CONTENT_TYPE__TYPE0 = 1,
268 	TA_HDCP2_CONTENT_TYPE__TYPE1,
269 };
270 
271 enum ta_hdcp_content_type_negotiation_type {
272 	TA_HDCP2_CONTENT_TYPE_NEGOTIATION_TYPE__FORCE_TYPE0 = 1,
273 	TA_HDCP2_CONTENT_TYPE_NEGOTIATION_TYPE__FORCE_TYPE1,
274 	TA_HDCP2_CONTENT_TYPE_NEGOTIATION_TYPE__MAX_SUPPORTED
275 };
276 
277 enum ta_hdcp2_version {
278 	TA_HDCP2_VERSION_UNKNOWN = 0,
279 	TA_HDCP2_VERSION_2_0 = 20,
280 	TA_HDCP2_VERSION_2_1 = 21,
281 	TA_HDCP2_VERSION_2_2 = 22
282 };
283 
284 /* input/output structures for HDCP commands */
285 /**********************************************************/
286 struct ta_hdcp_cmd_hdcp1_create_session_input {
287 	uint8_t display_handle;
288 };
289 
290 struct ta_hdcp_cmd_hdcp1_create_session_output {
291 	uint32_t session_handle;
292 	uint8_t an_primary[TA_HDCP__HDCP1_AN_SIZE];
293 	uint8_t aksv_primary[TA_HDCP__HDCP1_KSV_SIZE];
294 	uint8_t ainfo_primary;
295 	uint8_t an_secondary[TA_HDCP__HDCP1_AN_SIZE];
296 	uint8_t aksv_secondary[TA_HDCP__HDCP1_KSV_SIZE];
297 	uint8_t ainfo_secondary;
298 };
299 
300 struct ta_hdcp_cmd_hdcp1_destroy_session_input {
301 	uint32_t session_handle;
302 };
303 
304 struct ta_hdcp_cmd_hdcp1_first_part_authentication_input {
305 	uint32_t session_handle;
306 	uint8_t bksv_primary[TA_HDCP__HDCP1_KSV_SIZE];
307 	uint8_t bksv_secondary[TA_HDCP__HDCP1_KSV_SIZE];
308 	uint8_t bcaps;
309 	uint16_t r0_prime_primary;
310 	uint16_t r0_prime_secondary;
311 };
312 
313 struct ta_hdcp_cmd_hdcp1_first_part_authentication_output {
314 	enum ta_hdcp_authentication_status authentication_status;
315 };
316 
317 struct ta_hdcp_cmd_hdcp1_second_part_authentication_input {
318 	uint32_t session_handle;
319 	uint16_t bstatus_binfo;
320 	uint8_t ksv_list[TA_HDCP__HDCP1_KSV_LIST_MAX_ENTRIES][TA_HDCP__HDCP1_KSV_SIZE];
321 	uint32_t ksv_list_size;
322 	uint8_t pj_prime;
323 	uint8_t v_prime[TA_HDCP__HDCP1_V_PRIME_SIZE];
324 };
325 
326 struct ta_hdcp_cmd_hdcp1_second_part_authentication_output {
327 	enum ta_hdcp_authentication_status authentication_status;
328 };
329 
330 struct ta_hdcp_cmd_hdcp1_enable_encryption_input {
331 	uint32_t session_handle;
332 };
333 
334 struct ta_hdcp_cmd_hdcp1_enable_dp_stream_encryption_input {
335 	uint32_t session_handle;
336 	uint32_t display_handle;
337 };
338 
339 struct ta_hdcp_cmd_hdcp1_get_encryption_status_input {
340 	uint32_t session_handle;
341 };
342 
343 struct ta_hdcp_cmd_hdcp1_get_encryption_status_output {
344 	uint32_t protection_level;
345 };
346 
347 struct ta_hdcp_cmd_hdcp2_create_session_input_v2 {
348 	uint32_t display_handle;
349 	enum ta_hdcp_content_type_negotiation_type negotiate_content_type;
350 };
351 
352 struct ta_hdcp_cmd_hdcp2_create_session_output_v2 {
353 	uint32_t session_handle;
354 };
355 
356 struct ta_hdcp_cmd_hdcp2_destroy_session_input {
357 	uint32_t session_handle;
358 };
359 
360 struct ta_hdcp_cmd_hdcp2_authentication_message_v2 {
361 	enum ta_hdcp2_msg_id msg_id;
362 	uint32_t msg_size;
363 };
364 
365 struct ta_hdcp_cmd_hdcp2_process_authentication_message_input_v2 {
366 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg1_desc;
367 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg2_desc;
368 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg3_desc;
369 	uint8_t receiver_message[TA_HDCP__HDCP2_RX_BUF_MAX_SIZE];
370 };
371 
372 struct ta_hdcp_cmd_hdcp2_process_authentication_message_output_v2 {
373 	uint32_t hdcp_version;
374 	uint32_t is_km_stored;
375 	uint32_t is_locality_precompute_support;
376 	uint32_t is_repeater;
377 	enum ta_hdcp2_msg_authentication_status msg1_status;
378 	enum ta_hdcp2_msg_authentication_status msg2_status;
379 	enum ta_hdcp2_msg_authentication_status msg3_status;
380 };
381 
382 struct ta_hdcp_cmd_hdcp2_prepare_authentication_message_input_v2 {
383 	enum ta_hdcp2_msg_id msg1_id;
384 	enum ta_hdcp2_msg_id msg2_id;
385 };
386 
387 struct ta_hdcp_cmd_hdcp2_prepare_authentication_message_output_v2 {
388 	enum ta_hdcp2_msg_authentication_status msg1_status;
389 	enum ta_hdcp2_msg_authentication_status msg2_status;
390 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg1_desc;
391 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg2_desc;
392 	uint8_t transmitter_message[TA_HDCP__HDCP2_TX_BUF_MAX_SIZE];
393 };
394 
395 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2 {
396 	uint32_t session_handle;
397 	struct ta_hdcp_cmd_hdcp2_process_authentication_message_input_v2 process;
398 	struct ta_hdcp_cmd_hdcp2_prepare_authentication_message_input_v2 prepare;
399 };
400 
401 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2 {
402 	uint32_t authentication_status;
403 	struct ta_hdcp_cmd_hdcp2_process_authentication_message_output_v2 process;
404 	struct ta_hdcp_cmd_hdcp2_prepare_authentication_message_output_v2 prepare;
405 };
406 
407 struct ta_hdcp_cmd_hdcp2_set_encryption_input {
408 	uint32_t session_handle;
409 };
410 
411 struct ta_hdcp_cmd_hdcp2_get_encryption_status_input {
412 	uint32_t session_handle;
413 };
414 
415 struct ta_hdcp_cmd_hdcp2_get_encryption_status_output {
416 	enum ta_hdcp_content_type hdcp2_type;
417 	uint32_t protection_level;
418 };
419 
420 struct ta_hdcp_cmd_hdcp2_enable_dp_stream_encryption_input {
421 	uint32_t session_handle;
422 	uint32_t display_handle;
423 };
424 
425 struct ta_hdcp_cmd_set_srm_input {
426 	uint32_t srm_buf_size;
427 	uint8_t srm_buf[PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE];
428 };
429 
430 struct ta_hdcp_cmd_set_srm_output {
431 	uint8_t valid_signature;
432 	uint32_t srm_version;
433 };
434 
435 struct ta_hdcp_cmd_get_srm_output {
436 	uint32_t srm_version;
437 	uint32_t srm_buf_size;
438 	uint8_t srm_buf[PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE];
439 };
440 
441 /**********************************************************/
442 /* Common input structure for HDCP callbacks */
443 union ta_hdcp_cmd_input {
444 	struct ta_hdcp_cmd_hdcp1_create_session_input hdcp1_create_session;
445 	struct ta_hdcp_cmd_hdcp1_destroy_session_input hdcp1_destroy_session;
446 	struct ta_hdcp_cmd_hdcp1_first_part_authentication_input hdcp1_first_part_authentication;
447 	struct ta_hdcp_cmd_hdcp1_second_part_authentication_input hdcp1_second_part_authentication;
448 	struct ta_hdcp_cmd_hdcp1_enable_encryption_input hdcp1_enable_encryption;
449 	struct ta_hdcp_cmd_hdcp1_enable_dp_stream_encryption_input hdcp1_enable_dp_stream_encryption;
450 	struct ta_hdcp_cmd_hdcp1_get_encryption_status_input hdcp1_get_encryption_status;
451 	struct ta_hdcp_cmd_hdcp2_destroy_session_input hdcp2_destroy_session;
452 	struct ta_hdcp_cmd_hdcp2_set_encryption_input hdcp2_set_encryption;
453 	struct ta_hdcp_cmd_hdcp2_get_encryption_status_input hdcp2_get_encryption_status;
454 	struct ta_hdcp_cmd_hdcp2_create_session_input_v2 hdcp2_create_session_v2;
455 	struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
456 		hdcp2_prepare_process_authentication_message_v2;
457 	struct ta_hdcp_cmd_hdcp2_enable_dp_stream_encryption_input hdcp2_enable_dp_stream_encryption;
458 	struct ta_hdcp_cmd_set_srm_input hdcp_set_srm;
459 };
460 
461 /* Common output structure for HDCP callbacks */
462 union ta_hdcp_cmd_output {
463 	struct ta_hdcp_cmd_hdcp1_create_session_output hdcp1_create_session;
464 	struct ta_hdcp_cmd_hdcp1_first_part_authentication_output hdcp1_first_part_authentication;
465 	struct ta_hdcp_cmd_hdcp1_second_part_authentication_output hdcp1_second_part_authentication;
466 	struct ta_hdcp_cmd_hdcp1_get_encryption_status_output hdcp1_get_encryption_status;
467 	struct ta_hdcp_cmd_hdcp2_get_encryption_status_output hdcp2_get_encryption_status;
468 	struct ta_hdcp_cmd_hdcp2_create_session_output_v2 hdcp2_create_session_v2;
469 	struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
470 		hdcp2_prepare_process_authentication_message_v2;
471 	struct ta_hdcp_cmd_set_srm_output hdcp_set_srm;
472 	struct ta_hdcp_cmd_get_srm_output hdcp_get_srm;
473 };
474 /**********************************************************/
475 
476 struct ta_hdcp_shared_memory {
477 	uint32_t cmd_id;
478 	enum ta_hdcp_status hdcp_status;
479 	uint32_t reserved;
480 	union ta_hdcp_cmd_input in_msg;
481 	union ta_hdcp_cmd_output out_msg;
482 };
483 
484 enum psp_status {
485 	PSP_STATUS__SUCCESS = 0,
486 	PSP_STATUS__ERROR_INVALID_PARAMS,
487 	PSP_STATUS__ERROR_GENERIC,
488 	PSP_STATUS__ERROR_OUT_OF_MEMORY,
489 	PSP_STATUS__ERROR_UNSUPPORTED_FEATURE
490 };
491 
492 #endif /* MODULES_HDCP_HDCP_PSP_H_ */
493