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 	TA_DTM_COMMAND__TOPOLOGY_UPDATE_V3
49 };
50 
51 /* DTM related enumerations */
52 /**********************************************************/
53 
54 enum ta_dtm_status {
55 	TA_DTM_STATUS__SUCCESS = 0x00,
56 	TA_DTM_STATUS__GENERIC_FAILURE = 0x01,
57 	TA_DTM_STATUS__INVALID_PARAMETER = 0x02,
58 	TA_DTM_STATUS__NULL_POINTER = 0x3
59 };
60 
61 /* input/output structures for DTM commands */
62 /**********************************************************/
63 /**
64  * Input structures
65  */
66 enum ta_dtm_hdcp_version_max_supported {
67 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__NONE = 0,
68 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__1_x = 10,
69 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__2_0 = 20,
70 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__2_1 = 21,
71 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__2_2 = 22,
72 	TA_DTM_HDCP_VERSION_MAX_SUPPORTED__2_3 = 23
73 };
74 
75 struct ta_dtm_topology_update_input_v2 {
76 	/* display handle is unique across the driver and is used to identify a display */
77 	/* for all security interfaces which reference displays such as HDCP */
78 	uint32_t display_handle;
79 	uint32_t is_active;
80 	uint32_t is_miracast;
81 	uint32_t controller;
82 	uint32_t ddc_line;
83 	uint32_t dig_be;
84 	uint32_t dig_fe;
85 	uint32_t dp_mst_vcid;
86 	uint32_t is_assr;
87 	uint32_t max_hdcp_supported_version;
88 };
89 
90 /* For security reason/HW may change value, these encoder type enum values are not HW register values */
91 /* Security code will check real HW register values and these SW enum values */
92 enum ta_dtm_encoder_type {
93 	TA_DTM_ENCODER_TYPE__INVALID    = 0,
94 	TA_DTM_ENCODER_TYPE__DIG        = 0x10
95 };
96 
97 struct ta_dtm_topology_update_input_v3 {
98 	/* display handle is unique across the driver and is used to identify a display */
99 	/* for all security interfaces which reference displays such as HDCP */
100 	/* link_hdcp_cap means link is HDCP-capable for audio HDCP capable property(informational), not for other logic(e.g. Crossbar) */
101 	uint32_t display_handle;
102 	uint32_t is_active;
103 	uint32_t is_miracast;
104 	uint32_t controller;
105 	uint32_t ddc_line;
106 	uint32_t link_enc;
107 	uint32_t stream_enc;
108 	uint32_t dp_mst_vcid;
109 	uint32_t is_assr;
110 	uint32_t max_hdcp_supported_version;
111 	enum ta_dtm_encoder_type encoder_type;
112 	uint32_t phy_id;
113 	uint32_t link_hdcp_cap;
114 };
115 
116 struct ta_dtm_topology_assr_enable {
117 	uint32_t display_topology_dig_be_index;
118 };
119 
120 /**
121  * Output structures
122  */
123 
124 /* No output structures yet */
125 
126 union ta_dtm_cmd_input {
127 	struct ta_dtm_topology_update_input_v2 topology_update_v2;
128 	struct ta_dtm_topology_assr_enable topology_assr_enable;
129 	struct ta_dtm_topology_update_input_v3 topology_update_v3;
130 };
131 
132 union ta_dtm_cmd_output {
133 	uint32_t reserved;
134 };
135 
136 struct ta_dtm_shared_memory {
137 	uint32_t cmd_id;
138 	uint32_t resp_id;
139 	enum ta_dtm_status dtm_status;
140 	uint32_t reserved;
141 	union ta_dtm_cmd_input dtm_in_message;
142 	union ta_dtm_cmd_output dtm_out_message;
143 };
144 
145 int psp_cmd_submit_buf(struct psp_context *psp, struct amdgpu_firmware_info *ucode, struct psp_gfx_cmd_resp *cmd,
146 		uint64_t fence_mc_addr);
147 
148 enum { PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE = 5120 };
149 
150 enum ta_hdcp_command {
151 	TA_HDCP_COMMAND__INITIALIZE,
152 	TA_HDCP_COMMAND__HDCP1_CREATE_SESSION,
153 	TA_HDCP_COMMAND__HDCP1_DESTROY_SESSION,
154 	TA_HDCP_COMMAND__HDCP1_FIRST_PART_AUTHENTICATION,
155 	TA_HDCP_COMMAND__HDCP1_SECOND_PART_AUTHENTICATION,
156 	TA_HDCP_COMMAND__HDCP1_ENABLE_ENCRYPTION,
157 	TA_HDCP_COMMAND__HDCP1_ENABLE_DP_STREAM_ENCRYPTION,
158 	TA_HDCP_COMMAND__HDCP1_GET_ENCRYPTION_STATUS,
159 	TA_HDCP_COMMAND__UNUSED_1,
160 	TA_HDCP_COMMAND__HDCP2_DESTROY_SESSION,
161 	TA_HDCP_COMMAND__UNUSED_2,
162 	TA_HDCP_COMMAND__HDCP2_SET_ENCRYPTION,
163 	TA_HDCP_COMMAND__HDCP2_GET_ENCRYPTION_STATUS,
164 	TA_HDCP_COMMAND__UNUSED_3,
165 	TA_HDCP_COMMAND__HDCP2_CREATE_SESSION_V2,
166 	TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2,
167 	TA_HDCP_COMMAND__HDCP2_ENABLE_DP_STREAM_ENCRYPTION,
168 	TA_HDCP_COMMAND__HDCP_DESTROY_ALL_SESSIONS,
169 	TA_HDCP_COMMAND__HDCP_SET_SRM,
170 	TA_HDCP_COMMAND__HDCP_GET_SRM
171 };
172 
173 enum ta_hdcp2_msg_id {
174 	TA_HDCP_HDCP2_MSG_ID__NULL_MESSAGE = 1,
175 	TA_HDCP_HDCP2_MSG_ID__AKE_INIT = 2,
176 	TA_HDCP_HDCP2_MSG_ID__AKE_SEND_CERT = 3,
177 	TA_HDCP_HDCP2_MSG_ID__AKE_NO_STORED_KM = 4,
178 	TA_HDCP_HDCP2_MSG_ID__AKE_STORED_KM = 5,
179 	TA_HDCP_HDCP2_MSG_ID__AKE_SEND_RRX = 6,
180 	TA_HDCP_HDCP2_MSG_ID__AKE_SEND_H_PRIME = 7,
181 	TA_HDCP_HDCP2_MSG_ID__AKE_SEND_PAIRING_INFO = 8,
182 	TA_HDCP_HDCP2_MSG_ID__LC_INIT = 9,
183 	TA_HDCP_HDCP2_MSG_ID__LC_SEND_L_PRIME = 10,
184 	TA_HDCP_HDCP2_MSG_ID__SKE_SEND_EKS = 11,
185 	TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_SEND_RECEIVERID_LIST = 12,
186 	TA_HDCP_HDCP2_MSG_ID__RTT_READY = 13,
187 	TA_HDCP_HDCP2_MSG_ID__RTT_CHALLENGE = 14,
188 	TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_SEND_ACK = 15,
189 	TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_STREAM_MANAGE = 16,
190 	TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_STREAM_READY = 17,
191 	TA_HDCP_HDCP2_MSG_ID__RECEIVER_AUTH_STATUS = 18,
192 	TA_HDCP_HDCP2_MSG_ID__AKE_TRANSMITTER_INFO = 19,
193 	TA_HDCP_HDCP2_MSG_ID__AKE_RECEIVER_INFO = 20,
194 	TA_HDCP_HDCP2_MSG_ID__SIGNAL_CONTENT_STREAM_TYPE_DP = 129
195 };
196 
197 enum ta_hdcp2_hdcp2_msg_id_max_size {
198 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__NULL_MESSAGE = 0,
199 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_INIT = 12,
200 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_CERT = 534,
201 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_NO_STORED_KM = 129,
202 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_STORED_KM = 33,
203 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_RRX = 9,
204 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_H_PRIME = 33,
205 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_PAIRING_INFO = 17,
206 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__LC_INIT = 9,
207 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__LC_SEND_L_PRIME = 33,
208 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__SKE_SEND_EKS = 25,
209 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__REPEATERAUTH_SEND_RECEIVERID_LIST = 181,
210 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__RTT_READY = 1,
211 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__RTT_CHALLENGE = 17,
212 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__REPEATERAUTH_SEND_RACK = 17,
213 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__REPEATERAUTH_STREAM_MANAGE = 13,
214 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__REPEATERAUTH_STREAM_READY = 33,
215 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__RECEIVER_AUTH_STATUS = 4,
216 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_TRANSMITTER_INFO = 6,
217 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_RECEIVER_INFO = 6,
218 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__SIGNAL_CONTENT_STREAM_TYPE_DP = 1
219 };
220 
221 /* HDCP related enumerations */
222 /**********************************************************/
223 #define TA_HDCP__INVALID_SESSION 0xFFFF
224 #define TA_HDCP__HDCP1_AN_SIZE 8
225 #define TA_HDCP__HDCP1_KSV_SIZE 5
226 #define TA_HDCP__HDCP1_KSV_LIST_MAX_ENTRIES 127
227 #define TA_HDCP__HDCP1_V_PRIME_SIZE 20
228 #define TA_HDCP__HDCP2_TX_BUF_MAX_SIZE                                                                                 \
229 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_NO_STORED_KM + TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_STORED_KM + 6
230 
231 // 64 bits boundaries
232 #define TA_HDCP__HDCP2_RX_BUF_MAX_SIZE                                                                                 \
233 	TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_CERT + TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_RECEIVER_INFO + 4
234 
235 enum ta_hdcp_status {
236 	TA_HDCP_STATUS__SUCCESS = 0x00,
237 	TA_HDCP_STATUS__GENERIC_FAILURE = 0x01,
238 	TA_HDCP_STATUS__NULL_POINTER = 0x02,
239 	TA_HDCP_STATUS__FAILED_ALLOCATING_SESSION = 0x03,
240 	TA_HDCP_STATUS__FAILED_SETUP_TX = 0x04,
241 	TA_HDCP_STATUS__INVALID_PARAMETER = 0x05,
242 	TA_HDCP_STATUS__VHX_ERROR = 0x06,
243 	TA_HDCP_STATUS__SESSION_NOT_CLOSED_PROPERLY = 0x07,
244 	TA_HDCP_STATUS__SRM_FAILURE = 0x08,
245 	TA_HDCP_STATUS__MST_AUTHENTICATED_ALREADY_STARTED = 0x09,
246 	TA_HDCP_STATUS__AKE_SEND_CERT_FAILURE = 0x0A,
247 	TA_HDCP_STATUS__AKE_NO_STORED_KM_FAILURE = 0x0B,
248 	TA_HDCP_STATUS__AKE_SEND_HPRIME_FAILURE = 0x0C,
249 	TA_HDCP_STATUS__LC_SEND_LPRIME_FAILURE = 0x0D,
250 	TA_HDCP_STATUS__SKE_SEND_EKS_FAILURE = 0x0E,
251 	TA_HDCP_STATUS__REPAUTH_SEND_RXIDLIST_FAILURE = 0x0F,
252 	TA_HDCP_STATUS__REPAUTH_STREAM_READY_FAILURE = 0x10,
253 	TA_HDCP_STATUS__ASD_GENERIC_FAILURE = 0x11,
254 	TA_HDCP_STATUS__UNWRAP_SECRET_FAILURE = 0x12,
255 	TA_HDCP_STATUS__ENABLE_ENCR_FAILURE = 0x13,
256 	TA_HDCP_STATUS__DISABLE_ENCR_FAILURE = 0x14,
257 	TA_HDCP_STATUS__NOT_ENOUGH_MEMORY_FAILURE = 0x15,
258 	TA_HDCP_STATUS__UNKNOWN_MESSAGE = 0x16,
259 	TA_HDCP_STATUS__TOO_MANY_STREAM = 0x17
260 };
261 
262 enum ta_hdcp_authentication_status {
263 	TA_HDCP_AUTHENTICATION_STATUS__NOT_STARTED = 0x00,
264 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_FIRST_PART_FAILED = 0x01,
265 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_FIRST_PART_COMPLETE = 0x02,
266 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_SECOND_PART_FAILED = 0x03,
267 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_AUTHENTICATED = 0x04,
268 	TA_HDCP_AUTHENTICATION_STATUS__HDCP22_AUTHENTICATION_PENDING = 0x06,
269 	TA_HDCP_AUTHENTICATION_STATUS__HDCP22_AUTHENTICATION_FAILED = 0x07,
270 	TA_HDCP_AUTHENTICATION_STATUS__HDCP22_AUTHENTICATED = 0x08,
271 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_KSV_VALIDATION_FAILED = 0x09,
272 	TA_HDCP_AUTHENTICATION_STATUS__HDCP1_KSV_REVOKED = 0x0A
273 };
274 
275 enum ta_hdcp2_msg_authentication_status {
276 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__SUCCESS = 0,
277 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__KM_NOT_AVAILABLE,
278 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__UNUSED,
279 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID = 100, // everything above does not fail the request
280 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__NOT_ENOUGH_MEMORY,
281 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__NOT_EXPECTED_MSG,
282 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__SIGNATURE_CERTIFICAT_ERROR,
283 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INCORRECT_HDCP_VERSION,
284 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__UNKNOWN_MESSAGE,
285 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_HMAC,
286 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_TOPOLOGY,
287 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_SEQ_NUM,
288 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_SIZE,
289 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__INVALID_LENGTH,
290 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__REAUTH_REQUEST,
291 	TA_HDCP2_MSG_AUTHENTICATION_STATUS__RECEIVERID_REVOKED
292 };
293 
294 enum ta_hdcp_content_type {
295 	TA_HDCP2_CONTENT_TYPE__TYPE0 = 1,
296 	TA_HDCP2_CONTENT_TYPE__TYPE1,
297 };
298 
299 enum ta_hdcp_content_type_negotiation_type {
300 	TA_HDCP2_CONTENT_TYPE_NEGOTIATION_TYPE__FORCE_TYPE0 = 1,
301 	TA_HDCP2_CONTENT_TYPE_NEGOTIATION_TYPE__FORCE_TYPE1,
302 	TA_HDCP2_CONTENT_TYPE_NEGOTIATION_TYPE__MAX_SUPPORTED
303 };
304 
305 enum ta_hdcp2_version {
306 	TA_HDCP2_VERSION_UNKNOWN = 0,
307 	TA_HDCP2_VERSION_2_0 = 20,
308 	TA_HDCP2_VERSION_2_1 = 21,
309 	TA_HDCP2_VERSION_2_2 = 22,
310 	TA_HDCP2_VERSION_2_3 = 23,
311 };
312 
313 /* input/output structures for HDCP commands */
314 /**********************************************************/
315 struct ta_hdcp_cmd_hdcp1_create_session_input {
316 	uint8_t display_handle;
317 };
318 
319 struct ta_hdcp_cmd_hdcp1_create_session_output {
320 	uint32_t session_handle;
321 	uint8_t an_primary[TA_HDCP__HDCP1_AN_SIZE];
322 	uint8_t aksv_primary[TA_HDCP__HDCP1_KSV_SIZE];
323 	uint8_t ainfo_primary;
324 	uint8_t an_secondary[TA_HDCP__HDCP1_AN_SIZE];
325 	uint8_t aksv_secondary[TA_HDCP__HDCP1_KSV_SIZE];
326 	uint8_t ainfo_secondary;
327 };
328 
329 struct ta_hdcp_cmd_hdcp1_destroy_session_input {
330 	uint32_t session_handle;
331 };
332 
333 struct ta_hdcp_cmd_hdcp1_first_part_authentication_input {
334 	uint32_t session_handle;
335 	uint8_t bksv_primary[TA_HDCP__HDCP1_KSV_SIZE];
336 	uint8_t bksv_secondary[TA_HDCP__HDCP1_KSV_SIZE];
337 	uint8_t bcaps;
338 	uint16_t r0_prime_primary;
339 	uint16_t r0_prime_secondary;
340 };
341 
342 struct ta_hdcp_cmd_hdcp1_first_part_authentication_output {
343 	enum ta_hdcp_authentication_status authentication_status;
344 };
345 
346 struct ta_hdcp_cmd_hdcp1_second_part_authentication_input {
347 	uint32_t session_handle;
348 	uint16_t bstatus_binfo;
349 	uint8_t ksv_list[TA_HDCP__HDCP1_KSV_LIST_MAX_ENTRIES][TA_HDCP__HDCP1_KSV_SIZE];
350 	uint32_t ksv_list_size;
351 	uint8_t pj_prime;
352 	uint8_t v_prime[TA_HDCP__HDCP1_V_PRIME_SIZE];
353 };
354 
355 struct ta_hdcp_cmd_hdcp1_second_part_authentication_output {
356 	enum ta_hdcp_authentication_status authentication_status;
357 };
358 
359 struct ta_hdcp_cmd_hdcp1_enable_encryption_input {
360 	uint32_t session_handle;
361 };
362 
363 struct ta_hdcp_cmd_hdcp1_enable_dp_stream_encryption_input {
364 	uint32_t session_handle;
365 	uint32_t display_handle;
366 };
367 
368 struct ta_hdcp_cmd_hdcp1_get_encryption_status_input {
369 	uint32_t session_handle;
370 };
371 
372 struct ta_hdcp_cmd_hdcp1_get_encryption_status_output {
373 	uint32_t protection_level;
374 };
375 
376 struct ta_hdcp_cmd_hdcp2_create_session_input_v2 {
377 	uint32_t display_handle;
378 	enum ta_hdcp_content_type_negotiation_type negotiate_content_type;
379 };
380 
381 struct ta_hdcp_cmd_hdcp2_create_session_output_v2 {
382 	uint32_t session_handle;
383 };
384 
385 struct ta_hdcp_cmd_hdcp2_destroy_session_input {
386 	uint32_t session_handle;
387 };
388 
389 struct ta_hdcp_cmd_hdcp2_authentication_message_v2 {
390 	enum ta_hdcp2_msg_id msg_id;
391 	uint32_t msg_size;
392 };
393 
394 struct ta_hdcp_cmd_hdcp2_process_authentication_message_input_v2 {
395 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg1_desc;
396 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg2_desc;
397 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg3_desc;
398 	uint8_t receiver_message[TA_HDCP__HDCP2_RX_BUF_MAX_SIZE];
399 };
400 
401 struct ta_hdcp_cmd_hdcp2_process_authentication_message_output_v2 {
402 	uint32_t hdcp_version;
403 	uint32_t is_km_stored;
404 	uint32_t is_locality_precompute_support;
405 	uint32_t is_repeater;
406 	enum ta_hdcp2_msg_authentication_status msg1_status;
407 	enum ta_hdcp2_msg_authentication_status msg2_status;
408 	enum ta_hdcp2_msg_authentication_status msg3_status;
409 };
410 
411 struct ta_hdcp_cmd_hdcp2_prepare_authentication_message_input_v2 {
412 	enum ta_hdcp2_msg_id msg1_id;
413 	enum ta_hdcp2_msg_id msg2_id;
414 };
415 
416 struct ta_hdcp_cmd_hdcp2_prepare_authentication_message_output_v2 {
417 	enum ta_hdcp2_msg_authentication_status msg1_status;
418 	enum ta_hdcp2_msg_authentication_status msg2_status;
419 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg1_desc;
420 	struct ta_hdcp_cmd_hdcp2_authentication_message_v2 msg2_desc;
421 	uint8_t transmitter_message[TA_HDCP__HDCP2_TX_BUF_MAX_SIZE];
422 };
423 
424 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2 {
425 	uint32_t session_handle;
426 	struct ta_hdcp_cmd_hdcp2_process_authentication_message_input_v2 process;
427 	struct ta_hdcp_cmd_hdcp2_prepare_authentication_message_input_v2 prepare;
428 };
429 
430 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2 {
431 	uint32_t authentication_status;
432 	struct ta_hdcp_cmd_hdcp2_process_authentication_message_output_v2 process;
433 	struct ta_hdcp_cmd_hdcp2_prepare_authentication_message_output_v2 prepare;
434 };
435 
436 struct ta_hdcp_cmd_hdcp2_set_encryption_input {
437 	uint32_t session_handle;
438 };
439 
440 struct ta_hdcp_cmd_hdcp2_get_encryption_status_input {
441 	uint32_t session_handle;
442 };
443 
444 struct ta_hdcp_cmd_hdcp2_get_encryption_status_output {
445 	enum ta_hdcp_content_type hdcp2_type;
446 	uint32_t protection_level;
447 };
448 
449 struct ta_hdcp_cmd_hdcp2_enable_dp_stream_encryption_input {
450 	uint32_t session_handle;
451 	uint32_t display_handle;
452 };
453 
454 struct ta_hdcp_cmd_set_srm_input {
455 	uint32_t srm_buf_size;
456 	uint8_t srm_buf[PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE];
457 };
458 
459 struct ta_hdcp_cmd_set_srm_output {
460 	uint8_t valid_signature;
461 	uint32_t srm_version;
462 };
463 
464 struct ta_hdcp_cmd_get_srm_output {
465 	uint32_t srm_version;
466 	uint32_t srm_buf_size;
467 	uint8_t srm_buf[PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE];
468 };
469 
470 /**********************************************************/
471 /* Common input structure for HDCP callbacks */
472 union ta_hdcp_cmd_input {
473 	struct ta_hdcp_cmd_hdcp1_create_session_input hdcp1_create_session;
474 	struct ta_hdcp_cmd_hdcp1_destroy_session_input hdcp1_destroy_session;
475 	struct ta_hdcp_cmd_hdcp1_first_part_authentication_input hdcp1_first_part_authentication;
476 	struct ta_hdcp_cmd_hdcp1_second_part_authentication_input hdcp1_second_part_authentication;
477 	struct ta_hdcp_cmd_hdcp1_enable_encryption_input hdcp1_enable_encryption;
478 	struct ta_hdcp_cmd_hdcp1_enable_dp_stream_encryption_input hdcp1_enable_dp_stream_encryption;
479 	struct ta_hdcp_cmd_hdcp1_get_encryption_status_input hdcp1_get_encryption_status;
480 	struct ta_hdcp_cmd_hdcp2_destroy_session_input hdcp2_destroy_session;
481 	struct ta_hdcp_cmd_hdcp2_set_encryption_input hdcp2_set_encryption;
482 	struct ta_hdcp_cmd_hdcp2_get_encryption_status_input hdcp2_get_encryption_status;
483 	struct ta_hdcp_cmd_hdcp2_create_session_input_v2 hdcp2_create_session_v2;
484 	struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
485 		hdcp2_prepare_process_authentication_message_v2;
486 	struct ta_hdcp_cmd_hdcp2_enable_dp_stream_encryption_input hdcp2_enable_dp_stream_encryption;
487 	struct ta_hdcp_cmd_set_srm_input hdcp_set_srm;
488 };
489 
490 /* Common output structure for HDCP callbacks */
491 union ta_hdcp_cmd_output {
492 	struct ta_hdcp_cmd_hdcp1_create_session_output hdcp1_create_session;
493 	struct ta_hdcp_cmd_hdcp1_first_part_authentication_output hdcp1_first_part_authentication;
494 	struct ta_hdcp_cmd_hdcp1_second_part_authentication_output hdcp1_second_part_authentication;
495 	struct ta_hdcp_cmd_hdcp1_get_encryption_status_output hdcp1_get_encryption_status;
496 	struct ta_hdcp_cmd_hdcp2_get_encryption_status_output hdcp2_get_encryption_status;
497 	struct ta_hdcp_cmd_hdcp2_create_session_output_v2 hdcp2_create_session_v2;
498 	struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
499 		hdcp2_prepare_process_authentication_message_v2;
500 	struct ta_hdcp_cmd_set_srm_output hdcp_set_srm;
501 	struct ta_hdcp_cmd_get_srm_output hdcp_get_srm;
502 };
503 /**********************************************************/
504 
505 struct ta_hdcp_shared_memory {
506 	uint32_t cmd_id;
507 	enum ta_hdcp_status hdcp_status;
508 	uint32_t reserved;
509 	union ta_hdcp_cmd_input in_msg;
510 	union ta_hdcp_cmd_output out_msg;
511 };
512 
513 enum psp_status {
514 	PSP_STATUS__SUCCESS = 0,
515 	PSP_STATUS__ERROR_INVALID_PARAMS,
516 	PSP_STATUS__ERROR_GENERIC,
517 	PSP_STATUS__ERROR_OUT_OF_MEMORY,
518 	PSP_STATUS__ERROR_UNSUPPORTED_FEATURE
519 };
520 
521 #endif /* MODULES_HDCP_HDCP_PSP_H_ */
522