<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Rex Zhu <Rex.Zhu@amd.com><br>
<b>Sent:</b> Thursday, December 21, 2017 5:41:36 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhu, Rex<br>
<b>Subject:</b> [PATCH] drm/amd/pp: Get and save CZ/ST smu version</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">The smu firmware is loaded by the sbios on APUs, so query it<br>
from the smu and save the smu fw version info that is reported<br>
to userspace.<br>
<br>
Change-Id: Ifce41405c0369610985881cea26e14b0525e4d25<br>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c          |  2 ++<br>
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c | 13 +++++++++++++<br>
 2 files changed, 15 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c<br>
index 13607e2..4466f35 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c<br>
@@ -801,6 +801,8 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,<br>
                                 else<br>
                                         strcpy(fw_name, "amdgpu/vega10_smc.bin");<br>
                                 break;<br>
+                       case CHIP_CARRIZO:<br>
+                       case CHIP_STONEY:<br>
                         case CHIP_RAVEN:<br>
                                 adev->pm.fw_version = info->version;<br>
                                 return 0;<br>
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c<br>
index 78ab055..4d3aff3 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c<br>
@@ -709,6 +709,19 @@ static int cz_start_smu(struct pp_hwmgr *hwmgr)<br>
 {<br>
         int ret = 0;<br>
         uint32_t fw_to_check = 0;<br>
+       struct cgs_firmware_info info = {0};<br>
+       uint32_t index = SMN_MP1_SRAM_START_ADDR +<br>
+                        SMU8_FIRMWARE_HEADER_LOCATION +<br>
+                        offsetof(struct SMU8_Firmware_Header, Version);<br>
+<br>
+<br>
+       if (hwmgr == NULL || hwmgr->device == NULL)<br>
+               return -EINVAL;<br>
+<br>
+       cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX, index);<br>
+       hwmgr->smu_version = cgs_read_register(hwmgr->device, mmMP0PUB_IND_DATA);<br>
+       info.version = hwmgr->smu_version >> 8;<br>
+       cgs_get_firmware_info(hwmgr->device, CGS_UCODE_ID_SMU, &info);<br>
 <br>
         fw_to_check = UCODE_ID_RLC_G_MASK |<br>
                         UCODE_ID_SDMA0_MASK |<br>
-- <br>
1.9.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>