Commit cd093c24 authored by Yang Wang's avatar Yang Wang Committed by Alex Deucher

drm/amdgpu: refine gmc firmware loading

refine gmc 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 8d7ff60f
...@@ -98,9 +98,7 @@ static void gmc_v6_0_mc_resume(struct amdgpu_device *adev) ...@@ -98,9 +98,7 @@ static void gmc_v6_0_mc_resume(struct amdgpu_device *adev)
static int gmc_v6_0_init_microcode(struct amdgpu_device *adev) static int gmc_v6_0_init_microcode(struct amdgpu_device *adev)
{ {
const char *chip_name; const char *chip_name;
char fw_name[30];
int err; int err;
bool is_58_fw = false;
DRM_DEBUG("\n"); DRM_DEBUG("\n");
...@@ -126,17 +124,13 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev) ...@@ -126,17 +124,13 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev)
/* this memory configuration requires special firmware */ /* this memory configuration requires special firmware */
if (((RREG32(mmMC_SEQ_MISC0) & 0xff000000) >> 24) == 0x58) if (((RREG32(mmMC_SEQ_MISC0) & 0xff000000) >> 24) == 0x58)
is_58_fw = true; chip_name = "si58";
if (is_58_fw) err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
snprintf(fw_name, sizeof(fw_name), "amdgpu/si58_mc.bin");
else
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name);
err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name);
if (err) { if (err) {
dev_err(adev->dev, dev_err(adev->dev,
"si_mc: Failed to load firmware \"%s\"\n", "si_mc: Failed to load firmware \"%s_mc.bin\"\n",
fw_name); chip_name);
amdgpu_ucode_release(&adev->gmc.fw); amdgpu_ucode_release(&adev->gmc.fw);
} }
return err; return err;
......
...@@ -130,7 +130,6 @@ static void gmc_v7_0_mc_resume(struct amdgpu_device *adev) ...@@ -130,7 +130,6 @@ static void gmc_v7_0_mc_resume(struct amdgpu_device *adev)
static int gmc_v7_0_init_microcode(struct amdgpu_device *adev) static int gmc_v7_0_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");
...@@ -153,11 +152,9 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev) ...@@ -153,11 +152,9 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev)
return -EINVAL; return -EINVAL;
} }
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name); err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name);
if (err) { if (err) {
pr_err("cik_mc: Failed to load firmware \"%s\"\n", fw_name); pr_err("cik_mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
amdgpu_ucode_release(&adev->gmc.fw); amdgpu_ucode_release(&adev->gmc.fw);
} }
return err; return err;
......
...@@ -212,7 +212,6 @@ static void gmc_v8_0_mc_resume(struct amdgpu_device *adev) ...@@ -212,7 +212,6 @@ static void gmc_v8_0_mc_resume(struct amdgpu_device *adev)
static int gmc_v8_0_init_microcode(struct amdgpu_device *adev) static int gmc_v8_0_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");
...@@ -255,10 +254,9 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev) ...@@ -255,10 +254,9 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev)
return -EINVAL; return -EINVAL;
} }
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name); err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name);
if (err) { if (err) {
pr_err("mc: Failed to load firmware \"%s\"\n", fw_name); pr_err("mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
amdgpu_ucode_release(&adev->gmc.fw); amdgpu_ucode_release(&adev->gmc.fw);
} }
return err; return err;
......
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