0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef __MEI_HDCP_H__
0010 #define __MEI_HDCP_H__
0011
0012 #include <drm/display/drm_hdcp.h>
0013
0014
0015 enum me_hdcp_status {
0016 ME_HDCP_STATUS_SUCCESS = 0x0000,
0017
0018
0019 ME_HDCP_STATUS_INTERNAL_ERROR = 0x1000,
0020 ME_HDCP_STATUS_UNKNOWN_ERROR = 0x1001,
0021 ME_HDCP_STATUS_INCORRECT_API_VERSION = 0x1002,
0022 ME_HDCP_STATUS_INVALID_FUNCTION = 0x1003,
0023 ME_HDCP_STATUS_INVALID_BUFFER_LENGTH = 0x1004,
0024 ME_HDCP_STATUS_INVALID_PARAMS = 0x1005,
0025 ME_HDCP_STATUS_AUTHENTICATION_FAILED = 0x1006,
0026
0027
0028 ME_HDCP_INVALID_SESSION_STATE = 0x6000,
0029 ME_HDCP_SRM_FRAGMENT_UNEXPECTED = 0x6001,
0030 ME_HDCP_SRM_INVALID_LENGTH = 0x6002,
0031 ME_HDCP_SRM_FRAGMENT_OFFSET_INVALID = 0x6003,
0032 ME_HDCP_SRM_VERIFICATION_FAILED = 0x6004,
0033 ME_HDCP_SRM_VERSION_TOO_OLD = 0x6005,
0034 ME_HDCP_RX_CERT_VERIFICATION_FAILED = 0x6006,
0035 ME_HDCP_RX_REVOKED = 0x6007,
0036 ME_HDCP_H_VERIFICATION_FAILED = 0x6008,
0037 ME_HDCP_REPEATER_CHECK_UNEXPECTED = 0x6009,
0038 ME_HDCP_TOPOLOGY_MAX_EXCEEDED = 0x600A,
0039 ME_HDCP_V_VERIFICATION_FAILED = 0x600B,
0040 ME_HDCP_L_VERIFICATION_FAILED = 0x600C,
0041 ME_HDCP_STREAM_KEY_ALLOC_FAILED = 0x600D,
0042 ME_HDCP_BASE_KEY_RESET_FAILED = 0x600E,
0043 ME_HDCP_NONCE_GENERATION_FAILED = 0x600F,
0044 ME_HDCP_STATUS_INVALID_E_KEY_STATE = 0x6010,
0045 ME_HDCP_STATUS_INVALID_CS_ICV = 0x6011,
0046 ME_HDCP_STATUS_INVALID_KB_KEY_STATE = 0x6012,
0047 ME_HDCP_STATUS_INVALID_PAVP_MODE_ICV = 0x6013,
0048 ME_HDCP_STATUS_INVALID_PAVP_MODE = 0x6014,
0049 ME_HDCP_STATUS_LC_MAX_ATTEMPTS = 0x6015,
0050
0051
0052 ME_HDCP_STATUS_MISMATCH_IN_M = 0x6016,
0053
0054
0055 ME_HDCP_STATUS_RX_PROV_NOT_ALLOWED = 0x6017,
0056 ME_HDCP_STATUS_RX_PROV_WRONG_SUBJECT = 0x6018,
0057 ME_HDCP_RX_NEEDS_PROVISIONING = 0x6019,
0058 ME_HDCP_BKSV_ICV_AUTH_FAILED = 0x6020,
0059 ME_HDCP_STATUS_INVALID_STREAM_ID = 0x6021,
0060 ME_HDCP_STATUS_CHAIN_NOT_INITIALIZED = 0x6022,
0061 ME_HDCP_FAIL_NOT_EXPECTED = 0x6023,
0062 ME_HDCP_FAIL_HDCP_OFF = 0x6024,
0063 ME_HDCP_FAIL_INVALID_PAVP_MEMORY_MODE = 0x6025,
0064 ME_HDCP_FAIL_AES_ECB_FAILURE = 0x6026,
0065 ME_HDCP_FEATURE_NOT_SUPPORTED = 0x6027,
0066 ME_HDCP_DMA_READ_ERROR = 0x6028,
0067 ME_HDCP_DMA_WRITE_ERROR = 0x6029,
0068 ME_HDCP_FAIL_INVALID_PACKET_SIZE = 0x6030,
0069 ME_HDCP_H264_PARSING_ERROR = 0x6031,
0070 ME_HDCP_HDCP2_ERRATA_VIDEO_VIOLATION = 0x6032,
0071 ME_HDCP_HDCP2_ERRATA_AUDIO_VIOLATION = 0x6033,
0072 ME_HDCP_TX_ACTIVE_ERROR = 0x6034,
0073 ME_HDCP_MODE_CHANGE_ERROR = 0x6035,
0074 ME_HDCP_STREAM_TYPE_ERROR = 0x6036,
0075 ME_HDCP_STREAM_MANAGE_NOT_POSSIBLE = 0x6037,
0076
0077 ME_HDCP_STATUS_PORT_INVALID_COMMAND = 0x6038,
0078 ME_HDCP_STATUS_UNSUPPORTED_PROTOCOL = 0x6039,
0079 ME_HDCP_STATUS_INVALID_PORT_INDEX = 0x603a,
0080 ME_HDCP_STATUS_TX_AUTH_NEEDED = 0x603b,
0081 ME_HDCP_STATUS_NOT_INTEGRATED_PORT = 0x603c,
0082 ME_HDCP_STATUS_SESSION_MAX_REACHED = 0x603d,
0083
0084
0085 ME_HDCP_STATUS_NOT_HDCP_CAPABLE = 0x6041,
0086
0087 ME_HDCP_STATUS_INVALID_STREAM_COUNT = 0x6042,
0088 };
0089
0090 #define HDCP_API_VERSION 0x00010000
0091
0092 #define HDCP_M_LEN 16
0093 #define HDCP_KH_LEN 16
0094
0095
0096
0097 #define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN (4 + 1)
0098 #define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_OUT (4 + 8 + 3)
0099
0100 #define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN (4 + 522 + 8 + 3)
0101 #define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MIN_OUT (4 + 1 + 3 + 16 + 16)
0102 #define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MAX_OUT (4 + 1 + 3 + 128)
0103
0104 #define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN (4 + 32)
0105 #define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_OUT (4)
0106
0107 #define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN (4 + 16)
0108 #define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_OUT (4)
0109
0110 #define WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN (4)
0111 #define WIRED_CMD_BUF_LEN_CLOSE_SESSION_OUT (4)
0112
0113
0114 #define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN (4)
0115 #define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_OUT (4 + 8)
0116
0117 #define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN (4 + 32)
0118 #define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_OUT (4)
0119
0120
0121 #define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN (4)
0122 #define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_OUT (4 + 16 + 8)
0123
0124
0125 #define WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN (4 + 1)
0126 #define WIRED_CMD_BUF_LEN_ENABLE_AUTH_OUT (4)
0127
0128
0129 #define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN (4 + 2 + 3 + 16 + 155)
0130 #define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_OUT (4 + 1 + 16)
0131
0132 #define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN (4 + 3 + \
0133 32 + 2 + 2)
0134
0135 #define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_OUT (4)
0136
0137
0138 enum hdcp_command_id {
0139 _WIDI_COMMAND_BASE = 0x00030000,
0140 WIDI_INITIATE_HDCP2_SESSION = _WIDI_COMMAND_BASE,
0141 HDCP_GET_SRM_STATUS,
0142 HDCP_SEND_SRM_FRAGMENT,
0143
0144
0145 _WIRED_COMMAND_BASE = 0x00031000,
0146 WIRED_INITIATE_HDCP2_SESSION = _WIRED_COMMAND_BASE,
0147 WIRED_VERIFY_RECEIVER_CERT,
0148 WIRED_AKE_SEND_HPRIME,
0149 WIRED_AKE_SEND_PAIRING_INFO,
0150 WIRED_INIT_LOCALITY_CHECK,
0151 WIRED_VALIDATE_LOCALITY,
0152 WIRED_GET_SESSION_KEY,
0153 WIRED_ENABLE_AUTH,
0154 WIRED_VERIFY_REPEATER,
0155 WIRED_REPEATER_AUTH_STREAM_REQ,
0156 WIRED_CLOSE_SESSION,
0157
0158 _WIRED_COMMANDS_COUNT,
0159 };
0160
0161 union encrypted_buff {
0162 u8 e_kpub_km[HDCP_2_2_E_KPUB_KM_LEN];
0163 u8 e_kh_km_m[HDCP_2_2_E_KH_KM_M_LEN];
0164 struct {
0165 u8 e_kh_km[HDCP_KH_LEN];
0166 u8 m[HDCP_M_LEN];
0167 } __packed;
0168 };
0169
0170
0171 struct hdcp_cmd_header {
0172 u32 api_version;
0173 u32 command_id;
0174 enum me_hdcp_status status;
0175
0176 u32 buffer_len;
0177 } __packed;
0178
0179
0180 struct hdcp_cmd_no_data {
0181 struct hdcp_cmd_header header;
0182 } __packed;
0183
0184
0185 struct hdcp_port_id {
0186 u8 integrated_port_type;
0187
0188 u8 physical_port;
0189
0190 u8 attached_transcoder;
0191 u8 reserved;
0192 } __packed;
0193
0194
0195
0196
0197
0198
0199 struct wired_cmd_initiate_hdcp2_session_in {
0200 struct hdcp_cmd_header header;
0201 struct hdcp_port_id port;
0202 u8 protocol;
0203 } __packed;
0204
0205 struct wired_cmd_initiate_hdcp2_session_out {
0206 struct hdcp_cmd_header header;
0207 struct hdcp_port_id port;
0208 u8 r_tx[HDCP_2_2_RTX_LEN];
0209 struct hdcp2_tx_caps tx_caps;
0210 } __packed;
0211
0212
0213 struct wired_cmd_close_session_in {
0214 struct hdcp_cmd_header header;
0215 struct hdcp_port_id port;
0216 } __packed;
0217
0218 struct wired_cmd_close_session_out {
0219 struct hdcp_cmd_header header;
0220 struct hdcp_port_id port;
0221 } __packed;
0222
0223
0224 struct wired_cmd_verify_receiver_cert_in {
0225 struct hdcp_cmd_header header;
0226 struct hdcp_port_id port;
0227 struct hdcp2_cert_rx cert_rx;
0228 u8 r_rx[HDCP_2_2_RRX_LEN];
0229 u8 rx_caps[HDCP_2_2_RXCAPS_LEN];
0230 } __packed;
0231
0232 struct wired_cmd_verify_receiver_cert_out {
0233 struct hdcp_cmd_header header;
0234 struct hdcp_port_id port;
0235 u8 km_stored;
0236 u8 reserved[3];
0237 union encrypted_buff ekm_buff;
0238 } __packed;
0239
0240
0241 struct wired_cmd_ake_send_hprime_in {
0242 struct hdcp_cmd_header header;
0243 struct hdcp_port_id port;
0244 u8 h_prime[HDCP_2_2_H_PRIME_LEN];
0245 } __packed;
0246
0247 struct wired_cmd_ake_send_hprime_out {
0248 struct hdcp_cmd_header header;
0249 struct hdcp_port_id port;
0250 } __packed;
0251
0252
0253
0254
0255
0256 struct wired_cmd_ake_send_pairing_info_in {
0257 struct hdcp_cmd_header header;
0258 struct hdcp_port_id port;
0259 u8 e_kh_km[HDCP_2_2_E_KH_KM_LEN];
0260 } __packed;
0261
0262 struct wired_cmd_ake_send_pairing_info_out {
0263 struct hdcp_cmd_header header;
0264 struct hdcp_port_id port;
0265 } __packed;
0266
0267
0268
0269
0270
0271
0272 struct wired_cmd_init_locality_check_in {
0273 struct hdcp_cmd_header header;
0274 struct hdcp_port_id port;
0275 } __packed;
0276
0277 struct wired_cmd_init_locality_check_out {
0278 struct hdcp_cmd_header header;
0279 struct hdcp_port_id port;
0280 u8 r_n[HDCP_2_2_RN_LEN];
0281 } __packed;
0282
0283
0284
0285
0286
0287 struct wired_cmd_validate_locality_in {
0288 struct hdcp_cmd_header header;
0289 struct hdcp_port_id port;
0290 u8 l_prime[HDCP_2_2_L_PRIME_LEN];
0291 } __packed;
0292
0293 struct wired_cmd_validate_locality_out {
0294 struct hdcp_cmd_header header;
0295 struct hdcp_port_id port;
0296 } __packed;
0297
0298
0299
0300
0301
0302
0303 struct wired_cmd_get_session_key_in {
0304 struct hdcp_cmd_header header;
0305 struct hdcp_port_id port;
0306 } __packed;
0307
0308 struct wired_cmd_get_session_key_out {
0309 struct hdcp_cmd_header header;
0310 struct hdcp_port_id port;
0311 u8 e_dkey_ks[HDCP_2_2_E_DKEY_KS_LEN];
0312 u8 r_iv[HDCP_2_2_RIV_LEN];
0313 } __packed;
0314
0315
0316 struct wired_cmd_enable_auth_in {
0317 struct hdcp_cmd_header header;
0318 struct hdcp_port_id port;
0319 u8 stream_type;
0320 } __packed;
0321
0322 struct wired_cmd_enable_auth_out {
0323 struct hdcp_cmd_header header;
0324 struct hdcp_port_id port;
0325 } __packed;
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335 struct wired_cmd_verify_repeater_in {
0336 struct hdcp_cmd_header header;
0337 struct hdcp_port_id port;
0338 u8 rx_info[HDCP_2_2_RXINFO_LEN];
0339 u8 seq_num_v[HDCP_2_2_SEQ_NUM_LEN];
0340 u8 v_prime[HDCP_2_2_V_PRIME_HALF_LEN];
0341 u8 receiver_ids[HDCP_2_2_RECEIVER_IDS_MAX_LEN];
0342 } __packed;
0343
0344 struct wired_cmd_verify_repeater_out {
0345 struct hdcp_cmd_header header;
0346 struct hdcp_port_id port;
0347 u8 content_type_supported;
0348 u8 v[HDCP_2_2_V_PRIME_HALF_LEN];
0349 } __packed;
0350
0351
0352
0353
0354
0355 struct wired_cmd_repeater_auth_stream_req_in {
0356 struct hdcp_cmd_header header;
0357 struct hdcp_port_id port;
0358 u8 seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
0359 u8 m_prime[HDCP_2_2_MPRIME_LEN];
0360 __be16 k;
0361 struct hdcp2_streamid_type streams[];
0362 } __packed;
0363
0364 struct wired_cmd_repeater_auth_stream_req_out {
0365 struct hdcp_cmd_header header;
0366 struct hdcp_port_id port;
0367 } __packed;
0368 #endif