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