root/drivers/misc/mei/hdcp/mei_hdcp.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 /*
   3  * Copyright © 2019 Intel Corporation
   4  *
   5  * Authors:
   6  * Ramalingam C <ramalingam.c@intel.com>
   7  */
   8 
   9 #ifndef __MEI_HDCP_H__
  10 #define __MEI_HDCP_H__
  11 
  12 #include <drm/drm_hdcp.h>
  13 
  14 /* me_hdcp_status: Enumeration of all HDCP Status Codes */
  15 enum me_hdcp_status {
  16         ME_HDCP_STATUS_SUCCESS                  = 0x0000,
  17 
  18         /* WiDi Generic Status Codes */
  19         ME_HDCP_STATUS_INTERNAL_ERROR           = 0x1000,
  20         ME_HDCP_STATUS_UNKNOWN_ERROR            = 0x1001,
  21         ME_HDCP_STATUS_INCORRECT_API_VERSION    = 0x1002,
  22         ME_HDCP_STATUS_INVALID_FUNCTION         = 0x1003,
  23         ME_HDCP_STATUS_INVALID_BUFFER_LENGTH    = 0x1004,
  24         ME_HDCP_STATUS_INVALID_PARAMS           = 0x1005,
  25         ME_HDCP_STATUS_AUTHENTICATION_FAILED    = 0x1006,
  26 
  27         /* WiDi Status Codes */
  28         ME_HDCP_INVALID_SESSION_STATE           = 0x6000,
  29         ME_HDCP_SRM_FRAGMENT_UNEXPECTED         = 0x6001,
  30         ME_HDCP_SRM_INVALID_LENGTH              = 0x6002,
  31         ME_HDCP_SRM_FRAGMENT_OFFSET_INVALID     = 0x6003,
  32         ME_HDCP_SRM_VERIFICATION_FAILED         = 0x6004,
  33         ME_HDCP_SRM_VERSION_TOO_OLD             = 0x6005,
  34         ME_HDCP_RX_CERT_VERIFICATION_FAILED     = 0x6006,
  35         ME_HDCP_RX_REVOKED                      = 0x6007,
  36         ME_HDCP_H_VERIFICATION_FAILED           = 0x6008,
  37         ME_HDCP_REPEATER_CHECK_UNEXPECTED       = 0x6009,
  38         ME_HDCP_TOPOLOGY_MAX_EXCEEDED           = 0x600A,
  39         ME_HDCP_V_VERIFICATION_FAILED           = 0x600B,
  40         ME_HDCP_L_VERIFICATION_FAILED           = 0x600C,
  41         ME_HDCP_STREAM_KEY_ALLOC_FAILED         = 0x600D,
  42         ME_HDCP_BASE_KEY_RESET_FAILED           = 0x600E,
  43         ME_HDCP_NONCE_GENERATION_FAILED         = 0x600F,
  44         ME_HDCP_STATUS_INVALID_E_KEY_STATE      = 0x6010,
  45         ME_HDCP_STATUS_INVALID_CS_ICV           = 0x6011,
  46         ME_HDCP_STATUS_INVALID_KB_KEY_STATE     = 0x6012,
  47         ME_HDCP_STATUS_INVALID_PAVP_MODE_ICV    = 0x6013,
  48         ME_HDCP_STATUS_INVALID_PAVP_MODE        = 0x6014,
  49         ME_HDCP_STATUS_LC_MAX_ATTEMPTS          = 0x6015,
  50 
  51         /* New status for HDCP 2.1 */
  52         ME_HDCP_STATUS_MISMATCH_IN_M            = 0x6016,
  53 
  54         /* New status code for HDCP 2.2 Rx */
  55         ME_HDCP_STATUS_RX_PROV_NOT_ALLOWED      = 0x6017,
  56         ME_HDCP_STATUS_RX_PROV_WRONG_SUBJECT    = 0x6018,
  57         ME_HDCP_RX_NEEDS_PROVISIONING           = 0x6019,
  58         ME_HDCP_BKSV_ICV_AUTH_FAILED            = 0x6020,
  59         ME_HDCP_STATUS_INVALID_STREAM_ID        = 0x6021,
  60         ME_HDCP_STATUS_CHAIN_NOT_INITIALIZED    = 0x6022,
  61         ME_HDCP_FAIL_NOT_EXPECTED               = 0x6023,
  62         ME_HDCP_FAIL_HDCP_OFF                   = 0x6024,
  63         ME_HDCP_FAIL_INVALID_PAVP_MEMORY_MODE   = 0x6025,
  64         ME_HDCP_FAIL_AES_ECB_FAILURE            = 0x6026,
  65         ME_HDCP_FEATURE_NOT_SUPPORTED           = 0x6027,
  66         ME_HDCP_DMA_READ_ERROR                  = 0x6028,
  67         ME_HDCP_DMA_WRITE_ERROR                 = 0x6029,
  68         ME_HDCP_FAIL_INVALID_PACKET_SIZE        = 0x6030,
  69         ME_HDCP_H264_PARSING_ERROR              = 0x6031,
  70         ME_HDCP_HDCP2_ERRATA_VIDEO_VIOLATION    = 0x6032,
  71         ME_HDCP_HDCP2_ERRATA_AUDIO_VIOLATION    = 0x6033,
  72         ME_HDCP_TX_ACTIVE_ERROR                 = 0x6034,
  73         ME_HDCP_MODE_CHANGE_ERROR               = 0x6035,
  74         ME_HDCP_STREAM_TYPE_ERROR               = 0x6036,
  75         ME_HDCP_STREAM_MANAGE_NOT_POSSIBLE      = 0x6037,
  76 
  77         ME_HDCP_STATUS_PORT_INVALID_COMMAND     = 0x6038,
  78         ME_HDCP_STATUS_UNSUPPORTED_PROTOCOL     = 0x6039,
  79         ME_HDCP_STATUS_INVALID_PORT_INDEX       = 0x603a,
  80         ME_HDCP_STATUS_TX_AUTH_NEEDED           = 0x603b,
  81         ME_HDCP_STATUS_NOT_INTEGRATED_PORT      = 0x603c,
  82         ME_HDCP_STATUS_SESSION_MAX_REACHED      = 0x603d,
  83 
  84         /* hdcp capable bit is not set in rx_caps(error is unique to DP) */
  85         ME_HDCP_STATUS_NOT_HDCP_CAPABLE         = 0x6041,
  86 
  87         ME_HDCP_STATUS_INVALID_STREAM_COUNT     = 0x6042,
  88 };
  89 
  90 #define HDCP_API_VERSION                                0x00010000
  91 
  92 #define HDCP_M_LEN                                      16
  93 #define HDCP_KH_LEN                                     16
  94 
  95 /* Payload Buffer size(Excluding Header) for CMDs and corresponding response */
  96 /* Wired_Tx_AKE  */
  97 #define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN     (4 + 1)
  98 #define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_OUT    (4 + 8 + 3)
  99 
 100 #define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN       (4 + 522 + 8 + 3)
 101 #define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MIN_OUT  (4 + 1 + 3 + 16 + 16)
 102 #define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MAX_OUT  (4 + 1 + 3 + 128)
 103 
 104 #define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN            (4 + 32)
 105 #define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_OUT           (4)
 106 
 107 #define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN          (4 + 16)
 108 #define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_OUT         (4)
 109 
 110 #define WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN              (4)
 111 #define WIRED_CMD_BUF_LEN_CLOSE_SESSION_OUT             (4)
 112 
 113 /* Wired_Tx_LC */
 114 #define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN        (4)
 115 #define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_OUT       (4 + 8)
 116 
 117 #define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN          (4 + 32)
 118 #define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_OUT         (4)
 119 
 120 /* Wired_Tx_SKE */
 121 #define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN            (4)
 122 #define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_OUT           (4 + 16 + 8)
 123 
 124 /* Wired_Tx_SKE */
 125 #define WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN                (4 + 1)
 126 #define WIRED_CMD_BUF_LEN_ENABLE_AUTH_OUT               (4)
 127 
 128 /* Wired_Tx_Repeater */
 129 #define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN            (4 + 2 + 3 + 16 + 155)
 130 #define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_OUT           (4 + 1 + 16)
 131 
 132 #define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN       (4 + 3 + \
 133                                                                 32 + 2 + 2)
 134 
 135 #define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_OUT          (4)
 136 
 137 /* hdcp_command_id: Enumeration of all WIRED HDCP Command IDs */
 138 enum hdcp_command_id {
 139         _WIDI_COMMAND_BASE              = 0x00030000,
 140         WIDI_INITIATE_HDCP2_SESSION     = _WIDI_COMMAND_BASE,
 141         HDCP_GET_SRM_STATUS,
 142         HDCP_SEND_SRM_FRAGMENT,
 143 
 144         /* The wired HDCP Tx commands */
 145         _WIRED_COMMAND_BASE             = 0x00031000,
 146         WIRED_INITIATE_HDCP2_SESSION    = _WIRED_COMMAND_BASE,
 147         WIRED_VERIFY_RECEIVER_CERT,
 148         WIRED_AKE_SEND_HPRIME,
 149         WIRED_AKE_SEND_PAIRING_INFO,
 150         WIRED_INIT_LOCALITY_CHECK,
 151         WIRED_VALIDATE_LOCALITY,
 152         WIRED_GET_SESSION_KEY,
 153         WIRED_ENABLE_AUTH,
 154         WIRED_VERIFY_REPEATER,
 155         WIRED_REPEATER_AUTH_STREAM_REQ,
 156         WIRED_CLOSE_SESSION,
 157 
 158         _WIRED_COMMANDS_COUNT,
 159 };
 160 
 161 union encrypted_buff {
 162         u8              e_kpub_km[HDCP_2_2_E_KPUB_KM_LEN];
 163         u8              e_kh_km_m[HDCP_2_2_E_KH_KM_M_LEN];
 164         struct {
 165                 u8      e_kh_km[HDCP_KH_LEN];
 166                 u8      m[HDCP_M_LEN];
 167         } __packed;
 168 };
 169 
 170 /* HDCP HECI message header. All header values are little endian. */
 171 struct hdcp_cmd_header {
 172         u32                     api_version;
 173         u32                     command_id;
 174         enum me_hdcp_status     status;
 175         /* Length of the HECI message (excluding the header) */
 176         u32                     buffer_len;
 177 } __packed;
 178 
 179 /* Empty command request or response. No data follows the header. */
 180 struct hdcp_cmd_no_data {
 181         struct hdcp_cmd_header header;
 182 } __packed;
 183 
 184 /* Uniquely identifies the hdcp port being addressed for a given command. */
 185 struct hdcp_port_id {
 186         u8      integrated_port_type;
 187         u8      physical_port;
 188         u16     reserved;
 189 } __packed;
 190 
 191 /*
 192  * Data structures for integrated wired HDCP2 Tx in
 193  * support of the AKE protocol
 194  */
 195 /* HECI struct for integrated wired HDCP Tx session initiation. */
 196 struct wired_cmd_initiate_hdcp2_session_in {
 197         struct hdcp_cmd_header  header;
 198         struct hdcp_port_id     port;
 199         u8                      protocol; /* for HDMI vs DP */
 200 } __packed;
 201 
 202 struct wired_cmd_initiate_hdcp2_session_out {
 203         struct hdcp_cmd_header  header;
 204         struct hdcp_port_id     port;
 205         u8                      r_tx[HDCP_2_2_RTX_LEN];
 206         struct hdcp2_tx_caps    tx_caps;
 207 } __packed;
 208 
 209 /* HECI struct for ending an integrated wired HDCP Tx session. */
 210 struct wired_cmd_close_session_in {
 211         struct hdcp_cmd_header  header;
 212         struct hdcp_port_id     port;
 213 } __packed;
 214 
 215 struct wired_cmd_close_session_out {
 216         struct hdcp_cmd_header  header;
 217         struct hdcp_port_id     port;
 218 } __packed;
 219 
 220 /* HECI struct for integrated wired HDCP Tx Rx Cert verification. */
 221 struct wired_cmd_verify_receiver_cert_in {
 222         struct hdcp_cmd_header  header;
 223         struct hdcp_port_id     port;
 224         struct hdcp2_cert_rx    cert_rx;
 225         u8                      r_rx[HDCP_2_2_RRX_LEN];
 226         u8                      rx_caps[HDCP_2_2_RXCAPS_LEN];
 227 } __packed;
 228 
 229 struct wired_cmd_verify_receiver_cert_out {
 230         struct hdcp_cmd_header  header;
 231         struct hdcp_port_id     port;
 232         u8                      km_stored;
 233         u8                      reserved[3];
 234         union encrypted_buff    ekm_buff;
 235 } __packed;
 236 
 237 /* HECI struct for verification of Rx's Hprime in a HDCP Tx session */
 238 struct wired_cmd_ake_send_hprime_in {
 239         struct hdcp_cmd_header  header;
 240         struct hdcp_port_id     port;
 241         u8                      h_prime[HDCP_2_2_H_PRIME_LEN];
 242 } __packed;
 243 
 244 struct wired_cmd_ake_send_hprime_out {
 245         struct hdcp_cmd_header  header;
 246         struct hdcp_port_id     port;
 247 } __packed;
 248 
 249 /*
 250  * HECI struct for sending in AKE pairing data generated by the Rx in an
 251  * integrated wired HDCP Tx session.
 252  */
 253 struct wired_cmd_ake_send_pairing_info_in {
 254         struct hdcp_cmd_header  header;
 255         struct hdcp_port_id     port;
 256         u8                      e_kh_km[HDCP_2_2_E_KH_KM_LEN];
 257 } __packed;
 258 
 259 struct wired_cmd_ake_send_pairing_info_out {
 260         struct hdcp_cmd_header  header;
 261         struct hdcp_port_id     port;
 262 } __packed;
 263 
 264 /* Data structures for integrated wired HDCP2 Tx in support of the LC protocol*/
 265 /*
 266  * HECI struct for initiating locality check with an
 267  * integrated wired HDCP Tx session.
 268  */
 269 struct wired_cmd_init_locality_check_in {
 270         struct hdcp_cmd_header  header;
 271         struct hdcp_port_id     port;
 272 } __packed;
 273 
 274 struct wired_cmd_init_locality_check_out {
 275         struct hdcp_cmd_header  header;
 276         struct hdcp_port_id     port;
 277         u8                      r_n[HDCP_2_2_RN_LEN];
 278 } __packed;
 279 
 280 /*
 281  * HECI struct for validating an Rx's LPrime value in an
 282  * integrated wired HDCP Tx session.
 283  */
 284 struct wired_cmd_validate_locality_in {
 285         struct hdcp_cmd_header  header;
 286         struct hdcp_port_id     port;
 287         u8                      l_prime[HDCP_2_2_L_PRIME_LEN];
 288 } __packed;
 289 
 290 struct wired_cmd_validate_locality_out {
 291         struct hdcp_cmd_header  header;
 292         struct hdcp_port_id     port;
 293 } __packed;
 294 
 295 /*
 296  * Data structures for integrated wired HDCP2 Tx in support of the
 297  * SKE protocol
 298  */
 299 /* HECI struct for creating session key */
 300 struct wired_cmd_get_session_key_in {
 301         struct hdcp_cmd_header  header;
 302         struct hdcp_port_id     port;
 303 } __packed;
 304 
 305 struct wired_cmd_get_session_key_out {
 306         struct hdcp_cmd_header  header;
 307         struct hdcp_port_id     port;
 308         u8                      e_dkey_ks[HDCP_2_2_E_DKEY_KS_LEN];
 309         u8                      r_iv[HDCP_2_2_RIV_LEN];
 310 } __packed;
 311 
 312 /* HECI struct for the Tx enable authentication command */
 313 struct wired_cmd_enable_auth_in {
 314         struct hdcp_cmd_header  header;
 315         struct hdcp_port_id     port;
 316         u8                      stream_type;
 317 } __packed;
 318 
 319 struct wired_cmd_enable_auth_out {
 320         struct hdcp_cmd_header  header;
 321         struct hdcp_port_id     port;
 322 } __packed;
 323 
 324 /*
 325  * Data structures for integrated wired HDCP2 Tx in support of
 326  * the repeater protocols
 327  */
 328 /*
 329  * HECI struct for verifying the downstream repeater's HDCP topology in an
 330  * integrated wired HDCP Tx session.
 331  */
 332 struct wired_cmd_verify_repeater_in {
 333         struct hdcp_cmd_header  header;
 334         struct hdcp_port_id     port;
 335         u8                      rx_info[HDCP_2_2_RXINFO_LEN];
 336         u8                      seq_num_v[HDCP_2_2_SEQ_NUM_LEN];
 337         u8                      v_prime[HDCP_2_2_V_PRIME_HALF_LEN];
 338         u8                      receiver_ids[HDCP_2_2_RECEIVER_IDS_MAX_LEN];
 339 } __packed;
 340 
 341 struct wired_cmd_verify_repeater_out {
 342         struct hdcp_cmd_header  header;
 343         struct hdcp_port_id     port;
 344         u8                      content_type_supported;
 345         u8                      v[HDCP_2_2_V_PRIME_HALF_LEN];
 346 } __packed;
 347 
 348 /*
 349  * HECI struct in support of stream management in an
 350  * integrated wired HDCP Tx session.
 351  */
 352 struct wired_cmd_repeater_auth_stream_req_in {
 353         struct hdcp_cmd_header          header;
 354         struct hdcp_port_id             port;
 355         u8                              seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
 356         u8                              m_prime[HDCP_2_2_MPRIME_LEN];
 357         __be16                          k;
 358         struct hdcp2_streamid_type      streams[1];
 359 } __packed;
 360 
 361 struct wired_cmd_repeater_auth_stream_req_out {
 362         struct hdcp_cmd_header  header;
 363         struct hdcp_port_id     port;
 364 } __packed;
 365 
 366 enum mei_fw_ddi {
 367         MEI_DDI_INVALID_PORT = 0x0,
 368 
 369         MEI_DDI_B = 1,
 370         MEI_DDI_C,
 371         MEI_DDI_D,
 372         MEI_DDI_E,
 373         MEI_DDI_F,
 374         MEI_DDI_A = 7,
 375         MEI_DDI_RANGE_END = MEI_DDI_A,
 376 };
 377 #endif /* __MEI_HDCP_H__ */

/* [<][>][^][v][top][bottom][index][help] */