Lines Matching refs:hwmgr
55 static uint32_t smu8_get_argument(struct pp_hwmgr *hwmgr) in smu8_get_argument() argument
57 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_get_argument()
60 return cgs_read_register(hwmgr->device, in smu8_get_argument()
64 static int smu8_send_msg_to_smc_async(struct pp_hwmgr *hwmgr, uint16_t msg) in smu8_send_msg_to_smc_async() argument
68 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_send_msg_to_smc_async()
71 result = PHM_WAIT_FIELD_UNEQUAL(hwmgr, in smu8_send_msg_to_smc_async()
78 cgs_write_register(hwmgr->device, mmSMU_MP1_SRBM2P_RESP_0, 0); in smu8_send_msg_to_smc_async()
79 cgs_write_register(hwmgr->device, mmSMU_MP1_SRBM2P_MSG_0, msg); in smu8_send_msg_to_smc_async()
85 static int smu8_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg) in smu8_send_msg_to_smc() argument
89 result = smu8_send_msg_to_smc_async(hwmgr, msg); in smu8_send_msg_to_smc()
93 return PHM_WAIT_FIELD_UNEQUAL(hwmgr, in smu8_send_msg_to_smc()
97 static int smu8_set_smc_sram_address(struct pp_hwmgr *hwmgr, in smu8_set_smc_sram_address() argument
100 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_set_smc_sram_address()
113 cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX_0, in smu8_set_smc_sram_address()
119 static int smu8_write_smc_sram_dword(struct pp_hwmgr *hwmgr, in smu8_write_smc_sram_dword() argument
124 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_write_smc_sram_dword()
127 result = smu8_set_smc_sram_address(hwmgr, smc_address, limit); in smu8_write_smc_sram_dword()
129 cgs_write_register(hwmgr->device, mmMP0PUB_IND_DATA_0, value); in smu8_write_smc_sram_dword()
134 static int smu8_send_msg_to_smc_with_parameter(struct pp_hwmgr *hwmgr, in smu8_send_msg_to_smc_with_parameter() argument
137 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_send_msg_to_smc_with_parameter()
140 cgs_write_register(hwmgr->device, mmSMU_MP1_SRBM2P_ARG_0, parameter); in smu8_send_msg_to_smc_with_parameter()
142 return smu8_send_msg_to_smc(hwmgr, msg); in smu8_send_msg_to_smc_with_parameter()
145 static int smu8_check_fw_load_finish(struct pp_hwmgr *hwmgr, in smu8_check_fw_load_finish() argument
153 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_check_fw_load_finish()
156 cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX, index); in smu8_check_fw_load_finish()
158 for (i = 0; i < hwmgr->usec_timeout; i++) { in smu8_check_fw_load_finish()
160 (cgs_read_register(hwmgr->device, mmMP0PUB_IND_DATA) & firmware)) in smu8_check_fw_load_finish()
165 if (i >= hwmgr->usec_timeout) { in smu8_check_fw_load_finish()
173 static int smu8_load_mec_firmware(struct pp_hwmgr *hwmgr) in smu8_load_mec_firmware() argument
181 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_load_mec_firmware()
184 smu8_smu = hwmgr->smu_backend; in smu8_load_mec_firmware()
185 ret = cgs_get_firmware_info(hwmgr->device, in smu8_load_mec_firmware()
192 tmp = cgs_read_register(hwmgr->device, in smu8_load_mec_firmware()
196 cgs_write_register(hwmgr->device, mmCP_MEC_CNTL, tmp); in smu8_load_mec_firmware()
198 tmp = cgs_read_register(hwmgr->device, in smu8_load_mec_firmware()
205 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_CNTL, tmp); in smu8_load_mec_firmware()
209 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_LO, reg_data); in smu8_load_mec_firmware()
213 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_HI, reg_data); in smu8_load_mec_firmware()
218 static uint8_t smu8_translate_firmware_enum_to_arg(struct pp_hwmgr *hwmgr, in smu8_translate_firmware_enum_to_arg() argument
228 if (hwmgr->chip_id == CHIP_STONEY) in smu8_translate_firmware_enum_to_arg()
246 if (hwmgr->chip_id == CHIP_STONEY) in smu8_translate_firmware_enum_to_arg()
328 struct pp_hwmgr *hwmgr, in smu8_smu_populate_single_scratch_task() argument
333 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_populate_single_scratch_task()
338 task->arg = smu8_translate_firmware_enum_to_arg(hwmgr, fw_enum); in smu8_smu_populate_single_scratch_task()
365 struct pp_hwmgr *hwmgr, in smu8_smu_populate_single_ucode_load_task() argument
370 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_populate_single_ucode_load_task()
375 task->arg = smu8_translate_firmware_enum_to_arg(hwmgr, fw_enum); in smu8_smu_populate_single_ucode_load_task()
394 static int smu8_smu_construct_toc_for_rlc_aram_save(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_rlc_aram_save() argument
396 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_rlc_aram_save()
399 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_rlc_aram_save()
406 static int smu8_smu_initialize_toc_empty_job_list(struct pp_hwmgr *hwmgr) in smu8_smu_initialize_toc_empty_job_list() argument
409 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_initialize_toc_empty_job_list()
418 static int smu8_smu_construct_toc_for_vddgfx_enter(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_vddgfx_enter() argument
420 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_vddgfx_enter()
424 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_enter()
428 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_enter()
436 static int smu8_smu_construct_toc_for_vddgfx_exit(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_vddgfx_exit() argument
438 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_vddgfx_exit()
443 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
445 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
447 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
449 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
452 if (hwmgr->chip_id == CHIP_STONEY) in smu8_smu_construct_toc_for_vddgfx_exit()
453 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
456 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
459 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
463 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
467 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
471 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
478 static int smu8_smu_construct_toc_for_power_profiling(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_power_profiling() argument
480 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_power_profiling()
484 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_power_profiling()
490 static int smu8_smu_construct_toc_for_bootup(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_bootup() argument
492 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_bootup()
496 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
498 if (hwmgr->chip_id != CHIP_STONEY) in smu8_smu_construct_toc_for_bootup()
499 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
501 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
503 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
505 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
507 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
509 if (hwmgr->chip_id != CHIP_STONEY) in smu8_smu_construct_toc_for_bootup()
510 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
512 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
518 static int smu8_smu_construct_toc_for_clock_table(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_clock_table() argument
520 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_clock_table()
524 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_clock_table()
531 static int smu8_smu_construct_toc(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc() argument
533 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc()
536 smu8_smu_initialize_toc_empty_job_list(hwmgr); in smu8_smu_construct_toc()
537 smu8_smu_construct_toc_for_rlc_aram_save(hwmgr); in smu8_smu_construct_toc()
538 smu8_smu_construct_toc_for_vddgfx_enter(hwmgr); in smu8_smu_construct_toc()
539 smu8_smu_construct_toc_for_vddgfx_exit(hwmgr); in smu8_smu_construct_toc()
540 smu8_smu_construct_toc_for_power_profiling(hwmgr); in smu8_smu_construct_toc()
541 smu8_smu_construct_toc_for_bootup(hwmgr); in smu8_smu_construct_toc()
542 smu8_smu_construct_toc_for_clock_table(hwmgr); in smu8_smu_construct_toc()
547 static int smu8_smu_populate_firmware_entries(struct pp_hwmgr *hwmgr) in smu8_smu_populate_firmware_entries() argument
549 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_populate_firmware_entries()
560 firmware_type = smu8_translate_firmware_enum_to_arg(hwmgr, in smu8_smu_populate_firmware_entries()
565 ret = cgs_get_firmware_info(hwmgr->device, in smu8_smu_populate_firmware_entries()
582 struct pp_hwmgr *hwmgr, in smu8_smu_populate_single_scratch_entry() argument
587 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_populate_single_scratch_entry()
601 static int smu8_download_pptable_settings(struct pp_hwmgr *hwmgr, void **table) in smu8_download_pptable_settings() argument
603 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_download_pptable_settings()
614 smu8_send_msg_to_smc_with_parameter(hwmgr, in smu8_download_pptable_settings()
618 smu8_send_msg_to_smc_with_parameter(hwmgr, in smu8_download_pptable_settings()
622 smu8_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob, in smu8_download_pptable_settings()
625 smu8_send_msg_to_smc(hwmgr, PPSMC_MSG_ClkTableXferToDram); in smu8_download_pptable_settings()
630 static int smu8_upload_pptable_settings(struct pp_hwmgr *hwmgr) in smu8_upload_pptable_settings() argument
632 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_upload_pptable_settings()
641 smu8_send_msg_to_smc_with_parameter(hwmgr, in smu8_upload_pptable_settings()
645 smu8_send_msg_to_smc_with_parameter(hwmgr, in smu8_upload_pptable_settings()
649 smu8_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob, in smu8_upload_pptable_settings()
652 smu8_send_msg_to_smc(hwmgr, PPSMC_MSG_ClkTableXferToSmu); in smu8_upload_pptable_settings()
657 static int smu8_request_smu_load_fw(struct pp_hwmgr *hwmgr) in smu8_request_smu_load_fw() argument
659 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_request_smu_load_fw()
662 if (!hwmgr->reload_fw) { in smu8_request_smu_load_fw()
667 smu8_smu_populate_firmware_entries(hwmgr); in smu8_request_smu_load_fw()
669 smu8_smu_construct_toc(hwmgr); in smu8_request_smu_load_fw()
674 smu8_write_smc_sram_dword(hwmgr, smc_address, 0, smc_address+4); in smu8_request_smu_load_fw()
676 smu8_send_msg_to_smc_with_parameter(hwmgr, in smu8_request_smu_load_fw()
680 smu8_send_msg_to_smc_with_parameter(hwmgr, in smu8_request_smu_load_fw()
684 smu8_send_msg_to_smc(hwmgr, PPSMC_MSG_InitJobs); in smu8_request_smu_load_fw()
686 smu8_send_msg_to_smc_with_parameter(hwmgr, in smu8_request_smu_load_fw()
689 smu8_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob, in smu8_request_smu_load_fw()
692 return smu8_send_msg_to_smc_with_parameter(hwmgr, in smu8_request_smu_load_fw()
697 static int smu8_start_smu(struct pp_hwmgr *hwmgr) in smu8_start_smu() argument
701 struct amdgpu_device *adev = hwmgr->adev; in smu8_start_smu()
708 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_start_smu()
711 cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX, index); in smu8_start_smu()
712 hwmgr->smu_version = cgs_read_register(hwmgr->device, mmMP0PUB_IND_DATA); in smu8_start_smu()
713 adev->pm.fw_version = hwmgr->smu_version >> 8; in smu8_start_smu()
724 if (hwmgr->chip_id == CHIP_STONEY) in smu8_start_smu()
727 ret = smu8_request_smu_load_fw(hwmgr); in smu8_start_smu()
731 smu8_check_fw_load_finish(hwmgr, fw_to_check); in smu8_start_smu()
733 ret = smu8_load_mec_firmware(hwmgr); in smu8_start_smu()
740 static int smu8_smu_init(struct pp_hwmgr *hwmgr) in smu8_smu_init() argument
749 hwmgr->smu_backend = smu8_smu; in smu8_smu_init()
759 ret = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev, in smu8_smu_init()
769 ret = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev, in smu8_smu_init()
779 if (0 != smu8_smu_populate_single_scratch_entry(hwmgr, in smu8_smu_init()
787 if (0 != smu8_smu_populate_single_scratch_entry(hwmgr, in smu8_smu_init()
794 if (0 != smu8_smu_populate_single_scratch_entry(hwmgr, in smu8_smu_init()
802 if (0 != smu8_smu_populate_single_scratch_entry(hwmgr, in smu8_smu_init()
810 if (0 != smu8_smu_populate_single_scratch_entry(hwmgr, in smu8_smu_init()
833 static int smu8_smu_fini(struct pp_hwmgr *hwmgr) in smu8_smu_fini() argument
837 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_smu_fini()
840 smu8_smu = hwmgr->smu_backend; in smu8_smu_fini()
854 static bool smu8_dpm_check_smu_features(struct pp_hwmgr *hwmgr, in smu8_dpm_check_smu_features() argument
860 result = smu8_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_GetFeatureStatus, 0); in smu8_dpm_check_smu_features()
862 features = smum_get_argument(hwmgr); in smu8_dpm_check_smu_features()
870 static bool smu8_is_dpm_running(struct pp_hwmgr *hwmgr) in smu8_is_dpm_running() argument
872 if (smu8_dpm_check_smu_features(hwmgr, SMU_EnabledFeatureScoreboard_SclkDpmOn)) in smu8_is_dpm_running()