drivers/gpu/drm/amd/amdgpu/soc21.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/soc21.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/soc21.c- Extension
.c- Size
- 34035 bytes
- Lines
- 1057
- 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.hamdgpu.hamdgpu_atombios.hamdgpu_ih.hamdgpu_uvd.hamdgpu_vce.hamdgpu_ucode.hamdgpu_psp.hamdgpu_smu.hatom.hamd_pcie.hgc/gc_11_0_0_offset.hgc/gc_11_0_0_sh_mask.hmp/mp_13_0_0_offset.hsoc15.hsoc15_common.hsoc21.hmxgpu_nv.h
Detected Declarations
function soc21_query_video_codecsfunction soc21_didt_rregfunction soc21_didt_wregfunction soc21_get_config_memsizefunction soc21_get_xclkfunction soc21_grbm_selectfunction soc21_read_disabled_biosfunction soc21_get_register_valuefunction soc21_read_registerfunction soc21_asic_mode1_resetfunction soc21_asic_reset_methodfunction soc21_asic_resetfunction soc21_set_uvd_clocksfunction soc21_set_vce_clocksfunction soc21_need_full_resetfunction soc21_need_reset_on_initfunction soc21_init_doorbell_indexfunction soc21_update_umd_stable_pstatefunction soc21_common_early_initfunction soc21_common_late_initfunction soc21_common_sw_initfunction soc21_common_hw_initfunction soc21_common_hw_finifunction soc21_common_suspendfunction soc21_need_reset_on_resumefunction soc21_common_resumefunction soc21_common_is_idlefunction soc21_common_set_clockgating_statefunction soc21_common_set_powergating_statefunction soc21_common_get_clockgating_state
Annotated Snippet
if (amdgpu_sriov_vf(adev)) {
if ((adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0) ||
!amdgpu_sriov_is_av1_support(adev)) {
if (encode)
*codecs = &sriov_vcn_4_0_0_video_codecs_encode_vcn1;
else
*codecs = &sriov_vcn_4_0_0_video_codecs_decode_vcn1;
} else {
if (encode)
*codecs = &sriov_vcn_4_0_0_video_codecs_encode_vcn0;
else
*codecs = &sriov_vcn_4_0_0_video_codecs_decode_vcn0;
}
} else {
if ((adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0)) {
if (encode)
*codecs = &vcn_4_0_0_video_codecs_encode_vcn1;
else
*codecs = &vcn_4_0_0_video_codecs_decode_vcn1;
} else {
if (encode)
*codecs = &vcn_4_0_0_video_codecs_encode_vcn0;
else
*codecs = &vcn_4_0_0_video_codecs_decode_vcn0;
}
}
return 0;
case IP_VERSION(4, 0, 6):
if (encode)
*codecs = &vcn_4_0_0_video_codecs_encode_vcn0;
else
*codecs = &vcn_4_0_0_video_codecs_decode_vcn0;
return 0;
case IP_VERSION(5, 3, 0):
if (encode)
*codecs = &vcn_5_3_0_video_codecs_encode_vcn0;
else
*codecs = &vcn_5_3_0_video_codecs_decode_vcn0;
return 0;
default:
return -EINVAL;
}
}
static u32 soc21_didt_rreg(struct amdgpu_device *adev, u32 reg)
{
unsigned long flags, address, data;
u32 r;
address = SOC15_REG_OFFSET(GC, 0, regDIDT_IND_INDEX);
data = SOC15_REG_OFFSET(GC, 0, regDIDT_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 soc21_didt_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
{
unsigned long flags, address, data;
address = SOC15_REG_OFFSET(GC, 0, regDIDT_IND_INDEX);
data = SOC15_REG_OFFSET(GC, 0, regDIDT_IND_DATA);
spin_lock_irqsave(&adev->reg.didt.lock, flags);
WREG32(address, (reg));
WREG32(data, (v));
spin_unlock_irqrestore(&adev->reg.didt.lock, flags);
}
static u32 soc21_get_config_memsize(struct amdgpu_device *adev)
{
return adev->nbio.funcs->get_memsize(adev);
}
static u32 soc21_get_xclk(struct amdgpu_device *adev)
{
u32 reference_clock = adev->clock.spll.reference_freq;
/* reference clock is actually 99.81 Mhz rather than 100 Mhz */
if ((adev->flags & AMD_IS_APU) && reference_clock == 10000)
return 9981;
return reference_clock;
}
void soc21_grbm_select(struct amdgpu_device *adev,
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/slab.h`, `linux/module.h`, `linux/pci.h`, `amdgpu.h`, `amdgpu_atombios.h`, `amdgpu_ih.h`, `amdgpu_uvd.h`.
- Detected declarations: `function soc21_query_video_codecs`, `function soc21_didt_rreg`, `function soc21_didt_wreg`, `function soc21_get_config_memsize`, `function soc21_get_xclk`, `function soc21_grbm_select`, `function soc21_read_disabled_bios`, `function soc21_get_register_value`, `function soc21_read_register`, `function soc21_asic_mode1_reset`.
- 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.