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