@@ -111,10 +111,6 @@ def init(self):
111
111
self ._smu_cmn_send_smc_msg_with_param (smu_v13_0_0 .PPSMC_MSG_SetDriverDramAddrLow , lo32 (self .adev .paddr2mc (self .driver_table_paddr )), poll = True )
112
112
self ._smu_cmn_send_smc_msg_with_param (smu_v13_0_0 .PPSMC_MSG_EnableAllSmuFeatures , 0 , poll = True )
113
113
114
- for clck in [0x00000C94 , 0x000204E1 , 0x000105DC , 0x00050B76 , 0x00070B76 , 0x00040898 , 0x00060898 , 0x000308FD ]:
115
- self ._smu_cmn_send_smc_msg_with_param (smu_v13_0_0 .PPSMC_MSG_SetSoftMinByFreq , clck , poll = True )
116
- self ._smu_cmn_send_smc_msg_with_param (smu_v13_0_0 .PPSMC_MSG_SetSoftMaxByFreq , clck , poll = True )
117
-
118
114
def is_smu_alive (self ):
119
115
with contextlib .suppress (RuntimeError ): self ._smu_cmn_send_smc_msg_with_param (smu_v13_0_0 .PPSMC_MSG_GetSmuVersion , 0 , timeout = 100 )
120
116
return self .adev .mmMP1_SMN_C2PMSG_90 .read () != 0
@@ -129,6 +125,12 @@ def read_table(self, table_t, cmd):
129
125
return table_t .from_buffer (to_mv (self .adev .paddr2cpu (self .driver_table_paddr ), ctypes .sizeof (table_t )))
130
126
def read_metrics (self ): return self .read_table (smu_v13_0_0 .SmuMetricsExternal_t , smu_v13_0_0 .TABLE_SMU_METRICS )
131
127
128
+ def set_clocks (self , perf ):
129
+ # TODO: Parse from bios.
130
+ for clck , (mn , mx ) in {smu_v13_0_0 .PPCLK_GFXCLK : (0 , 3220 ), smu_v13_0_0 .PPCLK_UCLK : (0 , 1249 ), smu_v13_0_0 .PPCLK_FCLK : (0 , 2301 )}.items ():
131
+ self ._smu_cmn_send_smc_msg_with_param (smu_v13_0_0 .PPSMC_MSG_SetSoftMinByFreq , clck << 16 | (mx if perf else mn ), poll = True )
132
+ self ._smu_cmn_send_smc_msg_with_param (smu_v13_0_0 .PPSMC_MSG_SetSoftMaxByFreq , clck << 16 | (mx if perf else mn ), poll = True )
133
+
132
134
def _smu_cmn_poll_stat (self , timeout = 10000 ): self .adev .wait_reg (self .adev .mmMP1_SMN_C2PMSG_90 , mask = 0xFFFFFFFF , value = 1 , timeout = timeout )
133
135
def _smu_cmn_send_msg (self , msg , param = 0 ):
134
136
self .adev .mmMP1_SMN_C2PMSG_90 .write (0 ) # resp reg
0 commit comments