drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c- Extension
.c- Size
- 99528 bytes
- Lines
- 2999
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/slab.hlinux/delay.hlinux/types.hlinux/pci.hsmumgr.hpp_debug.hci_smumgr.hppsmc.hsmu7_hwmgr.hhardwaremanager.hppatomctrl.hcgs_common.hatombios.hpppcielanes.hsmu7_smumgr.hsmu/smu_7_0_1_d.hsmu/smu_7_0_1_sh_mask.hdce/dce_8_0_d.hdce/dce_8_0_sh_mask.hbif/bif_4_1_d.hbif/bif_4_1_sh_mask.hgca/gfx_7_2_d.hgca/gfx_7_2_sh_mask.hgmc/gmc_7_1_d.hgmc/gmc_7_1_sh_mask.hprocesspptables.h
Detected Declarations
function ci_set_smc_sram_addressfunction ci_copy_bytes_to_smcfunction ci_program_jump_on_startfunction ci_is_smc_ram_runningfunction ci_read_smc_sram_dwordfunction ci_send_msg_to_smcfunction ci_send_msg_to_smc_with_parameterfunction ci_initialize_power_tune_defaultsfunction ci_get_dependency_volt_by_clkfunction ci_calculate_sclk_paramsfunction ci_populate_phase_value_based_on_sclkfunction ci_get_sleep_divider_id_from_clockfunction ci_populate_single_graphic_levelfunction ci_populate_all_graphic_levelsfunction ci_populate_svi_load_linefunction ci_populate_tdc_limitfunction ci_populate_dw8function ci_populate_fuzzy_fanfunction ci_populate_bapm_vddc_vid_siddfunction ci_populate_vddc_vidfunction ci_min_max_v_gnbl_pm_lid_from_bapm_vddcfunction ci_populate_bapm_vddc_base_leakage_siddfunction ci_populate_pm_fusesfunction ci_populate_bapm_parameters_in_dpm_tablefunction ci_get_std_voltage_value_siddfunction ci_populate_smc_voltage_tablefunction ci_populate_smc_vddc_tablefunction ci_populate_smc_vdd_ci_tablefunction ci_populate_smc_mvdd_tablefunction ci_populate_smc_voltage_tablesfunction ci_populate_ulv_levelfunction ci_populate_ulv_statefunction ci_populate_smc_link_levelfunction ci_calculate_mclk_paramsfunction ci_get_mclk_frequency_ratiofunction ci_get_ddr3_mclk_frequency_ratiofunction ci_populate_phase_value_based_on_mclkfunction ci_populate_single_memory_levelfunction ci_populate_all_memory_levelsfunction ci_populate_mvdd_valuefunction ci_populate_smc_acpi_levelfunction ci_populate_smc_uvd_levelfunction ci_populate_smc_vce_levelfunction ci_populate_smc_acp_levelfunction ci_populate_memory_timing_parametersfunction ci_program_memory_timing_parametersfunction ci_populate_smc_boot_levelfunction ci_populate_mc_reg_address
Annotated Snippet
while (byte_count > 0) {
/* Bytes are written into the SMC addres space with the MSB first. */
data = (0x100 * data) + *src++;
byte_count--;
}
data <<= extra_shift;
data |= (original_data & ~((~0UL) << extra_shift));
result = ci_set_smc_sram_address(hwmgr, addr, limit);
if (0 != result)
return result;
cgs_write_register(hwmgr->device, mmSMC_IND_DATA_0, data);
}
return 0;
}
static int ci_program_jump_on_start(struct pp_hwmgr *hwmgr)
{
static const unsigned char data[4] = { 0xE0, 0x00, 0x80, 0x40 };
ci_copy_bytes_to_smc(hwmgr, 0x0, data, 4, sizeof(data)+1);
return 0;
}
static bool ci_is_smc_ram_running(struct pp_hwmgr *hwmgr)
{
return ((0 == PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device,
CGS_IND_REG__SMC, SMC_SYSCON_CLOCK_CNTL_0, ck_disable))
&& (0x20100 <= cgs_read_ind_register(hwmgr->device,
CGS_IND_REG__SMC, ixSMC_PC_C)));
}
static int ci_read_smc_sram_dword(struct pp_hwmgr *hwmgr, uint32_t smc_addr,
uint32_t *value, uint32_t limit)
{
int result;
result = ci_set_smc_sram_address(hwmgr, smc_addr, limit);
if (result)
return result;
*value = cgs_read_register(hwmgr->device, mmSMC_IND_DATA_0);
return 0;
}
static int ci_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
{
struct amdgpu_device *adev = hwmgr->adev;
int ret;
cgs_write_register(hwmgr->device, mmSMC_RESP_0, 0);
cgs_write_register(hwmgr->device, mmSMC_MESSAGE_0, msg);
PHM_WAIT_FIELD_UNEQUAL(hwmgr, SMC_RESP_0, SMC_RESP, 0);
ret = PHM_READ_FIELD(hwmgr->device, SMC_RESP_0, SMC_RESP);
if (ret != 1)
dev_info(adev->dev,
"failed to send message %x ret is %d\n", msg,ret);
return 0;
}
static int ci_send_msg_to_smc_with_parameter(struct pp_hwmgr *hwmgr,
uint16_t msg, uint32_t parameter)
{
cgs_write_register(hwmgr->device, mmSMC_MSG_ARG_0, parameter);
return ci_send_msg_to_smc(hwmgr, msg);
}
static void ci_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr)
{
struct ci_smumgr *smu_data = (struct ci_smumgr *)(hwmgr->smu_backend);
struct amdgpu_device *adev = hwmgr->adev;
uint32_t dev_id;
dev_id = adev->pdev->device;
switch (dev_id) {
case 0x67BA:
case 0x67B1:
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/delay.h`, `linux/types.h`, `linux/pci.h`, `smumgr.h`, `pp_debug.h`, `ci_smumgr.h`.
- Detected declarations: `function ci_set_smc_sram_address`, `function ci_copy_bytes_to_smc`, `function ci_program_jump_on_start`, `function ci_is_smc_ram_running`, `function ci_read_smc_sram_dword`, `function ci_send_msg_to_smc`, `function ci_send_msg_to_smc_with_parameter`, `function ci_initialize_power_tune_defaults`, `function ci_get_dependency_volt_by_clk`, `function ci_calculate_sclk_params`.
- 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.