drivers/gpu/drm/display/drm_hdcp_helper.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/display/drm_hdcp_helper.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/display/drm_hdcp_helper.c- Extension
.c- Size
- 12315 bytes
- Lines
- 422
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/err.hlinux/gfp.hlinux/export.hlinux/slab.hlinux/firmware.hdrm/display/drm_hdcp_helper.hdrm/drm_sysfs.hdrm/drm_print.hdrm/drm_device.hdrm/drm_property.hdrm/drm_mode_object.hdrm/drm_connector.h
Detected Declarations
function Copyrightfunction drm_hdcp_get_revoked_ksv_countfunction drm_hdcp_get_revoked_ksvsfunction get_vrl_lengthfunction drm_hdcp_parse_hdcp1_srmfunction drm_hdcp_parse_hdcp2_srmfunction is_srm_version_hdcp1function is_srm_version_hdcp2function drm_hdcp_srm_updatefunction drm_hdcp_request_srmfunction Messagefunction createdfunction drm_hdcp_update_content_protectionexport drm_hdcp_check_ksvs_revokedexport drm_connector_attach_content_protection_propertyexport drm_hdcp_update_content_protection
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2019 Intel Corporation.
*
* Authors:
* Ramalingam C <ramalingam.c@intel.com>
*/
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gfp.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/firmware.h>
#include <drm/display/drm_hdcp_helper.h>
#include <drm/drm_sysfs.h>
#include <drm/drm_print.h>
#include <drm/drm_device.h>
#include <drm/drm_property.h>
#include <drm/drm_mode_object.h>
#include <drm/drm_connector.h>
static inline void drm_hdcp_print_ksv(const u8 *ksv)
{
DRM_DEBUG("\t%#02x, %#02x, %#02x, %#02x, %#02x\n",
ksv[0], ksv[1], ksv[2], ksv[3], ksv[4]);
}
static u32 drm_hdcp_get_revoked_ksv_count(const u8 *buf, u32 vrls_length)
{
u32 parsed_bytes = 0, ksv_count = 0, vrl_ksv_cnt, vrl_sz;
while (parsed_bytes < vrls_length) {
vrl_ksv_cnt = *buf;
ksv_count += vrl_ksv_cnt;
vrl_sz = (vrl_ksv_cnt * DRM_HDCP_KSV_LEN) + 1;
buf += vrl_sz;
parsed_bytes += vrl_sz;
}
/*
* When vrls are not valid, ksvs are not considered.
* Hence SRM will be discarded.
*/
if (parsed_bytes != vrls_length)
ksv_count = 0;
return ksv_count;
}
static u32 drm_hdcp_get_revoked_ksvs(const u8 *buf, u8 **revoked_ksv_list,
u32 vrls_length)
{
u32 vrl_ksv_cnt, vrl_ksv_sz, vrl_idx = 0;
u32 parsed_bytes = 0, ksv_count = 0;
do {
vrl_ksv_cnt = *buf;
vrl_ksv_sz = vrl_ksv_cnt * DRM_HDCP_KSV_LEN;
buf++;
DRM_DEBUG("vrl: %d, Revoked KSVs: %d\n", vrl_idx++,
vrl_ksv_cnt);
memcpy((*revoked_ksv_list) + (ksv_count * DRM_HDCP_KSV_LEN),
buf, vrl_ksv_sz);
ksv_count += vrl_ksv_cnt;
buf += vrl_ksv_sz;
parsed_bytes += (vrl_ksv_sz + 1);
} while (parsed_bytes < vrls_length);
return ksv_count;
}
static inline u32 get_vrl_length(const u8 *buf)
{
return drm_hdcp_be24_to_cpu(buf);
}
static int drm_hdcp_parse_hdcp1_srm(const u8 *buf, size_t count,
u8 **revoked_ksv_list, u32 *revoked_ksv_cnt)
{
struct hdcp_srm_header *header;
u32 vrl_length, ksv_count;
if (count < (sizeof(struct hdcp_srm_header) +
Annotation
- Immediate include surface: `linux/device.h`, `linux/err.h`, `linux/gfp.h`, `linux/export.h`, `linux/slab.h`, `linux/firmware.h`, `drm/display/drm_hdcp_helper.h`, `drm/drm_sysfs.h`.
- Detected declarations: `function Copyright`, `function drm_hdcp_get_revoked_ksv_count`, `function drm_hdcp_get_revoked_ksvs`, `function get_vrl_length`, `function drm_hdcp_parse_hdcp1_srm`, `function drm_hdcp_parse_hdcp2_srm`, `function is_srm_version_hdcp1`, `function is_srm_version_hdcp2`, `function drm_hdcp_srm_update`, `function drm_hdcp_request_srm`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.