smu7_discrete.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. /*
  2. * Copyright 2013 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 SMU7_DISCRETE_H
  24. #define SMU7_DISCRETE_H
  25. #include "smu7.h"
  26. #pragma pack(push, 1)
  27. #define SMU7_DTE_ITERATIONS 5
  28. #define SMU7_DTE_SOURCES 3
  29. #define SMU7_DTE_SINKS 1
  30. #define SMU7_NUM_CPU_TES 0
  31. #define SMU7_NUM_GPU_TES 1
  32. #define SMU7_NUM_NON_TES 2
  33. struct SMU7_SoftRegisters {
  34. uint32_t RefClockFrequency;
  35. uint32_t PmTimerP;
  36. uint32_t FeatureEnables;
  37. uint32_t PreVBlankGap;
  38. uint32_t VBlankTimeout;
  39. uint32_t TrainTimeGap;
  40. uint32_t MvddSwitchTime;
  41. uint32_t LongestAcpiTrainTime;
  42. uint32_t AcpiDelay;
  43. uint32_t G5TrainTime;
  44. uint32_t DelayMpllPwron;
  45. uint32_t VoltageChangeTimeout;
  46. uint32_t HandshakeDisables;
  47. uint8_t DisplayPhy1Config;
  48. uint8_t DisplayPhy2Config;
  49. uint8_t DisplayPhy3Config;
  50. uint8_t DisplayPhy4Config;
  51. uint8_t DisplayPhy5Config;
  52. uint8_t DisplayPhy6Config;
  53. uint8_t DisplayPhy7Config;
  54. uint8_t DisplayPhy8Config;
  55. uint32_t AverageGraphicsA;
  56. uint32_t AverageMemoryA;
  57. uint32_t AverageGioA;
  58. uint8_t SClkDpmEnabledLevels;
  59. uint8_t MClkDpmEnabledLevels;
  60. uint8_t LClkDpmEnabledLevels;
  61. uint8_t PCIeDpmEnabledLevels;
  62. uint8_t UVDDpmEnabledLevels;
  63. uint8_t SAMUDpmEnabledLevels;
  64. uint8_t ACPDpmEnabledLevels;
  65. uint8_t VCEDpmEnabledLevels;
  66. uint32_t DRAM_LOG_ADDR_H;
  67. uint32_t DRAM_LOG_ADDR_L;
  68. uint32_t DRAM_LOG_PHY_ADDR_H;
  69. uint32_t DRAM_LOG_PHY_ADDR_L;
  70. uint32_t DRAM_LOG_BUFF_SIZE;
  71. uint32_t UlvEnterC;
  72. uint32_t UlvTime;
  73. uint32_t Reserved[3];
  74. };
  75. typedef struct SMU7_SoftRegisters SMU7_SoftRegisters;
  76. struct SMU7_Discrete_VoltageLevel {
  77. uint16_t Voltage;
  78. uint16_t StdVoltageHiSidd;
  79. uint16_t StdVoltageLoSidd;
  80. uint8_t Smio;
  81. uint8_t padding;
  82. };
  83. typedef struct SMU7_Discrete_VoltageLevel SMU7_Discrete_VoltageLevel;
  84. struct SMU7_Discrete_GraphicsLevel {
  85. uint32_t Flags;
  86. uint32_t MinVddc;
  87. uint32_t MinVddcPhases;
  88. uint32_t SclkFrequency;
  89. uint8_t padding1[2];
  90. uint16_t ActivityLevel;
  91. uint32_t CgSpllFuncCntl3;
  92. uint32_t CgSpllFuncCntl4;
  93. uint32_t SpllSpreadSpectrum;
  94. uint32_t SpllSpreadSpectrum2;
  95. uint32_t CcPwrDynRm;
  96. uint32_t CcPwrDynRm1;
  97. uint8_t SclkDid;
  98. uint8_t DisplayWatermark;
  99. uint8_t EnabledForActivity;
  100. uint8_t EnabledForThrottle;
  101. uint8_t UpH;
  102. uint8_t DownH;
  103. uint8_t VoltageDownH;
  104. uint8_t PowerThrottle;
  105. uint8_t DeepSleepDivId;
  106. uint8_t padding[3];
  107. };
  108. typedef struct SMU7_Discrete_GraphicsLevel SMU7_Discrete_GraphicsLevel;
  109. struct SMU7_Discrete_ACPILevel {
  110. uint32_t Flags;
  111. uint32_t MinVddc;
  112. uint32_t MinVddcPhases;
  113. uint32_t SclkFrequency;
  114. uint8_t SclkDid;
  115. uint8_t DisplayWatermark;
  116. uint8_t DeepSleepDivId;
  117. uint8_t padding;
  118. uint32_t CgSpllFuncCntl;
  119. uint32_t CgSpllFuncCntl2;
  120. uint32_t CgSpllFuncCntl3;
  121. uint32_t CgSpllFuncCntl4;
  122. uint32_t SpllSpreadSpectrum;
  123. uint32_t SpllSpreadSpectrum2;
  124. uint32_t CcPwrDynRm;
  125. uint32_t CcPwrDynRm1;
  126. };
  127. typedef struct SMU7_Discrete_ACPILevel SMU7_Discrete_ACPILevel;
  128. struct SMU7_Discrete_Ulv {
  129. uint32_t CcPwrDynRm;
  130. uint32_t CcPwrDynRm1;
  131. uint16_t VddcOffset;
  132. uint8_t VddcOffsetVid;
  133. uint8_t VddcPhase;
  134. uint32_t Reserved;
  135. };
  136. typedef struct SMU7_Discrete_Ulv SMU7_Discrete_Ulv;
  137. struct SMU7_Discrete_MemoryLevel {
  138. uint32_t MinVddc;
  139. uint32_t MinVddcPhases;
  140. uint32_t MinVddci;
  141. uint32_t MinMvdd;
  142. uint32_t MclkFrequency;
  143. uint8_t EdcReadEnable;
  144. uint8_t EdcWriteEnable;
  145. uint8_t RttEnable;
  146. uint8_t StutterEnable;
  147. uint8_t StrobeEnable;
  148. uint8_t StrobeRatio;
  149. uint8_t EnabledForThrottle;
  150. uint8_t EnabledForActivity;
  151. uint8_t UpH;
  152. uint8_t DownH;
  153. uint8_t VoltageDownH;
  154. uint8_t padding;
  155. uint16_t ActivityLevel;
  156. uint8_t DisplayWatermark;
  157. uint8_t padding1;
  158. uint32_t MpllFuncCntl;
  159. uint32_t MpllFuncCntl_1;
  160. uint32_t MpllFuncCntl_2;
  161. uint32_t MpllAdFuncCntl;
  162. uint32_t MpllDqFuncCntl;
  163. uint32_t MclkPwrmgtCntl;
  164. uint32_t DllCntl;
  165. uint32_t MpllSs1;
  166. uint32_t MpllSs2;
  167. };
  168. typedef struct SMU7_Discrete_MemoryLevel SMU7_Discrete_MemoryLevel;
  169. struct SMU7_Discrete_LinkLevel {
  170. uint8_t PcieGenSpeed;
  171. uint8_t PcieLaneCount;
  172. uint8_t EnabledForActivity;
  173. uint8_t Padding;
  174. uint32_t DownT;
  175. uint32_t UpT;
  176. uint32_t Reserved;
  177. };
  178. typedef struct SMU7_Discrete_LinkLevel SMU7_Discrete_LinkLevel;
  179. struct SMU7_Discrete_MCArbDramTimingTableEntry {
  180. uint32_t McArbDramTiming;
  181. uint32_t McArbDramTiming2;
  182. uint8_t McArbBurstTime;
  183. uint8_t padding[3];
  184. };
  185. typedef struct SMU7_Discrete_MCArbDramTimingTableEntry SMU7_Discrete_MCArbDramTimingTableEntry;
  186. struct SMU7_Discrete_MCArbDramTimingTable {
  187. SMU7_Discrete_MCArbDramTimingTableEntry entries[SMU__NUM_SCLK_DPM_STATE][SMU__NUM_MCLK_DPM_LEVELS];
  188. };
  189. typedef struct SMU7_Discrete_MCArbDramTimingTable SMU7_Discrete_MCArbDramTimingTable;
  190. struct SMU7_Discrete_UvdLevel {
  191. uint32_t VclkFrequency;
  192. uint32_t DclkFrequency;
  193. uint16_t MinVddc;
  194. uint8_t MinVddcPhases;
  195. uint8_t VclkDivider;
  196. uint8_t DclkDivider;
  197. uint8_t padding[3];
  198. };
  199. typedef struct SMU7_Discrete_UvdLevel SMU7_Discrete_UvdLevel;
  200. struct SMU7_Discrete_ExtClkLevel {
  201. uint32_t Frequency;
  202. uint16_t MinVoltage;
  203. uint8_t MinPhases;
  204. uint8_t Divider;
  205. };
  206. typedef struct SMU7_Discrete_ExtClkLevel SMU7_Discrete_ExtClkLevel;
  207. struct SMU7_Discrete_StateInfo {
  208. uint32_t SclkFrequency;
  209. uint32_t MclkFrequency;
  210. uint32_t VclkFrequency;
  211. uint32_t DclkFrequency;
  212. uint32_t SamclkFrequency;
  213. uint32_t AclkFrequency;
  214. uint32_t EclkFrequency;
  215. uint16_t MvddVoltage;
  216. uint16_t padding16;
  217. uint8_t DisplayWatermark;
  218. uint8_t McArbIndex;
  219. uint8_t McRegIndex;
  220. uint8_t SeqIndex;
  221. uint8_t SclkDid;
  222. int8_t SclkIndex;
  223. int8_t MclkIndex;
  224. uint8_t PCIeGen;
  225. };
  226. typedef struct SMU7_Discrete_StateInfo SMU7_Discrete_StateInfo;
  227. struct SMU7_Discrete_DpmTable {
  228. SMU7_PIDController GraphicsPIDController;
  229. SMU7_PIDController MemoryPIDController;
  230. SMU7_PIDController LinkPIDController;
  231. uint32_t SystemFlags;
  232. uint32_t SmioMaskVddcVid;
  233. uint32_t SmioMaskVddcPhase;
  234. uint32_t SmioMaskVddciVid;
  235. uint32_t SmioMaskMvddVid;
  236. uint32_t VddcLevelCount;
  237. uint32_t VddciLevelCount;
  238. uint32_t MvddLevelCount;
  239. SMU7_Discrete_VoltageLevel VddcLevel [SMU7_MAX_LEVELS_VDDC];
  240. // SMU7_Discrete_VoltageLevel VddcStandardReference [SMU7_MAX_LEVELS_VDDC];
  241. SMU7_Discrete_VoltageLevel VddciLevel [SMU7_MAX_LEVELS_VDDCI];
  242. SMU7_Discrete_VoltageLevel MvddLevel [SMU7_MAX_LEVELS_MVDD];
  243. uint8_t GraphicsDpmLevelCount;
  244. uint8_t MemoryDpmLevelCount;
  245. uint8_t LinkLevelCount;
  246. uint8_t UvdLevelCount;
  247. uint8_t VceLevelCount;
  248. uint8_t AcpLevelCount;
  249. uint8_t SamuLevelCount;
  250. uint8_t MasterDeepSleepControl;
  251. uint32_t Reserved[5];
  252. // uint32_t SamuDefaultLevel;
  253. SMU7_Discrete_GraphicsLevel GraphicsLevel [SMU7_MAX_LEVELS_GRAPHICS];
  254. SMU7_Discrete_MemoryLevel MemoryACPILevel;
  255. SMU7_Discrete_MemoryLevel MemoryLevel [SMU7_MAX_LEVELS_MEMORY];
  256. SMU7_Discrete_LinkLevel LinkLevel [SMU7_MAX_LEVELS_LINK];
  257. SMU7_Discrete_ACPILevel ACPILevel;
  258. SMU7_Discrete_UvdLevel UvdLevel [SMU7_MAX_LEVELS_UVD];
  259. SMU7_Discrete_ExtClkLevel VceLevel [SMU7_MAX_LEVELS_VCE];
  260. SMU7_Discrete_ExtClkLevel AcpLevel [SMU7_MAX_LEVELS_ACP];
  261. SMU7_Discrete_ExtClkLevel SamuLevel [SMU7_MAX_LEVELS_SAMU];
  262. SMU7_Discrete_Ulv Ulv;
  263. uint32_t SclkStepSize;
  264. uint32_t Smio [SMU7_MAX_ENTRIES_SMIO];
  265. uint8_t UvdBootLevel;
  266. uint8_t VceBootLevel;
  267. uint8_t AcpBootLevel;
  268. uint8_t SamuBootLevel;
  269. uint8_t UVDInterval;
  270. uint8_t VCEInterval;
  271. uint8_t ACPInterval;
  272. uint8_t SAMUInterval;
  273. uint8_t GraphicsBootLevel;
  274. uint8_t GraphicsVoltageChangeEnable;
  275. uint8_t GraphicsThermThrottleEnable;
  276. uint8_t GraphicsInterval;
  277. uint8_t VoltageInterval;
  278. uint8_t ThermalInterval;
  279. uint16_t TemperatureLimitHigh;
  280. uint16_t TemperatureLimitLow;
  281. uint8_t MemoryBootLevel;
  282. uint8_t MemoryVoltageChangeEnable;
  283. uint8_t MemoryInterval;
  284. uint8_t MemoryThermThrottleEnable;
  285. uint16_t VddcVddciDelta;
  286. uint16_t VoltageResponseTime;
  287. uint16_t PhaseResponseTime;
  288. uint8_t PCIeBootLinkLevel;
  289. uint8_t PCIeGenInterval;
  290. uint8_t DTEInterval;
  291. uint8_t DTEMode;
  292. uint8_t SVI2Enable;
  293. uint8_t VRHotGpio;
  294. uint8_t AcDcGpio;
  295. uint8_t ThermGpio;
  296. uint16_t PPM_PkgPwrLimit;
  297. uint16_t PPM_TemperatureLimit;
  298. uint16_t DefaultTdp;
  299. uint16_t TargetTdp;
  300. uint16_t FpsHighT;
  301. uint16_t FpsLowT;
  302. uint16_t BAPMTI_R [SMU7_DTE_ITERATIONS][SMU7_DTE_SOURCES][SMU7_DTE_SINKS];
  303. uint16_t BAPMTI_RC [SMU7_DTE_ITERATIONS][SMU7_DTE_SOURCES][SMU7_DTE_SINKS];
  304. uint8_t DTEAmbientTempBase;
  305. uint8_t DTETjOffset;
  306. uint8_t GpuTjMax;
  307. uint8_t GpuTjHyst;
  308. uint16_t BootVddc;
  309. uint16_t BootVddci;
  310. uint16_t BootMVdd;
  311. uint16_t padding;
  312. uint32_t BAPM_TEMP_GRADIENT;
  313. uint32_t LowSclkInterruptT;
  314. };
  315. typedef struct SMU7_Discrete_DpmTable SMU7_Discrete_DpmTable;
  316. #define SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE 16
  317. #define SMU7_DISCRETE_MC_REGISTER_ARRAY_SET_COUNT SMU7_MAX_LEVELS_MEMORY
  318. struct SMU7_Discrete_MCRegisterAddress {
  319. uint16_t s0;
  320. uint16_t s1;
  321. };
  322. typedef struct SMU7_Discrete_MCRegisterAddress SMU7_Discrete_MCRegisterAddress;
  323. struct SMU7_Discrete_MCRegisterSet {
  324. uint32_t value[SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE];
  325. };
  326. typedef struct SMU7_Discrete_MCRegisterSet SMU7_Discrete_MCRegisterSet;
  327. struct SMU7_Discrete_MCRegisters {
  328. uint8_t last;
  329. uint8_t reserved[3];
  330. SMU7_Discrete_MCRegisterAddress address[SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE];
  331. SMU7_Discrete_MCRegisterSet data[SMU7_DISCRETE_MC_REGISTER_ARRAY_SET_COUNT];
  332. };
  333. typedef struct SMU7_Discrete_MCRegisters SMU7_Discrete_MCRegisters;
  334. struct SMU7_Discrete_FanTable {
  335. uint16_t FdoMode;
  336. int16_t TempMin;
  337. int16_t TempMed;
  338. int16_t TempMax;
  339. int16_t Slope1;
  340. int16_t Slope2;
  341. int16_t FdoMin;
  342. int16_t HystUp;
  343. int16_t HystDown;
  344. int16_t HystSlope;
  345. int16_t TempRespLim;
  346. int16_t TempCurr;
  347. int16_t SlopeCurr;
  348. int16_t PwmCurr;
  349. uint32_t RefreshPeriod;
  350. int16_t FdoMax;
  351. uint8_t TempSrc;
  352. int8_t Padding;
  353. };
  354. typedef struct SMU7_Discrete_FanTable SMU7_Discrete_FanTable;
  355. struct SMU7_Discrete_PmFuses {
  356. // dw0-dw1
  357. uint8_t BapmVddCVidHiSidd[8];
  358. // dw2-dw3
  359. uint8_t BapmVddCVidLoSidd[8];
  360. // dw4-dw5
  361. uint8_t VddCVid[8];
  362. // dw6
  363. uint8_t SviLoadLineEn;
  364. uint8_t SviLoadLineVddC;
  365. uint8_t SviLoadLineTrimVddC;
  366. uint8_t SviLoadLineOffsetVddC;
  367. // dw7
  368. uint16_t TDC_VDDC_PkgLimit;
  369. uint8_t TDC_VDDC_ThrottleReleaseLimitPerc;
  370. uint8_t TDC_MAWt;
  371. // dw8
  372. uint8_t TdcWaterfallCtl;
  373. uint8_t LPMLTemperatureMin;
  374. uint8_t LPMLTemperatureMax;
  375. uint8_t Reserved;
  376. // dw9-dw10
  377. uint8_t BapmVddCVidHiSidd2[8];
  378. // dw11-dw12
  379. int16_t FuzzyFan_ErrorSetDelta;
  380. int16_t FuzzyFan_ErrorRateSetDelta;
  381. int16_t FuzzyFan_PwmSetDelta;
  382. uint16_t CalcMeasPowerBlend;
  383. // dw13-dw16
  384. uint8_t GnbLPML[16];
  385. // dw17
  386. uint8_t GnbLPMLMaxVid;
  387. uint8_t GnbLPMLMinVid;
  388. uint8_t Reserved1[2];
  389. // dw18
  390. uint16_t BapmVddCBaseLeakageHiSidd;
  391. uint16_t BapmVddCBaseLeakageLoSidd;
  392. };
  393. typedef struct SMU7_Discrete_PmFuses SMU7_Discrete_PmFuses;
  394. #pragma pack(pop)
  395. #endif