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

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c
Extension
.c
Size
9191 bytes
Lines
244
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

#include "hdcp.h"

void mod_hdcp_dump_binary_message(uint8_t *msg, uint32_t msg_size,
		uint8_t *buf, uint32_t buf_size)
{
	const uint8_t bytes_per_line = 16,
			byte_size = 3,
			newline_size = 1,
			terminator_size = 1;
	uint32_t line_count = msg_size / bytes_per_line,
			trailing_bytes = msg_size % bytes_per_line;
	uint32_t target_size = (byte_size * bytes_per_line + newline_size) * line_count +
			byte_size * trailing_bytes + newline_size + terminator_size;
	uint32_t buf_pos = 0;
	uint32_t i = 0;

	if (buf_size >= target_size) {
		for (i = 0; i < msg_size; i++) {
			if (i % bytes_per_line == 0)
				buf[buf_pos++] = '\n';
			sprintf((char *)&buf[buf_pos], "%02X ", msg[i]);
			buf_pos += byte_size;
		}
		buf[buf_pos++] = '\0';
	}
}

void mod_hdcp_log_ddc_trace(struct mod_hdcp *hdcp)
{
	if (is_hdcp1(hdcp)) {
		HDCP_DDC_READ_TRACE(hdcp, "BKSV", hdcp->auth.msg.hdcp1.bksv,
				sizeof(hdcp->auth.msg.hdcp1.bksv));
		HDCP_DDC_READ_TRACE(hdcp, "BCAPS", &hdcp->auth.msg.hdcp1.bcaps,
				sizeof(hdcp->auth.msg.hdcp1.bcaps));
		HDCP_DDC_READ_TRACE(hdcp, "BSTATUS",
				(uint8_t *)&hdcp->auth.msg.hdcp1.bstatus,
				sizeof(hdcp->auth.msg.hdcp1.bstatus));
		HDCP_DDC_WRITE_TRACE(hdcp, "AN", hdcp->auth.msg.hdcp1.an,
				sizeof(hdcp->auth.msg.hdcp1.an));
		HDCP_DDC_WRITE_TRACE(hdcp, "AKSV", hdcp->auth.msg.hdcp1.aksv,
				sizeof(hdcp->auth.msg.hdcp1.aksv));
		HDCP_DDC_WRITE_TRACE(hdcp, "AINFO", &hdcp->auth.msg.hdcp1.ainfo,
				sizeof(hdcp->auth.msg.hdcp1.ainfo));
		HDCP_DDC_READ_TRACE(hdcp, "RI' / R0'",
				(uint8_t *)&hdcp->auth.msg.hdcp1.r0p,
				sizeof(hdcp->auth.msg.hdcp1.r0p));
		HDCP_DDC_READ_TRACE(hdcp, "BINFO",
				(uint8_t *)&hdcp->auth.msg.hdcp1.binfo_dp,
				sizeof(hdcp->auth.msg.hdcp1.binfo_dp));
		HDCP_DDC_READ_TRACE(hdcp, "KSVLIST", hdcp->auth.msg.hdcp1.ksvlist,
				hdcp->auth.msg.hdcp1.ksvlist_size);
		HDCP_DDC_READ_TRACE(hdcp, "V'", hdcp->auth.msg.hdcp1.vp,
				sizeof(hdcp->auth.msg.hdcp1.vp));
	} else if (is_hdcp2(hdcp)) {
		HDCP_DDC_READ_TRACE(hdcp, "HDCP2Version",
				&hdcp->auth.msg.hdcp2.hdcp2version_hdmi,
				sizeof(hdcp->auth.msg.hdcp2.hdcp2version_hdmi));
		HDCP_DDC_READ_TRACE(hdcp, "Rx Caps", hdcp->auth.msg.hdcp2.rxcaps_dp,
				sizeof(hdcp->auth.msg.hdcp2.rxcaps_dp));
		HDCP_DDC_WRITE_TRACE(hdcp, "AKE Init", hdcp->auth.msg.hdcp2.ake_init,
				sizeof(hdcp->auth.msg.hdcp2.ake_init));
		HDCP_DDC_READ_TRACE(hdcp, "AKE Cert", hdcp->auth.msg.hdcp2.ake_cert,
				sizeof(hdcp->auth.msg.hdcp2.ake_cert));
		HDCP_DDC_WRITE_TRACE(hdcp, "Stored KM",
				hdcp->auth.msg.hdcp2.ake_stored_km,
				sizeof(hdcp->auth.msg.hdcp2.ake_stored_km));
		HDCP_DDC_WRITE_TRACE(hdcp, "No Stored KM",
				hdcp->auth.msg.hdcp2.ake_no_stored_km,
				sizeof(hdcp->auth.msg.hdcp2.ake_no_stored_km));
		HDCP_DDC_READ_TRACE(hdcp, "H'", hdcp->auth.msg.hdcp2.ake_h_prime,
				sizeof(hdcp->auth.msg.hdcp2.ake_h_prime));
		HDCP_DDC_READ_TRACE(hdcp, "Pairing Info",
				hdcp->auth.msg.hdcp2.ake_pairing_info,
				sizeof(hdcp->auth.msg.hdcp2.ake_pairing_info));
		HDCP_DDC_WRITE_TRACE(hdcp, "LC Init", hdcp->auth.msg.hdcp2.lc_init,
				sizeof(hdcp->auth.msg.hdcp2.lc_init));
		HDCP_DDC_READ_TRACE(hdcp, "L'", hdcp->auth.msg.hdcp2.lc_l_prime,
				sizeof(hdcp->auth.msg.hdcp2.lc_l_prime));
		HDCP_DDC_WRITE_TRACE(hdcp, "Exchange KS", hdcp->auth.msg.hdcp2.ske_eks,
				sizeof(hdcp->auth.msg.hdcp2.ske_eks));
		HDCP_DDC_READ_TRACE(hdcp, "Rx Status",
				(uint8_t *)&hdcp->auth.msg.hdcp2.rxstatus,
				sizeof(hdcp->auth.msg.hdcp2.rxstatus));
		HDCP_DDC_READ_TRACE(hdcp, "Rx Id List",
				hdcp->auth.msg.hdcp2.rx_id_list,
				hdcp->auth.msg.hdcp2.rx_id_list_size);
		HDCP_DDC_WRITE_TRACE(hdcp, "Rx Id List Ack",
				hdcp->auth.msg.hdcp2.repeater_auth_ack,
				sizeof(hdcp->auth.msg.hdcp2.repeater_auth_ack));
		HDCP_DDC_WRITE_TRACE(hdcp, "Content Stream Management",

Annotation

Implementation Notes