drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c- Extension
.c- Size
- 39713 bytes
- Lines
- 1263
- 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
pp_debug.hlinux/module.hlinux/slab.hlinux/delay.hatom.hppatomctrl.hatombios.hcgs_common.h
Detected Declarations
function atomctrl_retrieve_ac_timingfunction atomctrl_set_mc_reg_address_tablefunction atomctrl_initialize_mc_reg_tablefunction atomctrl_initialize_mc_reg_table_v2_2function atomctrl_set_engine_dram_timings_rv770function atomctrl_get_memory_pll_dividers_sifunction atomctrl_get_memory_pll_dividers_vifunction atomctrl_get_memory_pll_dividers_aifunction atomctrl_get_engine_pll_dividers_kongfunction atomctrl_get_engine_pll_dividers_vifunction atomctrl_get_engine_pll_dividers_aifunction atomctrl_get_dfs_pll_dividers_vifunction atomctrl_get_reference_clockfunction atomctrl_is_voltage_controlled_by_gpio_v3function atomctrl_get_voltage_table_v3function atomctrl_lookup_gpio_pinfunction atomctrl_get_pp_assign_pinfunction atomctrl_get_voltage_evv_on_sclkfunction atomctrl_get_voltage_evvfunction atomctrl_get_mpll_reference_clockfunction atomctrl_is_asic_internal_ss_supportedfunction asic_internal_ss_get_ss_asignmentfunction atomctrl_get_memory_clock_spread_spectrumfunction atomctrl_get_engine_clock_spread_spectrumfunction atomctrl_read_efusefunction atomctrl_set_ac_timing_aifunction atomctrl_get_voltage_evv_on_sclk_aifunction atomctrl_get_smc_sclk_range_tablefunction atomctrl_get_vddc_shared_railinfofunction atomctrl_get_avfs_informationfunction atomctrl_get_svi2_infofunction atomctrl_get_leakage_id_from_efusefunction atomctrl_get_leakage_vddc_base_on_leakagefunction atomctrl_get_voltage_rangefunction atomctrl_get_edc_hilo_leakage_offset_tablefunction atomctrl_get_edc_leakage_table
Annotated Snippet
if (index == tmem_id) {
table->mc_reg_table_entry[num_ranges].mclk_max =
(uint32_t)((*(uint32_t *)reg_data & CLOCK_RANGE_MASK) >>
CLOCK_RANGE_SHIFT);
for (i = 0, j = 1; i < table->last; i++) {
if ((table->mc_reg_address[i].uc_pre_reg_data &
LOW_NIBBLE_MASK) == DATA_FROM_TABLE) {
table->mc_reg_table_entry[num_ranges].mc_data[i] =
(uint32_t)*((uint32_t *)reg_data + j);
j++;
} else if ((table->mc_reg_address[i].uc_pre_reg_data &
LOW_NIBBLE_MASK) == DATA_EQU_PREV) {
if (i)
table->mc_reg_table_entry[num_ranges].mc_data[i] =
table->mc_reg_table_entry[num_ranges].mc_data[i-1];
}
}
num_ranges++;
}
reg_data = (ATOM_MEMORY_SETTING_DATA_BLOCK *)
((uint8_t *)reg_data + le16_to_cpu(reg_block->usRegDataBlkSize)) ;
}
PP_ASSERT_WITH_CODE((*(uint32_t *)reg_data == END_OF_REG_DATA_BLOCK),
"Invalid VramInfo table.", return -1);
table->num_entries = num_ranges;
return 0;
}
/**
* atomctrl_set_mc_reg_address_table - Get memory clock AC timing registers index from VBIOS table
* VBIOS set end of memory clock AC timing registers by ucPreRegDataLength bit6 = 1
* @reg_block: the address ATOM_INIT_REG_BLOCK
* @table: the address of MCRegTable
* Return: 0
*/
static int atomctrl_set_mc_reg_address_table(
ATOM_INIT_REG_BLOCK *reg_block,
pp_atomctrl_mc_reg_table *table)
{
uint8_t i = 0;
uint8_t num_entries = (uint8_t)((le16_to_cpu(reg_block->usRegIndexTblSize))
/ sizeof(ATOM_INIT_REG_INDEX_FORMAT));
ATOM_INIT_REG_INDEX_FORMAT *format = ®_block->asRegIndexBuf[0];
num_entries--; /* subtract 1 data end mark entry */
PP_ASSERT_WITH_CODE((num_entries <= VBIOS_MC_REGISTER_ARRAY_SIZE),
"Invalid VramInfo table.", return -1);
/* ucPreRegDataLength bit6 = 1 is the end of memory clock AC timing registers */
while ((!(format->ucPreRegDataLength & ACCESS_PLACEHOLDER)) &&
(i < num_entries)) {
table->mc_reg_address[i].s1 =
(uint16_t)(le16_to_cpu(format->usRegIndex));
table->mc_reg_address[i].uc_pre_reg_data =
format->ucPreRegDataLength;
i++;
format = (ATOM_INIT_REG_INDEX_FORMAT *)
((uint8_t *)format + sizeof(ATOM_INIT_REG_INDEX_FORMAT));
}
table->last = i;
return 0;
}
int atomctrl_initialize_mc_reg_table(
struct pp_hwmgr *hwmgr,
uint8_t module_index,
pp_atomctrl_mc_reg_table *table)
{
ATOM_VRAM_INFO_HEADER_V2_1 *vram_info;
ATOM_INIT_REG_BLOCK *reg_block;
int result = 0;
u8 frev, crev;
u16 size;
vram_info = (ATOM_VRAM_INFO_HEADER_V2_1 *)
smu_atom_get_data_table(hwmgr->adev,
GetIndexIntoMasterTable(DATA, VRAM_Info), &size, &frev, &crev);
if (!vram_info) {
pr_err("Could not retrieve the VramInfo table!");
return -EINVAL;
}
if (module_index >= vram_info->ucNumOfVRAMModule) {
Annotation
- Immediate include surface: `pp_debug.h`, `linux/module.h`, `linux/slab.h`, `linux/delay.h`, `atom.h`, `ppatomctrl.h`, `atombios.h`, `cgs_common.h`.
- Detected declarations: `function atomctrl_retrieve_ac_timing`, `function atomctrl_set_mc_reg_address_table`, `function atomctrl_initialize_mc_reg_table`, `function atomctrl_initialize_mc_reg_table_v2_2`, `function atomctrl_set_engine_dram_timings_rv770`, `function atomctrl_get_memory_pll_dividers_si`, `function atomctrl_get_memory_pll_dividers_vi`, `function atomctrl_get_memory_pll_dividers_ai`, `function atomctrl_get_engine_pll_dividers_kong`, `function atomctrl_get_engine_pll_dividers_vi`.
- 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.