Commit 3e92af6b authored by Yang Wang's avatar Yang Wang Committed by Alex Deucher

drm/amdgpu: refine pmfw/smu firmware loading

refine pmfw/smu firmware loading
Signed-off-by: default avatarYang Wang <kevinyang.wang@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent cd093c24
...@@ -7648,7 +7648,6 @@ static int si_dpm_late_init(void *handle) ...@@ -7648,7 +7648,6 @@ static int si_dpm_late_init(void *handle)
static int si_dpm_init_microcode(struct amdgpu_device *adev) static int si_dpm_init_microcode(struct amdgpu_device *adev)
{ {
const char *chip_name; const char *chip_name;
char fw_name[30];
int err; int err;
DRM_DEBUG("\n"); DRM_DEBUG("\n");
...@@ -7708,11 +7707,10 @@ static int si_dpm_init_microcode(struct amdgpu_device *adev) ...@@ -7708,11 +7707,10 @@ static int si_dpm_init_microcode(struct amdgpu_device *adev)
default: BUG(); default: BUG();
} }
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name); err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s_smc.bin", chip_name);
err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
if (err) { if (err) {
DRM_ERROR("si_smc: Failed to load firmware. err = %d\"%s\"\n", DRM_ERROR("si_smc: Failed to load firmware. err = %d\"%s_smc.bin\"\n",
err, fw_name); err, chip_name);
amdgpu_ucode_release(&adev->pm.fw); amdgpu_ucode_release(&adev->pm.fw);
} }
return err; return err;
......
...@@ -94,7 +94,6 @@ int smu_v11_0_init_microcode(struct smu_context *smu) ...@@ -94,7 +94,6 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
{ {
struct amdgpu_device *adev = smu->adev; struct amdgpu_device *adev = smu->adev;
char ucode_prefix[25]; char ucode_prefix[25];
char fw_name[SMU_FW_NAME_LEN];
int err = 0; int err = 0;
const struct smc_firmware_header_v1_0 *hdr; const struct smc_firmware_header_v1_0 *hdr;
const struct common_firmware_header *header; const struct common_firmware_header *header;
...@@ -106,10 +105,7 @@ int smu_v11_0_init_microcode(struct smu_context *smu) ...@@ -106,10 +105,7 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
return 0; return 0;
amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix)); amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
if (err) if (err)
goto out; goto out;
......
...@@ -92,7 +92,6 @@ const int pmfw_decoded_link_width[7] = {0, 1, 2, 4, 8, 12, 16}; ...@@ -92,7 +92,6 @@ const int pmfw_decoded_link_width[7] = {0, 1, 2, 4, 8, 12, 16};
int smu_v13_0_init_microcode(struct smu_context *smu) int smu_v13_0_init_microcode(struct smu_context *smu)
{ {
struct amdgpu_device *adev = smu->adev; struct amdgpu_device *adev = smu->adev;
char fw_name[30];
char ucode_prefix[15]; char ucode_prefix[15];
int err = 0; int err = 0;
const struct smc_firmware_header_v1_0 *hdr; const struct smc_firmware_header_v1_0 *hdr;
...@@ -104,10 +103,7 @@ int smu_v13_0_init_microcode(struct smu_context *smu) ...@@ -104,10 +103,7 @@ int smu_v13_0_init_microcode(struct smu_context *smu)
return 0; return 0;
amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix)); amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
if (err) if (err)
goto out; goto out;
......
...@@ -272,7 +272,6 @@ static int smu_v13_0_6_init_microcode(struct smu_context *smu) ...@@ -272,7 +272,6 @@ static int smu_v13_0_6_init_microcode(struct smu_context *smu)
uint32_t p2s_table_id = P2S_TABLE_ID_A; uint32_t p2s_table_id = P2S_TABLE_ID_A;
int ret = 0, i, p2stable_count; int ret = 0, i, p2stable_count;
char ucode_prefix[15]; char ucode_prefix[15];
char fw_name[30];
/* No need to load P2S tables in IOV mode */ /* No need to load P2S tables in IOV mode */
if (amdgpu_sriov_vf(adev)) if (amdgpu_sriov_vf(adev))
...@@ -283,10 +282,7 @@ static int smu_v13_0_6_init_microcode(struct smu_context *smu) ...@@ -283,10 +282,7 @@ static int smu_v13_0_6_init_microcode(struct smu_context *smu)
amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix,
sizeof(ucode_prefix)); sizeof(ucode_prefix));
ret = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
ret = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
if (ret) if (ret)
goto out; goto out;
......
...@@ -68,7 +68,6 @@ MODULE_FIRMWARE("amdgpu/smu_14_0_3.bin"); ...@@ -68,7 +68,6 @@ MODULE_FIRMWARE("amdgpu/smu_14_0_3.bin");
int smu_v14_0_init_microcode(struct smu_context *smu) int smu_v14_0_init_microcode(struct smu_context *smu)
{ {
struct amdgpu_device *adev = smu->adev; struct amdgpu_device *adev = smu->adev;
char fw_name[30];
char ucode_prefix[15]; char ucode_prefix[15];
int err = 0; int err = 0;
const struct smc_firmware_header_v1_0 *hdr; const struct smc_firmware_header_v1_0 *hdr;
...@@ -80,10 +79,7 @@ int smu_v14_0_init_microcode(struct smu_context *smu) ...@@ -80,10 +79,7 @@ int smu_v14_0_init_microcode(struct smu_context *smu)
return 0; return 0;
amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix)); amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
if (err) if (err)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment