drivers/gpu/drm/amd/amdgpu/soc24.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/soc24.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/soc24.c- Extension
.c- Size
- 17915 bytes
- Lines
- 572
- 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.
- 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_ih.hamdgpu_uvd.hamdgpu_vce.hamdgpu_ucode.hamdgpu_psp.hamdgpu_smu.hatom.hamd_pcie.hgc/gc_12_0_0_offset.hgc/gc_12_0_0_sh_mask.hmp/mp_14_0_2_offset.hsoc15.hsoc15_common.hsoc24.hmxgpu_nv.h
Detected Declarations
function soc24_query_video_codecsfunction soc24_get_config_memsizefunction soc24_get_xclkfunction soc24_grbm_selectfunction soc24_get_register_valuefunction soc24_read_registerfunction soc24_asic_reset_methodfunction soc24_asic_resetfunction soc24_program_aspmfunction soc24_need_full_resetfunction soc24_need_reset_on_initfunction soc24_get_pcie_replay_countfunction soc24_init_doorbell_indexfunction soc24_update_umd_stable_pstatefunction soc24_common_early_initfunction soc24_common_late_initfunction soc24_common_sw_initfunction soc24_common_hw_initfunction soc24_common_hw_finifunction soc24_common_suspendfunction soc24_common_resumefunction soc24_common_is_idlefunction soc24_common_set_clockgating_statefunction soc24_common_set_powergating_statefunction soc24_common_get_clockgating_state
Annotated Snippet
#include <linux/firmware.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/pci.h>
#include "amdgpu.h"
#include "amdgpu_ih.h"
#include "amdgpu_uvd.h"
#include "amdgpu_vce.h"
#include "amdgpu_ucode.h"
#include "amdgpu_psp.h"
#include "amdgpu_smu.h"
#include "atom.h"
#include "amd_pcie.h"
#include "gc/gc_12_0_0_offset.h"
#include "gc/gc_12_0_0_sh_mask.h"
#include "mp/mp_14_0_2_offset.h"
#include "soc15.h"
#include "soc15_common.h"
#include "soc24.h"
#include "mxgpu_nv.h"
static const struct amd_ip_funcs soc24_common_ip_funcs;
static const struct amdgpu_video_codec_info vcn_5_0_0_video_codecs_encode_array_vcn0[] = {
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 0)},
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 0)},
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)},
};
static const struct amdgpu_video_codecs vcn_5_0_0_video_codecs_encode_vcn0 = {
.codec_count = ARRAY_SIZE(vcn_5_0_0_video_codecs_encode_array_vcn0),
.codec_array = vcn_5_0_0_video_codecs_encode_array_vcn0,
};
static const struct amdgpu_video_codec_info vcn_5_0_0_video_codecs_decode_array_vcn0[] = {
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4096, 52)},
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)},
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 16384, 16384, 0)},
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)},
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)},
};
static const struct amdgpu_video_codecs vcn_5_0_0_video_codecs_decode_vcn0 = {
.codec_count = ARRAY_SIZE(vcn_5_0_0_video_codecs_decode_array_vcn0),
.codec_array = vcn_5_0_0_video_codecs_decode_array_vcn0,
};
static int soc24_query_video_codecs(struct amdgpu_device *adev, bool encode,
const struct amdgpu_video_codecs **codecs)
{
if (adev->vcn.num_vcn_inst == hweight8(adev->vcn.harvest_config))
return -EINVAL;
switch (amdgpu_ip_version(adev, UVD_HWIP, 0)) {
case IP_VERSION(5, 0, 0):
if (encode)
*codecs = &vcn_5_0_0_video_codecs_encode_vcn0;
else
*codecs = &vcn_5_0_0_video_codecs_decode_vcn0;
return 0;
default:
return -EINVAL;
}
}
static u32 soc24_get_config_memsize(struct amdgpu_device *adev)
{
return adev->nbio.funcs->get_memsize(adev);
}
static u32 soc24_get_xclk(struct amdgpu_device *adev)
{
return adev->clock.spll.reference_freq;
}
void soc24_grbm_select(struct amdgpu_device *adev,
u32 me, u32 pipe, u32 queue, u32 vmid)
{
u32 grbm_gfx_cntl = 0;
grbm_gfx_cntl = REG_SET_FIELD(grbm_gfx_cntl, GRBM_GFX_CNTL, PIPEID, pipe);
grbm_gfx_cntl = REG_SET_FIELD(grbm_gfx_cntl, GRBM_GFX_CNTL, MEID, me);
grbm_gfx_cntl = REG_SET_FIELD(grbm_gfx_cntl, GRBM_GFX_CNTL, VMID, vmid);
grbm_gfx_cntl = REG_SET_FIELD(grbm_gfx_cntl, GRBM_GFX_CNTL, QUEUEID, queue);
WREG32_SOC15(GC, 0, regGRBM_GFX_CNTL, grbm_gfx_cntl);
}
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/slab.h`, `linux/module.h`, `linux/pci.h`, `amdgpu.h`, `amdgpu_ih.h`, `amdgpu_uvd.h`, `amdgpu_vce.h`.
- Detected declarations: `function soc24_query_video_codecs`, `function soc24_get_config_memsize`, `function soc24_get_xclk`, `function soc24_grbm_select`, `function soc24_get_register_value`, `function soc24_read_register`, `function soc24_asic_reset_method`, `function soc24_asic_reset`, `function soc24_program_aspm`, `function soc24_need_full_reset`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source 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.