smu73_discrete.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. /*
  2. * Copyright 2015 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. */
  23. #ifndef _SMU73_DISCRETE_H_
  24. #define _SMU73_DISCRETE_H_
  25. #include "smu73.h"
  26. #pragma pack(push, 1)
  27. struct SMIO_Pattern
  28. {
  29. uint16_t Voltage;
  30. uint8_t Smio;
  31. uint8_t padding;
  32. };
  33. typedef struct SMIO_Pattern SMIO_Pattern;
  34. struct SMIO_Table
  35. {
  36. SMIO_Pattern Pattern[SMU_MAX_SMIO_LEVELS];
  37. };
  38. typedef struct SMIO_Table SMIO_Table;
  39. struct SMU73_Discrete_GraphicsLevel {
  40. uint32_t MinVoltage;
  41. uint32_t SclkFrequency;
  42. uint8_t pcieDpmLevel;
  43. uint8_t DeepSleepDivId;
  44. uint16_t ActivityLevel;
  45. uint32_t CgSpllFuncCntl3;
  46. uint32_t CgSpllFuncCntl4;
  47. uint32_t SpllSpreadSpectrum;
  48. uint32_t SpllSpreadSpectrum2;
  49. uint32_t CcPwrDynRm;
  50. uint32_t CcPwrDynRm1;
  51. uint8_t SclkDid;
  52. uint8_t DisplayWatermark;
  53. uint8_t EnabledForActivity;
  54. uint8_t EnabledForThrottle;
  55. uint8_t UpHyst;
  56. uint8_t DownHyst;
  57. uint8_t VoltageDownHyst;
  58. uint8_t PowerThrottle;
  59. };
  60. typedef struct SMU73_Discrete_GraphicsLevel SMU73_Discrete_GraphicsLevel;
  61. struct SMU73_Discrete_ACPILevel {
  62. uint32_t Flags;
  63. uint32_t MinVoltage;
  64. uint32_t SclkFrequency;
  65. uint8_t SclkDid;
  66. uint8_t DisplayWatermark;
  67. uint8_t DeepSleepDivId;
  68. uint8_t padding;
  69. uint32_t CgSpllFuncCntl;
  70. uint32_t CgSpllFuncCntl2;
  71. uint32_t CgSpllFuncCntl3;
  72. uint32_t CgSpllFuncCntl4;
  73. uint32_t SpllSpreadSpectrum;
  74. uint32_t SpllSpreadSpectrum2;
  75. uint32_t CcPwrDynRm;
  76. uint32_t CcPwrDynRm1;
  77. };
  78. typedef struct SMU73_Discrete_ACPILevel SMU73_Discrete_ACPILevel;
  79. struct SMU73_Discrete_Ulv {
  80. uint32_t CcPwrDynRm;
  81. uint32_t CcPwrDynRm1;
  82. uint16_t VddcOffset;
  83. uint8_t VddcOffsetVid;
  84. uint8_t VddcPhase;
  85. uint32_t Reserved;
  86. };
  87. typedef struct SMU73_Discrete_Ulv SMU73_Discrete_Ulv;
  88. struct SMU73_Discrete_MemoryLevel
  89. {
  90. uint32_t MinVoltage;
  91. uint32_t MinMvdd;
  92. uint32_t MclkFrequency;
  93. uint8_t StutterEnable;
  94. uint8_t FreqRange;
  95. uint8_t EnabledForThrottle;
  96. uint8_t EnabledForActivity;
  97. uint8_t UpHyst;
  98. uint8_t DownHyst;
  99. uint8_t VoltageDownHyst;
  100. uint8_t padding;
  101. uint16_t ActivityLevel;
  102. uint8_t DisplayWatermark;
  103. uint8_t MclkDivider;
  104. };
  105. typedef struct SMU73_Discrete_MemoryLevel SMU73_Discrete_MemoryLevel;
  106. struct SMU73_Discrete_LinkLevel
  107. {
  108. uint8_t PcieGenSpeed; ///< 0:PciE-gen1 1:PciE-gen2 2:PciE-gen3
  109. uint8_t PcieLaneCount; ///< 1=x1, 2=x2, 3=x4, 4=x8, 5=x12, 6=x16
  110. uint8_t EnabledForActivity;
  111. uint8_t SPC;
  112. uint32_t DownThreshold;
  113. uint32_t UpThreshold;
  114. uint32_t Reserved;
  115. };
  116. typedef struct SMU73_Discrete_LinkLevel SMU73_Discrete_LinkLevel;
  117. // MC ARB DRAM Timing registers.
  118. struct SMU73_Discrete_MCArbDramTimingTableEntry
  119. {
  120. uint32_t McArbDramTiming;
  121. uint32_t McArbDramTiming2;
  122. uint8_t McArbBurstTime;
  123. uint8_t TRRDS;
  124. uint8_t TRRDL;
  125. uint8_t padding;
  126. };
  127. typedef struct SMU73_Discrete_MCArbDramTimingTableEntry SMU73_Discrete_MCArbDramTimingTableEntry;
  128. struct SMU73_Discrete_MCArbDramTimingTable
  129. {
  130. SMU73_Discrete_MCArbDramTimingTableEntry entries[SMU__NUM_SCLK_DPM_STATE][SMU__NUM_MCLK_DPM_LEVELS];
  131. };
  132. typedef struct SMU73_Discrete_MCArbDramTimingTable SMU73_Discrete_MCArbDramTimingTable;
  133. // UVD VCLK/DCLK state (level) definition.
  134. struct SMU73_Discrete_UvdLevel
  135. {
  136. uint32_t VclkFrequency;
  137. uint32_t DclkFrequency;
  138. uint32_t MinVoltage;
  139. uint8_t VclkDivider;
  140. uint8_t DclkDivider;
  141. uint8_t padding[2];
  142. };
  143. typedef struct SMU73_Discrete_UvdLevel SMU73_Discrete_UvdLevel;
  144. // Clocks for other external blocks (VCE, ACP, SAMU).
  145. struct SMU73_Discrete_ExtClkLevel
  146. {
  147. uint32_t Frequency;
  148. uint32_t MinVoltage;
  149. uint8_t Divider;
  150. uint8_t padding[3];
  151. };
  152. typedef struct SMU73_Discrete_ExtClkLevel SMU73_Discrete_ExtClkLevel;
  153. struct SMU73_Discrete_StateInfo
  154. {
  155. uint32_t SclkFrequency;
  156. uint32_t MclkFrequency;
  157. uint32_t VclkFrequency;
  158. uint32_t DclkFrequency;
  159. uint32_t SamclkFrequency;
  160. uint32_t AclkFrequency;
  161. uint32_t EclkFrequency;
  162. uint16_t MvddVoltage;
  163. uint16_t padding16;
  164. uint8_t DisplayWatermark;
  165. uint8_t McArbIndex;
  166. uint8_t McRegIndex;
  167. uint8_t SeqIndex;
  168. uint8_t SclkDid;
  169. int8_t SclkIndex;
  170. int8_t MclkIndex;
  171. uint8_t PCIeGen;
  172. };
  173. typedef struct SMU73_Discrete_StateInfo SMU73_Discrete_StateInfo;
  174. struct SMU73_Discrete_DpmTable
  175. {
  176. // Multi-DPM controller settings
  177. SMU73_PIDController GraphicsPIDController;
  178. SMU73_PIDController MemoryPIDController;
  179. SMU73_PIDController LinkPIDController;
  180. uint32_t SystemFlags;
  181. // SMIO masks for voltage and phase controls
  182. uint32_t VRConfig;
  183. uint32_t SmioMask1;
  184. uint32_t SmioMask2;
  185. SMIO_Table SmioTable1;
  186. SMIO_Table SmioTable2;
  187. uint32_t MvddLevelCount;
  188. uint8_t BapmVddcVidHiSidd [SMU73_MAX_LEVELS_VDDC];
  189. uint8_t BapmVddcVidLoSidd [SMU73_MAX_LEVELS_VDDC];
  190. uint8_t BapmVddcVidHiSidd2 [SMU73_MAX_LEVELS_VDDC];
  191. uint8_t GraphicsDpmLevelCount;
  192. uint8_t MemoryDpmLevelCount;
  193. uint8_t LinkLevelCount;
  194. uint8_t MasterDeepSleepControl;
  195. uint8_t UvdLevelCount;
  196. uint8_t VceLevelCount;
  197. uint8_t AcpLevelCount;
  198. uint8_t SamuLevelCount;
  199. uint8_t ThermOutGpio;
  200. uint8_t ThermOutPolarity;
  201. uint8_t ThermOutMode;
  202. uint8_t BootPhases;
  203. uint32_t Reserved[4];
  204. // State table entries for each DPM state
  205. SMU73_Discrete_GraphicsLevel GraphicsLevel [SMU73_MAX_LEVELS_GRAPHICS];
  206. SMU73_Discrete_MemoryLevel MemoryACPILevel;
  207. SMU73_Discrete_MemoryLevel MemoryLevel [SMU73_MAX_LEVELS_MEMORY];
  208. SMU73_Discrete_LinkLevel LinkLevel [SMU73_MAX_LEVELS_LINK];
  209. SMU73_Discrete_ACPILevel ACPILevel;
  210. SMU73_Discrete_UvdLevel UvdLevel [SMU73_MAX_LEVELS_UVD];
  211. SMU73_Discrete_ExtClkLevel VceLevel [SMU73_MAX_LEVELS_VCE];
  212. SMU73_Discrete_ExtClkLevel AcpLevel [SMU73_MAX_LEVELS_ACP];
  213. SMU73_Discrete_ExtClkLevel SamuLevel [SMU73_MAX_LEVELS_SAMU];
  214. SMU73_Discrete_Ulv Ulv;
  215. uint32_t SclkStepSize;
  216. uint32_t Smio [SMU73_MAX_ENTRIES_SMIO];
  217. uint8_t UvdBootLevel;
  218. uint8_t VceBootLevel;
  219. uint8_t AcpBootLevel;
  220. uint8_t SamuBootLevel;
  221. uint8_t GraphicsBootLevel;
  222. uint8_t GraphicsVoltageChangeEnable;
  223. uint8_t GraphicsThermThrottleEnable;
  224. uint8_t GraphicsInterval;
  225. uint8_t VoltageInterval;
  226. uint8_t ThermalInterval;
  227. uint16_t TemperatureLimitHigh;
  228. uint16_t TemperatureLimitLow;
  229. uint8_t MemoryBootLevel;
  230. uint8_t MemoryVoltageChangeEnable;
  231. uint16_t BootMVdd;
  232. uint8_t MemoryInterval;
  233. uint8_t MemoryThermThrottleEnable;
  234. uint16_t VoltageResponseTime;
  235. uint16_t PhaseResponseTime;
  236. uint8_t PCIeBootLinkLevel;
  237. uint8_t PCIeGenInterval;
  238. uint8_t DTEInterval;
  239. uint8_t DTEMode;
  240. uint8_t SVI2Enable;
  241. uint8_t VRHotGpio;
  242. uint8_t AcDcGpio;
  243. uint8_t ThermGpio;
  244. uint16_t PPM_PkgPwrLimit;
  245. uint16_t PPM_TemperatureLimit;
  246. uint16_t DefaultTdp;
  247. uint16_t TargetTdp;
  248. uint16_t FpsHighThreshold;
  249. uint16_t FpsLowThreshold;
  250. uint16_t TemperatureLimitEdge;
  251. uint16_t TemperatureLimitHotspot;
  252. uint16_t TemperatureLimitLiquid1;
  253. uint16_t TemperatureLimitLiquid2;
  254. uint16_t TemperatureLimitVrVddc;
  255. uint16_t TemperatureLimitVrMvdd;
  256. uint16_t TemperatureLimitPlx;
  257. uint16_t FanGainEdge;
  258. uint16_t FanGainHotspot;
  259. uint16_t FanGainLiquid;
  260. uint16_t FanGainVrVddc;
  261. uint16_t FanGainVrMvdd;
  262. uint16_t FanGainPlx;
  263. uint16_t FanGainHbm;
  264. uint8_t Liquid1_I2C_address;
  265. uint8_t Liquid2_I2C_address;
  266. uint8_t Vr_I2C_address;
  267. uint8_t Plx_I2C_address;
  268. uint8_t GeminiMode;
  269. uint8_t spare17[3];
  270. uint32_t GeminiApertureHigh;
  271. uint32_t GeminiApertureLow;
  272. uint8_t Liquid_I2C_LineSCL;
  273. uint8_t Liquid_I2C_LineSDA;
  274. uint8_t Vr_I2C_LineSCL;
  275. uint8_t Vr_I2C_LineSDA;
  276. uint8_t Plx_I2C_LineSCL;
  277. uint8_t Plx_I2C_LineSDA;
  278. uint8_t spare1253[2];
  279. uint32_t spare123[2];
  280. uint8_t DTEAmbientTempBase;
  281. uint8_t DTETjOffset;
  282. uint8_t GpuTjMax;
  283. uint8_t GpuTjHyst;
  284. uint16_t BootVddc;
  285. uint16_t BootVddci;
  286. uint32_t BAPM_TEMP_GRADIENT;
  287. uint32_t LowSclkInterruptThreshold;
  288. uint32_t VddGfxReChkWait;
  289. uint8_t ClockStretcherAmount;
  290. uint8_t Sclk_CKS_masterEn0_7;
  291. uint8_t Sclk_CKS_masterEn8_15;
  292. uint8_t DPMFreezeAndForced;
  293. uint8_t Sclk_voltageOffset[8];
  294. SMU_ClockStretcherDataTable ClockStretcherDataTable;
  295. SMU_CKS_LOOKUPTable CKS_LOOKUPTable;
  296. };
  297. typedef struct SMU73_Discrete_DpmTable SMU73_Discrete_DpmTable;
  298. // --------------------------------------------------- Fan Table -----------------------------------------------------------
  299. struct SMU73_Discrete_FanTable
  300. {
  301. uint16_t FdoMode;
  302. int16_t TempMin;
  303. int16_t TempMed;
  304. int16_t TempMax;
  305. int16_t Slope1;
  306. int16_t Slope2;
  307. int16_t FdoMin;
  308. int16_t HystUp;
  309. int16_t HystDown;
  310. int16_t HystSlope;
  311. int16_t TempRespLim;
  312. int16_t TempCurr;
  313. int16_t SlopeCurr;
  314. int16_t PwmCurr;
  315. uint32_t RefreshPeriod;
  316. int16_t FdoMax;
  317. uint8_t TempSrc;
  318. int8_t Padding;
  319. };
  320. typedef struct SMU73_Discrete_FanTable SMU73_Discrete_FanTable;
  321. #define SMU7_DISCRETE_GPIO_SCLK_DEBUG 4
  322. #define SMU7_DISCRETE_GPIO_SCLK_DEBUG_BIT (0x1 << SMU7_DISCRETE_GPIO_SCLK_DEBUG)
  323. struct SMU7_MclkDpmScoreboard
  324. {
  325. uint32_t PercentageBusy;
  326. int32_t PIDError;
  327. int32_t PIDIntegral;
  328. int32_t PIDOutput;
  329. uint32_t SigmaDeltaAccum;
  330. uint32_t SigmaDeltaOutput;
  331. uint32_t SigmaDeltaLevel;
  332. uint32_t UtilizationSetpoint;
  333. uint8_t TdpClampMode;
  334. uint8_t TdcClampMode;
  335. uint8_t ThermClampMode;
  336. uint8_t VoltageBusy;
  337. int8_t CurrLevel;
  338. int8_t TargLevel;
  339. uint8_t LevelChangeInProgress;
  340. uint8_t UpHyst;
  341. uint8_t DownHyst;
  342. uint8_t VoltageDownHyst;
  343. uint8_t DpmEnable;
  344. uint8_t DpmRunning;
  345. uint8_t DpmForce;
  346. uint8_t DpmForceLevel;
  347. uint8_t DisplayWatermark;
  348. uint8_t McArbIndex;
  349. uint32_t MinimumPerfMclk;
  350. uint8_t AcpiReq;
  351. uint8_t AcpiAck;
  352. uint8_t MclkSwitchInProgress;
  353. uint8_t MclkSwitchCritical;
  354. uint8_t IgnoreVBlank;
  355. uint8_t TargetMclkIndex;
  356. uint8_t TargetMvddIndex;
  357. uint8_t MclkSwitchResult;
  358. uint16_t VbiFailureCount;
  359. uint8_t VbiWaitCounter;
  360. uint8_t EnabledLevelsChange;
  361. uint16_t LevelResidencyCounters [SMU73_MAX_LEVELS_MEMORY];
  362. uint16_t LevelSwitchCounters [SMU73_MAX_LEVELS_MEMORY];
  363. void (*TargetStateCalculator)(uint8_t);
  364. void (*SavedTargetStateCalculator)(uint8_t);
  365. uint16_t AutoDpmInterval;
  366. uint16_t AutoDpmRange;
  367. uint16_t VbiTimeoutCount;
  368. uint16_t MclkSwitchingTime;
  369. uint8_t fastSwitch;
  370. uint8_t Save_PIC_VDDGFX_EXIT;
  371. uint8_t Save_PIC_VDDGFX_ENTER;
  372. uint8_t padding;
  373. };
  374. typedef struct SMU7_MclkDpmScoreboard SMU7_MclkDpmScoreboard;
  375. struct SMU7_UlvScoreboard
  376. {
  377. uint8_t EnterUlv;
  378. uint8_t ExitUlv;
  379. uint8_t UlvActive;
  380. uint8_t WaitingForUlv;
  381. uint8_t UlvEnable;
  382. uint8_t UlvRunning;
  383. uint8_t UlvMasterEnable;
  384. uint8_t padding;
  385. uint32_t UlvAbortedCount;
  386. uint32_t UlvTimeStamp;
  387. };
  388. typedef struct SMU7_UlvScoreboard SMU7_UlvScoreboard;
  389. struct VddgfxSavedRegisters
  390. {
  391. uint32_t GPU_DBG[3];
  392. uint32_t MEC_BaseAddress_Hi;
  393. uint32_t MEC_BaseAddress_Lo;
  394. uint32_t THM_TMON0_CTRL2__RDIR_PRESENT;
  395. uint32_t THM_TMON1_CTRL2__RDIR_PRESENT;
  396. uint32_t CP_INT_CNTL;
  397. };
  398. typedef struct VddgfxSavedRegisters VddgfxSavedRegisters;
  399. struct SMU7_VddGfxScoreboard
  400. {
  401. uint8_t VddGfxEnable;
  402. uint8_t VddGfxActive;
  403. uint8_t VPUResetOccured;
  404. uint8_t padding;
  405. uint32_t VddGfxEnteredCount;
  406. uint32_t VddGfxAbortedCount;
  407. uint32_t VddGfxVid;
  408. VddgfxSavedRegisters SavedRegisters;
  409. };
  410. typedef struct SMU7_VddGfxScoreboard SMU7_VddGfxScoreboard;
  411. struct SMU7_TdcLimitScoreboard {
  412. uint8_t Enable;
  413. uint8_t Running;
  414. uint16_t Alpha;
  415. uint32_t FilteredIddc;
  416. uint32_t IddcLimit;
  417. uint32_t IddcHyst;
  418. SMU7_HystController_Data HystControllerData;
  419. };
  420. typedef struct SMU7_TdcLimitScoreboard SMU7_TdcLimitScoreboard;
  421. struct SMU7_PkgPwrLimitScoreboard {
  422. uint8_t Enable;
  423. uint8_t Running;
  424. uint16_t Alpha;
  425. uint32_t FilteredPkgPwr;
  426. uint32_t Limit;
  427. uint32_t Hyst;
  428. uint32_t LimitFromDriver;
  429. SMU7_HystController_Data HystControllerData;
  430. };
  431. typedef struct SMU7_PkgPwrLimitScoreboard SMU7_PkgPwrLimitScoreboard;
  432. struct SMU7_BapmScoreboard {
  433. uint32_t source_powers[SMU73_DTE_SOURCES];
  434. uint32_t source_powers_last[SMU73_DTE_SOURCES];
  435. int32_t entity_temperatures[SMU73_NUM_GPU_TES];
  436. int32_t initial_entity_temperatures[SMU73_NUM_GPU_TES];
  437. int32_t Limit;
  438. int32_t Hyst;
  439. int32_t therm_influence_coeff_table[SMU73_DTE_ITERATIONS * SMU73_DTE_SOURCES * SMU73_DTE_SINKS * 2];
  440. int32_t therm_node_table[SMU73_DTE_ITERATIONS * SMU73_DTE_SOURCES * SMU73_DTE_SINKS];
  441. uint16_t ConfigTDPPowerScalar;
  442. uint16_t FanSpeedPowerScalar;
  443. uint16_t OverDrivePowerScalar;
  444. uint16_t OverDriveLimitScalar;
  445. uint16_t FinalPowerScalar;
  446. uint8_t VariantID;
  447. uint8_t spare997;
  448. SMU7_HystController_Data HystControllerData;
  449. int32_t temperature_gradient_slope;
  450. int32_t temperature_gradient;
  451. uint32_t measured_temperature;
  452. };
  453. typedef struct SMU7_BapmScoreboard SMU7_BapmScoreboard;
  454. struct SMU7_AcpiScoreboard {
  455. uint32_t SavedInterruptMask[2];
  456. uint8_t LastACPIRequest;
  457. uint8_t CgBifResp;
  458. uint8_t RequestType;
  459. uint8_t Padding;
  460. SMU73_Discrete_ACPILevel D0Level;
  461. };
  462. typedef struct SMU7_AcpiScoreboard SMU7_AcpiScoreboard;
  463. struct SMU_QuadraticCoeffs {
  464. int32_t m1;
  465. uint32_t b;
  466. int16_t m2;
  467. uint8_t m1_shift;
  468. uint8_t m2_shift;
  469. };
  470. typedef struct SMU_QuadraticCoeffs SMU_QuadraticCoeffs;
  471. struct SMU73_Discrete_PmFuses {
  472. /* dw0-dw1 */
  473. uint8_t BapmVddCVidHiSidd[8];
  474. /* dw2-dw3 */
  475. uint8_t BapmVddCVidLoSidd[8];
  476. /* dw4-dw5 */
  477. uint8_t VddCVid[8];
  478. /* dw1*/
  479. uint8_t SviLoadLineEn;
  480. uint8_t SviLoadLineVddC;
  481. uint8_t SviLoadLineTrimVddC;
  482. uint8_t SviLoadLineOffsetVddC;
  483. /* dw2 */
  484. uint16_t TDC_VDDC_PkgLimit;
  485. uint8_t TDC_VDDC_ThrottleReleaseLimitPerc;
  486. uint8_t TDC_MAWt;
  487. /* dw3 */
  488. uint8_t TdcWaterfallCtl;
  489. uint8_t LPMLTemperatureMin;
  490. uint8_t LPMLTemperatureMax;
  491. uint8_t Reserved;
  492. /* dw4-dw7 */
  493. uint8_t LPMLTemperatureScaler[16];
  494. /* dw8-dw9 */
  495. int16_t FuzzyFan_ErrorSetDelta;
  496. int16_t FuzzyFan_ErrorRateSetDelta;
  497. int16_t FuzzyFan_PwmSetDelta;
  498. uint16_t Reserved6;
  499. /* dw10-dw14 */
  500. uint8_t GnbLPML[16];
  501. /* dw15 */
  502. uint8_t GnbLPMLMaxVid;
  503. uint8_t GnbLPMLMinVid;
  504. uint8_t Reserved1[2];
  505. /* dw16 */
  506. uint16_t BapmVddCBaseLeakageHiSidd;
  507. uint16_t BapmVddCBaseLeakageLoSidd;
  508. /* AVFS */
  509. uint16_t VFT_Temp[3];
  510. uint16_t padding;
  511. SMU_QuadraticCoeffs VFT_ATE[3];
  512. SMU_QuadraticCoeffs AVFS_GB;
  513. SMU_QuadraticCoeffs ATE_ACBTC_GB;
  514. SMU_QuadraticCoeffs P2V;
  515. uint32_t PsmCharzFreq;
  516. uint16_t InversionVoltage;
  517. uint16_t PsmCharzTemp;
  518. uint32_t EnabledAvfsModules;
  519. };
  520. typedef struct SMU73_Discrete_PmFuses SMU73_Discrete_PmFuses;
  521. struct SMU7_Discrete_Log_Header_Table {
  522. uint32_t version;
  523. uint32_t asic_id;
  524. uint16_t flags;
  525. uint16_t entry_size;
  526. uint32_t total_size;
  527. uint32_t num_of_entries;
  528. uint8_t type;
  529. uint8_t mode;
  530. uint8_t filler_0[2];
  531. uint32_t filler_1[2];
  532. };
  533. typedef struct SMU7_Discrete_Log_Header_Table SMU7_Discrete_Log_Header_Table;
  534. struct SMU7_Discrete_Log_Cntl {
  535. uint8_t Enabled;
  536. uint8_t Type;
  537. uint8_t padding[2];
  538. uint32_t BufferSize;
  539. uint32_t SamplesLogged;
  540. uint32_t SampleSize;
  541. uint32_t AddrL;
  542. uint32_t AddrH;
  543. };
  544. typedef struct SMU7_Discrete_Log_Cntl SMU7_Discrete_Log_Cntl;
  545. #define CAC_ACC_NW_NUM_OF_SIGNALS 87
  546. struct SMU7_Discrete_Cac_Collection_Table {
  547. uint32_t temperature;
  548. uint32_t cac_acc_nw[CAC_ACC_NW_NUM_OF_SIGNALS];
  549. };
  550. typedef struct SMU7_Discrete_Cac_Collection_Table SMU7_Discrete_Cac_Collection_Table;
  551. struct SMU7_Discrete_Cac_Verification_Table {
  552. uint32_t VddcTotalPower;
  553. uint32_t VddcLeakagePower;
  554. uint32_t VddcConstantPower;
  555. uint32_t VddcGfxDynamicPower;
  556. uint32_t VddcUvdDynamicPower;
  557. uint32_t VddcVceDynamicPower;
  558. uint32_t VddcAcpDynamicPower;
  559. uint32_t VddcPcieDynamicPower;
  560. uint32_t VddcDceDynamicPower;
  561. uint32_t VddcCurrent;
  562. uint32_t VddcVoltage;
  563. uint32_t VddciTotalPower;
  564. uint32_t VddciLeakagePower;
  565. uint32_t VddciConstantPower;
  566. uint32_t VddciDynamicPower;
  567. uint32_t Vddr1TotalPower;
  568. uint32_t Vddr1LeakagePower;
  569. uint32_t Vddr1ConstantPower;
  570. uint32_t Vddr1DynamicPower;
  571. uint32_t spare[4];
  572. uint32_t temperature;
  573. };
  574. typedef struct SMU7_Discrete_Cac_Verification_Table SMU7_Discrete_Cac_Verification_Table;
  575. struct SMU7_Discrete_Pm_Status_Table {
  576. //Thermal entities
  577. int32_t T_meas_max[SMU73_THERMAL_INPUT_LOOP_COUNT];
  578. int32_t T_meas_acc[SMU73_THERMAL_INPUT_LOOP_COUNT];
  579. int32_t T_meas_acc_cnt[SMU73_THERMAL_INPUT_LOOP_COUNT];
  580. uint32_t T_hbm_acc;
  581. //Voltage domains
  582. uint32_t I_calc_max;
  583. uint32_t I_calc_acc;
  584. uint32_t P_meas_acc;
  585. uint32_t V_meas_load_acc;
  586. uint32_t I_meas_acc;
  587. uint32_t P_meas_acc_vddci;
  588. uint32_t V_meas_load_acc_vddci;
  589. uint32_t I_meas_acc_vddci;
  590. //Frequency
  591. uint16_t Sclk_dpm_residency[8];
  592. uint16_t Uvd_dpm_residency[8];
  593. uint16_t Vce_dpm_residency[8];
  594. //Chip
  595. uint32_t P_roc_acc;
  596. uint32_t PkgPwr_max;
  597. uint32_t PkgPwr_acc;
  598. uint32_t MclkSwitchingTime_max;
  599. uint32_t MclkSwitchingTime_acc;
  600. uint32_t FanPwm_acc;
  601. uint32_t FanRpm_acc;
  602. uint32_t Gfx_busy_acc;
  603. uint32_t Mc_busy_acc;
  604. uint32_t Fps_acc;
  605. uint32_t AccCnt;
  606. };
  607. typedef struct SMU7_Discrete_Pm_Status_Table SMU7_Discrete_Pm_Status_Table;
  608. //FIXME THESE NEED TO BE UPDATED
  609. #define SMU7_SCLK_CAC 0x561
  610. #define SMU7_MCLK_CAC 0xF9
  611. #define SMU7_VCLK_CAC 0x2DE
  612. #define SMU7_DCLK_CAC 0x2DE
  613. #define SMU7_ECLK_CAC 0x25E
  614. #define SMU7_ACLK_CAC 0x25E
  615. #define SMU7_SAMCLK_CAC 0x25E
  616. #define SMU7_DISPCLK_CAC 0x100
  617. #define SMU7_CAC_CONSTANT 0x2EE3430
  618. #define SMU7_CAC_CONSTANT_SHIFT 18
  619. #define SMU7_VDDCI_MCLK_CONST 1765
  620. #define SMU7_VDDCI_MCLK_CONST_SHIFT 16
  621. #define SMU7_VDDCI_VDDCI_CONST 50958
  622. #define SMU7_VDDCI_VDDCI_CONST_SHIFT 14
  623. #define SMU7_VDDCI_CONST 11781
  624. #define SMU7_VDDCI_STROBE_PWR 1331
  625. #define SMU7_VDDR1_CONST 693
  626. #define SMU7_VDDR1_CAC_WEIGHT 20
  627. #define SMU7_VDDR1_CAC_WEIGHT_SHIFT 19
  628. #define SMU7_VDDR1_STROBE_PWR 512
  629. #define SMU7_AREA_COEFF_UVD 0xA78
  630. #define SMU7_AREA_COEFF_VCE 0x190A
  631. #define SMU7_AREA_COEFF_ACP 0x22D1
  632. #define SMU7_AREA_COEFF_SAMU 0x534
  633. //ThermOutMode values
  634. #define SMU7_THERM_OUT_MODE_DISABLE 0x0
  635. #define SMU7_THERM_OUT_MODE_THERM_ONLY 0x1
  636. #define SMU7_THERM_OUT_MODE_THERM_VRHOT 0x2
  637. #pragma pack(pop)
  638. #endif