linux/include/drm/display/drm_hdcp.h

/* SPDX-License-Identifier: MIT */
/*
 * Copyright (C) 2017 Google, Inc.
 *
 * Authors:
 * Sean Paul <[email protected]>
 */

#ifndef _DRM_HDCP_H_
#define _DRM_HDCP_H_

#include <linux/types.h>

/* Period of hdcp checks (to ensure we're still authenticated) */
#define DRM_HDCP_CHECK_PERIOD_MS
#define DRM_HDCP2_CHECK_PERIOD_MS

/* Shared lengths/masks between HDMI/DVI/DisplayPort */
#define DRM_HDCP_AN_LEN
#define DRM_HDCP_BSTATUS_LEN
#define DRM_HDCP_KSV_LEN
#define DRM_HDCP_RI_LEN
#define DRM_HDCP_V_PRIME_PART_LEN
#define DRM_HDCP_V_PRIME_NUM_PARTS
#define DRM_HDCP_NUM_DOWNSTREAM(x)
#define DRM_HDCP_MAX_CASCADE_EXCEEDED(x)
#define DRM_HDCP_MAX_DEVICE_EXCEEDED(x)

/* Slave address for the HDCP registers in the receiver */
#define DRM_HDCP_DDC_ADDR

/* Value to use at the end of the SHA-1 bytestream used for repeaters */
#define DRM_HDCP_SHA1_TERMINATOR

/* HDCP register offsets for HDMI/DVI devices */
#define DRM_HDCP_DDC_BKSV
#define DRM_HDCP_DDC_RI_PRIME
#define DRM_HDCP_DDC_AKSV
#define DRM_HDCP_DDC_AN
#define DRM_HDCP_DDC_V_PRIME(h)
#define DRM_HDCP_DDC_BCAPS
#define DRM_HDCP_DDC_BCAPS_REPEATER_PRESENT
#define DRM_HDCP_DDC_BCAPS_KSV_FIFO_READY
#define DRM_HDCP_DDC_BSTATUS
#define DRM_HDCP_DDC_KSV_FIFO

#define DRM_HDCP_1_4_SRM_ID
#define DRM_HDCP_1_4_VRL_LENGTH_SIZE
#define DRM_HDCP_1_4_DCP_SIG_SIZE

/* Protocol message definition for HDCP2.2 specification */
/*
 * Protected content streams are classified into 2 types:
 * - Type0: Can be transmitted with HDCP 1.4+
 * - Type1: Can be transmitted with HDCP 2.2+
 */
#define HDCP_STREAM_TYPE0
#define HDCP_STREAM_TYPE1

/* HDCP2.2 Msg IDs */
#define HDCP_2_2_NULL_MSG
#define HDCP_2_2_AKE_INIT
#define HDCP_2_2_AKE_SEND_CERT
#define HDCP_2_2_AKE_NO_STORED_KM
#define HDCP_2_2_AKE_STORED_KM
#define HDCP_2_2_AKE_SEND_HPRIME
#define HDCP_2_2_AKE_SEND_PAIRING_INFO
#define HDCP_2_2_LC_INIT
#define HDCP_2_2_LC_SEND_LPRIME
#define HDCP_2_2_SKE_SEND_EKS
#define HDCP_2_2_REP_SEND_RECVID_LIST
#define HDCP_2_2_REP_SEND_ACK
#define HDCP_2_2_REP_STREAM_MANAGE
#define HDCP_2_2_REP_STREAM_READY

#define HDCP_2_2_RTX_LEN
#define HDCP_2_2_RRX_LEN

#define HDCP_2_2_K_PUB_RX_MOD_N_LEN
#define HDCP_2_2_K_PUB_RX_EXP_E_LEN
#define HDCP_2_2_K_PUB_RX_LEN

#define HDCP_2_2_DCP_LLC_SIG_LEN

#define HDCP_2_2_E_KPUB_KM_LEN
#define HDCP_2_2_E_KH_KM_M_LEN
#define HDCP_2_2_H_PRIME_LEN
#define HDCP_2_2_E_KH_KM_LEN
#define HDCP_2_2_RN_LEN
#define HDCP_2_2_L_PRIME_LEN
#define HDCP_2_2_E_DKEY_KS_LEN
#define HDCP_2_2_RIV_LEN
#define HDCP_2_2_SEQ_NUM_LEN
#define HDCP_2_2_V_PRIME_HALF_LEN
#define HDCP_2_2_RECEIVER_ID_LEN
#define HDCP_2_2_MAX_DEVICE_COUNT
#define HDCP_2_2_RECEIVER_IDS_MAX_LEN
#define HDCP_2_2_MPRIME_LEN

/* Following Macros take a byte at a time for bit(s) masking */
/*
 * TODO: HDCP_2_2_MAX_CONTENT_STREAMS_CNT is based upon actual
 * H/W MST streams capacity.
 * This required to be moved out to platform specific header.
 */
#define HDCP_2_2_MAX_CONTENT_STREAMS_CNT
#define HDCP_2_2_TXCAP_MASK_LEN
#define HDCP_2_2_RXCAPS_LEN
#define HDCP_2_2_RX_REPEATER(x)
#define HDCP_2_2_DP_HDCP_CAPABLE(x)
#define HDCP_2_2_RXINFO_LEN

/* HDCP1.x compliant device in downstream */
#define HDCP_2_2_HDCP1_DEVICE_CONNECTED(x)

/* HDCP2.0 Compliant repeater in downstream */
#define HDCP_2_2_HDCP_2_0_REP_CONNECTED(x)
#define HDCP_2_2_MAX_CASCADE_EXCEEDED(x)
#define HDCP_2_2_MAX_DEVS_EXCEEDED(x)
#define HDCP_2_2_DEV_COUNT_LO(x)
#define HDCP_2_2_DEV_COUNT_HI(x)
#define HDCP_2_2_DEPTH(x)

struct hdcp2_cert_rx {} __packed;

struct hdcp2_streamid_type {} __packed;

/*
 * The TxCaps field specified in the HDCP HDMI, DP specs
 * This field is big endian as specified in the errata.
 */
struct hdcp2_tx_caps {} __packed;

/* Main structures for HDCP2.2 protocol communication */
struct hdcp2_ake_init {} __packed;

struct hdcp2_ake_send_cert {} __packed;

struct hdcp2_ake_no_stored_km {} __packed;

struct hdcp2_ake_stored_km {} __packed;

struct hdcp2_ake_send_hprime {} __packed;

struct hdcp2_ake_send_pairing_info {} __packed;

struct hdcp2_lc_init {} __packed;

struct hdcp2_lc_send_lprime {} __packed;

struct hdcp2_ske_send_eks {} __packed;

struct hdcp2_rep_send_receiverid_list {} __packed;

struct hdcp2_rep_send_ack {} __packed;

struct hdcp2_rep_stream_manage {} __packed;

struct hdcp2_rep_stream_ready {} __packed;

/* HDCP2.2 TIMEOUTs in mSec */
#define HDCP_2_2_CERT_TIMEOUT_MS
#define HDCP_2_2_DP_CERT_READ_TIMEOUT_MS
#define HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT_MS
#define HDCP_2_2_HPRIME_PAIRED_TIMEOUT_MS
#define HDCP_2_2_DP_HPRIME_READ_TIMEOUT_MS
#define HDCP_2_2_PAIRING_TIMEOUT_MS
#define HDCP_2_2_DP_PAIRING_READ_TIMEOUT_MS
#define HDCP_2_2_HDMI_LPRIME_TIMEOUT_MS
#define HDCP_2_2_DP_LPRIME_TIMEOUT_MS
#define HDCP_2_2_RECVID_LIST_TIMEOUT_MS
#define HDCP_2_2_STREAM_READY_TIMEOUT_MS

/* HDMI HDCP2.2 Register Offsets */
#define HDCP_2_2_HDMI_REG_VER_OFFSET
#define HDCP_2_2_HDMI_REG_WR_MSG_OFFSET
#define HDCP_2_2_HDMI_REG_RXSTATUS_OFFSET
#define HDCP_2_2_HDMI_REG_RD_MSG_OFFSET
#define HDCP_2_2_HDMI_REG_DBG_OFFSET

#define HDCP_2_2_HDMI_SUPPORT_MASK
#define HDCP_2_2_RX_CAPS_VERSION_VAL
#define HDCP_2_2_SEQ_NUM_MAX
#define HDCP_2_2_DELAY_BEFORE_ENCRYPTION_EN

/* Below macros take a byte at a time and mask the bit(s) */
#define HDCP_2_2_HDMI_RXSTATUS_LEN
#define HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(x)
#define HDCP_2_2_HDMI_RXSTATUS_READY(x)
#define HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ(x)

/*
 * Helper functions to convert 24bit big endian hdcp sequence number to
 * host format and back
 */
static inline
u32 drm_hdcp_be24_to_cpu(const u8 seq_num[HDCP_2_2_SEQ_NUM_LEN])
{}

static inline
void drm_hdcp_cpu_to_be24(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val)
{}

#define DRM_HDCP_SRM_GEN1_MAX_BYTES
#define DRM_HDCP_1_4_SRM_ID
#define DRM_HDCP_SRM_ID_MASK
#define DRM_HDCP_1_4_VRL_LENGTH_SIZE
#define DRM_HDCP_1_4_DCP_SIG_SIZE
#define DRM_HDCP_2_SRM_ID
#define DRM_HDCP_2_INDICATOR
#define DRM_HDCP_2_INDICATOR_MASK
#define DRM_HDCP_2_VRL_LENGTH_SIZE
#define DRM_HDCP_2_DCP_SIG_SIZE
#define DRM_HDCP_2_NO_OF_DEV_PLUS_RESERVED_SZ
#define DRM_HDCP_2_KSV_COUNT_2_LSBITS(byte)

struct hdcp_srm_header {} __packed;

/* Content Type classification for HDCP2.2 vs others */
#define DRM_MODE_HDCP_CONTENT_TYPE0
#define DRM_MODE_HDCP_CONTENT_TYPE1

#endif