drivers/gpu/drm/amd/amdgpu/soc15.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/soc15.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/soc15.c- Extension
.c- Size
- 45894 bytes
- Lines
- 1496
- 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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hlinux/slab.hlinux/module.hlinux/pci.hdrm/amdgpu_drm.hamdgpu.hamdgpu_ih.hamdgpu_uvd.hamdgpu_vce.hamdgpu_ucode.hamdgpu_psp.hatom.hamd_pcie.huvd/uvd_7_0_offset.hgc/gc_9_0_offset.hgc/gc_9_0_sh_mask.hsdma0/sdma0_4_0_offset.hsdma1/sdma1_4_0_offset.hnbio/nbio_7_0_default.hnbio/nbio_7_0_offset.hnbio/nbio_7_0_sh_mask.hnbio/nbio_7_0_smn.hmp/mp_9_0_offset.hsoc15.hsoc15_common.hgfx_v9_0.hgmc_v9_0.hgfxhub_v1_0.hmmhub_v1_0.hdf_v1_7.hdf_v3_6.hnbio_v6_1.h
Detected Declarations
function soc15_query_video_codecsfunction soc15_uvd_ctx_rregfunction soc15_uvd_ctx_wregfunction soc15_didt_rregfunction soc15_didt_wregfunction soc15_gc_cac_rregfunction soc15_gc_cac_wregfunction soc15_se_cac_rregfunction soc15_se_cac_wregfunction soc15_get_config_memsizefunction soc15_get_xclkfunction soc15_grbm_selectfunction soc15_read_disabled_biosfunction soc15_get_register_valuefunction soc15_read_registerfunction soc15_program_register_sequencefunction soc15_asic_baco_resetfunction soc15_asic_reset_methodfunction IP_VERSIONfunction soc15_need_reset_on_resumefunction soc15_asic_resetfunction soc15_supports_bacofunction soc15_set_uvd_clocksfunction soc15_set_vce_clocksfunction soc15_reg_base_initfunction soc15_set_virt_opsfunction soc15_need_full_resetfunction soc15_get_pcie_usagefunction vega20_get_pcie_usagefunction soc15_need_reset_on_initfunction soc15_get_pcie_replay_countfunction soc15_pre_asic_initfunction soc15_common_early_initfunction soc15_common_late_initfunction soc15_common_sw_initfunction soc15_common_sw_finifunction soc15_sdma_doorbell_range_initfunction soc15_common_hw_initfunction soc15_common_hw_finifunction amdgpu_ras_is_supportedfunction soc15_common_suspendfunction soc15_common_resumefunction soc15_common_is_idlefunction soc15_update_drm_clock_gatingfunction soc15_update_drm_light_sleepfunction soc15_common_set_clockgating_statefunction soc15_common_get_clockgating_statefunction soc15_common_set_powergating_state
Annotated Snippet
switch (amdgpu_ip_version(adev, VCE_HWIP, 0)) {
case IP_VERSION(4, 0, 0):
case IP_VERSION(4, 1, 0):
if (encode)
*codecs = &vega_video_codecs_encode;
else
*codecs = &vega_video_codecs_decode;
return 0;
default:
return -EINVAL;
}
} else {
switch (amdgpu_ip_version(adev, UVD_HWIP, 0)) {
case IP_VERSION(1, 0, 0):
case IP_VERSION(1, 0, 1):
if (encode)
*codecs = &vega_video_codecs_encode;
else
*codecs = &rv_video_codecs_decode;
return 0;
case IP_VERSION(2, 5, 0):
case IP_VERSION(2, 6, 0):
case IP_VERSION(2, 2, 0):
if (encode)
*codecs = &vega_video_codecs_encode;
else
*codecs = &rn_video_codecs_decode;
return 0;
case IP_VERSION(4, 0, 3):
if (encode)
*codecs = &vcn_4_0_3_video_codecs_encode;
else
*codecs = &vcn_4_0_3_video_codecs_decode;
return 0;
case IP_VERSION(5, 0, 1):
if (encode)
*codecs = &vcn_5_0_1_video_codecs_encode_vcn0;
else
*codecs = &vcn_5_0_1_video_codecs_decode_vcn0;
return 0;
default:
return -EINVAL;
}
}
}
static u32 soc15_uvd_ctx_rreg(struct amdgpu_device *adev, u32 reg)
{
unsigned long flags, address, data;
u32 r;
address = SOC15_REG_OFFSET(UVD, 0, mmUVD_CTX_INDEX);
data = SOC15_REG_OFFSET(UVD, 0, mmUVD_CTX_DATA);
spin_lock_irqsave(&adev->reg.uvd_ctx.lock, flags);
WREG32(address, ((reg) & 0x1ff));
r = RREG32(data);
spin_unlock_irqrestore(&adev->reg.uvd_ctx.lock, flags);
return r;
}
static void soc15_uvd_ctx_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
{
unsigned long flags, address, data;
address = SOC15_REG_OFFSET(UVD, 0, mmUVD_CTX_INDEX);
data = SOC15_REG_OFFSET(UVD, 0, mmUVD_CTX_DATA);
spin_lock_irqsave(&adev->reg.uvd_ctx.lock, flags);
WREG32(address, ((reg) & 0x1ff));
WREG32(data, (v));
spin_unlock_irqrestore(&adev->reg.uvd_ctx.lock, flags);
}
static u32 soc15_didt_rreg(struct amdgpu_device *adev, u32 reg)
{
unsigned long flags, address, data;
u32 r;
address = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_INDEX);
data = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_DATA);
spin_lock_irqsave(&adev->reg.didt.lock, flags);
WREG32(address, (reg));
r = RREG32(data);
spin_unlock_irqrestore(&adev->reg.didt.lock, flags);
return r;
}
static void soc15_didt_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/slab.h`, `linux/module.h`, `linux/pci.h`, `drm/amdgpu_drm.h`, `amdgpu.h`, `amdgpu_ih.h`, `amdgpu_uvd.h`.
- Detected declarations: `function soc15_query_video_codecs`, `function soc15_uvd_ctx_rreg`, `function soc15_uvd_ctx_wreg`, `function soc15_didt_rreg`, `function soc15_didt_wreg`, `function soc15_gc_cac_rreg`, `function soc15_gc_cac_wreg`, `function soc15_se_cac_rreg`, `function soc15_se_cac_wreg`, `function soc15_get_config_memsize`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.