Lines Matching refs:psp
88 static int psp_v11_0_init_microcode(struct psp_context *psp) in psp_v11_0_init_microcode() argument
90 struct amdgpu_device *adev = psp->adev; in psp_v11_0_init_microcode()
137 err = psp_init_sos_microcode(psp, chip_name); in psp_v11_0_init_microcode()
140 err = psp_init_asd_microcode(psp, chip_name); in psp_v11_0_init_microcode()
144 err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); in psp_v11_0_init_microcode()
146 release_firmware(adev->psp.ta_fw); in psp_v11_0_init_microcode()
147 adev->psp.ta_fw = NULL; in psp_v11_0_init_microcode()
151 err = amdgpu_ucode_validate(adev->psp.ta_fw); in psp_v11_0_init_microcode()
155 ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data; in psp_v11_0_init_microcode()
156 adev->psp.xgmi_context.context.bin_desc.fw_version = in psp_v11_0_init_microcode()
158 adev->psp.xgmi_context.context.bin_desc.size_bytes = in psp_v11_0_init_microcode()
160 adev->psp.xgmi_context.context.bin_desc.start_addr = in psp_v11_0_init_microcode()
163 adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); in psp_v11_0_init_microcode()
164 adev->psp.ras_context.context.bin_desc.fw_version = in psp_v11_0_init_microcode()
166 adev->psp.ras_context.context.bin_desc.size_bytes = in psp_v11_0_init_microcode()
168 adev->psp.ras_context.context.bin_desc.start_addr = in psp_v11_0_init_microcode()
169 (uint8_t *)adev->psp.xgmi_context.context.bin_desc.start_addr + in psp_v11_0_init_microcode()
176 err = psp_init_sos_microcode(psp, chip_name); in psp_v11_0_init_microcode()
179 err = psp_init_asd_microcode(psp, chip_name); in psp_v11_0_init_microcode()
183 err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); in psp_v11_0_init_microcode()
185 release_firmware(adev->psp.ta_fw); in psp_v11_0_init_microcode()
186 adev->psp.ta_fw = NULL; in psp_v11_0_init_microcode()
190 err = amdgpu_ucode_validate(adev->psp.ta_fw); in psp_v11_0_init_microcode()
194 ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data; in psp_v11_0_init_microcode()
195 adev->psp.hdcp_context.context.bin_desc.fw_version = in psp_v11_0_init_microcode()
197 adev->psp.hdcp_context.context.bin_desc.size_bytes = in psp_v11_0_init_microcode()
199 adev->psp.hdcp_context.context.bin_desc.start_addr = in psp_v11_0_init_microcode()
204 adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); in psp_v11_0_init_microcode()
206 adev->psp.dtm_context.context.bin_desc.fw_version = in psp_v11_0_init_microcode()
208 adev->psp.dtm_context.context.bin_desc.size_bytes = in psp_v11_0_init_microcode()
210 adev->psp.dtm_context.context.bin_desc.start_addr = in psp_v11_0_init_microcode()
211 (uint8_t *)adev->psp.hdcp_context.context in psp_v11_0_init_microcode()
220 err = psp_init_sos_microcode(psp, chip_name); in psp_v11_0_init_microcode()
223 err = psp_init_ta_microcode(psp, chip_name); in psp_v11_0_init_microcode()
228 err = psp_init_asd_microcode(psp, chip_name); in psp_v11_0_init_microcode()
231 err = psp_init_toc_microcode(psp, chip_name); in psp_v11_0_init_microcode()
242 release_firmware(adev->psp.ta_fw); in psp_v11_0_init_microcode()
243 adev->psp.ta_fw = NULL; in psp_v11_0_init_microcode()
247 static int psp_v11_0_wait_for_bootloader(struct psp_context *psp) in psp_v11_0_wait_for_bootloader() argument
249 struct amdgpu_device *adev = psp->adev; in psp_v11_0_wait_for_bootloader()
257 ret = psp_wait_for(psp, in psp_v11_0_wait_for_bootloader()
270 static bool psp_v11_0_is_sos_alive(struct psp_context *psp) in psp_v11_0_is_sos_alive() argument
272 struct amdgpu_device *adev = psp->adev; in psp_v11_0_is_sos_alive()
280 static int psp_v11_0_bootloader_load_component(struct psp_context *psp, in psp_v11_0_bootloader_load_component() argument
286 struct amdgpu_device *adev = psp->adev; in psp_v11_0_bootloader_load_component()
291 if (psp_v11_0_is_sos_alive(psp)) in psp_v11_0_bootloader_load_component()
294 ret = psp_v11_0_wait_for_bootloader(psp); in psp_v11_0_bootloader_load_component()
299 psp_copy_fw(psp, bin_desc->start_addr, bin_desc->size_bytes); in psp_v11_0_bootloader_load_component()
303 (uint32_t)(psp->fw_pri_mc_addr >> 20)); in psp_v11_0_bootloader_load_component()
308 ret = psp_v11_0_wait_for_bootloader(psp); in psp_v11_0_bootloader_load_component()
313 static int psp_v11_0_bootloader_load_kdb(struct psp_context *psp) in psp_v11_0_bootloader_load_kdb() argument
315 return psp_v11_0_bootloader_load_component(psp, &psp->kdb, PSP_BL__LOAD_KEY_DATABASE); in psp_v11_0_bootloader_load_kdb()
318 static int psp_v11_0_bootloader_load_spl(struct psp_context *psp) in psp_v11_0_bootloader_load_spl() argument
320 return psp_v11_0_bootloader_load_component(psp, &psp->spl, PSP_BL__LOAD_TOS_SPL_TABLE); in psp_v11_0_bootloader_load_spl()
323 static int psp_v11_0_bootloader_load_sysdrv(struct psp_context *psp) in psp_v11_0_bootloader_load_sysdrv() argument
325 return psp_v11_0_bootloader_load_component(psp, &psp->sys, PSP_BL__LOAD_SYSDRV); in psp_v11_0_bootloader_load_sysdrv()
328 static int psp_v11_0_bootloader_load_sos(struct psp_context *psp) in psp_v11_0_bootloader_load_sos() argument
332 struct amdgpu_device *adev = psp->adev; in psp_v11_0_bootloader_load_sos()
337 if (psp_v11_0_is_sos_alive(psp)) in psp_v11_0_bootloader_load_sos()
340 ret = psp_v11_0_wait_for_bootloader(psp); in psp_v11_0_bootloader_load_sos()
345 psp_copy_fw(psp, psp->sos.start_addr, psp->sos.size_bytes); in psp_v11_0_bootloader_load_sos()
349 (uint32_t)(psp->fw_pri_mc_addr >> 20)); in psp_v11_0_bootloader_load_sos()
356 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_81), in psp_v11_0_bootloader_load_sos()
363 static int psp_v11_0_ring_init(struct psp_context *psp, in psp_v11_0_ring_init() argument
368 struct amdgpu_device *adev = psp->adev; in psp_v11_0_ring_init()
370 ring = &psp->km_ring; in psp_v11_0_ring_init()
389 static int psp_v11_0_ring_stop(struct psp_context *psp, in psp_v11_0_ring_stop() argument
393 struct amdgpu_device *adev = psp->adev; in psp_v11_0_ring_stop()
408 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101), in psp_v11_0_ring_stop()
411 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64), in psp_v11_0_ring_stop()
417 static int psp_v11_0_ring_create(struct psp_context *psp, in psp_v11_0_ring_create() argument
422 struct psp_ring *ring = &psp->km_ring; in psp_v11_0_ring_create()
423 struct amdgpu_device *adev = psp->adev; in psp_v11_0_ring_create()
427 ret = psp_v11_0_ring_stop(psp, ring_type); in psp_v11_0_ring_create()
448 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101), in psp_v11_0_ring_create()
453 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64), in psp_v11_0_ring_create()
478 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64), in psp_v11_0_ring_create()
486 static int psp_v11_0_ring_destroy(struct psp_context *psp, in psp_v11_0_ring_destroy() argument
490 struct psp_ring *ring = &psp->km_ring; in psp_v11_0_ring_destroy()
491 struct amdgpu_device *adev = psp->adev; in psp_v11_0_ring_destroy()
493 ret = psp_v11_0_ring_stop(psp, ring_type); in psp_v11_0_ring_destroy()
504 static int psp_v11_0_mode1_reset(struct psp_context *psp) in psp_v11_0_mode1_reset() argument
508 struct amdgpu_device *adev = psp->adev; in psp_v11_0_mode1_reset()
512 ret = psp_wait_for(psp, offset, 0x80000000, 0x8000FFFF, false); in psp_v11_0_mode1_reset()
526 ret = psp_wait_for(psp, offset, 0x80000000, 0x80000000, false); in psp_v11_0_mode1_reset()
538 static int psp_v11_0_memory_training_send_msg(struct psp_context *psp, int msg) in psp_v11_0_memory_training_send_msg() argument
544 struct amdgpu_device *adev = psp->adev; in psp_v11_0_memory_training_send_msg()
546 data_32 = (psp->mem_train_ctx.c2p_train_data_offset >> 20); in psp_v11_0_memory_training_send_msg()
552 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35), in psp_v11_0_memory_training_send_msg()
572 static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops) in psp_v11_0_memory_training() argument
574 struct psp_memory_training_context *ctx = &psp->mem_train_ctx; in psp_v11_0_memory_training()
576 struct amdgpu_device *adev = psp->adev; in psp_v11_0_memory_training()
590 if (psp_v11_0_is_sos_alive(psp)) { in psp_v11_0_memory_training()
655 ret = psp_v11_0_memory_training_send_msg(psp, PSP_BL__DRAM_LONG_TRAIN); in psp_v11_0_memory_training()
674 …amdgpu_device_vram_access(psp->adev, ctx->p2c_train_data_offset, ctx->sys_cache, ctx->train_data_s… in psp_v11_0_memory_training()
678 …amdgpu_device_vram_access(psp->adev, ctx->c2p_train_data_offset, ctx->sys_cache, ctx->train_data_s… in psp_v11_0_memory_training()
682 ret = psp_v11_0_memory_training_send_msg(psp, (amdgpu_force_long_training > 0) ? in psp_v11_0_memory_training()
693 static uint32_t psp_v11_0_ring_get_wptr(struct psp_context *psp) in psp_v11_0_ring_get_wptr() argument
696 struct amdgpu_device *adev = psp->adev; in psp_v11_0_ring_get_wptr()
699 data = psp->km_ring.ring_wptr; in psp_v11_0_ring_get_wptr()
706 static void psp_v11_0_ring_set_wptr(struct psp_context *psp, uint32_t value) in psp_v11_0_ring_set_wptr() argument
708 struct amdgpu_device *adev = psp->adev; in psp_v11_0_ring_set_wptr()
713 psp->km_ring.ring_wptr = value; in psp_v11_0_ring_set_wptr()
718 static int psp_v11_0_load_usbc_pd_fw(struct psp_context *psp, uint64_t fw_pri_mc_addr) in psp_v11_0_load_usbc_pd_fw() argument
720 struct amdgpu_device *adev = psp->adev; in psp_v11_0_load_usbc_pd_fw()
731 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35), in psp_v11_0_load_usbc_pd_fw()
761 static int psp_v11_0_read_usbc_pd_fw(struct psp_context *psp, uint32_t *fw_ver) in psp_v11_0_read_usbc_pd_fw() argument
763 struct amdgpu_device *adev = psp->adev; in psp_v11_0_read_usbc_pd_fw()
768 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35), in psp_v11_0_read_usbc_pd_fw()
794 void psp_v11_0_set_psp_funcs(struct psp_context *psp) in psp_v11_0_set_psp_funcs() argument
796 psp->funcs = &psp_v11_0_funcs; in psp_v11_0_set_psp_funcs()