18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: MIT */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2017 Google, Inc. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Authors: 68c2ecf20Sopenharmony_ci * Sean Paul <seanpaul@chromium.org> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef _DRM_HDCP_H_INCLUDED_ 108c2ecf20Sopenharmony_ci#define _DRM_HDCP_H_INCLUDED_ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/types.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* Period of hdcp checks (to ensure we're still authenticated) */ 158c2ecf20Sopenharmony_ci#define DRM_HDCP_CHECK_PERIOD_MS (128 * 16) 168c2ecf20Sopenharmony_ci#define DRM_HDCP2_CHECK_PERIOD_MS 500 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* Shared lengths/masks between HDMI/DVI/DisplayPort */ 198c2ecf20Sopenharmony_ci#define DRM_HDCP_AN_LEN 8 208c2ecf20Sopenharmony_ci#define DRM_HDCP_BSTATUS_LEN 2 218c2ecf20Sopenharmony_ci#define DRM_HDCP_KSV_LEN 5 228c2ecf20Sopenharmony_ci#define DRM_HDCP_RI_LEN 2 238c2ecf20Sopenharmony_ci#define DRM_HDCP_V_PRIME_PART_LEN 4 248c2ecf20Sopenharmony_ci#define DRM_HDCP_V_PRIME_NUM_PARTS 5 258c2ecf20Sopenharmony_ci#define DRM_HDCP_NUM_DOWNSTREAM(x) (x & 0x7f) 268c2ecf20Sopenharmony_ci#define DRM_HDCP_MAX_CASCADE_EXCEEDED(x) (x & BIT(3)) 278c2ecf20Sopenharmony_ci#define DRM_HDCP_MAX_DEVICE_EXCEEDED(x) (x & BIT(7)) 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* Slave address for the HDCP registers in the receiver */ 308c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_ADDR 0x3A 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* Value to use at the end of the SHA-1 bytestream used for repeaters */ 338c2ecf20Sopenharmony_ci#define DRM_HDCP_SHA1_TERMINATOR 0x80 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci/* HDCP register offsets for HDMI/DVI devices */ 368c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_BKSV 0x00 378c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_RI_PRIME 0x08 388c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_AKSV 0x10 398c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_AN 0x18 408c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_V_PRIME(h) (0x20 + h * 4) 418c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_BCAPS 0x40 428c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_BCAPS_REPEATER_PRESENT BIT(6) 438c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_BCAPS_KSV_FIFO_READY BIT(5) 448c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_BSTATUS 0x41 458c2ecf20Sopenharmony_ci#define DRM_HDCP_DDC_KSV_FIFO 0x43 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define DRM_HDCP_1_4_SRM_ID 0x8 488c2ecf20Sopenharmony_ci#define DRM_HDCP_1_4_VRL_LENGTH_SIZE 3 498c2ecf20Sopenharmony_ci#define DRM_HDCP_1_4_DCP_SIG_SIZE 40 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* Protocol message definition for HDCP2.2 specification */ 528c2ecf20Sopenharmony_ci/* 538c2ecf20Sopenharmony_ci * Protected content streams are classified into 2 types: 548c2ecf20Sopenharmony_ci * - Type0: Can be transmitted with HDCP 1.4+ 558c2ecf20Sopenharmony_ci * - Type1: Can be transmitted with HDCP 2.2+ 568c2ecf20Sopenharmony_ci */ 578c2ecf20Sopenharmony_ci#define HDCP_STREAM_TYPE0 0x00 588c2ecf20Sopenharmony_ci#define HDCP_STREAM_TYPE1 0x01 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/* HDCP2.2 Msg IDs */ 618c2ecf20Sopenharmony_ci#define HDCP_2_2_NULL_MSG 1 628c2ecf20Sopenharmony_ci#define HDCP_2_2_AKE_INIT 2 638c2ecf20Sopenharmony_ci#define HDCP_2_2_AKE_SEND_CERT 3 648c2ecf20Sopenharmony_ci#define HDCP_2_2_AKE_NO_STORED_KM 4 658c2ecf20Sopenharmony_ci#define HDCP_2_2_AKE_STORED_KM 5 668c2ecf20Sopenharmony_ci#define HDCP_2_2_AKE_SEND_HPRIME 7 678c2ecf20Sopenharmony_ci#define HDCP_2_2_AKE_SEND_PAIRING_INFO 8 688c2ecf20Sopenharmony_ci#define HDCP_2_2_LC_INIT 9 698c2ecf20Sopenharmony_ci#define HDCP_2_2_LC_SEND_LPRIME 10 708c2ecf20Sopenharmony_ci#define HDCP_2_2_SKE_SEND_EKS 11 718c2ecf20Sopenharmony_ci#define HDCP_2_2_REP_SEND_RECVID_LIST 12 728c2ecf20Sopenharmony_ci#define HDCP_2_2_REP_SEND_ACK 15 738c2ecf20Sopenharmony_ci#define HDCP_2_2_REP_STREAM_MANAGE 16 748c2ecf20Sopenharmony_ci#define HDCP_2_2_REP_STREAM_READY 17 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#define HDCP_2_2_RTX_LEN 8 778c2ecf20Sopenharmony_ci#define HDCP_2_2_RRX_LEN 8 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#define HDCP_2_2_K_PUB_RX_MOD_N_LEN 128 808c2ecf20Sopenharmony_ci#define HDCP_2_2_K_PUB_RX_EXP_E_LEN 3 818c2ecf20Sopenharmony_ci#define HDCP_2_2_K_PUB_RX_LEN (HDCP_2_2_K_PUB_RX_MOD_N_LEN + \ 828c2ecf20Sopenharmony_ci HDCP_2_2_K_PUB_RX_EXP_E_LEN) 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define HDCP_2_2_DCP_LLC_SIG_LEN 384 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define HDCP_2_2_E_KPUB_KM_LEN 128 878c2ecf20Sopenharmony_ci#define HDCP_2_2_E_KH_KM_M_LEN (16 + 16) 888c2ecf20Sopenharmony_ci#define HDCP_2_2_H_PRIME_LEN 32 898c2ecf20Sopenharmony_ci#define HDCP_2_2_E_KH_KM_LEN 16 908c2ecf20Sopenharmony_ci#define HDCP_2_2_RN_LEN 8 918c2ecf20Sopenharmony_ci#define HDCP_2_2_L_PRIME_LEN 32 928c2ecf20Sopenharmony_ci#define HDCP_2_2_E_DKEY_KS_LEN 16 938c2ecf20Sopenharmony_ci#define HDCP_2_2_RIV_LEN 8 948c2ecf20Sopenharmony_ci#define HDCP_2_2_SEQ_NUM_LEN 3 958c2ecf20Sopenharmony_ci#define HDCP_2_2_V_PRIME_HALF_LEN (HDCP_2_2_L_PRIME_LEN / 2) 968c2ecf20Sopenharmony_ci#define HDCP_2_2_RECEIVER_ID_LEN DRM_HDCP_KSV_LEN 978c2ecf20Sopenharmony_ci#define HDCP_2_2_MAX_DEVICE_COUNT 31 988c2ecf20Sopenharmony_ci#define HDCP_2_2_RECEIVER_IDS_MAX_LEN (HDCP_2_2_RECEIVER_ID_LEN * \ 998c2ecf20Sopenharmony_ci HDCP_2_2_MAX_DEVICE_COUNT) 1008c2ecf20Sopenharmony_ci#define HDCP_2_2_MPRIME_LEN 32 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci/* Following Macros take a byte at a time for bit(s) masking */ 1038c2ecf20Sopenharmony_ci/* 1048c2ecf20Sopenharmony_ci * TODO: This has to be changed for DP MST, as multiple stream on 1058c2ecf20Sopenharmony_ci * same port is possible. 1068c2ecf20Sopenharmony_ci * For HDCP2.2 on HDMI and DP SST this value is always 1. 1078c2ecf20Sopenharmony_ci */ 1088c2ecf20Sopenharmony_ci#define HDCP_2_2_MAX_CONTENT_STREAMS_CNT 1 1098c2ecf20Sopenharmony_ci#define HDCP_2_2_TXCAP_MASK_LEN 2 1108c2ecf20Sopenharmony_ci#define HDCP_2_2_RXCAPS_LEN 3 1118c2ecf20Sopenharmony_ci#define HDCP_2_2_RX_REPEATER(x) ((x) & BIT(0)) 1128c2ecf20Sopenharmony_ci#define HDCP_2_2_DP_HDCP_CAPABLE(x) ((x) & BIT(1)) 1138c2ecf20Sopenharmony_ci#define HDCP_2_2_RXINFO_LEN 2 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci/* HDCP1.x compliant device in downstream */ 1168c2ecf20Sopenharmony_ci#define HDCP_2_2_HDCP1_DEVICE_CONNECTED(x) ((x) & BIT(0)) 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/* HDCP2.0 Compliant repeater in downstream */ 1198c2ecf20Sopenharmony_ci#define HDCP_2_2_HDCP_2_0_REP_CONNECTED(x) ((x) & BIT(1)) 1208c2ecf20Sopenharmony_ci#define HDCP_2_2_MAX_CASCADE_EXCEEDED(x) ((x) & BIT(2)) 1218c2ecf20Sopenharmony_ci#define HDCP_2_2_MAX_DEVS_EXCEEDED(x) ((x) & BIT(3)) 1228c2ecf20Sopenharmony_ci#define HDCP_2_2_DEV_COUNT_LO(x) (((x) & (0xF << 4)) >> 4) 1238c2ecf20Sopenharmony_ci#define HDCP_2_2_DEV_COUNT_HI(x) ((x) & BIT(0)) 1248c2ecf20Sopenharmony_ci#define HDCP_2_2_DEPTH(x) (((x) & (0x7 << 1)) >> 1) 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_cistruct hdcp2_cert_rx { 1278c2ecf20Sopenharmony_ci u8 receiver_id[HDCP_2_2_RECEIVER_ID_LEN]; 1288c2ecf20Sopenharmony_ci u8 kpub_rx[HDCP_2_2_K_PUB_RX_LEN]; 1298c2ecf20Sopenharmony_ci u8 reserved[2]; 1308c2ecf20Sopenharmony_ci u8 dcp_signature[HDCP_2_2_DCP_LLC_SIG_LEN]; 1318c2ecf20Sopenharmony_ci} __packed; 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cistruct hdcp2_streamid_type { 1348c2ecf20Sopenharmony_ci u8 stream_id; 1358c2ecf20Sopenharmony_ci u8 stream_type; 1368c2ecf20Sopenharmony_ci} __packed; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci/* 1398c2ecf20Sopenharmony_ci * The TxCaps field specified in the HDCP HDMI, DP specs 1408c2ecf20Sopenharmony_ci * This field is big endian as specified in the errata. 1418c2ecf20Sopenharmony_ci */ 1428c2ecf20Sopenharmony_cistruct hdcp2_tx_caps { 1438c2ecf20Sopenharmony_ci /* Transmitter must set this to 0x2 */ 1448c2ecf20Sopenharmony_ci u8 version; 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci /* Reserved for HDCP and DP Spec. Read as Zero */ 1478c2ecf20Sopenharmony_ci u8 tx_cap_mask[HDCP_2_2_TXCAP_MASK_LEN]; 1488c2ecf20Sopenharmony_ci} __packed; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci/* Main structures for HDCP2.2 protocol communication */ 1518c2ecf20Sopenharmony_cistruct hdcp2_ake_init { 1528c2ecf20Sopenharmony_ci u8 msg_id; 1538c2ecf20Sopenharmony_ci u8 r_tx[HDCP_2_2_RTX_LEN]; 1548c2ecf20Sopenharmony_ci struct hdcp2_tx_caps tx_caps; 1558c2ecf20Sopenharmony_ci} __packed; 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_cistruct hdcp2_ake_send_cert { 1588c2ecf20Sopenharmony_ci u8 msg_id; 1598c2ecf20Sopenharmony_ci struct hdcp2_cert_rx cert_rx; 1608c2ecf20Sopenharmony_ci u8 r_rx[HDCP_2_2_RRX_LEN]; 1618c2ecf20Sopenharmony_ci u8 rx_caps[HDCP_2_2_RXCAPS_LEN]; 1628c2ecf20Sopenharmony_ci} __packed; 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_cistruct hdcp2_ake_no_stored_km { 1658c2ecf20Sopenharmony_ci u8 msg_id; 1668c2ecf20Sopenharmony_ci u8 e_kpub_km[HDCP_2_2_E_KPUB_KM_LEN]; 1678c2ecf20Sopenharmony_ci} __packed; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_cistruct hdcp2_ake_stored_km { 1708c2ecf20Sopenharmony_ci u8 msg_id; 1718c2ecf20Sopenharmony_ci u8 e_kh_km_m[HDCP_2_2_E_KH_KM_M_LEN]; 1728c2ecf20Sopenharmony_ci} __packed; 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_cistruct hdcp2_ake_send_hprime { 1758c2ecf20Sopenharmony_ci u8 msg_id; 1768c2ecf20Sopenharmony_ci u8 h_prime[HDCP_2_2_H_PRIME_LEN]; 1778c2ecf20Sopenharmony_ci} __packed; 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_cistruct hdcp2_ake_send_pairing_info { 1808c2ecf20Sopenharmony_ci u8 msg_id; 1818c2ecf20Sopenharmony_ci u8 e_kh_km[HDCP_2_2_E_KH_KM_LEN]; 1828c2ecf20Sopenharmony_ci} __packed; 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_cistruct hdcp2_lc_init { 1858c2ecf20Sopenharmony_ci u8 msg_id; 1868c2ecf20Sopenharmony_ci u8 r_n[HDCP_2_2_RN_LEN]; 1878c2ecf20Sopenharmony_ci} __packed; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_cistruct hdcp2_lc_send_lprime { 1908c2ecf20Sopenharmony_ci u8 msg_id; 1918c2ecf20Sopenharmony_ci u8 l_prime[HDCP_2_2_L_PRIME_LEN]; 1928c2ecf20Sopenharmony_ci} __packed; 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_cistruct hdcp2_ske_send_eks { 1958c2ecf20Sopenharmony_ci u8 msg_id; 1968c2ecf20Sopenharmony_ci u8 e_dkey_ks[HDCP_2_2_E_DKEY_KS_LEN]; 1978c2ecf20Sopenharmony_ci u8 riv[HDCP_2_2_RIV_LEN]; 1988c2ecf20Sopenharmony_ci} __packed; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_cistruct hdcp2_rep_send_receiverid_list { 2018c2ecf20Sopenharmony_ci u8 msg_id; 2028c2ecf20Sopenharmony_ci u8 rx_info[HDCP_2_2_RXINFO_LEN]; 2038c2ecf20Sopenharmony_ci u8 seq_num_v[HDCP_2_2_SEQ_NUM_LEN]; 2048c2ecf20Sopenharmony_ci u8 v_prime[HDCP_2_2_V_PRIME_HALF_LEN]; 2058c2ecf20Sopenharmony_ci u8 receiver_ids[HDCP_2_2_RECEIVER_IDS_MAX_LEN]; 2068c2ecf20Sopenharmony_ci} __packed; 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_cistruct hdcp2_rep_send_ack { 2098c2ecf20Sopenharmony_ci u8 msg_id; 2108c2ecf20Sopenharmony_ci u8 v[HDCP_2_2_V_PRIME_HALF_LEN]; 2118c2ecf20Sopenharmony_ci} __packed; 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_cistruct hdcp2_rep_stream_manage { 2148c2ecf20Sopenharmony_ci u8 msg_id; 2158c2ecf20Sopenharmony_ci u8 seq_num_m[HDCP_2_2_SEQ_NUM_LEN]; 2168c2ecf20Sopenharmony_ci __be16 k; 2178c2ecf20Sopenharmony_ci struct hdcp2_streamid_type streams[HDCP_2_2_MAX_CONTENT_STREAMS_CNT]; 2188c2ecf20Sopenharmony_ci} __packed; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_cistruct hdcp2_rep_stream_ready { 2218c2ecf20Sopenharmony_ci u8 msg_id; 2228c2ecf20Sopenharmony_ci u8 m_prime[HDCP_2_2_MPRIME_LEN]; 2238c2ecf20Sopenharmony_ci} __packed; 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci/* HDCP2.2 TIMEOUTs in mSec */ 2268c2ecf20Sopenharmony_ci#define HDCP_2_2_CERT_TIMEOUT_MS 100 2278c2ecf20Sopenharmony_ci#define HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT_MS 1000 2288c2ecf20Sopenharmony_ci#define HDCP_2_2_HPRIME_PAIRED_TIMEOUT_MS 200 2298c2ecf20Sopenharmony_ci#define HDCP_2_2_PAIRING_TIMEOUT_MS 200 2308c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_LPRIME_TIMEOUT_MS 20 2318c2ecf20Sopenharmony_ci#define HDCP_2_2_DP_LPRIME_TIMEOUT_MS 7 2328c2ecf20Sopenharmony_ci#define HDCP_2_2_RECVID_LIST_TIMEOUT_MS 3000 2338c2ecf20Sopenharmony_ci#define HDCP_2_2_STREAM_READY_TIMEOUT_MS 100 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci/* HDMI HDCP2.2 Register Offsets */ 2368c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_REG_VER_OFFSET 0x50 2378c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_REG_WR_MSG_OFFSET 0x60 2388c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_REG_RXSTATUS_OFFSET 0x70 2398c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_REG_RD_MSG_OFFSET 0x80 2408c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_REG_DBG_OFFSET 0xC0 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_SUPPORT_MASK BIT(2) 2438c2ecf20Sopenharmony_ci#define HDCP_2_2_RX_CAPS_VERSION_VAL 0x02 2448c2ecf20Sopenharmony_ci#define HDCP_2_2_SEQ_NUM_MAX 0xFFFFFF 2458c2ecf20Sopenharmony_ci#define HDCP_2_2_DELAY_BEFORE_ENCRYPTION_EN 200 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci/* Below macros take a byte at a time and mask the bit(s) */ 2488c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_RXSTATUS_LEN 2 2498c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(x) ((x) & 0x3) 2508c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_RXSTATUS_READY(x) ((x) & BIT(2)) 2518c2ecf20Sopenharmony_ci#define HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ(x) ((x) & BIT(3)) 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci/* 2548c2ecf20Sopenharmony_ci * Helper functions to convert 24bit big endian hdcp sequence number to 2558c2ecf20Sopenharmony_ci * host format and back 2568c2ecf20Sopenharmony_ci */ 2578c2ecf20Sopenharmony_cistatic inline 2588c2ecf20Sopenharmony_ciu32 drm_hdcp_be24_to_cpu(const u8 seq_num[HDCP_2_2_SEQ_NUM_LEN]) 2598c2ecf20Sopenharmony_ci{ 2608c2ecf20Sopenharmony_ci return (u32)(seq_num[2] | seq_num[1] << 8 | seq_num[0] << 16); 2618c2ecf20Sopenharmony_ci} 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_cistatic inline 2648c2ecf20Sopenharmony_civoid drm_hdcp_cpu_to_be24(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val) 2658c2ecf20Sopenharmony_ci{ 2668c2ecf20Sopenharmony_ci seq_num[0] = val >> 16; 2678c2ecf20Sopenharmony_ci seq_num[1] = val >> 8; 2688c2ecf20Sopenharmony_ci seq_num[2] = val; 2698c2ecf20Sopenharmony_ci} 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci#define DRM_HDCP_SRM_GEN1_MAX_BYTES (5 * 1024) 2728c2ecf20Sopenharmony_ci#define DRM_HDCP_1_4_SRM_ID 0x8 2738c2ecf20Sopenharmony_ci#define DRM_HDCP_SRM_ID_MASK (0xF << 4) 2748c2ecf20Sopenharmony_ci#define DRM_HDCP_1_4_VRL_LENGTH_SIZE 3 2758c2ecf20Sopenharmony_ci#define DRM_HDCP_1_4_DCP_SIG_SIZE 40 2768c2ecf20Sopenharmony_ci#define DRM_HDCP_2_SRM_ID 0x9 2778c2ecf20Sopenharmony_ci#define DRM_HDCP_2_INDICATOR 0x1 2788c2ecf20Sopenharmony_ci#define DRM_HDCP_2_INDICATOR_MASK 0xF 2798c2ecf20Sopenharmony_ci#define DRM_HDCP_2_VRL_LENGTH_SIZE 3 2808c2ecf20Sopenharmony_ci#define DRM_HDCP_2_DCP_SIG_SIZE 384 2818c2ecf20Sopenharmony_ci#define DRM_HDCP_2_NO_OF_DEV_PLUS_RESERVED_SZ 4 2828c2ecf20Sopenharmony_ci#define DRM_HDCP_2_KSV_COUNT_2_LSBITS(byte) (((byte) & 0xC0) >> 6) 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_cistruct hdcp_srm_header { 2858c2ecf20Sopenharmony_ci u8 srm_id; 2868c2ecf20Sopenharmony_ci u8 reserved; 2878c2ecf20Sopenharmony_ci __be16 srm_version; 2888c2ecf20Sopenharmony_ci u8 srm_gen_no; 2898c2ecf20Sopenharmony_ci} __packed; 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_cistruct drm_device; 2928c2ecf20Sopenharmony_cistruct drm_connector; 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ciint drm_hdcp_check_ksvs_revoked(struct drm_device *dev, 2958c2ecf20Sopenharmony_ci u8 *ksvs, u32 ksv_count); 2968c2ecf20Sopenharmony_ciint drm_connector_attach_content_protection_property( 2978c2ecf20Sopenharmony_ci struct drm_connector *connector, bool hdcp_content_type); 2988c2ecf20Sopenharmony_civoid drm_hdcp_update_content_protection(struct drm_connector *connector, 2998c2ecf20Sopenharmony_ci u64 val); 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci/* Content Type classification for HDCP2.2 vs others */ 3028c2ecf20Sopenharmony_ci#define DRM_MODE_HDCP_CONTENT_TYPE0 0 3038c2ecf20Sopenharmony_ci#define DRM_MODE_HDCP_CONTENT_TYPE1 1 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci#endif 306