2 * Copyright 2018 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 enum mod_hdcp_status
mod_hdcp_hdcp2_transition(struct mod_hdcp
*hdcp
,
29 struct mod_hdcp_event_context
*event_ctx
,
30 struct mod_hdcp_transition_input_hdcp2
*input
,
31 struct mod_hdcp_output
*output
)
33 enum mod_hdcp_status status
= MOD_HDCP_STATUS_SUCCESS
;
34 struct mod_hdcp_connection
*conn
= &hdcp
->connection
;
35 struct mod_hdcp_link_adjustment
*adjust
= &hdcp
->connection
.link
.adjust
;
37 switch (current_state(hdcp
)) {
38 case H2_A0_KNOWN_HDCP2_CAPABLE_RX
:
39 if (input
->hdcp2version_read
!= PASS
||
40 input
->hdcp2_capable_check
!= PASS
) {
41 adjust
->hdcp2
.disable
= 1;
42 callback_in_ms(0, output
);
43 set_state_id(hdcp
, output
, HDCP_INITIALIZED
);
45 callback_in_ms(0, output
);
46 set_state_id(hdcp
, output
, H2_A1_SEND_AKE_INIT
);
49 case H2_A1_SEND_AKE_INIT
:
50 if (input
->add_topology
!= PASS
||
51 input
->create_session
!= PASS
||
52 input
->ake_init_prepare
!= PASS
) {
53 /* out of sync with psp state */
54 adjust
->hdcp2
.disable
= 1;
55 fail_and_restart_in_ms(0, &status
, output
);
57 } else if (input
->ake_init_write
!= PASS
) {
58 fail_and_restart_in_ms(0, &status
, output
);
61 set_watchdog_in_ms(hdcp
, 100, output
);
62 callback_in_ms(0, output
);
63 set_state_id(hdcp
, output
, H2_A1_VALIDATE_AKE_CERT
);
65 case H2_A1_VALIDATE_AKE_CERT
:
66 if (input
->ake_cert_available
!= PASS
) {
67 if (event_ctx
->event
==
68 MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
) {
69 /* 1A-08: consider ake timeout a failure */
70 /* some hdmi receivers are not ready for HDCP
71 * immediately after video becomes active,
72 * delay 1s before retry on first HDCP message
75 fail_and_restart_in_ms(1000, &status
, output
);
77 /* continue ake cert polling*/
78 callback_in_ms(10, output
);
79 increment_stay_counter(hdcp
);
82 } else if (input
->ake_cert_read
!= PASS
||
83 input
->ake_cert_validation
!= PASS
) {
85 * 1A-09: consider invalid ake cert a failure
86 * 1A-10: consider receiver id listed in SRM a failure
88 fail_and_restart_in_ms(0, &status
, output
);
91 if (conn
->is_km_stored
&&
92 !adjust
->hdcp2
.force_no_stored_km
) {
93 callback_in_ms(0, output
);
94 set_state_id(hdcp
, output
, H2_A1_SEND_STORED_KM
);
96 callback_in_ms(0, output
);
97 set_state_id(hdcp
, output
, H2_A1_SEND_NO_STORED_KM
);
100 case H2_A1_SEND_NO_STORED_KM
:
101 if (input
->no_stored_km_write
!= PASS
) {
102 fail_and_restart_in_ms(0, &status
, output
);
105 if (adjust
->hdcp2
.increase_h_prime_timeout
)
106 set_watchdog_in_ms(hdcp
, 2000, output
);
108 set_watchdog_in_ms(hdcp
, 1000, output
);
109 callback_in_ms(0, output
);
110 set_state_id(hdcp
, output
, H2_A1_READ_H_PRIME
);
112 case H2_A1_READ_H_PRIME
:
113 if (input
->h_prime_available
!= PASS
) {
114 if (event_ctx
->event
==
115 MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
) {
116 /* 1A-11-3: consider h' timeout a failure */
117 fail_and_restart_in_ms(1000, &status
, output
);
119 /* continue h' polling */
120 callback_in_ms(100, output
);
121 increment_stay_counter(hdcp
);
124 } else if (input
->h_prime_read
!= PASS
) {
125 fail_and_restart_in_ms(0, &status
, output
);
128 set_watchdog_in_ms(hdcp
, 200, output
);
129 callback_in_ms(0, output
);
130 set_state_id(hdcp
, output
, H2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME
);
132 case H2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME
:
133 if (input
->pairing_available
!= PASS
) {
134 if (event_ctx
->event
==
135 MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
) {
136 /* 1A-12: consider pairing info timeout
139 fail_and_restart_in_ms(0, &status
, output
);
141 /* continue pairing info polling */
142 callback_in_ms(20, output
);
143 increment_stay_counter(hdcp
);
146 } else if (input
->pairing_info_read
!= PASS
||
147 input
->h_prime_validation
!= PASS
) {
148 /* 1A-11-1: consider invalid h' a failure */
149 fail_and_restart_in_ms(0, &status
, output
);
152 callback_in_ms(0, output
);
153 set_state_id(hdcp
, output
, H2_A2_LOCALITY_CHECK
);
155 case H2_A1_SEND_STORED_KM
:
156 if (input
->stored_km_write
!= PASS
) {
157 fail_and_restart_in_ms(0, &status
, output
);
160 set_watchdog_in_ms(hdcp
, 200, output
);
161 callback_in_ms(0, output
);
162 set_state_id(hdcp
, output
, H2_A1_VALIDATE_H_PRIME
);
164 case H2_A1_VALIDATE_H_PRIME
:
165 if (input
->h_prime_available
!= PASS
) {
166 if (event_ctx
->event
==
167 MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
) {
168 /* 1A-11-2: consider h' timeout a failure */
169 fail_and_restart_in_ms(1000, &status
, output
);
171 /* continue h' polling */
172 callback_in_ms(20, output
);
173 increment_stay_counter(hdcp
);
176 } else if (input
->h_prime_read
!= PASS
) {
177 fail_and_restart_in_ms(0, &status
, output
);
179 } else if (input
->h_prime_validation
!= PASS
) {
180 /* 1A-11-1: consider invalid h' a failure */
181 adjust
->hdcp2
.force_no_stored_km
= 1;
182 fail_and_restart_in_ms(0, &status
, output
);
185 callback_in_ms(0, output
);
186 set_state_id(hdcp
, output
, H2_A2_LOCALITY_CHECK
);
188 case H2_A2_LOCALITY_CHECK
:
189 if (hdcp
->state
.stay_count
> 10 ||
190 input
->lc_init_prepare
!= PASS
||
191 input
->lc_init_write
!= PASS
||
192 input
->l_prime_available_poll
!= PASS
||
193 input
->l_prime_read
!= PASS
) {
195 * 1A-05: consider disconnection after LC init a failure
196 * 1A-13-1: consider invalid l' a failure
197 * 1A-13-2: consider l' timeout a failure
199 fail_and_restart_in_ms(0, &status
, output
);
201 } else if (input
->l_prime_validation
!= PASS
) {
202 callback_in_ms(0, output
);
203 increment_stay_counter(hdcp
);
206 callback_in_ms(0, output
);
207 set_state_id(hdcp
, output
, H2_A3_EXCHANGE_KS_AND_TEST_FOR_REPEATER
);
209 case H2_A3_EXCHANGE_KS_AND_TEST_FOR_REPEATER
:
210 if (input
->eks_prepare
!= PASS
||
211 input
->eks_write
!= PASS
) {
212 fail_and_restart_in_ms(0, &status
, output
);
215 if (conn
->is_repeater
) {
216 set_watchdog_in_ms(hdcp
, 3000, output
);
217 callback_in_ms(0, output
);
218 set_state_id(hdcp
, output
, H2_A6_WAIT_FOR_RX_ID_LIST
);
220 /* some CTS equipment requires a delay GREATER than
221 * 200 ms, so delay 210 ms instead of 200 ms
223 callback_in_ms(210, output
);
224 set_state_id(hdcp
, output
, H2_ENABLE_ENCRYPTION
);
227 case H2_ENABLE_ENCRYPTION
:
228 if (input
->rxstatus_read
!= PASS
||
229 input
->reauth_request_check
!= PASS
) {
231 * 1A-07: restart hdcp on REAUTH_REQ
232 * 1B-08: restart hdcp on REAUTH_REQ
234 fail_and_restart_in_ms(0, &status
, output
);
236 } else if (event_ctx
->rx_id_list_ready
&& conn
->is_repeater
) {
237 callback_in_ms(0, output
);
238 set_state_id(hdcp
, output
, H2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
240 } else if (input
->enable_encryption
!= PASS
) {
241 fail_and_restart_in_ms(0, &status
, output
);
244 callback_in_ms(0, output
);
245 set_state_id(hdcp
, output
, H2_A5_AUTHENTICATED
);
246 HDCP_FULL_DDC_TRACE(hdcp
);
248 case H2_A5_AUTHENTICATED
:
249 if (input
->rxstatus_read
!= PASS
||
250 input
->reauth_request_check
!= PASS
) {
251 fail_and_restart_in_ms(0, &status
, output
);
253 } else if (event_ctx
->rx_id_list_ready
&& conn
->is_repeater
) {
254 callback_in_ms(0, output
);
255 set_state_id(hdcp
, output
, H2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
258 callback_in_ms(500, output
);
259 increment_stay_counter(hdcp
);
261 case H2_A6_WAIT_FOR_RX_ID_LIST
:
262 if (input
->rxstatus_read
!= PASS
||
263 input
->reauth_request_check
!= PASS
) {
264 fail_and_restart_in_ms(0, &status
, output
);
266 } else if (!event_ctx
->rx_id_list_ready
) {
267 if (event_ctx
->event
== MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
) {
268 /* 1B-02: consider rx id list timeout a failure */
269 /* some CTS equipment's actual timeout
270 * measurement is slightly greater than 3000 ms.
271 * Delay 100 ms to ensure it is fully timeout
272 * before re-authentication.
274 fail_and_restart_in_ms(100, &status
, output
);
276 callback_in_ms(300, output
);
277 increment_stay_counter(hdcp
);
281 callback_in_ms(0, output
);
282 set_state_id(hdcp
, output
, H2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
284 case H2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
:
285 if (input
->rxstatus_read
!= PASS
||
286 input
->reauth_request_check
!= PASS
||
287 input
->rx_id_list_read
!= PASS
||
288 input
->device_count_check
!= PASS
||
289 input
->rx_id_list_validation
!= PASS
||
290 input
->repeater_auth_ack_write
!= PASS
) {
291 /* 1B-03: consider invalid v' a failure
292 * 1B-04: consider MAX_DEVS_EXCEEDED a failure
293 * 1B-05: consider MAX_CASCADE_EXCEEDED a failure
294 * 1B-06: consider invalid seq_num_V a failure
295 * 1B-09: consider seq_num_V rollover a failure
297 fail_and_restart_in_ms(0, &status
, output
);
300 callback_in_ms(0, output
);
301 set_state_id(hdcp
, output
, H2_A9_SEND_STREAM_MANAGEMENT
);
303 case H2_A9_SEND_STREAM_MANAGEMENT
:
304 if (input
->rxstatus_read
!= PASS
||
305 input
->reauth_request_check
!= PASS
) {
306 fail_and_restart_in_ms(0, &status
, output
);
308 } else if (event_ctx
->rx_id_list_ready
&& conn
->is_repeater
) {
309 callback_in_ms(0, output
);
310 set_state_id(hdcp
, output
, H2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
312 } else if (input
->prepare_stream_manage
!= PASS
||
313 input
->stream_manage_write
!= PASS
) {
314 fail_and_restart_in_ms(0, &status
, output
);
317 set_watchdog_in_ms(hdcp
, 100, output
);
318 callback_in_ms(0, output
);
319 set_state_id(hdcp
, output
, H2_A9_VALIDATE_STREAM_READY
);
321 case H2_A9_VALIDATE_STREAM_READY
:
322 if (input
->rxstatus_read
!= PASS
||
323 input
->reauth_request_check
!= PASS
) {
324 fail_and_restart_in_ms(0, &status
, output
);
326 } else if (event_ctx
->rx_id_list_ready
&& conn
->is_repeater
) {
327 callback_in_ms(0, output
);
328 set_state_id(hdcp
, output
, H2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
330 } else if (input
->stream_ready_available
!= PASS
) {
331 if (event_ctx
->event
== MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
) {
332 /* 1B-10-2: restart content stream management on
333 * stream ready timeout
335 hdcp
->auth
.count
.stream_management_retry_count
++;
336 callback_in_ms(0, output
);
337 set_state_id(hdcp
, output
, H2_A9_SEND_STREAM_MANAGEMENT
);
339 callback_in_ms(10, output
);
340 increment_stay_counter(hdcp
);
343 } else if (input
->stream_ready_read
!= PASS
||
344 input
->stream_ready_validation
!= PASS
) {
346 * 1B-10-1: restart content stream management
349 if (hdcp
->auth
.count
.stream_management_retry_count
> 10) {
350 fail_and_restart_in_ms(0, &status
, output
);
352 hdcp
->auth
.count
.stream_management_retry_count
++;
353 callback_in_ms(0, output
);
354 set_state_id(hdcp
, output
, H2_A9_SEND_STREAM_MANAGEMENT
);
358 callback_in_ms(200, output
);
359 set_state_id(hdcp
, output
, H2_ENABLE_ENCRYPTION
);
362 status
= MOD_HDCP_STATUS_INVALID_STATE
;
363 fail_and_restart_in_ms(0, &status
, output
);
370 enum mod_hdcp_status
mod_hdcp_hdcp2_dp_transition(struct mod_hdcp
*hdcp
,
371 struct mod_hdcp_event_context
*event_ctx
,
372 struct mod_hdcp_transition_input_hdcp2
*input
,
373 struct mod_hdcp_output
*output
)
375 enum mod_hdcp_status status
= MOD_HDCP_STATUS_SUCCESS
;
376 struct mod_hdcp_connection
*conn
= &hdcp
->connection
;
377 struct mod_hdcp_link_adjustment
*adjust
= &hdcp
->connection
.link
.adjust
;
379 switch (current_state(hdcp
)) {
380 case D2_A0_DETERMINE_RX_HDCP_CAPABLE
:
381 if (input
->rx_caps_read_dp
!= PASS
||
382 input
->hdcp2_capable_check
!= PASS
) {
383 adjust
->hdcp2
.disable
= 1;
384 callback_in_ms(0, output
);
385 set_state_id(hdcp
, output
, HDCP_INITIALIZED
);
387 callback_in_ms(0, output
);
388 set_state_id(hdcp
, output
, D2_A1_SEND_AKE_INIT
);
391 case D2_A1_SEND_AKE_INIT
:
392 if (input
->add_topology
!= PASS
||
393 input
->create_session
!= PASS
||
394 input
->ake_init_prepare
!= PASS
) {
395 /* out of sync with psp state */
396 adjust
->hdcp2
.disable
= 1;
397 fail_and_restart_in_ms(0, &status
, output
);
399 } else if (input
->ake_init_write
!= PASS
) {
400 /* possibly display not ready */
401 fail_and_restart_in_ms(0, &status
, output
);
404 callback_in_ms(100, output
);
405 set_state_id(hdcp
, output
, D2_A1_VALIDATE_AKE_CERT
);
407 case D2_A1_VALIDATE_AKE_CERT
:
408 if (input
->ake_cert_read
!= PASS
||
409 input
->ake_cert_validation
!= PASS
) {
411 * 1A-08: consider invalid ake cert a failure
412 * 1A-09: consider receiver id listed in SRM a failure
414 fail_and_restart_in_ms(0, &status
, output
);
417 if (conn
->is_km_stored
&&
418 !adjust
->hdcp2
.force_no_stored_km
) {
419 callback_in_ms(0, output
);
420 set_state_id(hdcp
, output
, D2_A1_SEND_STORED_KM
);
422 callback_in_ms(0, output
);
423 set_state_id(hdcp
, output
, D2_A1_SEND_NO_STORED_KM
);
426 case D2_A1_SEND_NO_STORED_KM
:
427 if (input
->no_stored_km_write
!= PASS
) {
428 fail_and_restart_in_ms(0, &status
, output
);
431 if (adjust
->hdcp2
.increase_h_prime_timeout
)
432 set_watchdog_in_ms(hdcp
, 2000, output
);
434 set_watchdog_in_ms(hdcp
, 1000, output
);
435 set_state_id(hdcp
, output
, D2_A1_READ_H_PRIME
);
437 case D2_A1_READ_H_PRIME
:
438 if (input
->h_prime_available
!= PASS
) {
439 if (event_ctx
->event
==
440 MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
)
441 /* 1A-10-3: consider h' timeout a failure */
442 fail_and_restart_in_ms(1000, &status
, output
);
444 increment_stay_counter(hdcp
);
446 } else if (input
->h_prime_read
!= PASS
) {
447 fail_and_restart_in_ms(0, &status
, output
);
450 set_watchdog_in_ms(hdcp
, 200, output
);
451 set_state_id(hdcp
, output
, D2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME
);
453 case D2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME
:
454 if (input
->pairing_available
!= PASS
) {
455 if (event_ctx
->event
==
456 MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
)
458 * 1A-11: consider pairing info timeout
461 fail_and_restart_in_ms(0, &status
, output
);
463 increment_stay_counter(hdcp
);
465 } else if (input
->pairing_info_read
!= PASS
||
466 input
->h_prime_validation
!= PASS
) {
467 /* 1A-10-1: consider invalid h' a failure */
468 fail_and_restart_in_ms(0, &status
, output
);
471 callback_in_ms(0, output
);
472 set_state_id(hdcp
, output
, D2_A2_LOCALITY_CHECK
);
474 case D2_A1_SEND_STORED_KM
:
475 if (input
->stored_km_write
!= PASS
) {
476 fail_and_restart_in_ms(0, &status
, output
);
479 set_watchdog_in_ms(hdcp
, 200, output
);
480 set_state_id(hdcp
, output
, D2_A1_VALIDATE_H_PRIME
);
482 case D2_A1_VALIDATE_H_PRIME
:
483 if (input
->h_prime_available
!= PASS
) {
484 if (event_ctx
->event
==
485 MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
)
486 /* 1A-10-2: consider h' timeout a failure */
487 fail_and_restart_in_ms(1000, &status
, output
);
489 increment_stay_counter(hdcp
);
491 } else if (input
->h_prime_read
!= PASS
) {
492 fail_and_restart_in_ms(0, &status
, output
);
494 } else if (input
->h_prime_validation
!= PASS
) {
495 /* 1A-10-1: consider invalid h' a failure */
496 adjust
->hdcp2
.force_no_stored_km
= 1;
497 fail_and_restart_in_ms(0, &status
, output
);
500 callback_in_ms(0, output
);
501 set_state_id(hdcp
, output
, D2_A2_LOCALITY_CHECK
);
503 case D2_A2_LOCALITY_CHECK
:
504 if (hdcp
->state
.stay_count
> 10 ||
505 input
->lc_init_prepare
!= PASS
||
506 input
->lc_init_write
!= PASS
||
507 input
->l_prime_read
!= PASS
) {
508 /* 1A-12: consider invalid l' a failure */
509 fail_and_restart_in_ms(0, &status
, output
);
511 } else if (input
->l_prime_validation
!= PASS
) {
512 callback_in_ms(0, output
);
513 increment_stay_counter(hdcp
);
516 callback_in_ms(0, output
);
517 set_state_id(hdcp
, output
, D2_A34_EXCHANGE_KS_AND_TEST_FOR_REPEATER
);
519 case D2_A34_EXCHANGE_KS_AND_TEST_FOR_REPEATER
:
520 if (input
->eks_prepare
!= PASS
||
521 input
->eks_write
!= PASS
) {
522 fail_and_restart_in_ms(0, &status
, output
);
525 if (conn
->is_repeater
) {
526 set_watchdog_in_ms(hdcp
, 3000, output
);
527 set_state_id(hdcp
, output
, D2_A6_WAIT_FOR_RX_ID_LIST
);
529 callback_in_ms(0, output
);
530 set_state_id(hdcp
, output
, D2_SEND_CONTENT_STREAM_TYPE
);
533 case D2_SEND_CONTENT_STREAM_TYPE
:
534 if (input
->rxstatus_read
!= PASS
||
535 input
->reauth_request_check
!= PASS
||
536 input
->link_integrity_check_dp
!= PASS
||
537 input
->content_stream_type_write
!= PASS
) {
538 fail_and_restart_in_ms(0, &status
, output
);
541 callback_in_ms(210, output
);
542 set_state_id(hdcp
, output
, D2_ENABLE_ENCRYPTION
);
544 case D2_ENABLE_ENCRYPTION
:
545 if (input
->rxstatus_read
!= PASS
||
546 input
->reauth_request_check
!= PASS
||
547 input
->link_integrity_check_dp
!= PASS
) {
549 * 1A-07: restart hdcp on REAUTH_REQ
550 * 1B-08: restart hdcp on REAUTH_REQ
552 fail_and_restart_in_ms(0, &status
, output
);
554 } else if (event_ctx
->rx_id_list_ready
&& conn
->is_repeater
) {
555 callback_in_ms(0, output
);
556 set_state_id(hdcp
, output
, D2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
558 } else if (input
->enable_encryption
!= PASS
||
559 (is_dp_mst_hdcp(hdcp
) && input
->stream_encryption_dp
!= PASS
)) {
560 fail_and_restart_in_ms(0, &status
, output
);
563 set_state_id(hdcp
, output
, D2_A5_AUTHENTICATED
);
564 HDCP_FULL_DDC_TRACE(hdcp
);
566 case D2_A5_AUTHENTICATED
:
567 if (input
->rxstatus_read
!= PASS
||
568 input
->reauth_request_check
!= PASS
) {
569 fail_and_restart_in_ms(0, &status
, output
);
571 } else if (input
->link_integrity_check_dp
!= PASS
) {
572 if (hdcp
->connection
.hdcp2_retry_count
>= 1)
573 adjust
->hdcp2
.force_type
= MOD_HDCP_FORCE_TYPE_0
;
574 fail_and_restart_in_ms(0, &status
, output
);
576 } else if (event_ctx
->rx_id_list_ready
&& conn
->is_repeater
) {
577 callback_in_ms(0, output
);
578 set_state_id(hdcp
, output
, D2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
581 increment_stay_counter(hdcp
);
583 case D2_A6_WAIT_FOR_RX_ID_LIST
:
584 if (input
->rxstatus_read
!= PASS
||
585 input
->reauth_request_check
!= PASS
||
586 input
->link_integrity_check_dp
!= PASS
) {
587 fail_and_restart_in_ms(0, &status
, output
);
589 } else if (!event_ctx
->rx_id_list_ready
) {
590 if (event_ctx
->event
== MOD_HDCP_EVENT_WATCHDOG_TIMEOUT
)
591 /* 1B-02: consider rx id list timeout a failure */
592 fail_and_restart_in_ms(0, &status
, output
);
594 increment_stay_counter(hdcp
);
597 callback_in_ms(0, output
);
598 set_state_id(hdcp
, output
, D2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
600 case D2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
:
601 if (input
->rxstatus_read
!= PASS
||
602 input
->reauth_request_check
!= PASS
||
603 input
->link_integrity_check_dp
!= PASS
||
604 input
->rx_id_list_read
!= PASS
||
605 input
->device_count_check
!= PASS
||
606 input
->rx_id_list_validation
!= PASS
||
607 input
->repeater_auth_ack_write
!= PASS
) {
609 * 1B-03: consider invalid v' a failure
610 * 1B-04: consider MAX_DEVS_EXCEEDED a failure
611 * 1B-05: consider MAX_CASCADE_EXCEEDED a failure
612 * 1B-06: consider invalid seq_num_V a failure
613 * 1B-09: consider seq_num_V rollover a failure
615 fail_and_restart_in_ms(0, &status
, output
);
618 callback_in_ms(0, output
);
619 set_state_id(hdcp
, output
, D2_A9_SEND_STREAM_MANAGEMENT
);
621 case D2_A9_SEND_STREAM_MANAGEMENT
:
622 if (input
->rxstatus_read
!= PASS
||
623 input
->reauth_request_check
!= PASS
||
624 input
->link_integrity_check_dp
!= PASS
) {
625 fail_and_restart_in_ms(0, &status
, output
);
627 } else if (event_ctx
->rx_id_list_ready
) {
628 callback_in_ms(0, output
);
629 set_state_id(hdcp
, output
, D2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
631 } else if (input
->prepare_stream_manage
!= PASS
||
632 input
->stream_manage_write
!= PASS
) {
633 if (event_ctx
->event
== MOD_HDCP_EVENT_CALLBACK
)
634 fail_and_restart_in_ms(0, &status
, output
);
636 increment_stay_counter(hdcp
);
639 callback_in_ms(100, output
);
640 set_state_id(hdcp
, output
, D2_A9_VALIDATE_STREAM_READY
);
642 case D2_A9_VALIDATE_STREAM_READY
:
643 if (input
->rxstatus_read
!= PASS
||
644 input
->reauth_request_check
!= PASS
||
645 input
->link_integrity_check_dp
!= PASS
) {
646 fail_and_restart_in_ms(0, &status
, output
);
648 } else if (event_ctx
->rx_id_list_ready
) {
649 callback_in_ms(0, output
);
650 set_state_id(hdcp
, output
, D2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
);
652 } else if (input
->stream_ready_read
!= PASS
||
653 input
->stream_ready_validation
!= PASS
) {
655 * 1B-10-1: restart content stream management
657 * 1B-10-2: consider stream ready timeout a failure
659 if (hdcp
->auth
.count
.stream_management_retry_count
> 10) {
660 fail_and_restart_in_ms(0, &status
, output
);
661 } else if (event_ctx
->event
== MOD_HDCP_EVENT_CALLBACK
) {
662 hdcp
->auth
.count
.stream_management_retry_count
++;
663 callback_in_ms(0, output
);
664 set_state_id(hdcp
, output
, D2_A9_SEND_STREAM_MANAGEMENT
);
666 increment_stay_counter(hdcp
);
670 callback_in_ms(200, output
);
671 set_state_id(hdcp
, output
, D2_ENABLE_ENCRYPTION
);
674 status
= MOD_HDCP_STATUS_INVALID_STATE
;
675 fail_and_restart_in_ms(0, &status
, output
);