[Intel-gfx] [RFC v1 14/20] drm/hdcp2.2: HDCP2.2 protocol msg definitions

Ramalingam C ramalingam.c at intel.com
Wed Jul 12 08:28:58 UTC 2017


Protocol message structures and constants of the
HDCP2.2 specification are defined at <drm/drm_hdcp.h>

Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
 include/drm/drm_hdcp.h | 204 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 204 insertions(+)

diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
index d5adbf5..1f9a04d 100644
--- a/include/drm/drm_hdcp.h
+++ b/include/drm/drm_hdcp.h
@@ -166,6 +166,210 @@ struct drm_hdcp {
 #define DRM_HDCP_STATUS_SHIFT			20
 #define DRM_HDCP_STATUS_MASK			(0xFULL<<DRM_HDCP_STATUS_SHIFT)
 
+
+/**
+ * Protocol message definition for HDCP2.2 specification
+ */
+
+/* HDCP2.2 Msg IDs */
+#define NULL_MSG				1
+#define AKE_INIT				2
+#define AKE_SEND_CERT				3
+#define AKE_NO_STORED_KM			4
+#define AKE_STORED_KM				5
+#define AKE_SEND_HPRIME				7
+#define AKE_SEND_PARING_INFO			8
+#define LC_INIT					9
+#define LC_SEND_LPRIME				10
+#define SKE_SEND_EKS				11
+#define REP_SEND_RECVID_LIST			12
+#define REP_SEND_ACK				15
+#define REP_STREAM_MANAGE			16
+#define REP_STREAM_READY			17
+
+#define HDCP_RTX_LEN				8
+#define HDCP_RRX_LEN				8
+#define RECEIVER_ID_SIZE			5
+
+#define K_PUB_RX_MOD_N_SIZE			128
+#define K_PUB_RX_EXP_E_SIZE			3
+#define K_PUB_RX_SIZE				(K_PUB_RX_MOD_N_SIZE + \
+						 K_PUB_RX_EXP_E_SIZE)
+
+#define DCP_LLC_SIGNATURE_SIZE			384
+
+#define HDCP_E_KPUB_KM_LEN			128
+#define HDCP_E_KH_KM_M_LEN			(16 + 16)
+#define HDCP_H_PRIME_LEN			32
+#define HDCP_E_KH_KM_LEN			16
+#define HDCP_RN_LEN				8
+#define HDCP_L_PRIME_LEN			32
+#define HDCP_E_DKEY_KS_LEN			16
+#define HDCP_RIV_LEN				8
+#define HDCP_SEQ_NUM_LEN			3
+#define HDCP_LPRIME_HALF_SIZE			(HDCP_L_PRIME_LEN / 2)
+#define HDCP_RECEIVER_ID_LEN			5
+#define HDCP_MAX_DEVICE_COUNT			31
+#define HDCP_RECEIVER_IDS_MAX_LEN		(HDCP_RECEIVER_ID_LEN * \
+						 HDCP_MAX_DEVICE_COUNT)
+
+/**
+ * TODO: This has to be changed for DP MST, as multiple stream on
+ * same port is possible.
+ * For HDCP2.2 on HDMI and DP SST this value is always 1.
+ */
+#define MAX_CONTENT_STREAMS_CNT			1
+
+#define HDCP_MPRIME_LEN				32
+
+struct hdcp_cert_rx {
+	uint8_t	receiver_id[RECEIVER_ID_SIZE];
+	uint8_t	kpub_rx[K_PUB_RX_SIZE];
+	uint8_t	reserved1			:4;
+
+	/* As per HDMI & DP HDCP Spec, must be 0x0 or 0x1 */
+	uint8_t	protocol_descriptor		:4;
+
+	/* As per HDMI & DP HDCP Spec, must be 0x0000 */
+	uint8_t	reserved2;
+	uint8_t	dcp_signature[DCP_LLC_SIGNATURE_SIZE];
+} __packed;
+
+/**
+ * The RxCaps field specified in the HDCP HDMI, DP specs
+ * This field is big endian as specified in the errata.
+ */
+union rx_caps {
+	struct	{
+		uint8_t version;
+		uint8_t receiver_capability_mask_hi;
+		uint8_t repeater:1;
+
+		/* Rsvd in HDMI. Applicable in DP alone */
+		uint8_t hdcp_capable:1;
+		uint8_t receiver_capability_mask_low:6;
+	} fields;
+	uint8_t rx_caps_value[3];
+} __packed;
+
+/**
+ * RxInfo fields Contains various topology information for the
+ * repeater authentication flows
+ */
+union rx_info {
+	struct {
+		uint8_t device_count_hi:1;
+		uint8_t depth:3;
+		uint8_t rsvd:4;
+
+		/* Bit-0: downstream HDCP 1.x device exist */
+		uint8_t hdcp1_device_downstream:1;
+
+		/* Bit-1: downstream HDCP 2.0, 2.1 device exist */
+		uint8_t hdcp2_legacy_device_downstream:1;
+
+		/* Bit-2: downstream Topology limit errors */
+		uint8_t max_cascade_exceeded:1;
+		uint8_t max_devs_exceeded:1;
+		uint8_t device_count_lo:4;
+
+	} fields;
+	uint16_t rx_info_value;
+} __packed;
+
+struct wired_streamid_type {
+	uint8_t stream_id;
+	uint8_t stream_type;
+} __packed;
+
+/**
+ * The TxCaps field specified in the HDCP HDMI, DP specs
+ * This field is big endian as specified in the errata.
+ */
+struct tx_caps {
+	uint8_t			version;
+
+	/* Reserved for HDCP and DP Spec. Read as Zero */
+	uint16_t		transmitter_capability_mask;
+} __packed;
+
+/*
+ * Main structures for HDCP2.2 protocol communication
+ */
+struct wired_ake_init {
+	uint8_t			msg_id;
+	uint8_t			r_tx[HDCP_RTX_LEN];
+	struct tx_caps		tx_caps;
+} __packed;
+
+struct wired_ake_send_cert {
+	uint8_t			msg_id;
+	struct hdcp_cert_rx	cert_rx;
+	uint8_t			r_rx[HDCP_RRX_LEN];
+	union rx_caps		rx_caps;
+} __packed;
+
+struct wired_ake_no_stored_km {
+	uint8_t			msg_id;
+	uint8_t			e_kpub_km[HDCP_E_KPUB_KM_LEN];
+} __packed;
+
+struct wired_ake_stored_km {
+	uint8_t			msg_id;
+	uint8_t			e_kh_km_m[HDCP_E_KH_KM_M_LEN];
+} __packed;
+
+struct wired_ake_send_hprime {
+	uint8_t			msg_id;
+	uint8_t			h_prime[HDCP_H_PRIME_LEN];
+} __packed;
+
+struct wired_ake_send_pairing_info {
+	uint8_t			msg_id;
+	uint8_t			e_kh_km[HDCP_E_KH_KM_LEN];
+} __packed;
+
+struct wired_lc_init {
+	uint8_t			msg_id;
+	uint8_t			r_n[HDCP_RN_LEN];
+} __packed;
+
+struct wired_lc_send_lprime {
+	uint8_t			msg_id;
+	uint8_t			l_prime[HDCP_L_PRIME_LEN];
+} __packed;
+
+struct wired_ske_send_eks {
+	uint8_t			msg_id;
+	uint8_t			e_dkey_ks[HDCP_E_DKEY_KS_LEN];
+	uint8_t			riv[HDCP_RIV_LEN];
+} __packed;
+
+struct wired_rep_send_receiverid_list {
+	uint8_t			msg_id;
+	union rx_info		rx_info;
+	uint8_t			seq_num_v[HDCP_SEQ_NUM_LEN];
+	uint8_t			v_prime[HDCP_LPRIME_HALF_SIZE];
+	uint8_t			receiver_ids[HDCP_RECEIVER_IDS_MAX_LEN];
+} __packed;
+
+struct wired_rep_send_ack {
+	uint8_t			msg_id;
+	uint8_t			v[HDCP_LPRIME_HALF_SIZE];
+} __packed;
+
+struct wired_rep_stream_manage {
+	uint8_t			msg_id;
+	uint8_t			seq_num_m[HDCP_SEQ_NUM_LEN];
+	uint16_t		k;
+	struct wired_streamid_type streams[MAX_CONTENT_STREAMS_CNT];
+} __packed;
+
+struct wired_rep_stream_ready {
+	uint8_t			msg_id;
+	uint8_t			m_prime[HDCP_MPRIME_LEN];
+} __packed;
+
 /* Functions exported */
 extern int drm_hdcp_init(struct drm_connector *connector,
 					struct drm_hdcp *hdcp,
-- 
2.7.4



More information about the Intel-gfx mailing list