drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c- Extension
.c- Size
- 16671 bytes
- Lines
- 569
- 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
pp_debug.hsmumgr.hsmu_ucode_xfer_vi.hppatomctrl.hcgs_common.hsmu7_ppsmc.hsmu7_smumgr.hsmu7_common.hpolaris10_pwrvirus.h
Detected Declarations
function filesfunction smu7_copy_bytes_to_smcfunction smu7_program_jump_on_startfunction smu7_is_smc_ram_runningfunction smu7_send_msg_to_smcfunction smu7_send_msg_to_smc_with_parameterfunction smu7_get_argumentfunction smu7_send_msg_to_smc_offsetfunction smu7_convert_fw_type_to_cgsfunction smu7_read_smc_sram_dwordfunction smu7_write_smc_sram_dwordfunction smu7_populate_single_firmware_entryfunction smu7_request_smu_load_fwfunction smu7_check_fw_load_finishfunction smu7_reload_firmwarefunction smu7_upload_smc_firmware_datafunction smu7_upload_smu_firmware_imagefunction execute_pwr_tablefunction execute_pwr_dfy_tablefunction smu7_setup_pwr_virusfunction smu7_initfunction smu7_smu_fini
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 = smu7_set_smc_sram_address(hwmgr, addr, limit);
if (0 != result)
return result;
cgs_write_register(hwmgr->device, mmSMC_IND_DATA_11, data);
}
return 0;
}
int smu7_program_jump_on_start(struct pp_hwmgr *hwmgr)
{
static const unsigned char data[4] = { 0xE0, 0x00, 0x80, 0x40 };
smu7_copy_bytes_to_smc(hwmgr, 0x0, data, 4, sizeof(data)+1);
return 0;
}
bool smu7_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)));
}
int smu7_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
{
struct amdgpu_device *adev = hwmgr->adev;
int ret;
PHM_WAIT_FIELD_UNEQUAL(hwmgr, SMC_RESP_0, SMC_RESP, 0);
ret = PHM_READ_FIELD(hwmgr->device, SMC_RESP_0, SMC_RESP);
if (ret == 0xFE)
dev_dbg(adev->dev, "last message was not supported\n");
else if (ret != 1)
dev_info(adev->dev,
"\nlast message was failed ret is %d\n", 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 == 0xFE)
dev_dbg(adev->dev, "message %x was not supported\n", msg);
else if (ret != 1)
dev_dbg(adev->dev,
"failed to send message %x ret is %d \n", msg, ret);
return 0;
}
int smu7_send_msg_to_smc_with_parameter(struct pp_hwmgr *hwmgr, uint16_t msg, uint32_t parameter)
{
PHM_WAIT_FIELD_UNEQUAL(hwmgr, SMC_RESP_0, SMC_RESP, 0);
cgs_write_register(hwmgr->device, mmSMC_MSG_ARG_0, parameter);
return smu7_send_msg_to_smc(hwmgr, msg);
}
uint32_t smu7_get_argument(struct pp_hwmgr *hwmgr)
{
return cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0);
}
int smu7_send_msg_to_smc_offset(struct pp_hwmgr *hwmgr)
{
return smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_Test, 0x20000, NULL);
}
enum cgs_ucode_id smu7_convert_fw_type_to_cgs(uint32_t fw_type)
{
enum cgs_ucode_id result = CGS_UCODE_ID_MAXIMUM;
Annotation
- Immediate include surface: `pp_debug.h`, `smumgr.h`, `smu_ucode_xfer_vi.h`, `ppatomctrl.h`, `cgs_common.h`, `smu7_ppsmc.h`, `smu7_smumgr.h`, `smu7_common.h`.
- Detected declarations: `function files`, `function smu7_copy_bytes_to_smc`, `function smu7_program_jump_on_start`, `function smu7_is_smc_ram_running`, `function smu7_send_msg_to_smc`, `function smu7_send_msg_to_smc_with_parameter`, `function smu7_get_argument`, `function smu7_send_msg_to_smc_offset`, `function smu7_convert_fw_type_to_cgs`, `function smu7_read_smc_sram_dword`.
- 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.