[2/5] drm/amdgpu:correct smc fw version error

Submitted by Alex Deucher on Sept. 19, 2016, 5:12 p.m.

Details

Message ID 1474305161-11435-2-git-send-email-alexander.deucher@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Alex Deucher Sept. 19, 2016, 5:12 p.m.
From: Monk Liu <Monk.Liu@amd.com>

original method get wrong smc fw version.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index f1c53a2..f6dbdf8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -743,12 +743,13 @@  static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
 		info->version = (uint16_t)le32_to_cpu(header->header.ucode_version);
 		info->feature_version = (uint16_t)le32_to_cpu(header->ucode_feature_version);
 	} else {
+		uint32_t fw_ver;
 		char fw_name[30] = {0};
 		int err = 0;
 		uint32_t ucode_size;
 		uint32_t ucode_start_address;
 		const uint8_t *src;
-		const struct smc_firmware_header_v1_0 *hdr;
+		struct smc_firmware_header_v1_0 *hdr;
 
 		if (!adev->pm.fw) {
 			switch (adev->asic_type) {
@@ -793,12 +794,15 @@  static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
 			}
 		}
 
-		hdr = (const struct smc_firmware_header_v1_0 *)	adev->pm.fw->data;
+		hdr = (struct smc_firmware_header_v1_0 *)adev->pm.fw->data;
+		/* firmware version is located at 69 dw from begining */
+		fw_ver = *((uint32_t *)adev->pm.fw->data + 69);
+		hdr->header.ucode_version = fw_ver;
 		amdgpu_ucode_print_smc_hdr(&hdr->header);
 		adev->pm.fw_version = le32_to_cpu(hdr->header.ucode_version);
 		ucode_size = le32_to_cpu(hdr->header.ucode_size_bytes);
 		ucode_start_address = le32_to_cpu(hdr->ucode_start_addr);
-		src = (const uint8_t *)(adev->pm.fw->data +
+		src = (uint8_t *)(adev->pm.fw->data +
 		       le32_to_cpu(hdr->header.ucode_array_offset_bytes));
 
 		info->version = adev->pm.fw_version;