Lines Matching refs:hwmgr

56 static uint32_t smu8_get_argument(struct pp_hwmgr *hwmgr)  in smu8_get_argument()  argument
58 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_get_argument()
61 return cgs_read_register(hwmgr->device, in smu8_get_argument()
66 static int smu8_send_msg_to_smc_with_parameter(struct pp_hwmgr *hwmgr, in smu8_send_msg_to_smc_with_parameter() argument
73 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_send_msg_to_smc_with_parameter()
76 result = PHM_WAIT_FIELD_UNEQUAL(hwmgr, in smu8_send_msg_to_smc_with_parameter()
80 uint32_t val = cgs_read_register(hwmgr->device, in smu8_send_msg_to_smc_with_parameter()
88 cgs_write_register(hwmgr->device, mmSMU_MP1_SRBM2P_ARG_0, parameter); in smu8_send_msg_to_smc_with_parameter()
90 cgs_write_register(hwmgr->device, mmSMU_MP1_SRBM2P_RESP_0, 0); in smu8_send_msg_to_smc_with_parameter()
91 cgs_write_register(hwmgr->device, mmSMU_MP1_SRBM2P_MSG_0, msg); in smu8_send_msg_to_smc_with_parameter()
93 result = PHM_WAIT_FIELD_UNEQUAL(hwmgr, in smu8_send_msg_to_smc_with_parameter()
104 static int smu8_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg) in smu8_send_msg_to_smc() argument
106 return smu8_send_msg_to_smc_with_parameter(hwmgr, msg, 0); in smu8_send_msg_to_smc()
109 static int smu8_set_smc_sram_address(struct pp_hwmgr *hwmgr, in smu8_set_smc_sram_address() argument
112 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_set_smc_sram_address()
125 cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX_0, in smu8_set_smc_sram_address()
131 static int smu8_write_smc_sram_dword(struct pp_hwmgr *hwmgr, in smu8_write_smc_sram_dword() argument
136 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_write_smc_sram_dword()
139 result = smu8_set_smc_sram_address(hwmgr, smc_address, limit); in smu8_write_smc_sram_dword()
141 cgs_write_register(hwmgr->device, mmMP0PUB_IND_DATA_0, value); in smu8_write_smc_sram_dword()
146 static int smu8_check_fw_load_finish(struct pp_hwmgr *hwmgr, in smu8_check_fw_load_finish() argument
154 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_check_fw_load_finish()
157 cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX, index); in smu8_check_fw_load_finish()
159 for (i = 0; i < hwmgr->usec_timeout; i++) { in smu8_check_fw_load_finish()
161 (cgs_read_register(hwmgr->device, mmMP0PUB_IND_DATA) & firmware)) in smu8_check_fw_load_finish()
166 if (i >= hwmgr->usec_timeout) { in smu8_check_fw_load_finish()
174 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 ret = cgs_get_firmware_info(hwmgr->device, in smu8_load_mec_firmware()
191 tmp = cgs_read_register(hwmgr->device, in smu8_load_mec_firmware()
195 cgs_write_register(hwmgr->device, mmCP_MEC_CNTL, tmp); in smu8_load_mec_firmware()
197 tmp = cgs_read_register(hwmgr->device, in smu8_load_mec_firmware()
204 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_CNTL, tmp); in smu8_load_mec_firmware()
208 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_LO, reg_data); in smu8_load_mec_firmware()
212 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_HI, reg_data); in smu8_load_mec_firmware()
217 static uint8_t smu8_translate_firmware_enum_to_arg(struct pp_hwmgr *hwmgr, in smu8_translate_firmware_enum_to_arg() argument
227 if (hwmgr->chip_id == CHIP_STONEY) in smu8_translate_firmware_enum_to_arg()
245 if (hwmgr->chip_id == CHIP_STONEY) in smu8_translate_firmware_enum_to_arg()
327 struct pp_hwmgr *hwmgr, in smu8_smu_populate_single_scratch_task() argument
332 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_populate_single_scratch_task()
337 task->arg = smu8_translate_firmware_enum_to_arg(hwmgr, fw_enum); in smu8_smu_populate_single_scratch_task()
364 struct pp_hwmgr *hwmgr, in smu8_smu_populate_single_ucode_load_task() argument
369 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_populate_single_ucode_load_task()
374 task->arg = smu8_translate_firmware_enum_to_arg(hwmgr, fw_enum); in smu8_smu_populate_single_ucode_load_task()
393 static int smu8_smu_construct_toc_for_rlc_aram_save(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_rlc_aram_save() argument
395 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_rlc_aram_save()
398 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_rlc_aram_save()
405 static int smu8_smu_initialize_toc_empty_job_list(struct pp_hwmgr *hwmgr) in smu8_smu_initialize_toc_empty_job_list() argument
408 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_initialize_toc_empty_job_list()
417 static int smu8_smu_construct_toc_for_vddgfx_enter(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_vddgfx_enter() argument
419 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_vddgfx_enter()
423 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_enter()
427 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_enter()
435 static int smu8_smu_construct_toc_for_vddgfx_exit(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_vddgfx_exit() argument
437 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_vddgfx_exit()
442 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
444 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
446 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
448 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
451 if (hwmgr->chip_id == CHIP_STONEY) in smu8_smu_construct_toc_for_vddgfx_exit()
452 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
455 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
458 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
462 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
466 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
470 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_vddgfx_exit()
477 static int smu8_smu_construct_toc_for_power_profiling(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_power_profiling() argument
479 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_power_profiling()
483 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_power_profiling()
489 static int smu8_smu_construct_toc_for_bootup(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_bootup() argument
491 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_bootup()
495 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
497 if (hwmgr->chip_id != CHIP_STONEY) in smu8_smu_construct_toc_for_bootup()
498 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
500 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
502 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
504 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
506 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
508 if (hwmgr->chip_id != CHIP_STONEY) in smu8_smu_construct_toc_for_bootup()
509 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
511 smu8_smu_populate_single_ucode_load_task(hwmgr, in smu8_smu_construct_toc_for_bootup()
517 static int smu8_smu_construct_toc_for_clock_table(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc_for_clock_table() argument
519 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc_for_clock_table()
523 smu8_smu_populate_single_scratch_task(hwmgr, in smu8_smu_construct_toc_for_clock_table()
530 static int smu8_smu_construct_toc(struct pp_hwmgr *hwmgr) in smu8_smu_construct_toc() argument
532 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_construct_toc()
535 smu8_smu_initialize_toc_empty_job_list(hwmgr); in smu8_smu_construct_toc()
536 smu8_smu_construct_toc_for_rlc_aram_save(hwmgr); in smu8_smu_construct_toc()
537 smu8_smu_construct_toc_for_vddgfx_enter(hwmgr); in smu8_smu_construct_toc()
538 smu8_smu_construct_toc_for_vddgfx_exit(hwmgr); in smu8_smu_construct_toc()
539 smu8_smu_construct_toc_for_power_profiling(hwmgr); in smu8_smu_construct_toc()
540 smu8_smu_construct_toc_for_bootup(hwmgr); in smu8_smu_construct_toc()
541 smu8_smu_construct_toc_for_clock_table(hwmgr); in smu8_smu_construct_toc()
546 static int smu8_smu_populate_firmware_entries(struct pp_hwmgr *hwmgr) in smu8_smu_populate_firmware_entries() argument
548 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_populate_firmware_entries()
559 firmware_type = smu8_translate_firmware_enum_to_arg(hwmgr, in smu8_smu_populate_firmware_entries()
564 ret = cgs_get_firmware_info(hwmgr->device, in smu8_smu_populate_firmware_entries()
581 struct pp_hwmgr *hwmgr, in smu8_smu_populate_single_scratch_entry() argument
586 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_smu_populate_single_scratch_entry()
600 static int smu8_download_pptable_settings(struct pp_hwmgr *hwmgr, void **table) in smu8_download_pptable_settings() argument
602 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_download_pptable_settings()
613 smum_send_msg_to_smc_with_parameter(hwmgr, in smu8_download_pptable_settings()
618 smum_send_msg_to_smc_with_parameter(hwmgr, in smu8_download_pptable_settings()
623 smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob, in smu8_download_pptable_settings()
627 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ClkTableXferToDram, NULL); in smu8_download_pptable_settings()
632 static int smu8_upload_pptable_settings(struct pp_hwmgr *hwmgr) in smu8_upload_pptable_settings() argument
634 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_upload_pptable_settings()
643 smum_send_msg_to_smc_with_parameter(hwmgr, in smu8_upload_pptable_settings()
648 smum_send_msg_to_smc_with_parameter(hwmgr, in smu8_upload_pptable_settings()
653 smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob, in smu8_upload_pptable_settings()
657 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ClkTableXferToSmu, NULL); in smu8_upload_pptable_settings()
662 static int smu8_request_smu_load_fw(struct pp_hwmgr *hwmgr) in smu8_request_smu_load_fw() argument
664 struct smu8_smumgr *smu8_smu = hwmgr->smu_backend; in smu8_request_smu_load_fw()
669 amdgpu_ucode_init_bo(hwmgr->adev); in smu8_request_smu_load_fw()
671 smu8_smu_populate_firmware_entries(hwmgr); in smu8_request_smu_load_fw()
673 smu8_smu_construct_toc(hwmgr); in smu8_request_smu_load_fw()
678 smu8_write_smc_sram_dword(hwmgr, smc_address, 0, smc_address+4); in smu8_request_smu_load_fw()
680 smum_send_msg_to_smc_with_parameter(hwmgr, in smu8_request_smu_load_fw()
685 smum_send_msg_to_smc_with_parameter(hwmgr, in smu8_request_smu_load_fw()
690 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_InitJobs, NULL); in smu8_request_smu_load_fw()
692 smum_send_msg_to_smc_with_parameter(hwmgr, in smu8_request_smu_load_fw()
696 smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob, in smu8_request_smu_load_fw()
700 smum_send_msg_to_smc_with_parameter(hwmgr, in smu8_request_smu_load_fw()
714 if (hwmgr->chip_id == CHIP_STONEY) in smu8_request_smu_load_fw()
717 ret = smu8_check_fw_load_finish(hwmgr, fw_to_check); in smu8_request_smu_load_fw()
723 ret = smu8_load_mec_firmware(hwmgr); in smu8_request_smu_load_fw()
732 static int smu8_start_smu(struct pp_hwmgr *hwmgr) in smu8_start_smu() argument
740 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_start_smu()
743 adev = hwmgr->adev; in smu8_start_smu()
745 cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX, index); in smu8_start_smu()
746 hwmgr->smu_version = cgs_read_register(hwmgr->device, mmMP0PUB_IND_DATA); in smu8_start_smu()
748 ((hwmgr->smu_version >> 16) & 0xFF), in smu8_start_smu()
749 ((hwmgr->smu_version >> 8) & 0xFF), in smu8_start_smu()
750 (hwmgr->smu_version & 0xFF)); in smu8_start_smu()
751 adev->pm.fw_version = hwmgr->smu_version >> 8; in smu8_start_smu()
753 return smu8_request_smu_load_fw(hwmgr); in smu8_start_smu()
756 static int smu8_smu_init(struct pp_hwmgr *hwmgr) in smu8_smu_init() argument
765 hwmgr->smu_backend = smu8_smu; in smu8_smu_init()
775 ret = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev, in smu8_smu_init()
785 ret = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev, in smu8_smu_init()
795 if (0 != smu8_smu_populate_single_scratch_entry(hwmgr, in smu8_smu_init()
803 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()
818 if (0 != smu8_smu_populate_single_scratch_entry(hwmgr, in smu8_smu_init()
826 if (0 != smu8_smu_populate_single_scratch_entry(hwmgr, in smu8_smu_init()
849 static int smu8_smu_fini(struct pp_hwmgr *hwmgr) in smu8_smu_fini() argument
853 if (hwmgr == NULL || hwmgr->device == NULL) in smu8_smu_fini()
856 smu8_smu = hwmgr->smu_backend; in smu8_smu_fini()
870 static bool smu8_dpm_check_smu_features(struct pp_hwmgr *hwmgr, in smu8_dpm_check_smu_features() argument
876 result = smum_send_msg_to_smc_with_parameter(hwmgr, in smu8_dpm_check_smu_features()
888 static bool smu8_is_dpm_running(struct pp_hwmgr *hwmgr) in smu8_is_dpm_running() argument
890 if (smu8_dpm_check_smu_features(hwmgr, SMU_EnabledFeatureScoreboard_SclkDpmOn)) in smu8_is_dpm_running()