2 * Copyright 2019 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
28 #define MIN(a, b) ((a) < (b) ? (a) : (b))
29 #define HDCP_I2C_ADDR 0x3a /* 0x74 >> 1*/
30 #define KSV_READ_SIZE 0xf /* 0x6803b - 0x6802c */
31 #define HDCP_MAX_AUX_TRANSACTION_SIZE 16
33 enum mod_hdcp_ddc_message_id
{
34 MOD_HDCP_MESSAGE_ID_INVALID
= -1,
38 MOD_HDCP_MESSAGE_ID_READ_BKSV
= 0,
39 MOD_HDCP_MESSAGE_ID_READ_RI_R0
,
40 MOD_HDCP_MESSAGE_ID_WRITE_AKSV
,
41 MOD_HDCP_MESSAGE_ID_WRITE_AINFO
,
42 MOD_HDCP_MESSAGE_ID_WRITE_AN
,
43 MOD_HDCP_MESSAGE_ID_READ_VH_X
,
44 MOD_HDCP_MESSAGE_ID_READ_VH_0
,
45 MOD_HDCP_MESSAGE_ID_READ_VH_1
,
46 MOD_HDCP_MESSAGE_ID_READ_VH_2
,
47 MOD_HDCP_MESSAGE_ID_READ_VH_3
,
48 MOD_HDCP_MESSAGE_ID_READ_VH_4
,
49 MOD_HDCP_MESSAGE_ID_READ_BCAPS
,
50 MOD_HDCP_MESSAGE_ID_READ_BSTATUS
,
51 MOD_HDCP_MESSAGE_ID_READ_KSV_FIFO
,
52 MOD_HDCP_MESSAGE_ID_READ_BINFO
,
56 MOD_HDCP_MESSAGE_ID_HDCP2VERSION
,
57 MOD_HDCP_MESSAGE_ID_RX_CAPS
,
58 MOD_HDCP_MESSAGE_ID_WRITE_AKE_INIT
,
59 MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_CERT
,
60 MOD_HDCP_MESSAGE_ID_WRITE_AKE_NO_STORED_KM
,
61 MOD_HDCP_MESSAGE_ID_WRITE_AKE_STORED_KM
,
62 MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_H_PRIME
,
63 MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_PAIRING_INFO
,
64 MOD_HDCP_MESSAGE_ID_WRITE_LC_INIT
,
65 MOD_HDCP_MESSAGE_ID_READ_LC_SEND_L_PRIME
,
66 MOD_HDCP_MESSAGE_ID_WRITE_SKE_SEND_EKS
,
67 MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_SEND_RECEIVERID_LIST
,
68 MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_SEND_ACK
,
69 MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_STREAM_MANAGE
,
70 MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_STREAM_READY
,
71 MOD_HDCP_MESSAGE_ID_READ_RXSTATUS
,
72 MOD_HDCP_MESSAGE_ID_WRITE_CONTENT_STREAM_TYPE
,
74 MOD_HDCP_MESSAGE_ID_MAX
77 static const uint8_t hdcp_i2c_offsets
[] = {
78 [MOD_HDCP_MESSAGE_ID_READ_BKSV
] = 0x0,
79 [MOD_HDCP_MESSAGE_ID_READ_RI_R0
] = 0x8,
80 [MOD_HDCP_MESSAGE_ID_WRITE_AKSV
] = 0x10,
81 [MOD_HDCP_MESSAGE_ID_WRITE_AINFO
] = 0x15,
82 [MOD_HDCP_MESSAGE_ID_WRITE_AN
] = 0x18,
83 [MOD_HDCP_MESSAGE_ID_READ_VH_X
] = 0x20,
84 [MOD_HDCP_MESSAGE_ID_READ_VH_0
] = 0x20,
85 [MOD_HDCP_MESSAGE_ID_READ_VH_1
] = 0x24,
86 [MOD_HDCP_MESSAGE_ID_READ_VH_2
] = 0x28,
87 [MOD_HDCP_MESSAGE_ID_READ_VH_3
] = 0x2C,
88 [MOD_HDCP_MESSAGE_ID_READ_VH_4
] = 0x30,
89 [MOD_HDCP_MESSAGE_ID_READ_BCAPS
] = 0x40,
90 [MOD_HDCP_MESSAGE_ID_READ_BSTATUS
] = 0x41,
91 [MOD_HDCP_MESSAGE_ID_READ_KSV_FIFO
] = 0x43,
92 [MOD_HDCP_MESSAGE_ID_READ_BINFO
] = 0xFF,
93 [MOD_HDCP_MESSAGE_ID_HDCP2VERSION
] = 0x50,
94 [MOD_HDCP_MESSAGE_ID_WRITE_AKE_INIT
] = 0x60,
95 [MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_CERT
] = 0x80,
96 [MOD_HDCP_MESSAGE_ID_WRITE_AKE_NO_STORED_KM
] = 0x60,
97 [MOD_HDCP_MESSAGE_ID_WRITE_AKE_STORED_KM
] = 0x60,
98 [MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_H_PRIME
] = 0x80,
99 [MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_PAIRING_INFO
] = 0x80,
100 [MOD_HDCP_MESSAGE_ID_WRITE_LC_INIT
] = 0x60,
101 [MOD_HDCP_MESSAGE_ID_READ_LC_SEND_L_PRIME
] = 0x80,
102 [MOD_HDCP_MESSAGE_ID_WRITE_SKE_SEND_EKS
] = 0x60,
103 [MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_SEND_RECEIVERID_LIST
] = 0x80,
104 [MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_SEND_ACK
] = 0x60,
105 [MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_STREAM_MANAGE
] = 0x60,
106 [MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_STREAM_READY
] = 0x80,
107 [MOD_HDCP_MESSAGE_ID_READ_RXSTATUS
] = 0x70,
108 [MOD_HDCP_MESSAGE_ID_WRITE_CONTENT_STREAM_TYPE
] = 0x0
111 static const uint32_t hdcp_dpcd_addrs
[] = {
112 [MOD_HDCP_MESSAGE_ID_READ_BKSV
] = 0x68000,
113 [MOD_HDCP_MESSAGE_ID_READ_RI_R0
] = 0x68005,
114 [MOD_HDCP_MESSAGE_ID_WRITE_AKSV
] = 0x68007,
115 [MOD_HDCP_MESSAGE_ID_WRITE_AINFO
] = 0x6803B,
116 [MOD_HDCP_MESSAGE_ID_WRITE_AN
] = 0x6800c,
117 [MOD_HDCP_MESSAGE_ID_READ_VH_X
] = 0x68014,
118 [MOD_HDCP_MESSAGE_ID_READ_VH_0
] = 0x68014,
119 [MOD_HDCP_MESSAGE_ID_READ_VH_1
] = 0x68018,
120 [MOD_HDCP_MESSAGE_ID_READ_VH_2
] = 0x6801c,
121 [MOD_HDCP_MESSAGE_ID_READ_VH_3
] = 0x68020,
122 [MOD_HDCP_MESSAGE_ID_READ_VH_4
] = 0x68024,
123 [MOD_HDCP_MESSAGE_ID_READ_BCAPS
] = 0x68028,
124 [MOD_HDCP_MESSAGE_ID_READ_BSTATUS
] = 0x68029,
125 [MOD_HDCP_MESSAGE_ID_READ_KSV_FIFO
] = 0x6802c,
126 [MOD_HDCP_MESSAGE_ID_READ_BINFO
] = 0x6802a,
127 [MOD_HDCP_MESSAGE_ID_RX_CAPS
] = 0x6921d,
128 [MOD_HDCP_MESSAGE_ID_WRITE_AKE_INIT
] = 0x69000,
129 [MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_CERT
] = 0x6900b,
130 [MOD_HDCP_MESSAGE_ID_WRITE_AKE_NO_STORED_KM
] = 0x69220,
131 [MOD_HDCP_MESSAGE_ID_WRITE_AKE_STORED_KM
] = 0x692a0,
132 [MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_H_PRIME
] = 0x692c0,
133 [MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_PAIRING_INFO
] = 0x692e0,
134 [MOD_HDCP_MESSAGE_ID_WRITE_LC_INIT
] = 0x692f0,
135 [MOD_HDCP_MESSAGE_ID_READ_LC_SEND_L_PRIME
] = 0x692f8,
136 [MOD_HDCP_MESSAGE_ID_WRITE_SKE_SEND_EKS
] = 0x69318,
137 [MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_SEND_RECEIVERID_LIST
] = 0x69330,
138 [MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_SEND_ACK
] = 0x693e0,
139 [MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_STREAM_MANAGE
] = 0x693f0,
140 [MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_STREAM_READY
] = 0x69473,
141 [MOD_HDCP_MESSAGE_ID_READ_RXSTATUS
] = 0x69493,
142 [MOD_HDCP_MESSAGE_ID_WRITE_CONTENT_STREAM_TYPE
] = 0x69494
145 static enum mod_hdcp_status
read(struct mod_hdcp
*hdcp
,
146 enum mod_hdcp_ddc_message_id msg_id
,
151 uint32_t cur_size
= 0;
152 uint32_t data_offset
= 0;
154 if (is_dp_hdcp(hdcp
)) {
155 while (buf_len
> 0) {
156 cur_size
= MIN(buf_len
, HDCP_MAX_AUX_TRANSACTION_SIZE
);
157 success
= hdcp
->config
.ddc
.funcs
.read_dpcd(hdcp
->config
.ddc
.handle
,
158 hdcp_dpcd_addrs
[msg_id
] + data_offset
,
166 data_offset
+= cur_size
;
169 success
= hdcp
->config
.ddc
.funcs
.read_i2c(
170 hdcp
->config
.ddc
.handle
,
172 hdcp_i2c_offsets
[msg_id
],
177 return success
? MOD_HDCP_STATUS_SUCCESS
: MOD_HDCP_STATUS_DDC_FAILURE
;
180 static enum mod_hdcp_status
read_repeatedly(struct mod_hdcp
*hdcp
,
181 enum mod_hdcp_ddc_message_id msg_id
,
186 enum mod_hdcp_status status
= MOD_HDCP_STATUS_DDC_FAILURE
;
187 uint32_t cur_size
= 0;
188 uint32_t data_offset
= 0;
190 while (buf_len
> 0) {
191 cur_size
= MIN(buf_len
, read_size
);
192 status
= read(hdcp
, msg_id
, buf
+ data_offset
, cur_size
);
194 if (status
!= MOD_HDCP_STATUS_SUCCESS
)
198 data_offset
+= cur_size
;
204 static enum mod_hdcp_status
write(struct mod_hdcp
*hdcp
,
205 enum mod_hdcp_ddc_message_id msg_id
,
210 uint32_t cur_size
= 0;
211 uint32_t data_offset
= 0;
213 if (is_dp_hdcp(hdcp
)) {
214 while (buf_len
> 0) {
215 cur_size
= MIN(buf_len
, HDCP_MAX_AUX_TRANSACTION_SIZE
);
216 success
= hdcp
->config
.ddc
.funcs
.write_dpcd(
217 hdcp
->config
.ddc
.handle
,
218 hdcp_dpcd_addrs
[msg_id
] + data_offset
,
226 data_offset
+= cur_size
;
229 hdcp
->buf
[0] = hdcp_i2c_offsets
[msg_id
];
230 memmove(&hdcp
->buf
[1], buf
, buf_len
);
231 success
= hdcp
->config
.ddc
.funcs
.write_i2c(
232 hdcp
->config
.ddc
.handle
,
235 (uint32_t)(buf_len
+1));
238 return success
? MOD_HDCP_STATUS_SUCCESS
: MOD_HDCP_STATUS_DDC_FAILURE
;
241 enum mod_hdcp_status
mod_hdcp_read_bksv(struct mod_hdcp
*hdcp
)
243 return read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_BKSV
,
244 hdcp
->auth
.msg
.hdcp1
.bksv
,
245 sizeof(hdcp
->auth
.msg
.hdcp1
.bksv
));
248 enum mod_hdcp_status
mod_hdcp_read_bcaps(struct mod_hdcp
*hdcp
)
250 return read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_BCAPS
,
251 &hdcp
->auth
.msg
.hdcp1
.bcaps
,
252 sizeof(hdcp
->auth
.msg
.hdcp1
.bcaps
));
255 enum mod_hdcp_status
mod_hdcp_read_bstatus(struct mod_hdcp
*hdcp
)
257 enum mod_hdcp_status status
;
259 if (is_dp_hdcp(hdcp
))
260 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_BSTATUS
,
261 (uint8_t *)&hdcp
->auth
.msg
.hdcp1
.bstatus
,
264 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_BSTATUS
,
265 (uint8_t *)&hdcp
->auth
.msg
.hdcp1
.bstatus
,
266 sizeof(hdcp
->auth
.msg
.hdcp1
.bstatus
));
270 enum mod_hdcp_status
mod_hdcp_read_r0p(struct mod_hdcp
*hdcp
)
272 return read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_RI_R0
,
273 (uint8_t *)&hdcp
->auth
.msg
.hdcp1
.r0p
,
274 sizeof(hdcp
->auth
.msg
.hdcp1
.r0p
));
277 /* special case, reading repeatedly at the same address, don't use read() */
278 enum mod_hdcp_status
mod_hdcp_read_ksvlist(struct mod_hdcp
*hdcp
)
280 enum mod_hdcp_status status
;
282 if (is_dp_hdcp(hdcp
))
283 status
= read_repeatedly(hdcp
, MOD_HDCP_MESSAGE_ID_READ_KSV_FIFO
,
284 hdcp
->auth
.msg
.hdcp1
.ksvlist
,
285 hdcp
->auth
.msg
.hdcp1
.ksvlist_size
,
288 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_KSV_FIFO
,
289 (uint8_t *)&hdcp
->auth
.msg
.hdcp1
.ksvlist
,
290 hdcp
->auth
.msg
.hdcp1
.ksvlist_size
);
294 enum mod_hdcp_status
mod_hdcp_read_vp(struct mod_hdcp
*hdcp
)
296 enum mod_hdcp_status status
;
298 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_VH_0
,
299 &hdcp
->auth
.msg
.hdcp1
.vp
[0], 4);
300 if (status
!= MOD_HDCP_STATUS_SUCCESS
)
303 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_VH_1
,
304 &hdcp
->auth
.msg
.hdcp1
.vp
[4], 4);
305 if (status
!= MOD_HDCP_STATUS_SUCCESS
)
308 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_VH_2
,
309 &hdcp
->auth
.msg
.hdcp1
.vp
[8], 4);
310 if (status
!= MOD_HDCP_STATUS_SUCCESS
)
313 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_VH_3
,
314 &hdcp
->auth
.msg
.hdcp1
.vp
[12], 4);
315 if (status
!= MOD_HDCP_STATUS_SUCCESS
)
318 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_VH_4
,
319 &hdcp
->auth
.msg
.hdcp1
.vp
[16], 4);
324 enum mod_hdcp_status
mod_hdcp_read_binfo(struct mod_hdcp
*hdcp
)
326 enum mod_hdcp_status status
;
328 if (is_dp_hdcp(hdcp
))
329 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_BINFO
,
330 (uint8_t *)&hdcp
->auth
.msg
.hdcp1
.binfo_dp
,
331 sizeof(hdcp
->auth
.msg
.hdcp1
.binfo_dp
));
333 status
= MOD_HDCP_STATUS_INVALID_OPERATION
;
338 enum mod_hdcp_status
mod_hdcp_write_aksv(struct mod_hdcp
*hdcp
)
340 return write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_AKSV
,
341 hdcp
->auth
.msg
.hdcp1
.aksv
,
342 sizeof(hdcp
->auth
.msg
.hdcp1
.aksv
));
345 enum mod_hdcp_status
mod_hdcp_write_ainfo(struct mod_hdcp
*hdcp
)
347 return write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_AINFO
,
348 &hdcp
->auth
.msg
.hdcp1
.ainfo
,
349 sizeof(hdcp
->auth
.msg
.hdcp1
.ainfo
));
352 enum mod_hdcp_status
mod_hdcp_write_an(struct mod_hdcp
*hdcp
)
354 return write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_AN
,
355 hdcp
->auth
.msg
.hdcp1
.an
,
356 sizeof(hdcp
->auth
.msg
.hdcp1
.an
));
359 enum mod_hdcp_status
mod_hdcp_read_hdcp2version(struct mod_hdcp
*hdcp
)
361 enum mod_hdcp_status status
;
363 if (is_dp_hdcp(hdcp
))
364 status
= MOD_HDCP_STATUS_INVALID_OPERATION
;
366 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_HDCP2VERSION
,
367 &hdcp
->auth
.msg
.hdcp2
.hdcp2version_hdmi
,
368 sizeof(hdcp
->auth
.msg
.hdcp2
.hdcp2version_hdmi
));
373 enum mod_hdcp_status
mod_hdcp_read_rxcaps(struct mod_hdcp
*hdcp
)
375 enum mod_hdcp_status status
;
377 if (!is_dp_hdcp(hdcp
))
378 status
= MOD_HDCP_STATUS_INVALID_OPERATION
;
380 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_RX_CAPS
,
381 hdcp
->auth
.msg
.hdcp2
.rxcaps_dp
,
382 sizeof(hdcp
->auth
.msg
.hdcp2
.rxcaps_dp
));
387 enum mod_hdcp_status
mod_hdcp_read_rxstatus(struct mod_hdcp
*hdcp
)
389 enum mod_hdcp_status status
;
391 if (is_dp_hdcp(hdcp
)) {
392 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_RXSTATUS
,
393 &hdcp
->auth
.msg
.hdcp2
.rxstatus_dp
,
396 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_RXSTATUS
,
397 (uint8_t *)&hdcp
->auth
.msg
.hdcp2
.rxstatus
,
398 sizeof(hdcp
->auth
.msg
.hdcp2
.rxstatus
));
403 enum mod_hdcp_status
mod_hdcp_read_ake_cert(struct mod_hdcp
*hdcp
)
405 enum mod_hdcp_status status
;
407 if (is_dp_hdcp(hdcp
)) {
408 hdcp
->auth
.msg
.hdcp2
.ake_cert
[0] = 3;
409 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_CERT
,
410 hdcp
->auth
.msg
.hdcp2
.ake_cert
+1,
411 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_cert
)-1);
414 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_CERT
,
415 hdcp
->auth
.msg
.hdcp2
.ake_cert
,
416 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_cert
));
421 enum mod_hdcp_status
mod_hdcp_read_h_prime(struct mod_hdcp
*hdcp
)
423 enum mod_hdcp_status status
;
425 if (is_dp_hdcp(hdcp
)) {
426 hdcp
->auth
.msg
.hdcp2
.ake_h_prime
[0] = 7;
427 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_H_PRIME
,
428 hdcp
->auth
.msg
.hdcp2
.ake_h_prime
+1,
429 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_h_prime
)-1);
432 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_H_PRIME
,
433 hdcp
->auth
.msg
.hdcp2
.ake_h_prime
,
434 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_h_prime
));
439 enum mod_hdcp_status
mod_hdcp_read_pairing_info(struct mod_hdcp
*hdcp
)
441 enum mod_hdcp_status status
;
443 if (is_dp_hdcp(hdcp
)) {
444 hdcp
->auth
.msg
.hdcp2
.ake_pairing_info
[0] = 8;
445 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_PAIRING_INFO
,
446 hdcp
->auth
.msg
.hdcp2
.ake_pairing_info
+1,
447 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_pairing_info
)-1);
450 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_PAIRING_INFO
,
451 hdcp
->auth
.msg
.hdcp2
.ake_pairing_info
,
452 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_pairing_info
));
457 enum mod_hdcp_status
mod_hdcp_read_l_prime(struct mod_hdcp
*hdcp
)
459 enum mod_hdcp_status status
;
461 if (is_dp_hdcp(hdcp
)) {
462 hdcp
->auth
.msg
.hdcp2
.lc_l_prime
[0] = 10;
463 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_LC_SEND_L_PRIME
,
464 hdcp
->auth
.msg
.hdcp2
.lc_l_prime
+1,
465 sizeof(hdcp
->auth
.msg
.hdcp2
.lc_l_prime
)-1);
468 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_LC_SEND_L_PRIME
,
469 hdcp
->auth
.msg
.hdcp2
.lc_l_prime
,
470 sizeof(hdcp
->auth
.msg
.hdcp2
.lc_l_prime
));
475 enum mod_hdcp_status
mod_hdcp_read_rx_id_list(struct mod_hdcp
*hdcp
)
477 enum mod_hdcp_status status
;
479 if (is_dp_hdcp(hdcp
)) {
480 hdcp
->auth
.msg
.hdcp2
.rx_id_list
[0] = 12;
481 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_SEND_RECEIVERID_LIST
,
482 hdcp
->auth
.msg
.hdcp2
.rx_id_list
+1,
483 sizeof(hdcp
->auth
.msg
.hdcp2
.rx_id_list
)-1);
486 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_SEND_RECEIVERID_LIST
,
487 hdcp
->auth
.msg
.hdcp2
.rx_id_list
,
488 hdcp
->auth
.msg
.hdcp2
.rx_id_list_size
);
493 enum mod_hdcp_status
mod_hdcp_read_stream_ready(struct mod_hdcp
*hdcp
)
495 enum mod_hdcp_status status
;
497 if (is_dp_hdcp(hdcp
)) {
498 hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_ready
[0] = 17;
499 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_STREAM_READY
,
500 hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_ready
+1,
501 sizeof(hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_ready
)-1);
504 status
= read(hdcp
, MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_STREAM_READY
,
505 hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_ready
,
506 sizeof(hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_ready
));
511 enum mod_hdcp_status
mod_hdcp_write_ake_init(struct mod_hdcp
*hdcp
)
513 enum mod_hdcp_status status
;
515 if (is_dp_hdcp(hdcp
))
516 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_AKE_INIT
,
517 hdcp
->auth
.msg
.hdcp2
.ake_init
+1,
518 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_init
)-1);
520 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_AKE_INIT
,
521 hdcp
->auth
.msg
.hdcp2
.ake_init
,
522 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_init
));
526 enum mod_hdcp_status
mod_hdcp_write_no_stored_km(struct mod_hdcp
*hdcp
)
528 enum mod_hdcp_status status
;
530 if (is_dp_hdcp(hdcp
))
531 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_AKE_NO_STORED_KM
,
532 hdcp
->auth
.msg
.hdcp2
.ake_no_stored_km
+1,
533 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_no_stored_km
)-1);
535 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_AKE_NO_STORED_KM
,
536 hdcp
->auth
.msg
.hdcp2
.ake_no_stored_km
,
537 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_no_stored_km
));
541 enum mod_hdcp_status
mod_hdcp_write_stored_km(struct mod_hdcp
*hdcp
)
543 enum mod_hdcp_status status
;
545 if (is_dp_hdcp(hdcp
))
546 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_AKE_STORED_KM
,
547 hdcp
->auth
.msg
.hdcp2
.ake_stored_km
+1,
548 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_stored_km
)-1);
550 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_AKE_STORED_KM
,
551 hdcp
->auth
.msg
.hdcp2
.ake_stored_km
,
552 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_stored_km
));
556 enum mod_hdcp_status
mod_hdcp_write_lc_init(struct mod_hdcp
*hdcp
)
558 enum mod_hdcp_status status
;
560 if (is_dp_hdcp(hdcp
))
561 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_LC_INIT
,
562 hdcp
->auth
.msg
.hdcp2
.lc_init
+1,
563 sizeof(hdcp
->auth
.msg
.hdcp2
.lc_init
)-1);
565 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_LC_INIT
,
566 hdcp
->auth
.msg
.hdcp2
.lc_init
,
567 sizeof(hdcp
->auth
.msg
.hdcp2
.lc_init
));
571 enum mod_hdcp_status
mod_hdcp_write_eks(struct mod_hdcp
*hdcp
)
573 enum mod_hdcp_status status
;
575 if (is_dp_hdcp(hdcp
))
577 MOD_HDCP_MESSAGE_ID_WRITE_SKE_SEND_EKS
,
578 hdcp
->auth
.msg
.hdcp2
.ske_eks
+1,
579 sizeof(hdcp
->auth
.msg
.hdcp2
.ske_eks
)-1);
582 MOD_HDCP_MESSAGE_ID_WRITE_SKE_SEND_EKS
,
583 hdcp
->auth
.msg
.hdcp2
.ske_eks
,
584 sizeof(hdcp
->auth
.msg
.hdcp2
.ske_eks
));
588 enum mod_hdcp_status
mod_hdcp_write_repeater_auth_ack(struct mod_hdcp
*hdcp
)
590 enum mod_hdcp_status status
;
592 if (is_dp_hdcp(hdcp
))
593 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_SEND_ACK
,
594 hdcp
->auth
.msg
.hdcp2
.repeater_auth_ack
+1,
595 sizeof(hdcp
->auth
.msg
.hdcp2
.repeater_auth_ack
)-1);
597 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_SEND_ACK
,
598 hdcp
->auth
.msg
.hdcp2
.repeater_auth_ack
,
599 sizeof(hdcp
->auth
.msg
.hdcp2
.repeater_auth_ack
));
603 enum mod_hdcp_status
mod_hdcp_write_stream_manage(struct mod_hdcp
*hdcp
)
605 enum mod_hdcp_status status
;
607 if (is_dp_hdcp(hdcp
))
609 MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_STREAM_MANAGE
,
610 hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_manage
+1,
611 hdcp
->auth
.msg
.hdcp2
.stream_manage_size
-1);
614 MOD_HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_STREAM_MANAGE
,
615 hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_manage
,
616 hdcp
->auth
.msg
.hdcp2
.stream_manage_size
);
620 enum mod_hdcp_status
mod_hdcp_write_content_type(struct mod_hdcp
*hdcp
)
622 enum mod_hdcp_status status
;
624 if (is_dp_hdcp(hdcp
))
625 status
= write(hdcp
, MOD_HDCP_MESSAGE_ID_WRITE_CONTENT_STREAM_TYPE
,
626 hdcp
->auth
.msg
.hdcp2
.content_stream_type_dp
+1,
627 sizeof(hdcp
->auth
.msg
.hdcp2
.content_stream_type_dp
)-1);
629 status
= MOD_HDCP_STATUS_INVALID_OPERATION
;