<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">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></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 Tom St Denis <tom.stdenis@amd.com><br>
<b>Sent:</b> Friday, March 27, 2020 9:44 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> StDenis, Tom <Tom.StDenis@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/amdgpu: Include headers for PWR and SMUIO registers</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Clean up the smu10, smu12, and gfx9 drivers to use headers for<br>
registers instead of hardcoding in the C source files.<br>
<br>
Signed-off-by: Tom St Denis <tom.stdenis@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c             | 10 +++-------<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  9 ++-------<br>
 drivers/gpu/drm/amd/powerplay/smu_v12_0.c         | 12 +++++++-----<br>
 3 files changed, 12 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
index 7d98dc1d452e..619dc0f8071f 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
@@ -50,18 +50,14 @@<br>
 <br>
 #include "gfx_v9_4.h"<br>
 <br>
+#include "asic_reg/pwr/pwr_10_0_offset.h"<br>
+#include "asic_reg/pwr/pwr_10_0_sh_mask.h"<br>
+<br>
 #define GFX9_NUM_GFX_RINGS     1<br>
 #define GFX9_MEC_HPD_SIZE 4096<br>
 #define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L<br>
 #define RLC_SAVE_RESTORE_ADDR_STARTING_OFFSET 0x00000000L<br>
 <br>
-#define mmPWR_MISC_CNTL_STATUS                                 0x0183<br>
-#define mmPWR_MISC_CNTL_STATUS_BASE_IDX                                0<br>
-#define PWR_MISC_CNTL_STATUS__PWR_GFX_RLC_CGPG_EN__SHIFT       0x0<br>
-#define PWR_MISC_CNTL_STATUS__PWR_GFXOFF_STATUS__SHIFT         0x1<br>
-#define PWR_MISC_CNTL_STATUS__PWR_GFX_RLC_CGPG_EN_MASK         0x00000001L<br>
-#define PWR_MISC_CNTL_STATUS__PWR_GFXOFF_STATUS_MASK           0x00000006L<br>
-<br>
 #define mmGCEA_PROBE_MAP                        0x070c<br>
 #define mmGCEA_PROBE_MAP_BASE_IDX               0<br>
 <br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c<br>
index 689072a312a7..69afdd24a0f0 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c<br>
@@ -36,6 +36,8 @@<br>
 #include "power_state.h"<br>
 #include "soc15_common.h"<br>
 #include "smu10.h"<br>
+#include "asic_reg/pwr/pwr_10_0_offset.h"<br>
+#include "asic_reg/pwr/pwr_10_0_sh_mask.h"<br>
 <br>
 #define SMU10_MAX_DEEPSLEEP_DIVIDER_ID     5<br>
 #define SMU10_MINIMUM_ENGINE_CLOCK         800   /* 8Mhz, the low boundary of engine clock allowed on this chip */<br>
@@ -43,13 +45,6 @@<br>
 #define SMU10_DISPCLK_BYPASS_THRESHOLD     10000 /* 100Mhz */<br>
 #define SMC_RAM_END                     0x40000<br>
 <br>
-#define mmPWR_MISC_CNTL_STATUS                                 0x0183<br>
-#define mmPWR_MISC_CNTL_STATUS_BASE_IDX                                0<br>
-#define PWR_MISC_CNTL_STATUS__PWR_GFX_RLC_CGPG_EN__SHIFT       0x0<br>
-#define PWR_MISC_CNTL_STATUS__PWR_GFXOFF_STATUS__SHIFT         0x1<br>
-#define PWR_MISC_CNTL_STATUS__PWR_GFX_RLC_CGPG_EN_MASK         0x00000001L<br>
-#define PWR_MISC_CNTL_STATUS__PWR_GFXOFF_STATUS_MASK           0x00000006L<br>
-<br>
 static const unsigned long SMU10_Magic = (unsigned long) PHM_Rv_Magic;<br>
 <br>
 <br>
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br>
index 169ebdad87b8..4fc68d4600e0 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br>
@@ -32,13 +32,15 @@<br>
 <br>
 #include "asic_reg/mp/mp_12_0_0_offset.h"<br>
 #include "asic_reg/mp/mp_12_0_0_sh_mask.h"<br>
+#include "asic_reg/smuio/smuio_12_0_0_offset.h"<br>
+#include "asic_reg/smuio/smuio_12_0_0_sh_mask.h"<br>
 <br>
-#define smnMP1_FIRMWARE_FLAGS                                0x3010024<br>
+// because some SMU12 based ASICs use older ip offset tables<br>
+// we should undefine this register from the smuio12 header<br>
+// to prevent confusion down the road<br>
+#undef mmPWR_MISC_CNTL_STATUS<br>
 <br>
-#define mmSMUIO_GFX_MISC_CNTL                                0x00c8<br>
-#define mmSMUIO_GFX_MISC_CNTL_BASE_IDX                       0<br>
-#define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS_MASK          0x00000006L<br>
-#define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS__SHIFT        0x1<br>
+#define smnMP1_FIRMWARE_FLAGS                                0x3010024<br>
 <br>
 int smu_v12_0_send_msg_without_waiting(struct smu_context *smu,<br>
                                               uint16_t msg)<br>
-- <br>
2.25.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7C63d58f7ec8114ef86c9108d7d254ff6b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637209135495314070&amp;sdata=itPgDOvpUPrdr5IwY0HtIb5McGA7v%2Bim7d4XeGJ5%2BiQ%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7C63d58f7ec8114ef86c9108d7d254ff6b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637209135495314070&amp;sdata=itPgDOvpUPrdr5IwY0HtIb5McGA7v%2Bim7d4XeGJ5%2BiQ%3D&amp;reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>