smu72_discrete.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef SMU72_DISCRETE_H
  3. #define SMU72_DISCRETE_H
  4. #include "smu72.h"
  5. #if !defined(SMC_MICROCODE)
  6. #pragma pack(push, 1)
  7. #endif
  8. struct SMIO_Pattern {
  9. uint16_t Voltage;
  10. uint8_t Smio;
  11. uint8_t padding;
  12. };
  13. typedef struct SMIO_Pattern SMIO_Pattern;
  14. struct SMIO_Table {
  15. SMIO_Pattern Pattern[SMU_MAX_SMIO_LEVELS];
  16. };
  17. typedef struct SMIO_Table SMIO_Table;
  18. struct SMU72_Discrete_GraphicsLevel {
  19. SMU_VoltageLevel MinVoltage;
  20. uint32_t SclkFrequency;
  21. uint8_t pcieDpmLevel;
  22. uint8_t DeepSleepDivId;
  23. uint16_t ActivityLevel;
  24. uint32_t CgSpllFuncCntl3;
  25. uint32_t CgSpllFuncCntl4;
  26. uint32_t SpllSpreadSpectrum;
  27. uint32_t SpllSpreadSpectrum2;
  28. uint32_t CcPwrDynRm;
  29. uint32_t CcPwrDynRm1;
  30. uint8_t SclkDid;
  31. uint8_t DisplayWatermark;
  32. uint8_t EnabledForActivity;
  33. uint8_t EnabledForThrottle;
  34. uint8_t UpHyst;
  35. uint8_t DownHyst;
  36. uint8_t VoltageDownHyst;
  37. uint8_t PowerThrottle;
  38. };
  39. typedef struct SMU72_Discrete_GraphicsLevel SMU72_Discrete_GraphicsLevel;
  40. struct SMU72_Discrete_ACPILevel {
  41. uint32_t Flags;
  42. SMU_VoltageLevel MinVoltage;
  43. uint32_t SclkFrequency;
  44. uint8_t SclkDid;
  45. uint8_t DisplayWatermark;
  46. uint8_t DeepSleepDivId;
  47. uint8_t padding;
  48. uint32_t CgSpllFuncCntl;
  49. uint32_t CgSpllFuncCntl2;
  50. uint32_t CgSpllFuncCntl3;
  51. uint32_t CgSpllFuncCntl4;
  52. uint32_t SpllSpreadSpectrum;
  53. uint32_t SpllSpreadSpectrum2;
  54. uint32_t CcPwrDynRm;
  55. uint32_t CcPwrDynRm1;
  56. };
  57. typedef struct SMU72_Discrete_ACPILevel SMU72_Discrete_ACPILevel;
  58. struct SMU72_Discrete_Ulv {
  59. uint32_t CcPwrDynRm;
  60. uint32_t CcPwrDynRm1;
  61. uint16_t VddcOffset;
  62. uint8_t VddcOffsetVid;
  63. uint8_t VddcPhase;
  64. uint32_t Reserved;
  65. };
  66. typedef struct SMU72_Discrete_Ulv SMU72_Discrete_Ulv;
  67. struct SMU72_Discrete_MemoryLevel {
  68. SMU_VoltageLevel MinVoltage;
  69. uint32_t MinMvdd;
  70. uint32_t MclkFrequency;
  71. uint8_t EdcReadEnable;
  72. uint8_t EdcWriteEnable;
  73. uint8_t RttEnable;
  74. uint8_t StutterEnable;
  75. uint8_t StrobeEnable;
  76. uint8_t StrobeRatio;
  77. uint8_t EnabledForThrottle;
  78. uint8_t EnabledForActivity;
  79. uint8_t UpHyst;
  80. uint8_t DownHyst;
  81. uint8_t VoltageDownHyst;
  82. uint8_t padding;
  83. uint16_t ActivityLevel;
  84. uint8_t DisplayWatermark;
  85. uint8_t padding1;
  86. uint32_t MpllFuncCntl;
  87. uint32_t MpllFuncCntl_1;
  88. uint32_t MpllFuncCntl_2;
  89. uint32_t MpllAdFuncCntl;
  90. uint32_t MpllDqFuncCntl;
  91. uint32_t MclkPwrmgtCntl;
  92. uint32_t DllCntl;
  93. uint32_t MpllSs1;
  94. uint32_t MpllSs2;
  95. };
  96. typedef struct SMU72_Discrete_MemoryLevel SMU72_Discrete_MemoryLevel;
  97. struct SMU72_Discrete_LinkLevel {
  98. uint8_t PcieGenSpeed; /*< 0:PciE-gen1 1:PciE-gen2 2:PciE-gen3 */
  99. uint8_t PcieLaneCount; /*< 1=x1, 2=x2, 3=x4, 4=x8, 5=x12, 6=x16 */
  100. uint8_t EnabledForActivity;
  101. uint8_t SPC;
  102. uint32_t DownThreshold;
  103. uint32_t UpThreshold;
  104. uint32_t Reserved;
  105. };
  106. typedef struct SMU72_Discrete_LinkLevel SMU72_Discrete_LinkLevel;
  107. /* MC ARB DRAM Timing registers. */
  108. struct SMU72_Discrete_MCArbDramTimingTableEntry {
  109. uint32_t McArbDramTiming;
  110. uint32_t McArbDramTiming2;
  111. uint8_t McArbBurstTime;
  112. uint8_t padding[3];
  113. };
  114. typedef struct SMU72_Discrete_MCArbDramTimingTableEntry SMU72_Discrete_MCArbDramTimingTableEntry;
  115. struct SMU72_Discrete_MCArbDramTimingTable {
  116. SMU72_Discrete_MCArbDramTimingTableEntry entries[SMU__NUM_SCLK_DPM_STATE][SMU__NUM_MCLK_DPM_LEVELS];
  117. };
  118. typedef struct SMU72_Discrete_MCArbDramTimingTable SMU72_Discrete_MCArbDramTimingTable;
  119. /* UVD VCLK/DCLK state (level) definition. */
  120. struct SMU72_Discrete_UvdLevel {
  121. uint32_t VclkFrequency;
  122. uint32_t DclkFrequency;
  123. SMU_VoltageLevel MinVoltage;
  124. uint8_t VclkDivider;
  125. uint8_t DclkDivider;
  126. uint8_t padding[2];
  127. };
  128. typedef struct SMU72_Discrete_UvdLevel SMU72_Discrete_UvdLevel;
  129. /* Clocks for other external blocks (VCE, ACP, SAMU). */
  130. struct SMU72_Discrete_ExtClkLevel {
  131. uint32_t Frequency;
  132. SMU_VoltageLevel MinVoltage;
  133. uint8_t Divider;
  134. uint8_t padding[3];
  135. };
  136. typedef struct SMU72_Discrete_ExtClkLevel SMU72_Discrete_ExtClkLevel;
  137. struct SMU72_Discrete_StateInfo {
  138. uint32_t SclkFrequency;
  139. uint32_t MclkFrequency;
  140. uint32_t VclkFrequency;
  141. uint32_t DclkFrequency;
  142. uint32_t SamclkFrequency;
  143. uint32_t AclkFrequency;
  144. uint32_t EclkFrequency;
  145. uint16_t MvddVoltage;
  146. uint16_t padding16;
  147. uint8_t DisplayWatermark;
  148. uint8_t McArbIndex;
  149. uint8_t McRegIndex;
  150. uint8_t SeqIndex;
  151. uint8_t SclkDid;
  152. int8_t SclkIndex;
  153. int8_t MclkIndex;
  154. uint8_t PCIeGen;
  155. };
  156. typedef struct SMU72_Discrete_StateInfo SMU72_Discrete_StateInfo;
  157. struct SMU72_Discrete_DpmTable {
  158. /* Multi-DPM controller settings */
  159. SMU72_PIDController GraphicsPIDController;
  160. SMU72_PIDController MemoryPIDController;
  161. SMU72_PIDController LinkPIDController;
  162. uint32_t SystemFlags;
  163. /* SMIO masks for voltage and phase controls */
  164. uint32_t VRConfig;
  165. uint32_t SmioMask1;
  166. uint32_t SmioMask2;
  167. SMIO_Table SmioTable1;
  168. SMIO_Table SmioTable2;
  169. uint32_t VddcLevelCount;
  170. uint32_t VddciLevelCount;
  171. uint32_t VddGfxLevelCount;
  172. uint32_t MvddLevelCount;
  173. uint16_t VddcTable[SMU72_MAX_LEVELS_VDDC];
  174. uint16_t VddGfxTable[SMU72_MAX_LEVELS_VDDGFX];
  175. uint16_t VddciTable[SMU72_MAX_LEVELS_VDDCI];
  176. uint8_t BapmVddGfxVidHiSidd[SMU72_MAX_LEVELS_VDDGFX];
  177. uint8_t BapmVddGfxVidLoSidd[SMU72_MAX_LEVELS_VDDGFX];
  178. uint8_t BapmVddGfxVidHiSidd2[SMU72_MAX_LEVELS_VDDGFX];
  179. uint8_t BapmVddcVidHiSidd[SMU72_MAX_LEVELS_VDDC];
  180. uint8_t BapmVddcVidLoSidd[SMU72_MAX_LEVELS_VDDC];
  181. uint8_t BapmVddcVidHiSidd2[SMU72_MAX_LEVELS_VDDC];
  182. uint8_t GraphicsDpmLevelCount;
  183. uint8_t MemoryDpmLevelCount;
  184. uint8_t LinkLevelCount;
  185. uint8_t MasterDeepSleepControl;
  186. uint8_t UvdLevelCount;
  187. uint8_t VceLevelCount;
  188. uint8_t AcpLevelCount;
  189. uint8_t SamuLevelCount;
  190. uint8_t ThermOutGpio;
  191. uint8_t ThermOutPolarity;
  192. uint8_t ThermOutMode;
  193. uint8_t DPMFreezeAndForced;
  194. uint32_t Reserved[4];
  195. /* State table entries for each DPM state */
  196. SMU72_Discrete_GraphicsLevel GraphicsLevel[SMU72_MAX_LEVELS_GRAPHICS];
  197. SMU72_Discrete_MemoryLevel MemoryACPILevel;
  198. SMU72_Discrete_MemoryLevel MemoryLevel[SMU72_MAX_LEVELS_MEMORY];
  199. SMU72_Discrete_LinkLevel LinkLevel[SMU72_MAX_LEVELS_LINK];
  200. SMU72_Discrete_ACPILevel ACPILevel;
  201. SMU72_Discrete_UvdLevel UvdLevel[SMU72_MAX_LEVELS_UVD];
  202. SMU72_Discrete_ExtClkLevel VceLevel[SMU72_MAX_LEVELS_VCE];
  203. SMU72_Discrete_ExtClkLevel AcpLevel[SMU72_MAX_LEVELS_ACP];
  204. SMU72_Discrete_ExtClkLevel SamuLevel[SMU72_MAX_LEVELS_SAMU];
  205. SMU72_Discrete_Ulv Ulv;
  206. uint32_t SclkStepSize;
  207. uint32_t Smio[SMU72_MAX_ENTRIES_SMIO];
  208. uint8_t UvdBootLevel;
  209. uint8_t VceBootLevel;
  210. uint8_t AcpBootLevel;
  211. uint8_t SamuBootLevel;
  212. uint8_t GraphicsBootLevel;
  213. uint8_t GraphicsVoltageChangeEnable;
  214. uint8_t GraphicsThermThrottleEnable;
  215. uint8_t GraphicsInterval;
  216. uint8_t VoltageInterval;
  217. uint8_t ThermalInterval;
  218. uint16_t TemperatureLimitHigh;
  219. uint16_t TemperatureLimitLow;
  220. uint8_t MemoryBootLevel;
  221. uint8_t MemoryVoltageChangeEnable;
  222. uint16_t BootMVdd;
  223. uint8_t MemoryInterval;
  224. uint8_t MemoryThermThrottleEnable;
  225. uint16_t VoltageResponseTime;
  226. uint16_t PhaseResponseTime;
  227. uint8_t PCIeBootLinkLevel;
  228. uint8_t PCIeGenInterval;
  229. uint8_t DTEInterval;
  230. uint8_t DTEMode;
  231. uint8_t SVI2Enable;
  232. uint8_t VRHotGpio;
  233. uint8_t AcDcGpio;
  234. uint8_t ThermGpio;
  235. uint16_t PPM_PkgPwrLimit;
  236. uint16_t PPM_TemperatureLimit;
  237. uint16_t DefaultTdp;
  238. uint16_t TargetTdp;
  239. uint16_t FpsHighThreshold;
  240. uint16_t FpsLowThreshold;
  241. uint16_t BAPMTI_R[SMU72_DTE_ITERATIONS][SMU72_DTE_SOURCES][SMU72_DTE_SINKS];
  242. uint16_t BAPMTI_RC[SMU72_DTE_ITERATIONS][SMU72_DTE_SOURCES][SMU72_DTE_SINKS];
  243. uint8_t DTEAmbientTempBase;
  244. uint8_t DTETjOffset;
  245. uint8_t GpuTjMax;
  246. uint8_t GpuTjHyst;
  247. SMU_VoltageLevel BootVoltage;
  248. uint32_t BAPM_TEMP_GRADIENT;
  249. uint32_t LowSclkInterruptThreshold;
  250. uint32_t VddGfxReChkWait;
  251. uint8_t ClockStretcherAmount;
  252. uint8_t Sclk_CKS_masterEn0_7;
  253. uint8_t Sclk_CKS_masterEn8_15;
  254. uint8_t padding[1];
  255. uint8_t Sclk_voltageOffset[8];
  256. SMU_ClockStretcherDataTable ClockStretcherDataTable;
  257. SMU_CKS_LOOKUPTable CKS_LOOKUPTable;
  258. };
  259. typedef struct SMU72_Discrete_DpmTable SMU72_Discrete_DpmTable;
  260. /* --------------------------------------------------- AC Timing Parameters ------------------------------------------------ */
  261. #define SMU72_DISCRETE_MC_REGISTER_ARRAY_SIZE 16
  262. #define SMU72_DISCRETE_MC_REGISTER_ARRAY_SET_COUNT SMU72_MAX_LEVELS_MEMORY /* DPM */
  263. struct SMU72_Discrete_MCRegisterAddress {
  264. uint16_t s0;
  265. uint16_t s1;
  266. };
  267. typedef struct SMU72_Discrete_MCRegisterAddress SMU72_Discrete_MCRegisterAddress;
  268. struct SMU72_Discrete_MCRegisterSet {
  269. uint32_t value[SMU72_DISCRETE_MC_REGISTER_ARRAY_SIZE];
  270. };
  271. typedef struct SMU72_Discrete_MCRegisterSet SMU72_Discrete_MCRegisterSet;
  272. struct SMU72_Discrete_MCRegisters {
  273. uint8_t last;
  274. uint8_t reserved[3];
  275. SMU72_Discrete_MCRegisterAddress address[SMU72_DISCRETE_MC_REGISTER_ARRAY_SIZE];
  276. SMU72_Discrete_MCRegisterSet data[SMU72_DISCRETE_MC_REGISTER_ARRAY_SET_COUNT];
  277. };
  278. typedef struct SMU72_Discrete_MCRegisters SMU72_Discrete_MCRegisters;
  279. /* --------------------------------------------------- Fan Table ----------------------------------------------------------- */
  280. struct SMU72_Discrete_FanTable {
  281. uint16_t FdoMode;
  282. int16_t TempMin;
  283. int16_t TempMed;
  284. int16_t TempMax;
  285. int16_t Slope1;
  286. int16_t Slope2;
  287. int16_t FdoMin;
  288. int16_t HystUp;
  289. int16_t HystDown;
  290. int16_t HystSlope;
  291. int16_t TempRespLim;
  292. int16_t TempCurr;
  293. int16_t SlopeCurr;
  294. int16_t PwmCurr;
  295. uint32_t RefreshPeriod;
  296. int16_t FdoMax;
  297. uint8_t TempSrc;
  298. int8_t FanControl_GL_Flag;
  299. };
  300. typedef struct SMU72_Discrete_FanTable SMU72_Discrete_FanTable;
  301. #define SMU7_DISCRETE_GPIO_SCLK_DEBUG 4
  302. #define SMU7_DISCRETE_GPIO_SCLK_DEBUG_BIT (0x1 << SMU7_DISCRETE_GPIO_SCLK_DEBUG)
  303. struct SMU7_MclkDpmScoreboard {
  304. uint32_t PercentageBusy;
  305. int32_t PIDError;
  306. int32_t PIDIntegral;
  307. int32_t PIDOutput;
  308. uint32_t SigmaDeltaAccum;
  309. uint32_t SigmaDeltaOutput;
  310. uint32_t SigmaDeltaLevel;
  311. uint32_t UtilizationSetpoint;
  312. uint8_t TdpClampMode;
  313. uint8_t TdcClampMode;
  314. uint8_t ThermClampMode;
  315. uint8_t VoltageBusy;
  316. int8_t CurrLevel;
  317. int8_t TargLevel;
  318. uint8_t LevelChangeInProgress;
  319. uint8_t UpHyst;
  320. uint8_t DownHyst;
  321. uint8_t VoltageDownHyst;
  322. uint8_t DpmEnable;
  323. uint8_t DpmRunning;
  324. uint8_t DpmForce;
  325. uint8_t DpmForceLevel;
  326. uint8_t DisplayWatermark;
  327. uint8_t McArbIndex;
  328. uint32_t MinimumPerfMclk;
  329. uint8_t AcpiReq;
  330. uint8_t AcpiAck;
  331. uint8_t MclkSwitchInProgress;
  332. uint8_t MclkSwitchCritical;
  333. uint8_t IgnoreVBlank;
  334. uint8_t TargetMclkIndex;
  335. uint8_t TargetMvddIndex;
  336. uint8_t MclkSwitchResult;
  337. uint16_t VbiFailureCount;
  338. uint8_t VbiWaitCounter;
  339. uint8_t EnabledLevelsChange;
  340. uint16_t LevelResidencyCountersN[SMU72_MAX_LEVELS_MEMORY];
  341. uint16_t LevelSwitchCounters[SMU72_MAX_LEVELS_MEMORY];
  342. void (*TargetStateCalculator)(uint8_t);
  343. void (*SavedTargetStateCalculator)(uint8_t);
  344. uint16_t AutoDpmInterval;
  345. uint16_t AutoDpmRange;
  346. uint16_t VbiTimeoutCount;
  347. uint16_t MclkSwitchingTime;
  348. uint8_t fastSwitch;
  349. uint8_t Save_PIC_VDDGFX_EXIT;
  350. uint8_t Save_PIC_VDDGFX_ENTER;
  351. uint8_t padding;
  352. };
  353. typedef struct SMU7_MclkDpmScoreboard SMU7_MclkDpmScoreboard;
  354. struct SMU7_UlvScoreboard {
  355. uint8_t EnterUlv;
  356. uint8_t ExitUlv;
  357. uint8_t UlvActive;
  358. uint8_t WaitingForUlv;
  359. uint8_t UlvEnable;
  360. uint8_t UlvRunning;
  361. uint8_t UlvMasterEnable;
  362. uint8_t padding;
  363. uint32_t UlvAbortedCount;
  364. uint32_t UlvTimeStamp;
  365. };
  366. typedef struct SMU7_UlvScoreboard SMU7_UlvScoreboard;
  367. struct VddgfxSavedRegisters {
  368. uint32_t GPU_DBG[3];
  369. uint32_t MEC_BaseAddress_Hi;
  370. uint32_t MEC_BaseAddress_Lo;
  371. uint32_t THM_TMON0_CTRL2__RDIR_PRESENT;
  372. uint32_t THM_TMON1_CTRL2__RDIR_PRESENT;
  373. uint32_t CP_INT_CNTL;
  374. };
  375. typedef struct VddgfxSavedRegisters VddgfxSavedRegisters;
  376. struct SMU7_VddGfxScoreboard {
  377. uint8_t VddGfxEnable;
  378. uint8_t VddGfxActive;
  379. uint8_t VPUResetOccured;
  380. uint8_t padding;
  381. uint32_t VddGfxEnteredCount;
  382. uint32_t VddGfxAbortedCount;
  383. uint32_t VddGfxVid;
  384. VddgfxSavedRegisters SavedRegisters;
  385. };
  386. typedef struct SMU7_VddGfxScoreboard SMU7_VddGfxScoreboard;
  387. struct SMU7_TdcLimitScoreboard {
  388. uint8_t Enable;
  389. uint8_t Running;
  390. uint16_t Alpha;
  391. uint32_t FilteredIddc;
  392. uint32_t IddcLimit;
  393. uint32_t IddcHyst;
  394. SMU7_HystController_Data HystControllerData;
  395. };
  396. typedef struct SMU7_TdcLimitScoreboard SMU7_TdcLimitScoreboard;
  397. struct SMU7_PkgPwrLimitScoreboard {
  398. uint8_t Enable;
  399. uint8_t Running;
  400. uint16_t Alpha;
  401. uint32_t FilteredPkgPwr;
  402. uint32_t Limit;
  403. uint32_t Hyst;
  404. uint32_t LimitFromDriver;
  405. SMU7_HystController_Data HystControllerData;
  406. };
  407. typedef struct SMU7_PkgPwrLimitScoreboard SMU7_PkgPwrLimitScoreboard;
  408. struct SMU7_BapmScoreboard {
  409. uint32_t source_powers[SMU72_DTE_SOURCES];
  410. uint32_t source_powers_last[SMU72_DTE_SOURCES];
  411. int32_t entity_temperatures[SMU72_NUM_GPU_TES];
  412. int32_t initial_entity_temperatures[SMU72_NUM_GPU_TES];
  413. int32_t Limit;
  414. int32_t Hyst;
  415. int32_t therm_influence_coeff_table[SMU72_DTE_ITERATIONS * SMU72_DTE_SOURCES * SMU72_DTE_SINKS * 2];
  416. int32_t therm_node_table[SMU72_DTE_ITERATIONS * SMU72_DTE_SOURCES * SMU72_DTE_SINKS];
  417. uint16_t ConfigTDPPowerScalar;
  418. uint16_t FanSpeedPowerScalar;
  419. uint16_t OverDrivePowerScalar;
  420. uint16_t OverDriveLimitScalar;
  421. uint16_t FinalPowerScalar;
  422. uint8_t VariantID;
  423. uint8_t spare997;
  424. SMU7_HystController_Data HystControllerData;
  425. int32_t temperature_gradient_slope;
  426. int32_t temperature_gradient;
  427. uint32_t measured_temperature;
  428. };
  429. typedef struct SMU7_BapmScoreboard SMU7_BapmScoreboard;
  430. struct SMU7_AcpiScoreboard {
  431. uint32_t SavedInterruptMask[2];
  432. uint8_t LastACPIRequest;
  433. uint8_t CgBifResp;
  434. uint8_t RequestType;
  435. uint8_t Padding;
  436. SMU72_Discrete_ACPILevel D0Level;
  437. };
  438. typedef struct SMU7_AcpiScoreboard SMU7_AcpiScoreboard;
  439. struct SMU72_Discrete_PmFuses {
  440. /* dw1 */
  441. uint8_t SviLoadLineEn;
  442. uint8_t SviLoadLineVddC;
  443. uint8_t SviLoadLineTrimVddC;
  444. uint8_t SviLoadLineOffsetVddC;
  445. /* dw2 */
  446. uint16_t TDC_VDDC_PkgLimit;
  447. uint8_t TDC_VDDC_ThrottleReleaseLimitPerc;
  448. uint8_t TDC_MAWt;
  449. /* dw3 */
  450. uint8_t TdcWaterfallCtl;
  451. uint8_t LPMLTemperatureMin;
  452. uint8_t LPMLTemperatureMax;
  453. uint8_t Reserved;
  454. /* dw4-dw7 */
  455. uint8_t LPMLTemperatureScaler[16];
  456. /* dw8-dw9 */
  457. int16_t FuzzyFan_ErrorSetDelta;
  458. int16_t FuzzyFan_ErrorRateSetDelta;
  459. int16_t FuzzyFan_PwmSetDelta;
  460. uint16_t Reserved6;
  461. /* dw10-dw14 */
  462. uint8_t GnbLPML[16];
  463. /* dw15 */
  464. uint8_t GnbLPMLMaxVid;
  465. uint8_t GnbLPMLMinVid;
  466. uint8_t Reserved1[2];
  467. /* dw16 */
  468. uint16_t BapmVddCBaseLeakageHiSidd;
  469. uint16_t BapmVddCBaseLeakageLoSidd;
  470. };
  471. typedef struct SMU72_Discrete_PmFuses SMU72_Discrete_PmFuses;
  472. struct SMU7_Discrete_Log_Header_Table {
  473. uint32_t version;
  474. uint32_t asic_id;
  475. uint16_t flags;
  476. uint16_t entry_size;
  477. uint32_t total_size;
  478. uint32_t num_of_entries;
  479. uint8_t type;
  480. uint8_t mode;
  481. uint8_t filler_0[2];
  482. uint32_t filler_1[2];
  483. };
  484. typedef struct SMU7_Discrete_Log_Header_Table SMU7_Discrete_Log_Header_Table;
  485. struct SMU7_Discrete_Log_Cntl {
  486. uint8_t Enabled;
  487. uint8_t Type;
  488. uint8_t padding[2];
  489. uint32_t BufferSize;
  490. uint32_t SamplesLogged;
  491. uint32_t SampleSize;
  492. uint32_t AddrL;
  493. uint32_t AddrH;
  494. };
  495. typedef struct SMU7_Discrete_Log_Cntl SMU7_Discrete_Log_Cntl;
  496. #define CAC_ACC_NW_NUM_OF_SIGNALS 87
  497. struct SMU7_Discrete_Cac_Collection_Table {
  498. uint32_t temperature;
  499. uint32_t cac_acc_nw[CAC_ACC_NW_NUM_OF_SIGNALS];
  500. };
  501. typedef struct SMU7_Discrete_Cac_Collection_Table SMU7_Discrete_Cac_Collection_Table;
  502. struct SMU7_Discrete_Cac_Verification_Table {
  503. uint32_t VddcTotalPower;
  504. uint32_t VddcLeakagePower;
  505. uint32_t VddcConstantPower;
  506. uint32_t VddcGfxDynamicPower;
  507. uint32_t VddcUvdDynamicPower;
  508. uint32_t VddcVceDynamicPower;
  509. uint32_t VddcAcpDynamicPower;
  510. uint32_t VddcPcieDynamicPower;
  511. uint32_t VddcDceDynamicPower;
  512. uint32_t VddcCurrent;
  513. uint32_t VddcVoltage;
  514. uint32_t VddciTotalPower;
  515. uint32_t VddciLeakagePower;
  516. uint32_t VddciConstantPower;
  517. uint32_t VddciDynamicPower;
  518. uint32_t Vddr1TotalPower;
  519. uint32_t Vddr1LeakagePower;
  520. uint32_t Vddr1ConstantPower;
  521. uint32_t Vddr1DynamicPower;
  522. uint32_t spare[4];
  523. uint32_t temperature;
  524. };
  525. typedef struct SMU7_Discrete_Cac_Verification_Table SMU7_Discrete_Cac_Verification_Table;
  526. struct SMU7_Discrete_Pm_Status_Table {
  527. /* Thermal entities */
  528. int32_t T_meas_max;
  529. int32_t T_meas_acc;
  530. int32_t T_calc_max;
  531. int32_t T_calc_acc;
  532. uint32_t P_scalar_acc;
  533. uint32_t P_calc_max;
  534. uint32_t P_calc_acc;
  535. /*Voltage domains */
  536. uint32_t I_calc_max;
  537. uint32_t I_calc_acc;
  538. uint32_t I_calc_acc_vddci;
  539. uint32_t V_calc_noload_acc;
  540. uint32_t V_calc_load_acc;
  541. uint32_t V_calc_noload_acc_vddci;
  542. uint32_t P_meas_acc;
  543. uint32_t V_meas_noload_acc;
  544. uint32_t V_meas_load_acc;
  545. uint32_t I_meas_acc;
  546. uint32_t P_meas_acc_vddci;
  547. uint32_t V_meas_noload_acc_vddci;
  548. uint32_t V_meas_load_acc_vddci;
  549. uint32_t I_meas_acc_vddci;
  550. /*Frequency */
  551. uint16_t Sclk_dpm_residency[8];
  552. uint16_t Uvd_dpm_residency[8];
  553. uint16_t Vce_dpm_residency[8];
  554. uint16_t Mclk_dpm_residency[4];
  555. /*Chip */
  556. uint32_t P_vddci_acc;
  557. uint32_t P_vddr1_acc;
  558. uint32_t P_nte1_acc;
  559. uint32_t PkgPwr_max;
  560. uint32_t PkgPwr_acc;
  561. uint32_t MclkSwitchingTime_max;
  562. uint32_t MclkSwitchingTime_acc;
  563. uint32_t FanPwm_acc;
  564. uint32_t FanRpm_acc;
  565. uint32_t AccCnt;
  566. };
  567. typedef struct SMU7_Discrete_Pm_Status_Table SMU7_Discrete_Pm_Status_Table;
  568. /*FIXME THESE NEED TO BE UPDATED */
  569. #define SMU7_SCLK_CAC 0x561
  570. #define SMU7_MCLK_CAC 0xF9
  571. #define SMU7_VCLK_CAC 0x2DE
  572. #define SMU7_DCLK_CAC 0x2DE
  573. #define SMU7_ECLK_CAC 0x25E
  574. #define SMU7_ACLK_CAC 0x25E
  575. #define SMU7_SAMCLK_CAC 0x25E
  576. #define SMU7_DISPCLK_CAC 0x100
  577. #define SMU7_CAC_CONSTANT 0x2EE3430
  578. #define SMU7_CAC_CONSTANT_SHIFT 18
  579. #define SMU7_VDDCI_MCLK_CONST 1765
  580. #define SMU7_VDDCI_MCLK_CONST_SHIFT 16
  581. #define SMU7_VDDCI_VDDCI_CONST 50958
  582. #define SMU7_VDDCI_VDDCI_CONST_SHIFT 14
  583. #define SMU7_VDDCI_CONST 11781
  584. #define SMU7_12C_VDDCI_MCLK_CONST 1623
  585. #define SMU7_12C_VDDCI_MCLK_CONST_SHIFT 15
  586. #define SMU7_12C_VDDCI_VDDCI_CONST 40088
  587. #define SMU7_12C_VDDCI_VDDCI_CONST_SHIFT 13
  588. #define SMU7_12C_VDDCI_CONST 20856
  589. #define SMU7_VDDCI_STROBE_PWR 1331
  590. #define SMU7_VDDR1_CONST 693
  591. #define SMU7_VDDR1_CAC_WEIGHT 20
  592. #define SMU7_VDDR1_CAC_WEIGHT_SHIFT 19
  593. #define SMU7_VDDR1_STROBE_PWR 512
  594. #define SMU7_AREA_COEFF_UVD 0xA78
  595. #define SMU7_AREA_COEFF_VCE 0x190A
  596. #define SMU7_AREA_COEFF_ACP 0x22D1
  597. #define SMU7_AREA_COEFF_SAMU 0x534
  598. /*ThermOutMode values */
  599. #define SMU7_THERM_OUT_MODE_DISABLE 0x0
  600. #define SMU7_THERM_OUT_MODE_THERM_ONLY 0x1
  601. #define SMU7_THERM_OUT_MODE_THERM_VRHOT 0x2
  602. #if !defined(SMC_MICROCODE)
  603. #pragma pack(pop)
  604. #endif
  605. #endif