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