smu7_discrete.h 15 KB

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