14f73dc7aSAnshuman Gupta /* SPDX-License-Identifier: (GPL-2.0+) */ 24f73dc7aSAnshuman Gupta /* 34f73dc7aSAnshuman Gupta * Copyright © 2017-2019 Intel Corporation 44f73dc7aSAnshuman Gupta * 54f73dc7aSAnshuman Gupta * Authors: 64f73dc7aSAnshuman Gupta * Ramalingam C <ramalingam.c@intel.com> 74f73dc7aSAnshuman Gupta */ 84f73dc7aSAnshuman Gupta 94f73dc7aSAnshuman Gupta #ifndef _I915_HDCP_INTERFACE_H_ 104f73dc7aSAnshuman Gupta #define _I915_HDCP_INTERFACE_H_ 114f73dc7aSAnshuman Gupta 124f73dc7aSAnshuman Gupta #include <linux/mutex.h> 134f73dc7aSAnshuman Gupta #include <linux/device.h> 144f73dc7aSAnshuman Gupta #include <drm/display/drm_hdcp.h> 154f73dc7aSAnshuman Gupta 164f73dc7aSAnshuman Gupta /** 174f73dc7aSAnshuman Gupta * enum hdcp_port_type - HDCP port implementation type defined by ME/GSC FW 184f73dc7aSAnshuman Gupta * @HDCP_PORT_TYPE_INVALID: Invalid hdcp port type 194f73dc7aSAnshuman Gupta * @HDCP_PORT_TYPE_INTEGRATED: In-Host HDCP2.x port 204f73dc7aSAnshuman Gupta * @HDCP_PORT_TYPE_LSPCON: HDCP2.2 discrete wired Tx port with LSPCON 214f73dc7aSAnshuman Gupta * (HDMI 2.0) solution 224f73dc7aSAnshuman Gupta * @HDCP_PORT_TYPE_CPDP: HDCP2.2 discrete wired Tx port using the CPDP (DP 1.3) 234f73dc7aSAnshuman Gupta * solution 244f73dc7aSAnshuman Gupta */ 254f73dc7aSAnshuman Gupta enum hdcp_port_type { 264f73dc7aSAnshuman Gupta HDCP_PORT_TYPE_INVALID, 274f73dc7aSAnshuman Gupta HDCP_PORT_TYPE_INTEGRATED, 284f73dc7aSAnshuman Gupta HDCP_PORT_TYPE_LSPCON, 294f73dc7aSAnshuman Gupta HDCP_PORT_TYPE_CPDP 304f73dc7aSAnshuman Gupta }; 314f73dc7aSAnshuman Gupta 324f73dc7aSAnshuman Gupta /** 334f73dc7aSAnshuman Gupta * enum hdcp_wired_protocol - HDCP adaptation used on the port 344f73dc7aSAnshuman Gupta * @HDCP_PROTOCOL_INVALID: Invalid HDCP adaptation protocol 354f73dc7aSAnshuman Gupta * @HDCP_PROTOCOL_HDMI: HDMI adaptation of HDCP used on the port 364f73dc7aSAnshuman Gupta * @HDCP_PROTOCOL_DP: DP adaptation of HDCP used on the port 374f73dc7aSAnshuman Gupta */ 384f73dc7aSAnshuman Gupta enum hdcp_wired_protocol { 394f73dc7aSAnshuman Gupta HDCP_PROTOCOL_INVALID, 404f73dc7aSAnshuman Gupta HDCP_PROTOCOL_HDMI, 414f73dc7aSAnshuman Gupta HDCP_PROTOCOL_DP 424f73dc7aSAnshuman Gupta }; 434f73dc7aSAnshuman Gupta 444f73dc7aSAnshuman Gupta enum hdcp_ddi { 454f73dc7aSAnshuman Gupta HDCP_DDI_INVALID_PORT = 0x0, 464f73dc7aSAnshuman Gupta 474f73dc7aSAnshuman Gupta HDCP_DDI_B = 1, 484f73dc7aSAnshuman Gupta HDCP_DDI_C, 494f73dc7aSAnshuman Gupta HDCP_DDI_D, 504f73dc7aSAnshuman Gupta HDCP_DDI_E, 514f73dc7aSAnshuman Gupta HDCP_DDI_F, 524f73dc7aSAnshuman Gupta HDCP_DDI_A = 7, 534f73dc7aSAnshuman Gupta HDCP_DDI_RANGE_END = HDCP_DDI_A, 544f73dc7aSAnshuman Gupta }; 554f73dc7aSAnshuman Gupta 564f73dc7aSAnshuman Gupta /** 574f73dc7aSAnshuman Gupta * enum hdcp_tc - ME/GSC Firmware defined index for transcoders 584f73dc7aSAnshuman Gupta * @HDCP_INVALID_TRANSCODER: Index for Invalid transcoder 594f73dc7aSAnshuman Gupta * @HDCP_TRANSCODER_EDP: Index for EDP Transcoder 604f73dc7aSAnshuman Gupta * @HDCP_TRANSCODER_DSI0: Index for DSI0 Transcoder 614f73dc7aSAnshuman Gupta * @HDCP_TRANSCODER_DSI1: Index for DSI1 Transcoder 624f73dc7aSAnshuman Gupta * @HDCP_TRANSCODER_A: Index for Transcoder A 634f73dc7aSAnshuman Gupta * @HDCP_TRANSCODER_B: Index for Transcoder B 644f73dc7aSAnshuman Gupta * @HDCP_TRANSCODER_C: Index for Transcoder C 654f73dc7aSAnshuman Gupta * @HDCP_TRANSCODER_D: Index for Transcoder D 664f73dc7aSAnshuman Gupta */ 674f73dc7aSAnshuman Gupta enum hdcp_transcoder { 684f73dc7aSAnshuman Gupta HDCP_INVALID_TRANSCODER = 0x00, 694f73dc7aSAnshuman Gupta HDCP_TRANSCODER_EDP, 704f73dc7aSAnshuman Gupta HDCP_TRANSCODER_DSI0, 714f73dc7aSAnshuman Gupta HDCP_TRANSCODER_DSI1, 724f73dc7aSAnshuman Gupta HDCP_TRANSCODER_A = 0x10, 734f73dc7aSAnshuman Gupta HDCP_TRANSCODER_B, 744f73dc7aSAnshuman Gupta HDCP_TRANSCODER_C, 754f73dc7aSAnshuman Gupta HDCP_TRANSCODER_D 764f73dc7aSAnshuman Gupta }; 774f73dc7aSAnshuman Gupta 784f73dc7aSAnshuman Gupta /** 794f73dc7aSAnshuman Gupta * struct hdcp_port_data - intel specific HDCP port data 804f73dc7aSAnshuman Gupta * @hdcp_ddi: ddi index as per ME/GSC FW 814f73dc7aSAnshuman Gupta * @hdcp_transcoder: transcoder index as per ME/GSC FW 824f73dc7aSAnshuman Gupta * @port_type: HDCP port type as per ME/GSC FW classification 834f73dc7aSAnshuman Gupta * @protocol: HDCP adaptation as per ME/GSC FW 844f73dc7aSAnshuman Gupta * @k: No of streams transmitted on a port. Only on DP MST this is != 1 854f73dc7aSAnshuman Gupta * @seq_num_m: Count of RepeaterAuth_Stream_Manage msg propagated. 864f73dc7aSAnshuman Gupta * Initialized to 0 on AKE_INIT. Incremented after every successful 874f73dc7aSAnshuman Gupta * transmission of RepeaterAuth_Stream_Manage message. When it rolls 884f73dc7aSAnshuman Gupta * over re-Auth has to be triggered. 894f73dc7aSAnshuman Gupta * @streams: struct hdcp2_streamid_type[k]. Defines the type and id for the 904f73dc7aSAnshuman Gupta * streams 914f73dc7aSAnshuman Gupta */ 924f73dc7aSAnshuman Gupta struct hdcp_port_data { 934f73dc7aSAnshuman Gupta enum hdcp_ddi hdcp_ddi; 944f73dc7aSAnshuman Gupta enum hdcp_transcoder hdcp_transcoder; 954f73dc7aSAnshuman Gupta u8 port_type; 964f73dc7aSAnshuman Gupta u8 protocol; 974f73dc7aSAnshuman Gupta u16 k; 984f73dc7aSAnshuman Gupta u32 seq_num_m; 994f73dc7aSAnshuman Gupta struct hdcp2_streamid_type *streams; 1004f73dc7aSAnshuman Gupta }; 1014f73dc7aSAnshuman Gupta 1024f73dc7aSAnshuman Gupta /** 1034f73dc7aSAnshuman Gupta * struct i915_hdcp_ops- ops for HDCP2.2 services. 1044f73dc7aSAnshuman Gupta * @owner: Module providing the ops 1054f73dc7aSAnshuman Gupta * @initiate_hdcp2_session: Initiate a Wired HDCP2.2 Tx Session. 1064f73dc7aSAnshuman Gupta * And Prepare AKE_Init. 1074f73dc7aSAnshuman Gupta * @verify_receiver_cert_prepare_km: Verify the Receiver Certificate 1084f73dc7aSAnshuman Gupta * AKE_Send_Cert and prepare 1094f73dc7aSAnshuman Gupta AKE_Stored_Km/AKE_No_Stored_Km 1104f73dc7aSAnshuman Gupta * @verify_hprime: Verify AKE_Send_H_prime 1114f73dc7aSAnshuman Gupta * @store_pairing_info: Store pairing info received 1124f73dc7aSAnshuman Gupta * @initiate_locality_check: Prepare LC_Init 1134f73dc7aSAnshuman Gupta * @verify_lprime: Verify lprime 1144f73dc7aSAnshuman Gupta * @get_session_key: Prepare SKE_Send_Eks 1154f73dc7aSAnshuman Gupta * @repeater_check_flow_prepare_ack: Validate the Downstream topology 1164f73dc7aSAnshuman Gupta * and prepare rep_ack 1174f73dc7aSAnshuman Gupta * @verify_mprime: Verify mprime 1184f73dc7aSAnshuman Gupta * @enable_hdcp_authentication: Mark a port as authenticated. 1194f73dc7aSAnshuman Gupta * @close_hdcp_session: Close the Wired HDCP Tx session per port. 1204f73dc7aSAnshuman Gupta * This also disables the authenticated state of the port. 1214f73dc7aSAnshuman Gupta */ 1224f73dc7aSAnshuman Gupta struct i915_hdcp_ops { 1234f73dc7aSAnshuman Gupta /** 1244f73dc7aSAnshuman Gupta * @owner: hdcp module 1254f73dc7aSAnshuman Gupta */ 1264f73dc7aSAnshuman Gupta struct module *owner; 1274f73dc7aSAnshuman Gupta 1284f73dc7aSAnshuman Gupta int (*initiate_hdcp2_session)(struct device *dev, 1294f73dc7aSAnshuman Gupta struct hdcp_port_data *data, 1304f73dc7aSAnshuman Gupta struct hdcp2_ake_init *ake_data); 1314f73dc7aSAnshuman Gupta int (*verify_receiver_cert_prepare_km)(struct device *dev, 1324f73dc7aSAnshuman Gupta struct hdcp_port_data *data, 1334f73dc7aSAnshuman Gupta struct hdcp2_ake_send_cert 1344f73dc7aSAnshuman Gupta *rx_cert, 1354f73dc7aSAnshuman Gupta bool *km_stored, 1364f73dc7aSAnshuman Gupta struct hdcp2_ake_no_stored_km 1374f73dc7aSAnshuman Gupta *ek_pub_km, 1384f73dc7aSAnshuman Gupta size_t *msg_sz); 1394f73dc7aSAnshuman Gupta int (*verify_hprime)(struct device *dev, 1404f73dc7aSAnshuman Gupta struct hdcp_port_data *data, 1414f73dc7aSAnshuman Gupta struct hdcp2_ake_send_hprime *rx_hprime); 1424f73dc7aSAnshuman Gupta int (*store_pairing_info)(struct device *dev, 1434f73dc7aSAnshuman Gupta struct hdcp_port_data *data, 1444f73dc7aSAnshuman Gupta struct hdcp2_ake_send_pairing_info 1454f73dc7aSAnshuman Gupta *pairing_info); 1464f73dc7aSAnshuman Gupta int (*initiate_locality_check)(struct device *dev, 1474f73dc7aSAnshuman Gupta struct hdcp_port_data *data, 1484f73dc7aSAnshuman Gupta struct hdcp2_lc_init *lc_init_data); 1494f73dc7aSAnshuman Gupta int (*verify_lprime)(struct device *dev, 1504f73dc7aSAnshuman Gupta struct hdcp_port_data *data, 1514f73dc7aSAnshuman Gupta struct hdcp2_lc_send_lprime *rx_lprime); 1524f73dc7aSAnshuman Gupta int (*get_session_key)(struct device *dev, 1534f73dc7aSAnshuman Gupta struct hdcp_port_data *data, 1544f73dc7aSAnshuman Gupta struct hdcp2_ske_send_eks *ske_data); 1554f73dc7aSAnshuman Gupta int (*repeater_check_flow_prepare_ack)(struct device *dev, 1564f73dc7aSAnshuman Gupta struct hdcp_port_data *data, 1574f73dc7aSAnshuman Gupta struct hdcp2_rep_send_receiverid_list 1584f73dc7aSAnshuman Gupta *rep_topology, 1594f73dc7aSAnshuman Gupta struct hdcp2_rep_send_ack 1604f73dc7aSAnshuman Gupta *rep_send_ack); 1614f73dc7aSAnshuman Gupta int (*verify_mprime)(struct device *dev, 1624f73dc7aSAnshuman Gupta struct hdcp_port_data *data, 1634f73dc7aSAnshuman Gupta struct hdcp2_rep_stream_ready *stream_ready); 1644f73dc7aSAnshuman Gupta int (*enable_hdcp_authentication)(struct device *dev, 1654f73dc7aSAnshuman Gupta struct hdcp_port_data *data); 1664f73dc7aSAnshuman Gupta int (*close_hdcp_session)(struct device *dev, 1674f73dc7aSAnshuman Gupta struct hdcp_port_data *data); 1684f73dc7aSAnshuman Gupta }; 1694f73dc7aSAnshuman Gupta 1704f73dc7aSAnshuman Gupta /** 171*5c8ec987SSuraj Kandpal * struct i915_hdcp_arbiter - Used for communication between i915 1724f73dc7aSAnshuman Gupta * and hdcp drivers for the HDCP2.2 services 1734f73dc7aSAnshuman Gupta * @hdcp_dev: device that provide the HDCP2.2 service from MEI Bus. 1744f73dc7aSAnshuman Gupta * @hdcp_ops: Ops implemented by hdcp driver or intel_hdcp_gsc , used by i915 driver. 1754f73dc7aSAnshuman Gupta */ 176*5c8ec987SSuraj Kandpal struct i915_hdcp_arbiter { 1774f73dc7aSAnshuman Gupta struct device *hdcp_dev; 1784f73dc7aSAnshuman Gupta const struct i915_hdcp_ops *ops; 1794f73dc7aSAnshuman Gupta 1804f73dc7aSAnshuman Gupta /* To protect the above members. */ 1814f73dc7aSAnshuman Gupta struct mutex mutex; 1824f73dc7aSAnshuman Gupta }; 1834f73dc7aSAnshuman Gupta 18433898377SSuraj Kandpal /* fw_hdcp_status: Enumeration of all HDCP Status Codes */ 18533898377SSuraj Kandpal enum fw_hdcp_status { 18633898377SSuraj Kandpal FW_HDCP_STATUS_SUCCESS = 0x0000, 18733898377SSuraj Kandpal 18833898377SSuraj Kandpal /* WiDi Generic Status Codes */ 18933898377SSuraj Kandpal FW_HDCP_STATUS_INTERNAL_ERROR = 0x1000, 19033898377SSuraj Kandpal FW_HDCP_STATUS_UNKNOWN_ERROR = 0x1001, 19133898377SSuraj Kandpal FW_HDCP_STATUS_INCORRECT_API_VERSION = 0x1002, 19233898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_FUNCTION = 0x1003, 19333898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_BUFFER_LENGTH = 0x1004, 19433898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_PARAMS = 0x1005, 19533898377SSuraj Kandpal FW_HDCP_STATUS_AUTHENTICATION_FAILED = 0x1006, 19633898377SSuraj Kandpal 19733898377SSuraj Kandpal /* WiDi Status Codes */ 19833898377SSuraj Kandpal FW_HDCP_INVALID_SESSION_STATE = 0x6000, 19933898377SSuraj Kandpal FW_HDCP_SRM_FRAGMENT_UNEXPECTED = 0x6001, 20033898377SSuraj Kandpal FW_HDCP_SRM_INVALID_LENGTH = 0x6002, 20133898377SSuraj Kandpal FW_HDCP_SRM_FRAGMENT_OFFSET_INVALID = 0x6003, 20233898377SSuraj Kandpal FW_HDCP_SRM_VERIFICATION_FAILED = 0x6004, 20333898377SSuraj Kandpal FW_HDCP_SRM_VERSION_TOO_OLD = 0x6005, 20433898377SSuraj Kandpal FW_HDCP_RX_CERT_VERIFICATION_FAILED = 0x6006, 20533898377SSuraj Kandpal FW_HDCP_RX_REVOKED = 0x6007, 20633898377SSuraj Kandpal FW_HDCP_H_VERIFICATION_FAILED = 0x6008, 20733898377SSuraj Kandpal FW_HDCP_REPEATER_CHECK_UNEXPECTED = 0x6009, 20833898377SSuraj Kandpal FW_HDCP_TOPOLOGY_MAX_EXCEEDED = 0x600A, 20933898377SSuraj Kandpal FW_HDCP_V_VERIFICATION_FAILED = 0x600B, 21033898377SSuraj Kandpal FW_HDCP_L_VERIFICATION_FAILED = 0x600C, 21133898377SSuraj Kandpal FW_HDCP_STREAM_KEY_ALLOC_FAILED = 0x600D, 21233898377SSuraj Kandpal FW_HDCP_BASE_KEY_RESET_FAILED = 0x600E, 21333898377SSuraj Kandpal FW_HDCP_NONCE_GENERATION_FAILED = 0x600F, 21433898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_E_KEY_STATE = 0x6010, 21533898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_CS_ICV = 0x6011, 21633898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_KB_KEY_STATE = 0x6012, 21733898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_PAVP_MODE_ICV = 0x6013, 21833898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_PAVP_MODE = 0x6014, 21933898377SSuraj Kandpal FW_HDCP_STATUS_LC_MAX_ATTEMPTS = 0x6015, 22033898377SSuraj Kandpal 22133898377SSuraj Kandpal /* New status for HDCP 2.1 */ 22233898377SSuraj Kandpal FW_HDCP_STATUS_MISMATCH_IN_M = 0x6016, 22333898377SSuraj Kandpal 22433898377SSuraj Kandpal /* New status code for HDCP 2.2 Rx */ 22533898377SSuraj Kandpal FW_HDCP_STATUS_RX_PROV_NOT_ALLOWED = 0x6017, 22633898377SSuraj Kandpal FW_HDCP_STATUS_RX_PROV_WRONG_SUBJECT = 0x6018, 22733898377SSuraj Kandpal FW_HDCP_RX_NEEDS_PROVISIONING = 0x6019, 22833898377SSuraj Kandpal FW_HDCP_BKSV_ICV_AUTH_FAILED = 0x6020, 22933898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_STREAM_ID = 0x6021, 23033898377SSuraj Kandpal FW_HDCP_STATUS_CHAIN_NOT_INITIALIZED = 0x6022, 23133898377SSuraj Kandpal FW_HDCP_FAIL_NOT_EXPECTED = 0x6023, 23233898377SSuraj Kandpal FW_HDCP_FAIL_HDCP_OFF = 0x6024, 23333898377SSuraj Kandpal FW_HDCP_FAIL_INVALID_PAVP_MEMORY_MODE = 0x6025, 23433898377SSuraj Kandpal FW_HDCP_FAIL_AES_ECB_FAILURE = 0x6026, 23533898377SSuraj Kandpal FW_HDCP_FEATURE_NOT_SUPPORTED = 0x6027, 23633898377SSuraj Kandpal FW_HDCP_DMA_READ_ERROR = 0x6028, 23733898377SSuraj Kandpal FW_HDCP_DMA_WRITE_ERROR = 0x6029, 23833898377SSuraj Kandpal FW_HDCP_FAIL_INVALID_PACKET_SIZE = 0x6030, 23933898377SSuraj Kandpal FW_HDCP_H264_PARSING_ERROR = 0x6031, 24033898377SSuraj Kandpal FW_HDCP_HDCP2_ERRATA_VIDEO_VIOLATION = 0x6032, 24133898377SSuraj Kandpal FW_HDCP_HDCP2_ERRATA_AUDIO_VIOLATION = 0x6033, 24233898377SSuraj Kandpal FW_HDCP_TX_ACTIVE_ERROR = 0x6034, 24333898377SSuraj Kandpal FW_HDCP_MODE_CHANGE_ERROR = 0x6035, 24433898377SSuraj Kandpal FW_HDCP_STREAM_TYPE_ERROR = 0x6036, 24533898377SSuraj Kandpal FW_HDCP_STREAM_MANAGE_NOT_POSSIBLE = 0x6037, 24633898377SSuraj Kandpal 24733898377SSuraj Kandpal FW_HDCP_STATUS_PORT_INVALID_COMMAND = 0x6038, 24833898377SSuraj Kandpal FW_HDCP_STATUS_UNSUPPORTED_PROTOCOL = 0x6039, 24933898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_PORT_INDEX = 0x603a, 25033898377SSuraj Kandpal FW_HDCP_STATUS_TX_AUTH_NEEDED = 0x603b, 25133898377SSuraj Kandpal FW_HDCP_STATUS_NOT_INTEGRATED_PORT = 0x603c, 25233898377SSuraj Kandpal FW_HDCP_STATUS_SESSION_MAX_REACHED = 0x603d, 25333898377SSuraj Kandpal 25433898377SSuraj Kandpal /* hdcp capable bit is not set in rx_caps(error is unique to DP) */ 25533898377SSuraj Kandpal FW_HDCP_STATUS_NOT_HDCP_CAPABLE = 0x6041, 25633898377SSuraj Kandpal 25733898377SSuraj Kandpal FW_HDCP_STATUS_INVALID_STREAM_COUNT = 0x6042, 25833898377SSuraj Kandpal }; 25933898377SSuraj Kandpal 26033898377SSuraj Kandpal #define HDCP_API_VERSION 0x00010000 26133898377SSuraj Kandpal 26233898377SSuraj Kandpal #define HDCP_M_LEN 16 26333898377SSuraj Kandpal #define HDCP_KH_LEN 16 26433898377SSuraj Kandpal 26533898377SSuraj Kandpal /* Payload Buffer size(Excluding Header) for CMDs and corresponding response */ 26633898377SSuraj Kandpal /* Wired_Tx_AKE */ 26733898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN (4 + 1) 26833898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_OUT (4 + 8 + 3) 26933898377SSuraj Kandpal 27033898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN (4 + 522 + 8 + 3) 27133898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MIN_OUT (4 + 1 + 3 + 16 + 16) 27233898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MAX_OUT (4 + 1 + 3 + 128) 27333898377SSuraj Kandpal 27433898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN (4 + 32) 27533898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_OUT (4) 27633898377SSuraj Kandpal 27733898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN (4 + 16) 27833898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_OUT (4) 27933898377SSuraj Kandpal 28033898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN (4) 28133898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_CLOSE_SESSION_OUT (4) 28233898377SSuraj Kandpal 28333898377SSuraj Kandpal /* Wired_Tx_LC */ 28433898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN (4) 28533898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_OUT (4 + 8) 28633898377SSuraj Kandpal 28733898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN (4 + 32) 28833898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_OUT (4) 28933898377SSuraj Kandpal 29033898377SSuraj Kandpal /* Wired_Tx_SKE */ 29133898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN (4) 29233898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_OUT (4 + 16 + 8) 29333898377SSuraj Kandpal 29433898377SSuraj Kandpal /* Wired_Tx_SKE */ 29533898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN (4 + 1) 29633898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_ENABLE_AUTH_OUT (4) 29733898377SSuraj Kandpal 29833898377SSuraj Kandpal /* Wired_Tx_Repeater */ 29933898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN (4 + 2 + 3 + 16 + 155) 30033898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_OUT (4 + 1 + 16) 30133898377SSuraj Kandpal 30233898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN (4 + 3 + \ 30333898377SSuraj Kandpal 32 + 2 + 2) 30433898377SSuraj Kandpal 30533898377SSuraj Kandpal #define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_OUT (4) 30633898377SSuraj Kandpal 30733898377SSuraj Kandpal /* hdcp_command_id: Enumeration of all WIRED HDCP Command IDs */ 30833898377SSuraj Kandpal enum hdcp_command_id { 30933898377SSuraj Kandpal _WIDI_COMMAND_BASE = 0x00030000, 31033898377SSuraj Kandpal WIDI_INITIATE_HDCP2_SESSION = _WIDI_COMMAND_BASE, 31133898377SSuraj Kandpal HDCP_GET_SRM_STATUS, 31233898377SSuraj Kandpal HDCP_SEND_SRM_FRAGMENT, 31333898377SSuraj Kandpal 31433898377SSuraj Kandpal /* The wired HDCP Tx commands */ 31533898377SSuraj Kandpal _WIRED_COMMAND_BASE = 0x00031000, 31633898377SSuraj Kandpal WIRED_INITIATE_HDCP2_SESSION = _WIRED_COMMAND_BASE, 31733898377SSuraj Kandpal WIRED_VERIFY_RECEIVER_CERT, 31833898377SSuraj Kandpal WIRED_AKE_SEND_HPRIME, 31933898377SSuraj Kandpal WIRED_AKE_SEND_PAIRING_INFO, 32033898377SSuraj Kandpal WIRED_INIT_LOCALITY_CHECK, 32133898377SSuraj Kandpal WIRED_VALIDATE_LOCALITY, 32233898377SSuraj Kandpal WIRED_GET_SESSION_KEY, 32333898377SSuraj Kandpal WIRED_ENABLE_AUTH, 32433898377SSuraj Kandpal WIRED_VERIFY_REPEATER, 32533898377SSuraj Kandpal WIRED_REPEATER_AUTH_STREAM_REQ, 32633898377SSuraj Kandpal WIRED_CLOSE_SESSION, 32733898377SSuraj Kandpal 32833898377SSuraj Kandpal _WIRED_COMMANDS_COUNT, 32933898377SSuraj Kandpal }; 33033898377SSuraj Kandpal 33133898377SSuraj Kandpal union encrypted_buff { 33233898377SSuraj Kandpal u8 e_kpub_km[HDCP_2_2_E_KPUB_KM_LEN]; 33333898377SSuraj Kandpal u8 e_kh_km_m[HDCP_2_2_E_KH_KM_M_LEN]; 33433898377SSuraj Kandpal struct { 33533898377SSuraj Kandpal u8 e_kh_km[HDCP_KH_LEN]; 33633898377SSuraj Kandpal u8 m[HDCP_M_LEN]; 33733898377SSuraj Kandpal } __packed; 33833898377SSuraj Kandpal }; 33933898377SSuraj Kandpal 34033898377SSuraj Kandpal /* HDCP HECI message header. All header values are little endian. */ 34133898377SSuraj Kandpal struct hdcp_cmd_header { 34233898377SSuraj Kandpal u32 api_version; 34333898377SSuraj Kandpal u32 command_id; 34433898377SSuraj Kandpal enum fw_hdcp_status status; 34533898377SSuraj Kandpal /* Length of the HECI message (excluding the header) */ 34633898377SSuraj Kandpal u32 buffer_len; 34733898377SSuraj Kandpal } __packed; 34833898377SSuraj Kandpal 34933898377SSuraj Kandpal /* Empty command request or response. No data follows the header. */ 35033898377SSuraj Kandpal struct hdcp_cmd_no_data { 35133898377SSuraj Kandpal struct hdcp_cmd_header header; 35233898377SSuraj Kandpal } __packed; 35333898377SSuraj Kandpal 35433898377SSuraj Kandpal /* Uniquely identifies the hdcp port being addressed for a given command. */ 35533898377SSuraj Kandpal struct hdcp_port_id { 35633898377SSuraj Kandpal u8 integrated_port_type; 35733898377SSuraj Kandpal /* physical_port is used until Gen11.5. Must be zero for Gen11.5+ */ 35833898377SSuraj Kandpal u8 physical_port; 35933898377SSuraj Kandpal /* attached_transcoder is for Gen11.5+. Set to zero for <Gen11.5 */ 36033898377SSuraj Kandpal u8 attached_transcoder; 36133898377SSuraj Kandpal u8 reserved; 36233898377SSuraj Kandpal } __packed; 36333898377SSuraj Kandpal 36433898377SSuraj Kandpal /* 36533898377SSuraj Kandpal * Data structures for integrated wired HDCP2 Tx in 36633898377SSuraj Kandpal * support of the AKE protocol 36733898377SSuraj Kandpal */ 36833898377SSuraj Kandpal /* HECI struct for integrated wired HDCP Tx session initiation. */ 36933898377SSuraj Kandpal struct wired_cmd_initiate_hdcp2_session_in { 37033898377SSuraj Kandpal struct hdcp_cmd_header header; 37133898377SSuraj Kandpal struct hdcp_port_id port; 37233898377SSuraj Kandpal u8 protocol; /* for HDMI vs DP */ 37333898377SSuraj Kandpal } __packed; 37433898377SSuraj Kandpal 37533898377SSuraj Kandpal struct wired_cmd_initiate_hdcp2_session_out { 37633898377SSuraj Kandpal struct hdcp_cmd_header header; 37733898377SSuraj Kandpal struct hdcp_port_id port; 37833898377SSuraj Kandpal u8 r_tx[HDCP_2_2_RTX_LEN]; 37933898377SSuraj Kandpal struct hdcp2_tx_caps tx_caps; 38033898377SSuraj Kandpal } __packed; 38133898377SSuraj Kandpal 38233898377SSuraj Kandpal /* HECI struct for ending an integrated wired HDCP Tx session. */ 38333898377SSuraj Kandpal struct wired_cmd_close_session_in { 38433898377SSuraj Kandpal struct hdcp_cmd_header header; 38533898377SSuraj Kandpal struct hdcp_port_id port; 38633898377SSuraj Kandpal } __packed; 38733898377SSuraj Kandpal 38833898377SSuraj Kandpal struct wired_cmd_close_session_out { 38933898377SSuraj Kandpal struct hdcp_cmd_header header; 39033898377SSuraj Kandpal struct hdcp_port_id port; 39133898377SSuraj Kandpal } __packed; 39233898377SSuraj Kandpal 39333898377SSuraj Kandpal /* HECI struct for integrated wired HDCP Tx Rx Cert verification. */ 39433898377SSuraj Kandpal struct wired_cmd_verify_receiver_cert_in { 39533898377SSuraj Kandpal struct hdcp_cmd_header header; 39633898377SSuraj Kandpal struct hdcp_port_id port; 39733898377SSuraj Kandpal struct hdcp2_cert_rx cert_rx; 39833898377SSuraj Kandpal u8 r_rx[HDCP_2_2_RRX_LEN]; 39933898377SSuraj Kandpal u8 rx_caps[HDCP_2_2_RXCAPS_LEN]; 40033898377SSuraj Kandpal } __packed; 40133898377SSuraj Kandpal 40233898377SSuraj Kandpal struct wired_cmd_verify_receiver_cert_out { 40333898377SSuraj Kandpal struct hdcp_cmd_header header; 40433898377SSuraj Kandpal struct hdcp_port_id port; 40533898377SSuraj Kandpal u8 km_stored; 40633898377SSuraj Kandpal u8 reserved[3]; 40733898377SSuraj Kandpal union encrypted_buff ekm_buff; 40833898377SSuraj Kandpal } __packed; 40933898377SSuraj Kandpal 41033898377SSuraj Kandpal /* HECI struct for verification of Rx's Hprime in a HDCP Tx session */ 41133898377SSuraj Kandpal struct wired_cmd_ake_send_hprime_in { 41233898377SSuraj Kandpal struct hdcp_cmd_header header; 41333898377SSuraj Kandpal struct hdcp_port_id port; 41433898377SSuraj Kandpal u8 h_prime[HDCP_2_2_H_PRIME_LEN]; 41533898377SSuraj Kandpal } __packed; 41633898377SSuraj Kandpal 41733898377SSuraj Kandpal struct wired_cmd_ake_send_hprime_out { 41833898377SSuraj Kandpal struct hdcp_cmd_header header; 41933898377SSuraj Kandpal struct hdcp_port_id port; 42033898377SSuraj Kandpal } __packed; 42133898377SSuraj Kandpal 42233898377SSuraj Kandpal /* 42333898377SSuraj Kandpal * HECI struct for sending in AKE pairing data generated by the Rx in an 42433898377SSuraj Kandpal * integrated wired HDCP Tx session. 42533898377SSuraj Kandpal */ 42633898377SSuraj Kandpal struct wired_cmd_ake_send_pairing_info_in { 42733898377SSuraj Kandpal struct hdcp_cmd_header header; 42833898377SSuraj Kandpal struct hdcp_port_id port; 42933898377SSuraj Kandpal u8 e_kh_km[HDCP_2_2_E_KH_KM_LEN]; 43033898377SSuraj Kandpal } __packed; 43133898377SSuraj Kandpal 43233898377SSuraj Kandpal struct wired_cmd_ake_send_pairing_info_out { 43333898377SSuraj Kandpal struct hdcp_cmd_header header; 43433898377SSuraj Kandpal struct hdcp_port_id port; 43533898377SSuraj Kandpal } __packed; 43633898377SSuraj Kandpal 43733898377SSuraj Kandpal /* Data structures for integrated wired HDCP2 Tx in support of the LC protocol*/ 43833898377SSuraj Kandpal /* 43933898377SSuraj Kandpal * HECI struct for initiating locality check with an 44033898377SSuraj Kandpal * integrated wired HDCP Tx session. 44133898377SSuraj Kandpal */ 44233898377SSuraj Kandpal struct wired_cmd_init_locality_check_in { 44333898377SSuraj Kandpal struct hdcp_cmd_header header; 44433898377SSuraj Kandpal struct hdcp_port_id port; 44533898377SSuraj Kandpal } __packed; 44633898377SSuraj Kandpal 44733898377SSuraj Kandpal struct wired_cmd_init_locality_check_out { 44833898377SSuraj Kandpal struct hdcp_cmd_header header; 44933898377SSuraj Kandpal struct hdcp_port_id port; 45033898377SSuraj Kandpal u8 r_n[HDCP_2_2_RN_LEN]; 45133898377SSuraj Kandpal } __packed; 45233898377SSuraj Kandpal 45333898377SSuraj Kandpal /* 45433898377SSuraj Kandpal * HECI struct for validating an Rx's LPrime value in an 45533898377SSuraj Kandpal * integrated wired HDCP Tx session. 45633898377SSuraj Kandpal */ 45733898377SSuraj Kandpal struct wired_cmd_validate_locality_in { 45833898377SSuraj Kandpal struct hdcp_cmd_header header; 45933898377SSuraj Kandpal struct hdcp_port_id port; 46033898377SSuraj Kandpal u8 l_prime[HDCP_2_2_L_PRIME_LEN]; 46133898377SSuraj Kandpal } __packed; 46233898377SSuraj Kandpal 46333898377SSuraj Kandpal struct wired_cmd_validate_locality_out { 46433898377SSuraj Kandpal struct hdcp_cmd_header header; 46533898377SSuraj Kandpal struct hdcp_port_id port; 46633898377SSuraj Kandpal } __packed; 46733898377SSuraj Kandpal 46833898377SSuraj Kandpal /* 46933898377SSuraj Kandpal * Data structures for integrated wired HDCP2 Tx in support of the 47033898377SSuraj Kandpal * SKE protocol 47133898377SSuraj Kandpal */ 47233898377SSuraj Kandpal /* HECI struct for creating session key */ 47333898377SSuraj Kandpal struct wired_cmd_get_session_key_in { 47433898377SSuraj Kandpal struct hdcp_cmd_header header; 47533898377SSuraj Kandpal struct hdcp_port_id port; 47633898377SSuraj Kandpal } __packed; 47733898377SSuraj Kandpal 47833898377SSuraj Kandpal struct wired_cmd_get_session_key_out { 47933898377SSuraj Kandpal struct hdcp_cmd_header header; 48033898377SSuraj Kandpal struct hdcp_port_id port; 48133898377SSuraj Kandpal u8 e_dkey_ks[HDCP_2_2_E_DKEY_KS_LEN]; 48233898377SSuraj Kandpal u8 r_iv[HDCP_2_2_RIV_LEN]; 48333898377SSuraj Kandpal } __packed; 48433898377SSuraj Kandpal 48533898377SSuraj Kandpal /* HECI struct for the Tx enable authentication command */ 48633898377SSuraj Kandpal struct wired_cmd_enable_auth_in { 48733898377SSuraj Kandpal struct hdcp_cmd_header header; 48833898377SSuraj Kandpal struct hdcp_port_id port; 48933898377SSuraj Kandpal u8 stream_type; 49033898377SSuraj Kandpal } __packed; 49133898377SSuraj Kandpal 49233898377SSuraj Kandpal struct wired_cmd_enable_auth_out { 49333898377SSuraj Kandpal struct hdcp_cmd_header header; 49433898377SSuraj Kandpal struct hdcp_port_id port; 49533898377SSuraj Kandpal } __packed; 49633898377SSuraj Kandpal 49733898377SSuraj Kandpal /* 49833898377SSuraj Kandpal * Data structures for integrated wired HDCP2 Tx in support of 49933898377SSuraj Kandpal * the repeater protocols 50033898377SSuraj Kandpal */ 50133898377SSuraj Kandpal /* 50233898377SSuraj Kandpal * HECI struct for verifying the downstream repeater's HDCP topology in an 50333898377SSuraj Kandpal * integrated wired HDCP Tx session. 50433898377SSuraj Kandpal */ 50533898377SSuraj Kandpal struct wired_cmd_verify_repeater_in { 50633898377SSuraj Kandpal struct hdcp_cmd_header header; 50733898377SSuraj Kandpal struct hdcp_port_id port; 50833898377SSuraj Kandpal u8 rx_info[HDCP_2_2_RXINFO_LEN]; 50933898377SSuraj Kandpal u8 seq_num_v[HDCP_2_2_SEQ_NUM_LEN]; 51033898377SSuraj Kandpal u8 v_prime[HDCP_2_2_V_PRIME_HALF_LEN]; 51133898377SSuraj Kandpal u8 receiver_ids[HDCP_2_2_RECEIVER_IDS_MAX_LEN]; 51233898377SSuraj Kandpal } __packed; 51333898377SSuraj Kandpal 51433898377SSuraj Kandpal struct wired_cmd_verify_repeater_out { 51533898377SSuraj Kandpal struct hdcp_cmd_header header; 51633898377SSuraj Kandpal struct hdcp_port_id port; 51733898377SSuraj Kandpal u8 content_type_supported; 51833898377SSuraj Kandpal u8 v[HDCP_2_2_V_PRIME_HALF_LEN]; 51933898377SSuraj Kandpal } __packed; 52033898377SSuraj Kandpal 52133898377SSuraj Kandpal /* 52233898377SSuraj Kandpal * HECI struct in support of stream management in an 52333898377SSuraj Kandpal * integrated wired HDCP Tx session. 52433898377SSuraj Kandpal */ 52533898377SSuraj Kandpal struct wired_cmd_repeater_auth_stream_req_in { 52633898377SSuraj Kandpal struct hdcp_cmd_header header; 52733898377SSuraj Kandpal struct hdcp_port_id port; 52833898377SSuraj Kandpal u8 seq_num_m[HDCP_2_2_SEQ_NUM_LEN]; 52933898377SSuraj Kandpal u8 m_prime[HDCP_2_2_MPRIME_LEN]; 53033898377SSuraj Kandpal __be16 k; 53133898377SSuraj Kandpal struct hdcp2_streamid_type streams[]; 53233898377SSuraj Kandpal } __packed; 53333898377SSuraj Kandpal 53433898377SSuraj Kandpal struct wired_cmd_repeater_auth_stream_req_out { 53533898377SSuraj Kandpal struct hdcp_cmd_header header; 53633898377SSuraj Kandpal struct hdcp_port_id port; 53733898377SSuraj Kandpal } __packed; 53833898377SSuraj Kandpal 5394f73dc7aSAnshuman Gupta #endif /* _I915_HDCP_INTERFACE_H_ */ 540