Lines Matching full:hdcp
28 #include "hdcp.h"
30 static inline enum mod_hdcp_status check_receiver_id_list_ready(struct mod_hdcp *hdcp) in check_receiver_id_list_ready() argument
34 if (is_dp_hdcp(hdcp)) in check_receiver_id_list_ready()
35 is_ready = HDCP_2_2_DP_RXSTATUS_READY(hdcp->auth.msg.hdcp2.rxstatus_dp) ? 1 : 0; in check_receiver_id_list_ready()
37 is_ready = (HDCP_2_2_HDMI_RXSTATUS_READY(hdcp->auth.msg.hdcp2.rxstatus[1]) && in check_receiver_id_list_ready()
38 (HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(hdcp->auth.msg.hdcp2.rxstatus[1]) << 8 | in check_receiver_id_list_ready()
39 hdcp->auth.msg.hdcp2.rxstatus[0])) ? 1 : 0; in check_receiver_id_list_ready()
44 static inline enum mod_hdcp_status check_hdcp2_capable(struct mod_hdcp *hdcp) in check_hdcp2_capable() argument
48 if (is_dp_hdcp(hdcp)) in check_hdcp2_capable()
49 status = (hdcp->auth.msg.hdcp2.rxcaps_dp[0] == HDCP_2_2_RX_CAPS_VERSION_VAL) && in check_hdcp2_capable()
50 HDCP_2_2_DP_HDCP_CAPABLE(hdcp->auth.msg.hdcp2.rxcaps_dp[2]) ? in check_hdcp2_capable()
54 status = (hdcp->auth.msg.hdcp2.hdcp2version_hdmi & HDCP_2_2_HDMI_SUPPORT_MASK) ? in check_hdcp2_capable()
61 struct mod_hdcp *hdcp) in check_reauthentication_request() argument
65 if (is_dp_hdcp(hdcp)) in check_reauthentication_request()
66 ret = HDCP_2_2_DP_RXSTATUS_REAUTH_REQ(hdcp->auth.msg.hdcp2.rxstatus_dp) ? in check_reauthentication_request()
70 ret = HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ(hdcp->auth.msg.hdcp2.rxstatus[1]) ? in check_reauthentication_request()
77 struct mod_hdcp *hdcp) in check_link_integrity_failure_dp() argument
79 return HDCP_2_2_DP_RXSTATUS_LINK_FAILED(hdcp->auth.msg.hdcp2.rxstatus_dp) ? in check_link_integrity_failure_dp()
84 static enum mod_hdcp_status check_ake_cert_available(struct mod_hdcp *hdcp) in check_ake_cert_available() argument
89 if (is_dp_hdcp(hdcp)) { in check_ake_cert_available()
92 status = mod_hdcp_read_rxstatus(hdcp); in check_ake_cert_available()
94 size = HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(hdcp->auth.msg.hdcp2.rxstatus[1]) << 8 | in check_ake_cert_available()
95 hdcp->auth.msg.hdcp2.rxstatus[0]; in check_ake_cert_available()
96 status = (size == sizeof(hdcp->auth.msg.hdcp2.ake_cert)) ? in check_ake_cert_available()
104 static enum mod_hdcp_status check_h_prime_available(struct mod_hdcp *hdcp) in check_h_prime_available() argument
109 status = mod_hdcp_read_rxstatus(hdcp); in check_h_prime_available()
113 if (is_dp_hdcp(hdcp)) { in check_h_prime_available()
114 status = HDCP_2_2_DP_RXSTATUS_H_PRIME(hdcp->auth.msg.hdcp2.rxstatus_dp) ? in check_h_prime_available()
118 size = HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(hdcp->auth.msg.hdcp2.rxstatus[1]) << 8 | in check_h_prime_available()
119 hdcp->auth.msg.hdcp2.rxstatus[0]; in check_h_prime_available()
120 status = (size == sizeof(hdcp->auth.msg.hdcp2.ake_h_prime)) ? in check_h_prime_available()
128 static enum mod_hdcp_status check_pairing_info_available(struct mod_hdcp *hdcp) in check_pairing_info_available() argument
133 status = mod_hdcp_read_rxstatus(hdcp); in check_pairing_info_available()
137 if (is_dp_hdcp(hdcp)) { in check_pairing_info_available()
138 status = HDCP_2_2_DP_RXSTATUS_PAIRING(hdcp->auth.msg.hdcp2.rxstatus_dp) ? in check_pairing_info_available()
142 size = HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(hdcp->auth.msg.hdcp2.rxstatus[1]) << 8 | in check_pairing_info_available()
143 hdcp->auth.msg.hdcp2.rxstatus[0]; in check_pairing_info_available()
144 status = (size == sizeof(hdcp->auth.msg.hdcp2.ake_pairing_info)) ? in check_pairing_info_available()
152 static enum mod_hdcp_status poll_l_prime_available(struct mod_hdcp *hdcp) in poll_l_prime_available() argument
160 if (is_dp_hdcp(hdcp)) in poll_l_prime_available()
166 status = mod_hdcp_read_rxstatus(hdcp); in poll_l_prime_available()
170 size = HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(hdcp->auth.msg.hdcp2.rxstatus[1]) << 8 | in poll_l_prime_available()
171 hdcp->auth.msg.hdcp2.rxstatus[0]; in poll_l_prime_available()
172 status = (size == sizeof(hdcp->auth.msg.hdcp2.lc_l_prime)) ? in poll_l_prime_available()
181 static enum mod_hdcp_status check_stream_ready_available(struct mod_hdcp *hdcp) in check_stream_ready_available() argument
186 if (is_dp_hdcp(hdcp)) { in check_stream_ready_available()
189 status = mod_hdcp_read_rxstatus(hdcp); in check_stream_ready_available()
192 size = HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(hdcp->auth.msg.hdcp2.rxstatus[1]) << 8 | in check_stream_ready_available()
193 hdcp->auth.msg.hdcp2.rxstatus[0]; in check_stream_ready_available()
194 status = (size == sizeof(hdcp->auth.msg.hdcp2.repeater_auth_stream_ready)) ? in check_stream_ready_available()
202 static inline uint8_t get_device_count(struct mod_hdcp *hdcp) in get_device_count() argument
204 return HDCP_2_2_DEV_COUNT_LO(hdcp->auth.msg.hdcp2.rx_id_list[2]) + in get_device_count()
205 (HDCP_2_2_DEV_COUNT_HI(hdcp->auth.msg.hdcp2.rx_id_list[1]) << 4); in get_device_count()
208 static enum mod_hdcp_status check_device_count(struct mod_hdcp *hdcp) in check_device_count() argument
211 if (get_device_count(hdcp) == 0) in check_device_count()
214 /* Some MST display may choose to report the internal panel as an HDCP RX. */ in check_device_count()
216 /* panel is possibly not included in DEVICE_COUNT) + get_device_count(hdcp). */ in check_device_count()
217 /* Device count must be greater than or equal to tracked hdcp displays. */ in check_device_count()
218 return ((1 + get_device_count(hdcp)) < get_active_display_count(hdcp)) ? in check_device_count()
223 static uint8_t process_rxstatus(struct mod_hdcp *hdcp, in process_rxstatus() argument
230 hdcp, "rxstatus_read")) in process_rxstatus()
234 hdcp, "reauth_request_check")) in process_rxstatus()
236 if (is_dp_hdcp(hdcp)) { in process_rxstatus()
239 hdcp, "link_integrity_check_dp")) in process_rxstatus()
242 if (hdcp->connection.is_repeater) in process_rxstatus()
243 if (check_receiver_id_list_ready(hdcp) == in process_rxstatus()
245 HDCP_INPUT_PASS_TRACE(hdcp, "rx_id_list_ready"); in process_rxstatus()
247 if (is_dp_hdcp(hdcp)) in process_rxstatus()
248 hdcp->auth.msg.hdcp2.rx_id_list_size = in process_rxstatus()
249 sizeof(hdcp->auth.msg.hdcp2.rx_id_list); in process_rxstatus()
251 hdcp->auth.msg.hdcp2.rx_id_list_size = in process_rxstatus()
252 HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(hdcp->auth.msg.hdcp2.rxstatus[1]) << 8 | in process_rxstatus()
253 hdcp->auth.msg.hdcp2.rxstatus[0]; in process_rxstatus()
259 static enum mod_hdcp_status known_hdcp2_capable_rx(struct mod_hdcp *hdcp, in known_hdcp2_capable_rx() argument
272 hdcp, "hdcp2version_read")) in known_hdcp2_capable_rx()
276 hdcp, "hdcp2_capable")) in known_hdcp2_capable_rx()
282 static enum mod_hdcp_status send_ake_init(struct mod_hdcp *hdcp, in send_ake_init() argument
295 hdcp, "create_session")) in send_ake_init()
299 hdcp, "ake_init_prepare")) in send_ake_init()
303 hdcp, "ake_init_write")) in send_ake_init()
309 static enum mod_hdcp_status validate_ake_cert(struct mod_hdcp *hdcp, in validate_ake_cert() argument
322 if (is_hdmi_dvi_sl_hdcp(hdcp)) in validate_ake_cert()
325 hdcp, "ake_cert_available")) in validate_ake_cert()
329 hdcp, "ake_cert_read")) in validate_ake_cert()
333 hdcp, "ake_cert_validation")) in validate_ake_cert()
339 static enum mod_hdcp_status send_no_stored_km(struct mod_hdcp *hdcp, in send_no_stored_km() argument
352 hdcp, "no_stored_km_write")) in send_no_stored_km()
358 static enum mod_hdcp_status read_h_prime(struct mod_hdcp *hdcp, in read_h_prime() argument
373 hdcp, "h_prime_available")) in read_h_prime()
378 hdcp, "h_prime_read")) in read_h_prime()
385 struct mod_hdcp *hdcp, in read_pairing_info_and_validate_h_prime() argument
400 hdcp, "pairing_available")) in read_pairing_info_and_validate_h_prime()
404 hdcp, "pairing_info_read")) in read_pairing_info_and_validate_h_prime()
408 hdcp, "h_prime_validation")) in read_pairing_info_and_validate_h_prime()
414 static enum mod_hdcp_status send_stored_km(struct mod_hdcp *hdcp, in send_stored_km() argument
427 hdcp, "stored_km_write")) in send_stored_km()
433 static enum mod_hdcp_status validate_h_prime(struct mod_hdcp *hdcp, in validate_h_prime() argument
448 hdcp, "h_prime_available")) in validate_h_prime()
452 hdcp, "h_prime_read")) in validate_h_prime()
456 hdcp, "h_prime_validation")) in validate_h_prime()
462 static enum mod_hdcp_status locality_check(struct mod_hdcp *hdcp, in locality_check() argument
475 hdcp, "lc_init_prepare")) in locality_check()
479 hdcp, "lc_init_write")) in locality_check()
481 if (is_dp_hdcp(hdcp)) in locality_check()
486 hdcp, "l_prime_available_poll")) in locality_check()
490 hdcp, "l_prime_read")) in locality_check()
494 hdcp, "l_prime_validation")) in locality_check()
500 static enum mod_hdcp_status exchange_ks_and_test_for_repeater(struct mod_hdcp *hdcp, in exchange_ks_and_test_for_repeater() argument
513 hdcp, "eks_prepare")) in exchange_ks_and_test_for_repeater()
517 hdcp, "eks_write")) in exchange_ks_and_test_for_repeater()
523 static enum mod_hdcp_status enable_encryption(struct mod_hdcp *hdcp, in enable_encryption() argument
535 process_rxstatus(hdcp, event_ctx, input, &status); in enable_encryption()
539 if (is_hdmi_dvi_sl_hdcp(hdcp)) { in enable_encryption()
540 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in enable_encryption()
547 hdcp, "enable_encryption")) in enable_encryption()
549 if (is_dp_mst_hdcp(hdcp)) { in enable_encryption()
553 hdcp, "stream_encryption_dp")) in enable_encryption()
560 static enum mod_hdcp_status authenticated(struct mod_hdcp *hdcp, in authenticated() argument
572 process_rxstatus(hdcp, event_ctx, input, &status); in authenticated()
577 static enum mod_hdcp_status wait_for_rx_id_list(struct mod_hdcp *hdcp, in wait_for_rx_id_list() argument
590 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in wait_for_rx_id_list()
600 static enum mod_hdcp_status verify_rx_id_list_and_send_ack(struct mod_hdcp *hdcp, in verify_rx_id_list_and_send_ack() argument
612 process_rxstatus(hdcp, event_ctx, input, &status); in verify_rx_id_list_and_send_ack()
618 &status, hdcp, "receiver_id_list_read")) in verify_rx_id_list_and_send_ack()
622 &status, hdcp, "device_count_check")) in verify_rx_id_list_and_send_ack()
626 &status, hdcp, "rx_id_list_validation")) in verify_rx_id_list_and_send_ack()
630 &status, hdcp, "repeater_auth_ack_write")) in verify_rx_id_list_and_send_ack()
636 static enum mod_hdcp_status send_stream_management(struct mod_hdcp *hdcp, in send_stream_management() argument
648 process_rxstatus(hdcp, event_ctx, input, &status); in send_stream_management()
652 if (is_hdmi_dvi_sl_hdcp(hdcp)) { in send_stream_management()
653 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in send_stream_management()
660 &status, hdcp, "prepare_stream_manage")) in send_stream_management()
665 &status, hdcp, "stream_manage_write")) in send_stream_management()
671 static enum mod_hdcp_status validate_stream_ready(struct mod_hdcp *hdcp, in validate_stream_ready() argument
684 process_rxstatus(hdcp, event_ctx, input, &status); in validate_stream_ready()
688 if (is_hdmi_dvi_sl_hdcp(hdcp)) { in validate_stream_ready()
689 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in validate_stream_ready()
694 if (is_hdmi_dvi_sl_hdcp(hdcp)) in validate_stream_ready()
697 &status, hdcp, "stream_ready_available")) in validate_stream_ready()
701 &status, hdcp, "stream_ready_read")) in validate_stream_ready()
705 &status, hdcp, "stream_ready_validation")) in validate_stream_ready()
712 static enum mod_hdcp_status determine_rx_hdcp_capable_dp(struct mod_hdcp *hdcp, in determine_rx_hdcp_capable_dp() argument
725 &status, hdcp, "rx_caps_read_dp")) in determine_rx_hdcp_capable_dp()
729 hdcp, "hdcp2_capable_check")) in determine_rx_hdcp_capable_dp()
735 static enum mod_hdcp_status send_content_stream_type_dp(struct mod_hdcp *hdcp, in send_content_stream_type_dp() argument
747 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in send_content_stream_type_dp()
751 hdcp, "content_stream_type_write")) in send_content_stream_type_dp()
757 enum mod_hdcp_status mod_hdcp_hdcp2_execution(struct mod_hdcp *hdcp, in mod_hdcp_hdcp2_execution() argument
763 switch (current_state(hdcp)) { in mod_hdcp_hdcp2_execution()
765 status = known_hdcp2_capable_rx(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
768 status = send_ake_init(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
771 status = validate_ake_cert(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
774 status = send_no_stored_km(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
777 status = read_h_prime(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
780 status = read_pairing_info_and_validate_h_prime(hdcp, in mod_hdcp_hdcp2_execution()
784 status = send_stored_km(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
787 status = validate_h_prime(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
790 status = locality_check(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
793 status = exchange_ks_and_test_for_repeater(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
796 status = enable_encryption(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
799 status = authenticated(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
802 status = wait_for_rx_id_list(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
805 status = verify_rx_id_list_and_send_ack(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
808 status = send_stream_management(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
811 status = validate_stream_ready(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
821 enum mod_hdcp_status mod_hdcp_hdcp2_dp_execution(struct mod_hdcp *hdcp, in mod_hdcp_hdcp2_dp_execution() argument
827 switch (current_state(hdcp)) { in mod_hdcp_hdcp2_dp_execution()
829 status = determine_rx_hdcp_capable_dp(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
832 status = send_ake_init(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
835 status = validate_ake_cert(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
838 status = send_no_stored_km(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
841 status = read_h_prime(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
844 status = read_pairing_info_and_validate_h_prime(hdcp, in mod_hdcp_hdcp2_dp_execution()
848 status = send_stored_km(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
851 status = validate_h_prime(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
854 status = locality_check(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
857 status = exchange_ks_and_test_for_repeater(hdcp, in mod_hdcp_hdcp2_dp_execution()
861 status = send_content_stream_type_dp(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
864 status = enable_encryption(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
867 status = authenticated(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
870 status = wait_for_rx_id_list(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
873 status = verify_rx_id_list_and_send_ack(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
876 status = send_stream_management(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
879 status = validate_stream_ready(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()