Commit 7656168a authored by Lijo Lazar's avatar Lijo Lazar Committed by Alex Deucher
Browse files

drm/amdgpu: Add bootloader status check



Add a function to wait till bootloader has reached steady state.

Signed-off-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarAsad Kamal <asad.kamal@amd.com>
Tested-by: default avatarAsad Kamal <asad.kamal@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8c97e87c
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -885,15 +885,22 @@ static void amdgpu_block_invalid_wreg(struct amdgpu_device *adev,
 */
static int amdgpu_device_asic_init(struct amdgpu_device *adev)
{
	int ret;

	amdgpu_asic_pre_asic_init(adev);

	if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3) ||
	    adev->ip_versions[GC_HWIP][0] >= IP_VERSION(11, 0, 0))
		return amdgpu_atomfirmware_asic_init(adev, true);
	else
	    adev->ip_versions[GC_HWIP][0] >= IP_VERSION(11, 0, 0)) {
		amdgpu_psp_wait_for_bootloader(adev);
		ret = amdgpu_atomfirmware_asic_init(adev, true);
		return ret;
	} else {
		return amdgpu_atom_asic_init(adev->mode_info.atom_context);
	}

	return 0;
}

/**
 * amdgpu_device_mem_scratch_init - allocate the VRAM scratch page
 *
@@ -4697,6 +4704,9 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev)
		dev_err(adev->dev, "GPU mode1 reset failed\n");

	amdgpu_device_load_pci_state(adev->pdev);
	ret = amdgpu_psp_wait_for_bootloader(adev);
	if (ret)
		return ret;

	/* wait for asic to come out of reset */
	for (i = 0; i < adev->usec_timeout; i++) {
@@ -4708,6 +4718,7 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev)
	}

	amdgpu_atombios_scratch_regs_engine_hung(adev, false);

	return ret;
}

+11 −0
Original line number Diff line number Diff line
@@ -2078,6 +2078,17 @@ int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
}
/* SECUREDISPLAY end */

int amdgpu_psp_wait_for_bootloader(struct amdgpu_device *adev)
{
	struct psp_context *psp = &adev->psp;
	int ret = 0;

	if (!amdgpu_sriov_vf(adev) && psp->funcs && psp->funcs->wait_for_bootloader != NULL)
		ret = psp->funcs->wait_for_bootloader(psp);

	return ret;
}

static int psp_hw_start(struct psp_context *psp)
{
	struct amdgpu_device *adev = psp->adev;
+3 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ enum psp_reg_prog_id {

struct psp_funcs {
	int (*init_microcode)(struct psp_context *psp);
	int (*wait_for_bootloader)(struct psp_context *psp);
	int (*bootloader_load_kdb)(struct psp_context *psp);
	int (*bootloader_load_spl)(struct psp_context *psp);
	int (*bootloader_load_sysdrv)(struct psp_context *psp);
@@ -533,4 +534,6 @@ int psp_spatial_partition(struct psp_context *psp, int mode);

int is_psp_fw_valid(struct psp_bin_desc bin);

int amdgpu_psp_wait_for_bootloader(struct amdgpu_device *adev);

#endif