drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c
Extension
.c
Size
39635 bytes
Lines
1034
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (is_display_encryption_enabled(&hdcp->displays[i])) {
				hdcp->displays[i].state =
							MOD_HDCP_DISPLAY_ACTIVE;
				HDCP_HDCP1_DISABLED_TRACE(
					hdcp, hdcp->displays[i].index);
			}
	}

	mutex_unlock(&psp->hdcp_context.mutex);
	return status;
}

enum mod_hdcp_status mod_hdcp_hdcp1_validate_rx(struct mod_hdcp *hdcp)
{
	struct psp_context *psp = hdcp->config.psp.handle;
	struct ta_hdcp_shared_memory *hdcp_cmd;
	enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;

	mutex_lock(&psp->hdcp_context.mutex);
	hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
	memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));

	hdcp_cmd->in_msg.hdcp1_first_part_authentication.session_handle = hdcp->auth.id;

	memcpy(hdcp_cmd->in_msg.hdcp1_first_part_authentication.bksv_primary, hdcp->auth.msg.hdcp1.bksv,
		TA_HDCP__HDCP1_KSV_SIZE);

	hdcp_cmd->in_msg.hdcp1_first_part_authentication.r0_prime_primary = hdcp->auth.msg.hdcp1.r0p;
	hdcp_cmd->in_msg.hdcp1_first_part_authentication.bcaps = hdcp->auth.msg.hdcp1.bcaps;
	hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP1_FIRST_PART_AUTHENTICATION;

	psp_hdcp_invoke(psp, hdcp_cmd->cmd_id);

	if (hdcp_cmd->hdcp_status != TA_HDCP_STATUS__SUCCESS) {
		status = MOD_HDCP_STATUS_HDCP1_VALIDATE_RX_FAILURE;
	} else if (hdcp_cmd->out_msg.hdcp1_first_part_authentication.authentication_status ==
	    TA_HDCP_AUTHENTICATION_STATUS__HDCP1_FIRST_PART_COMPLETE) {
		/* needs second part of authentication */
		hdcp->connection.is_repeater = 1;
	} else if (hdcp_cmd->out_msg.hdcp1_first_part_authentication.authentication_status ==
		   TA_HDCP_AUTHENTICATION_STATUS__HDCP1_AUTHENTICATED) {
		hdcp->connection.is_repeater = 0;
	} else if (hdcp_cmd->out_msg.hdcp1_first_part_authentication.authentication_status ==
		   TA_HDCP_AUTHENTICATION_STATUS__HDCP1_KSV_REVOKED) {
		hdcp->connection.is_hdcp1_revoked = 1;
		status = MOD_HDCP_STATUS_HDCP1_BKSV_REVOKED;
	} else
		status = MOD_HDCP_STATUS_HDCP1_VALIDATE_RX_FAILURE;

	mutex_unlock(&psp->hdcp_context.mutex);
	return status;
}

enum mod_hdcp_status mod_hdcp_hdcp1_enable_encryption(struct mod_hdcp *hdcp)
{
	struct psp_context *psp = hdcp->config.psp.handle;
	struct ta_hdcp_shared_memory *hdcp_cmd;
	struct mod_hdcp_display *display = get_first_active_display(hdcp);
	enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;

	if (!display)
		return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND;

	mutex_lock(&psp->hdcp_context.mutex);
	hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
	memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));

	hdcp_cmd->in_msg.hdcp1_enable_encryption.session_handle = hdcp->auth.id;
	hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP1_ENABLE_ENCRYPTION;

	psp_hdcp_invoke(psp, hdcp_cmd->cmd_id);

	if (hdcp_cmd->hdcp_status != TA_HDCP_STATUS__SUCCESS) {
		status = MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION_FAILURE;
	} else if (!is_dp_mst_hdcp(hdcp)) {
		display->state = MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED;
		HDCP_HDCP1_ENABLED_TRACE(hdcp, display->index);
	}

	mutex_unlock(&psp->hdcp_context.mutex);
	return status;
}

enum mod_hdcp_status mod_hdcp_hdcp1_validate_ksvlist_vp(struct mod_hdcp *hdcp)
{
	struct psp_context *psp = hdcp->config.psp.handle;
	struct ta_hdcp_shared_memory *hdcp_cmd;
	enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;

	mutex_lock(&psp->hdcp_context.mutex);

Annotation

Implementation Notes