1770911a3SEric Huang /* 2770911a3SEric Huang * Copyright 2015 Advanced Micro Devices, Inc. 3770911a3SEric Huang * 4770911a3SEric Huang * Permission is hereby granted, free of charge, to any person obtaining a 5770911a3SEric Huang * copy of this software and associated documentation files (the "Software"), 6770911a3SEric Huang * to deal in the Software without restriction, including without limitation 7770911a3SEric Huang * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8770911a3SEric Huang * and/or sell copies of the Software, and to permit persons to whom the 9770911a3SEric Huang * Software is furnished to do so, subject to the following conditions: 10770911a3SEric Huang * 11770911a3SEric Huang * The above copyright notice and this permission notice shall be included in 12770911a3SEric Huang * all copies or substantial portions of the Software. 13770911a3SEric Huang * 14770911a3SEric Huang * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15770911a3SEric Huang * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16770911a3SEric Huang * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17770911a3SEric Huang * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18770911a3SEric Huang * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19770911a3SEric Huang * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20770911a3SEric Huang * OTHER DEALINGS IN THE SOFTWARE. 21770911a3SEric Huang * 22770911a3SEric Huang */ 23770911a3SEric Huang #ifndef _SMU73_DISCRETE_H_ 24770911a3SEric Huang #define _SMU73_DISCRETE_H_ 25770911a3SEric Huang 26770911a3SEric Huang #include "smu73.h" 27770911a3SEric Huang 28770911a3SEric Huang #pragma pack(push, 1) 29770911a3SEric Huang 30b0297530SRan Sun struct SMIO_Pattern { 31770911a3SEric Huang uint16_t Voltage; 32770911a3SEric Huang uint8_t Smio; 33770911a3SEric Huang uint8_t padding; 34770911a3SEric Huang }; 35770911a3SEric Huang 36770911a3SEric Huang typedef struct SMIO_Pattern SMIO_Pattern; 37770911a3SEric Huang 38b0297530SRan Sun struct SMIO_Table { 39770911a3SEric Huang SMIO_Pattern Pattern[SMU_MAX_SMIO_LEVELS]; 40770911a3SEric Huang }; 41770911a3SEric Huang 42770911a3SEric Huang typedef struct SMIO_Table SMIO_Table; 43770911a3SEric Huang 44770911a3SEric Huang struct SMU73_Discrete_GraphicsLevel { 45770911a3SEric Huang uint32_t MinVoltage; 46770911a3SEric Huang 47770911a3SEric Huang uint32_t SclkFrequency; 48770911a3SEric Huang 49770911a3SEric Huang uint8_t pcieDpmLevel; 50770911a3SEric Huang uint8_t DeepSleepDivId; 51770911a3SEric Huang uint16_t ActivityLevel; 52770911a3SEric Huang uint32_t CgSpllFuncCntl3; 53770911a3SEric Huang uint32_t CgSpllFuncCntl4; 54770911a3SEric Huang uint32_t SpllSpreadSpectrum; 55770911a3SEric Huang uint32_t SpllSpreadSpectrum2; 56770911a3SEric Huang uint32_t CcPwrDynRm; 57770911a3SEric Huang uint32_t CcPwrDynRm1; 58770911a3SEric Huang uint8_t SclkDid; 59770911a3SEric Huang uint8_t DisplayWatermark; 60770911a3SEric Huang uint8_t EnabledForActivity; 61770911a3SEric Huang uint8_t EnabledForThrottle; 62770911a3SEric Huang uint8_t UpHyst; 63770911a3SEric Huang uint8_t DownHyst; 64770911a3SEric Huang uint8_t VoltageDownHyst; 65770911a3SEric Huang uint8_t PowerThrottle; 66770911a3SEric Huang }; 67770911a3SEric Huang 68770911a3SEric Huang typedef struct SMU73_Discrete_GraphicsLevel SMU73_Discrete_GraphicsLevel; 69770911a3SEric Huang 70770911a3SEric Huang struct SMU73_Discrete_ACPILevel { 71770911a3SEric Huang uint32_t Flags; 72770911a3SEric Huang uint32_t MinVoltage; 73770911a3SEric Huang uint32_t SclkFrequency; 74770911a3SEric Huang uint8_t SclkDid; 75770911a3SEric Huang uint8_t DisplayWatermark; 76770911a3SEric Huang uint8_t DeepSleepDivId; 77770911a3SEric Huang uint8_t padding; 78770911a3SEric Huang uint32_t CgSpllFuncCntl; 79770911a3SEric Huang uint32_t CgSpllFuncCntl2; 80770911a3SEric Huang uint32_t CgSpllFuncCntl3; 81770911a3SEric Huang uint32_t CgSpllFuncCntl4; 82770911a3SEric Huang uint32_t SpllSpreadSpectrum; 83770911a3SEric Huang uint32_t SpllSpreadSpectrum2; 84770911a3SEric Huang uint32_t CcPwrDynRm; 85770911a3SEric Huang uint32_t CcPwrDynRm1; 86770911a3SEric Huang }; 87770911a3SEric Huang 88770911a3SEric Huang typedef struct SMU73_Discrete_ACPILevel SMU73_Discrete_ACPILevel; 89770911a3SEric Huang 90770911a3SEric Huang struct SMU73_Discrete_Ulv { 91770911a3SEric Huang uint32_t CcPwrDynRm; 92770911a3SEric Huang uint32_t CcPwrDynRm1; 93770911a3SEric Huang uint16_t VddcOffset; 94770911a3SEric Huang uint8_t VddcOffsetVid; 95770911a3SEric Huang uint8_t VddcPhase; 96770911a3SEric Huang uint32_t Reserved; 97770911a3SEric Huang }; 98770911a3SEric Huang 99770911a3SEric Huang typedef struct SMU73_Discrete_Ulv SMU73_Discrete_Ulv; 100770911a3SEric Huang 101b0297530SRan Sun struct SMU73_Discrete_MemoryLevel { 102770911a3SEric Huang uint32_t MinVoltage; 103770911a3SEric Huang uint32_t MinMvdd; 104770911a3SEric Huang 105770911a3SEric Huang uint32_t MclkFrequency; 106770911a3SEric Huang 107770911a3SEric Huang uint8_t StutterEnable; 108770911a3SEric Huang uint8_t FreqRange; 109770911a3SEric Huang uint8_t EnabledForThrottle; 110770911a3SEric Huang uint8_t EnabledForActivity; 111770911a3SEric Huang 112770911a3SEric Huang uint8_t UpHyst; 113770911a3SEric Huang uint8_t DownHyst; 114770911a3SEric Huang uint8_t VoltageDownHyst; 115770911a3SEric Huang uint8_t padding; 116770911a3SEric Huang 117770911a3SEric Huang uint16_t ActivityLevel; 118770911a3SEric Huang uint8_t DisplayWatermark; 119770911a3SEric Huang uint8_t MclkDivider; 120770911a3SEric Huang }; 121770911a3SEric Huang 122770911a3SEric Huang typedef struct SMU73_Discrete_MemoryLevel SMU73_Discrete_MemoryLevel; 123770911a3SEric Huang 124b0297530SRan Sun struct SMU73_Discrete_LinkLevel { 125770911a3SEric Huang uint8_t PcieGenSpeed; ///< 0:PciE-gen1 1:PciE-gen2 2:PciE-gen3 126770911a3SEric Huang uint8_t PcieLaneCount; ///< 1=x1, 2=x2, 3=x4, 4=x8, 5=x12, 6=x16 127770911a3SEric Huang uint8_t EnabledForActivity; 128770911a3SEric Huang uint8_t SPC; 129770911a3SEric Huang uint32_t DownThreshold; 130770911a3SEric Huang uint32_t UpThreshold; 131770911a3SEric Huang uint32_t Reserved; 132770911a3SEric Huang }; 133770911a3SEric Huang 134770911a3SEric Huang typedef struct SMU73_Discrete_LinkLevel SMU73_Discrete_LinkLevel; 135770911a3SEric Huang 136770911a3SEric Huang 137770911a3SEric Huang // MC ARB DRAM Timing registers. 138b0297530SRan Sun struct SMU73_Discrete_MCArbDramTimingTableEntry { 139770911a3SEric Huang uint32_t McArbDramTiming; 140770911a3SEric Huang uint32_t McArbDramTiming2; 141770911a3SEric Huang uint8_t McArbBurstTime; 142770911a3SEric Huang uint8_t TRRDS; 143770911a3SEric Huang uint8_t TRRDL; 144770911a3SEric Huang uint8_t padding; 145770911a3SEric Huang }; 146770911a3SEric Huang 147770911a3SEric Huang typedef struct SMU73_Discrete_MCArbDramTimingTableEntry SMU73_Discrete_MCArbDramTimingTableEntry; 148770911a3SEric Huang 149b0297530SRan Sun struct SMU73_Discrete_MCArbDramTimingTable { 150770911a3SEric Huang SMU73_Discrete_MCArbDramTimingTableEntry entries[SMU__NUM_SCLK_DPM_STATE][SMU__NUM_MCLK_DPM_LEVELS]; 151770911a3SEric Huang }; 152770911a3SEric Huang 153770911a3SEric Huang typedef struct SMU73_Discrete_MCArbDramTimingTable SMU73_Discrete_MCArbDramTimingTable; 154770911a3SEric Huang 155770911a3SEric Huang // UVD VCLK/DCLK state (level) definition. 156b0297530SRan Sun struct SMU73_Discrete_UvdLevel { 157770911a3SEric Huang uint32_t VclkFrequency; 158770911a3SEric Huang uint32_t DclkFrequency; 159770911a3SEric Huang uint32_t MinVoltage; 160770911a3SEric Huang uint8_t VclkDivider; 161770911a3SEric Huang uint8_t DclkDivider; 162770911a3SEric Huang uint8_t padding[2]; 163770911a3SEric Huang }; 164770911a3SEric Huang 165770911a3SEric Huang typedef struct SMU73_Discrete_UvdLevel SMU73_Discrete_UvdLevel; 166770911a3SEric Huang 167770911a3SEric Huang // Clocks for other external blocks (VCE, ACP, SAMU). 168b0297530SRan Sun struct SMU73_Discrete_ExtClkLevel { 169770911a3SEric Huang uint32_t Frequency; 170770911a3SEric Huang uint32_t MinVoltage; 171770911a3SEric Huang uint8_t Divider; 172770911a3SEric Huang uint8_t padding[3]; 173770911a3SEric Huang }; 174770911a3SEric Huang 175770911a3SEric Huang typedef struct SMU73_Discrete_ExtClkLevel SMU73_Discrete_ExtClkLevel; 176770911a3SEric Huang 177b0297530SRan Sun struct SMU73_Discrete_StateInfo { 178770911a3SEric Huang uint32_t SclkFrequency; 179770911a3SEric Huang uint32_t MclkFrequency; 180770911a3SEric Huang uint32_t VclkFrequency; 181770911a3SEric Huang uint32_t DclkFrequency; 182770911a3SEric Huang uint32_t SamclkFrequency; 183770911a3SEric Huang uint32_t AclkFrequency; 184770911a3SEric Huang uint32_t EclkFrequency; 185770911a3SEric Huang uint16_t MvddVoltage; 186770911a3SEric Huang uint16_t padding16; 187770911a3SEric Huang uint8_t DisplayWatermark; 188770911a3SEric Huang uint8_t McArbIndex; 189770911a3SEric Huang uint8_t McRegIndex; 190770911a3SEric Huang uint8_t SeqIndex; 191770911a3SEric Huang uint8_t SclkDid; 192770911a3SEric Huang int8_t SclkIndex; 193770911a3SEric Huang int8_t MclkIndex; 194770911a3SEric Huang uint8_t PCIeGen; 195770911a3SEric Huang 196770911a3SEric Huang }; 197770911a3SEric Huang 198770911a3SEric Huang typedef struct SMU73_Discrete_StateInfo SMU73_Discrete_StateInfo; 199770911a3SEric Huang 200b0297530SRan Sun struct SMU73_Discrete_DpmTable { 201770911a3SEric Huang // Multi-DPM controller settings 202770911a3SEric Huang SMU73_PIDController GraphicsPIDController; 203770911a3SEric Huang SMU73_PIDController MemoryPIDController; 204770911a3SEric Huang SMU73_PIDController LinkPIDController; 205770911a3SEric Huang 206770911a3SEric Huang uint32_t SystemFlags; 207770911a3SEric Huang 208770911a3SEric Huang // SMIO masks for voltage and phase controls 209770911a3SEric Huang uint32_t VRConfig; 210770911a3SEric Huang uint32_t SmioMask1; 211770911a3SEric Huang uint32_t SmioMask2; 212770911a3SEric Huang SMIO_Table SmioTable1; 213770911a3SEric Huang SMIO_Table SmioTable2; 214770911a3SEric Huang 215770911a3SEric Huang uint32_t MvddLevelCount; 216770911a3SEric Huang 217770911a3SEric Huang 218770911a3SEric Huang uint8_t BapmVddcVidHiSidd[SMU73_MAX_LEVELS_VDDC]; 219770911a3SEric Huang uint8_t BapmVddcVidLoSidd[SMU73_MAX_LEVELS_VDDC]; 220770911a3SEric Huang uint8_t BapmVddcVidHiSidd2[SMU73_MAX_LEVELS_VDDC]; 221770911a3SEric Huang 222770911a3SEric Huang uint8_t GraphicsDpmLevelCount; 223770911a3SEric Huang uint8_t MemoryDpmLevelCount; 224770911a3SEric Huang uint8_t LinkLevelCount; 225770911a3SEric Huang uint8_t MasterDeepSleepControl; 226770911a3SEric Huang 227770911a3SEric Huang uint8_t UvdLevelCount; 228770911a3SEric Huang uint8_t VceLevelCount; 229770911a3SEric Huang uint8_t AcpLevelCount; 230770911a3SEric Huang uint8_t SamuLevelCount; 231770911a3SEric Huang 232770911a3SEric Huang uint8_t ThermOutGpio; 233770911a3SEric Huang uint8_t ThermOutPolarity; 234770911a3SEric Huang uint8_t ThermOutMode; 235770911a3SEric Huang uint8_t BootPhases; 236770911a3SEric Huang uint32_t Reserved[4]; 237770911a3SEric Huang 238770911a3SEric Huang // State table entries for each DPM state 239770911a3SEric Huang SMU73_Discrete_GraphicsLevel GraphicsLevel[SMU73_MAX_LEVELS_GRAPHICS]; 240770911a3SEric Huang SMU73_Discrete_MemoryLevel MemoryACPILevel; 241770911a3SEric Huang SMU73_Discrete_MemoryLevel MemoryLevel[SMU73_MAX_LEVELS_MEMORY]; 242770911a3SEric Huang SMU73_Discrete_LinkLevel LinkLevel[SMU73_MAX_LEVELS_LINK]; 243770911a3SEric Huang SMU73_Discrete_ACPILevel ACPILevel; 244770911a3SEric Huang SMU73_Discrete_UvdLevel UvdLevel[SMU73_MAX_LEVELS_UVD]; 245770911a3SEric Huang SMU73_Discrete_ExtClkLevel VceLevel[SMU73_MAX_LEVELS_VCE]; 246770911a3SEric Huang SMU73_Discrete_ExtClkLevel AcpLevel[SMU73_MAX_LEVELS_ACP]; 247770911a3SEric Huang SMU73_Discrete_ExtClkLevel SamuLevel[SMU73_MAX_LEVELS_SAMU]; 248770911a3SEric Huang SMU73_Discrete_Ulv Ulv; 249770911a3SEric Huang 250770911a3SEric Huang uint32_t SclkStepSize; 251770911a3SEric Huang uint32_t Smio[SMU73_MAX_ENTRIES_SMIO]; 252770911a3SEric Huang 253770911a3SEric Huang uint8_t UvdBootLevel; 254770911a3SEric Huang uint8_t VceBootLevel; 255770911a3SEric Huang uint8_t AcpBootLevel; 256770911a3SEric Huang uint8_t SamuBootLevel; 257770911a3SEric Huang 258770911a3SEric Huang uint8_t GraphicsBootLevel; 259770911a3SEric Huang uint8_t GraphicsVoltageChangeEnable; 260770911a3SEric Huang uint8_t GraphicsThermThrottleEnable; 261770911a3SEric Huang uint8_t GraphicsInterval; 262770911a3SEric Huang 263770911a3SEric Huang uint8_t VoltageInterval; 264770911a3SEric Huang uint8_t ThermalInterval; 265770911a3SEric Huang uint16_t TemperatureLimitHigh; 266770911a3SEric Huang 267770911a3SEric Huang uint16_t TemperatureLimitLow; 268770911a3SEric Huang uint8_t MemoryBootLevel; 269770911a3SEric Huang uint8_t MemoryVoltageChangeEnable; 270770911a3SEric Huang 271770911a3SEric Huang uint16_t BootMVdd; 272770911a3SEric Huang uint8_t MemoryInterval; 273770911a3SEric Huang uint8_t MemoryThermThrottleEnable; 274770911a3SEric Huang 275770911a3SEric Huang uint16_t VoltageResponseTime; 276770911a3SEric Huang uint16_t PhaseResponseTime; 277770911a3SEric Huang 278770911a3SEric Huang uint8_t PCIeBootLinkLevel; 279770911a3SEric Huang uint8_t PCIeGenInterval; 280770911a3SEric Huang uint8_t DTEInterval; 281770911a3SEric Huang uint8_t DTEMode; 282770911a3SEric Huang 283770911a3SEric Huang uint8_t SVI2Enable; 284770911a3SEric Huang uint8_t VRHotGpio; 285770911a3SEric Huang uint8_t AcDcGpio; 286770911a3SEric Huang uint8_t ThermGpio; 287770911a3SEric Huang 288770911a3SEric Huang uint16_t PPM_PkgPwrLimit; 289770911a3SEric Huang uint16_t PPM_TemperatureLimit; 290770911a3SEric Huang 291770911a3SEric Huang uint16_t DefaultTdp; 292770911a3SEric Huang uint16_t TargetTdp; 293770911a3SEric Huang 294770911a3SEric Huang uint16_t FpsHighThreshold; 295770911a3SEric Huang uint16_t FpsLowThreshold; 296770911a3SEric Huang 297770911a3SEric Huang uint16_t TemperatureLimitEdge; 298770911a3SEric Huang uint16_t TemperatureLimitHotspot; 299770911a3SEric Huang uint16_t TemperatureLimitLiquid1; 300770911a3SEric Huang uint16_t TemperatureLimitLiquid2; 301770911a3SEric Huang uint16_t TemperatureLimitVrVddc; 302770911a3SEric Huang uint16_t TemperatureLimitVrMvdd; 303770911a3SEric Huang uint16_t TemperatureLimitPlx; 304770911a3SEric Huang 305770911a3SEric Huang uint16_t FanGainEdge; 306770911a3SEric Huang uint16_t FanGainHotspot; 307770911a3SEric Huang uint16_t FanGainLiquid; 308770911a3SEric Huang uint16_t FanGainVrVddc; 309770911a3SEric Huang uint16_t FanGainVrMvdd; 310770911a3SEric Huang uint16_t FanGainPlx; 311770911a3SEric Huang uint16_t FanGainHbm; 312770911a3SEric Huang 313770911a3SEric Huang uint8_t Liquid1_I2C_address; 314770911a3SEric Huang uint8_t Liquid2_I2C_address; 315770911a3SEric Huang uint8_t Vr_I2C_address; 316770911a3SEric Huang uint8_t Plx_I2C_address; 317770911a3SEric Huang 318770911a3SEric Huang uint8_t GeminiMode; 319770911a3SEric Huang uint8_t spare17[3]; 320770911a3SEric Huang uint32_t GeminiApertureHigh; 321770911a3SEric Huang uint32_t GeminiApertureLow; 322770911a3SEric Huang 323770911a3SEric Huang uint8_t Liquid_I2C_LineSCL; 324770911a3SEric Huang uint8_t Liquid_I2C_LineSDA; 325770911a3SEric Huang uint8_t Vr_I2C_LineSCL; 326770911a3SEric Huang uint8_t Vr_I2C_LineSDA; 327770911a3SEric Huang uint8_t Plx_I2C_LineSCL; 328770911a3SEric Huang uint8_t Plx_I2C_LineSDA; 329770911a3SEric Huang 330770911a3SEric Huang uint8_t spare1253[2]; 331770911a3SEric Huang uint32_t spare123[2]; 332770911a3SEric Huang 333770911a3SEric Huang uint8_t DTEAmbientTempBase; 334770911a3SEric Huang uint8_t DTETjOffset; 335770911a3SEric Huang uint8_t GpuTjMax; 336770911a3SEric Huang uint8_t GpuTjHyst; 337770911a3SEric Huang 338770911a3SEric Huang uint16_t BootVddc; 339770911a3SEric Huang uint16_t BootVddci; 340770911a3SEric Huang 341770911a3SEric Huang uint32_t BAPM_TEMP_GRADIENT; 342770911a3SEric Huang 343770911a3SEric Huang uint32_t LowSclkInterruptThreshold; 344770911a3SEric Huang uint32_t VddGfxReChkWait; 345770911a3SEric Huang 346770911a3SEric Huang uint8_t ClockStretcherAmount; 347770911a3SEric Huang uint8_t Sclk_CKS_masterEn0_7; 348770911a3SEric Huang uint8_t Sclk_CKS_masterEn8_15; 349770911a3SEric Huang uint8_t DPMFreezeAndForced; 350770911a3SEric Huang 351770911a3SEric Huang uint8_t Sclk_voltageOffset[8]; 352770911a3SEric Huang 353770911a3SEric Huang SMU_ClockStretcherDataTable ClockStretcherDataTable; 354770911a3SEric Huang SMU_CKS_LOOKUPTable CKS_LOOKUPTable; 355770911a3SEric Huang }; 356770911a3SEric Huang 357770911a3SEric Huang typedef struct SMU73_Discrete_DpmTable SMU73_Discrete_DpmTable; 358770911a3SEric Huang 359770911a3SEric Huang 360770911a3SEric Huang // --------------------------------------------------- Fan Table ----------------------------------------------------------- 361b0297530SRan Sun struct SMU73_Discrete_FanTable { 362770911a3SEric Huang uint16_t FdoMode; 363770911a3SEric Huang int16_t TempMin; 364770911a3SEric Huang int16_t TempMed; 365770911a3SEric Huang int16_t TempMax; 366770911a3SEric Huang int16_t Slope1; 367770911a3SEric Huang int16_t Slope2; 368770911a3SEric Huang int16_t FdoMin; 369770911a3SEric Huang int16_t HystUp; 370770911a3SEric Huang int16_t HystDown; 371770911a3SEric Huang int16_t HystSlope; 372770911a3SEric Huang int16_t TempRespLim; 373770911a3SEric Huang int16_t TempCurr; 374770911a3SEric Huang int16_t SlopeCurr; 375770911a3SEric Huang int16_t PwmCurr; 376770911a3SEric Huang uint32_t RefreshPeriod; 377770911a3SEric Huang int16_t FdoMax; 378770911a3SEric Huang uint8_t TempSrc; 379770911a3SEric Huang int8_t Padding; 380770911a3SEric Huang }; 381770911a3SEric Huang 382770911a3SEric Huang typedef struct SMU73_Discrete_FanTable SMU73_Discrete_FanTable; 383770911a3SEric Huang 384770911a3SEric Huang #define SMU7_DISCRETE_GPIO_SCLK_DEBUG 4 385770911a3SEric Huang #define SMU7_DISCRETE_GPIO_SCLK_DEBUG_BIT (0x1 << SMU7_DISCRETE_GPIO_SCLK_DEBUG) 386770911a3SEric Huang 387770911a3SEric Huang 388770911a3SEric Huang 389b0297530SRan Sun struct SMU7_MclkDpmScoreboard { 390770911a3SEric Huang 391770911a3SEric Huang uint32_t PercentageBusy; 392770911a3SEric Huang 393770911a3SEric Huang int32_t PIDError; 394770911a3SEric Huang int32_t PIDIntegral; 395770911a3SEric Huang int32_t PIDOutput; 396770911a3SEric Huang 397770911a3SEric Huang uint32_t SigmaDeltaAccum; 398770911a3SEric Huang uint32_t SigmaDeltaOutput; 399770911a3SEric Huang uint32_t SigmaDeltaLevel; 400770911a3SEric Huang 401770911a3SEric Huang uint32_t UtilizationSetpoint; 402770911a3SEric Huang 403770911a3SEric Huang uint8_t TdpClampMode; 404770911a3SEric Huang uint8_t TdcClampMode; 405770911a3SEric Huang uint8_t ThermClampMode; 406770911a3SEric Huang uint8_t VoltageBusy; 407770911a3SEric Huang 408770911a3SEric Huang int8_t CurrLevel; 409770911a3SEric Huang int8_t TargLevel; 410770911a3SEric Huang uint8_t LevelChangeInProgress; 411770911a3SEric Huang uint8_t UpHyst; 412770911a3SEric Huang 413770911a3SEric Huang uint8_t DownHyst; 414770911a3SEric Huang uint8_t VoltageDownHyst; 415770911a3SEric Huang uint8_t DpmEnable; 416770911a3SEric Huang uint8_t DpmRunning; 417770911a3SEric Huang 418770911a3SEric Huang uint8_t DpmForce; 419770911a3SEric Huang uint8_t DpmForceLevel; 420770911a3SEric Huang uint8_t DisplayWatermark; 421770911a3SEric Huang uint8_t McArbIndex; 422770911a3SEric Huang 423770911a3SEric Huang uint32_t MinimumPerfMclk; 424770911a3SEric Huang 425770911a3SEric Huang uint8_t AcpiReq; 426770911a3SEric Huang uint8_t AcpiAck; 427770911a3SEric Huang uint8_t MclkSwitchInProgress; 428770911a3SEric Huang uint8_t MclkSwitchCritical; 429770911a3SEric Huang 430770911a3SEric Huang uint8_t IgnoreVBlank; 431770911a3SEric Huang uint8_t TargetMclkIndex; 432770911a3SEric Huang uint8_t TargetMvddIndex; 433770911a3SEric Huang uint8_t MclkSwitchResult; 434770911a3SEric Huang 435770911a3SEric Huang uint16_t VbiFailureCount; 436770911a3SEric Huang uint8_t VbiWaitCounter; 437770911a3SEric Huang uint8_t EnabledLevelsChange; 438770911a3SEric Huang 439770911a3SEric Huang uint16_t LevelResidencyCounters[SMU73_MAX_LEVELS_MEMORY]; 440770911a3SEric Huang uint16_t LevelSwitchCounters[SMU73_MAX_LEVELS_MEMORY]; 441770911a3SEric Huang 442770911a3SEric Huang void (*TargetStateCalculator)(uint8_t); 443770911a3SEric Huang void (*SavedTargetStateCalculator)(uint8_t); 444770911a3SEric Huang 445770911a3SEric Huang uint16_t AutoDpmInterval; 446770911a3SEric Huang uint16_t AutoDpmRange; 447770911a3SEric Huang 448770911a3SEric Huang uint16_t VbiTimeoutCount; 449770911a3SEric Huang uint16_t MclkSwitchingTime; 450770911a3SEric Huang 451770911a3SEric Huang uint8_t fastSwitch; 452770911a3SEric Huang uint8_t Save_PIC_VDDGFX_EXIT; 453770911a3SEric Huang uint8_t Save_PIC_VDDGFX_ENTER; 454770911a3SEric Huang uint8_t padding; 455770911a3SEric Huang 456770911a3SEric Huang }; 457770911a3SEric Huang 458770911a3SEric Huang typedef struct SMU7_MclkDpmScoreboard SMU7_MclkDpmScoreboard; 459770911a3SEric Huang 460b0297530SRan Sun struct SMU7_UlvScoreboard { 461770911a3SEric Huang uint8_t EnterUlv; 462770911a3SEric Huang uint8_t ExitUlv; 463770911a3SEric Huang uint8_t UlvActive; 464770911a3SEric Huang uint8_t WaitingForUlv; 465770911a3SEric Huang uint8_t UlvEnable; 466770911a3SEric Huang uint8_t UlvRunning; 467770911a3SEric Huang uint8_t UlvMasterEnable; 468770911a3SEric Huang uint8_t padding; 469770911a3SEric Huang uint32_t UlvAbortedCount; 470770911a3SEric Huang uint32_t UlvTimeStamp; 471770911a3SEric Huang }; 472770911a3SEric Huang 473770911a3SEric Huang typedef struct SMU7_UlvScoreboard SMU7_UlvScoreboard; 474770911a3SEric Huang 475b0297530SRan Sun struct VddgfxSavedRegisters { 476770911a3SEric Huang uint32_t GPU_DBG[3]; 477770911a3SEric Huang uint32_t MEC_BaseAddress_Hi; 478770911a3SEric Huang uint32_t MEC_BaseAddress_Lo; 479770911a3SEric Huang uint32_t THM_TMON0_CTRL2__RDIR_PRESENT; 480770911a3SEric Huang uint32_t THM_TMON1_CTRL2__RDIR_PRESENT; 481770911a3SEric Huang uint32_t CP_INT_CNTL; 482770911a3SEric Huang }; 483770911a3SEric Huang 484770911a3SEric Huang typedef struct VddgfxSavedRegisters VddgfxSavedRegisters; 485770911a3SEric Huang 486b0297530SRan Sun struct SMU7_VddGfxScoreboard { 487770911a3SEric Huang uint8_t VddGfxEnable; 488770911a3SEric Huang uint8_t VddGfxActive; 489770911a3SEric Huang uint8_t VPUResetOccured; 490770911a3SEric Huang uint8_t padding; 491770911a3SEric Huang 492770911a3SEric Huang uint32_t VddGfxEnteredCount; 493770911a3SEric Huang uint32_t VddGfxAbortedCount; 494770911a3SEric Huang 495770911a3SEric Huang uint32_t VddGfxVid; 496770911a3SEric Huang 497770911a3SEric Huang VddgfxSavedRegisters SavedRegisters; 498770911a3SEric Huang }; 499770911a3SEric Huang 500770911a3SEric Huang typedef struct SMU7_VddGfxScoreboard SMU7_VddGfxScoreboard; 501770911a3SEric Huang 502770911a3SEric Huang struct SMU7_TdcLimitScoreboard { 503770911a3SEric Huang uint8_t Enable; 504770911a3SEric Huang uint8_t Running; 505770911a3SEric Huang uint16_t Alpha; 506770911a3SEric Huang uint32_t FilteredIddc; 507770911a3SEric Huang uint32_t IddcLimit; 508770911a3SEric Huang uint32_t IddcHyst; 509770911a3SEric Huang SMU7_HystController_Data HystControllerData; 510770911a3SEric Huang }; 511770911a3SEric Huang 512770911a3SEric Huang typedef struct SMU7_TdcLimitScoreboard SMU7_TdcLimitScoreboard; 513770911a3SEric Huang 514770911a3SEric Huang struct SMU7_PkgPwrLimitScoreboard { 515770911a3SEric Huang uint8_t Enable; 516770911a3SEric Huang uint8_t Running; 517770911a3SEric Huang uint16_t Alpha; 518770911a3SEric Huang uint32_t FilteredPkgPwr; 519770911a3SEric Huang uint32_t Limit; 520770911a3SEric Huang uint32_t Hyst; 521770911a3SEric Huang uint32_t LimitFromDriver; 522770911a3SEric Huang SMU7_HystController_Data HystControllerData; 523770911a3SEric Huang }; 524770911a3SEric Huang 525770911a3SEric Huang typedef struct SMU7_PkgPwrLimitScoreboard SMU7_PkgPwrLimitScoreboard; 526770911a3SEric Huang 527770911a3SEric Huang struct SMU7_BapmScoreboard { 528770911a3SEric Huang uint32_t source_powers[SMU73_DTE_SOURCES]; 529770911a3SEric Huang uint32_t source_powers_last[SMU73_DTE_SOURCES]; 530770911a3SEric Huang int32_t entity_temperatures[SMU73_NUM_GPU_TES]; 531770911a3SEric Huang int32_t initial_entity_temperatures[SMU73_NUM_GPU_TES]; 532770911a3SEric Huang int32_t Limit; 533770911a3SEric Huang int32_t Hyst; 534770911a3SEric Huang int32_t therm_influence_coeff_table[SMU73_DTE_ITERATIONS * SMU73_DTE_SOURCES * SMU73_DTE_SINKS * 2]; 535770911a3SEric Huang int32_t therm_node_table[SMU73_DTE_ITERATIONS * SMU73_DTE_SOURCES * SMU73_DTE_SINKS]; 536770911a3SEric Huang uint16_t ConfigTDPPowerScalar; 537770911a3SEric Huang uint16_t FanSpeedPowerScalar; 538770911a3SEric Huang uint16_t OverDrivePowerScalar; 539770911a3SEric Huang uint16_t OverDriveLimitScalar; 540770911a3SEric Huang uint16_t FinalPowerScalar; 541770911a3SEric Huang uint8_t VariantID; 542770911a3SEric Huang uint8_t spare997; 543770911a3SEric Huang 544770911a3SEric Huang SMU7_HystController_Data HystControllerData; 545770911a3SEric Huang 546770911a3SEric Huang int32_t temperature_gradient_slope; 547770911a3SEric Huang int32_t temperature_gradient; 548770911a3SEric Huang uint32_t measured_temperature; 549770911a3SEric Huang }; 550770911a3SEric Huang 551770911a3SEric Huang 552770911a3SEric Huang typedef struct SMU7_BapmScoreboard SMU7_BapmScoreboard; 553770911a3SEric Huang 554770911a3SEric Huang struct SMU7_AcpiScoreboard { 555770911a3SEric Huang uint32_t SavedInterruptMask[2]; 556770911a3SEric Huang uint8_t LastACPIRequest; 557770911a3SEric Huang uint8_t CgBifResp; 558770911a3SEric Huang uint8_t RequestType; 559770911a3SEric Huang uint8_t Padding; 560770911a3SEric Huang SMU73_Discrete_ACPILevel D0Level; 561770911a3SEric Huang }; 562770911a3SEric Huang 563770911a3SEric Huang typedef struct SMU7_AcpiScoreboard SMU7_AcpiScoreboard; 564770911a3SEric Huang 565770911a3SEric Huang struct SMU_QuadraticCoeffs { 566770911a3SEric Huang int32_t m1; 567770911a3SEric Huang uint32_t b; 568770911a3SEric Huang 569770911a3SEric Huang int16_t m2; 570770911a3SEric Huang uint8_t m1_shift; 571770911a3SEric Huang uint8_t m2_shift; 572770911a3SEric Huang }; 573770911a3SEric Huang 574770911a3SEric Huang typedef struct SMU_QuadraticCoeffs SMU_QuadraticCoeffs; 575770911a3SEric Huang 576770911a3SEric Huang struct SMU73_Discrete_PmFuses { 577770911a3SEric Huang /* dw0-dw1 */ 578770911a3SEric Huang uint8_t BapmVddCVidHiSidd[8]; 579770911a3SEric Huang 580770911a3SEric Huang /* dw2-dw3 */ 581770911a3SEric Huang uint8_t BapmVddCVidLoSidd[8]; 582770911a3SEric Huang 583770911a3SEric Huang /* dw4-dw5 */ 584770911a3SEric Huang uint8_t VddCVid[8]; 585770911a3SEric Huang 586770911a3SEric Huang /* dw1*/ 587770911a3SEric Huang uint8_t SviLoadLineEn; 588770911a3SEric Huang uint8_t SviLoadLineVddC; 589770911a3SEric Huang uint8_t SviLoadLineTrimVddC; 590770911a3SEric Huang uint8_t SviLoadLineOffsetVddC; 591770911a3SEric Huang 592770911a3SEric Huang /* dw2 */ 593770911a3SEric Huang uint16_t TDC_VDDC_PkgLimit; 594770911a3SEric Huang uint8_t TDC_VDDC_ThrottleReleaseLimitPerc; 595770911a3SEric Huang uint8_t TDC_MAWt; 596770911a3SEric Huang 597770911a3SEric Huang /* dw3 */ 598770911a3SEric Huang uint8_t TdcWaterfallCtl; 599770911a3SEric Huang uint8_t LPMLTemperatureMin; 600770911a3SEric Huang uint8_t LPMLTemperatureMax; 601770911a3SEric Huang uint8_t Reserved; 602770911a3SEric Huang 603770911a3SEric Huang /* dw4-dw7 */ 604770911a3SEric Huang uint8_t LPMLTemperatureScaler[16]; 605770911a3SEric Huang 606770911a3SEric Huang /* dw8-dw9 */ 607770911a3SEric Huang int16_t FuzzyFan_ErrorSetDelta; 608770911a3SEric Huang int16_t FuzzyFan_ErrorRateSetDelta; 609770911a3SEric Huang int16_t FuzzyFan_PwmSetDelta; 610770911a3SEric Huang uint16_t Reserved6; 611770911a3SEric Huang 612770911a3SEric Huang /* dw10-dw14 */ 613770911a3SEric Huang uint8_t GnbLPML[16]; 614770911a3SEric Huang 615770911a3SEric Huang /* dw15 */ 616770911a3SEric Huang uint8_t GnbLPMLMaxVid; 617770911a3SEric Huang uint8_t GnbLPMLMinVid; 618770911a3SEric Huang uint8_t Reserved1[2]; 619770911a3SEric Huang 620770911a3SEric Huang /* dw16 */ 621770911a3SEric Huang uint16_t BapmVddCBaseLeakageHiSidd; 622770911a3SEric Huang uint16_t BapmVddCBaseLeakageLoSidd; 623770911a3SEric Huang 624770911a3SEric Huang /* AVFS */ 625770911a3SEric Huang uint16_t VFT_Temp[3]; 626770911a3SEric Huang uint16_t padding; 627770911a3SEric Huang 628770911a3SEric Huang SMU_QuadraticCoeffs VFT_ATE[3]; 629770911a3SEric Huang 630770911a3SEric Huang SMU_QuadraticCoeffs AVFS_GB; 631770911a3SEric Huang SMU_QuadraticCoeffs ATE_ACBTC_GB; 632770911a3SEric Huang 633770911a3SEric Huang SMU_QuadraticCoeffs P2V; 634770911a3SEric Huang 635770911a3SEric Huang uint32_t PsmCharzFreq; 636770911a3SEric Huang 637770911a3SEric Huang uint16_t InversionVoltage; 638770911a3SEric Huang uint16_t PsmCharzTemp; 639770911a3SEric Huang 640770911a3SEric Huang uint32_t EnabledAvfsModules; 641770911a3SEric Huang }; 642770911a3SEric Huang 643770911a3SEric Huang typedef struct SMU73_Discrete_PmFuses SMU73_Discrete_PmFuses; 644770911a3SEric Huang 645770911a3SEric Huang struct SMU7_Discrete_Log_Header_Table { 646770911a3SEric Huang uint32_t version; 647770911a3SEric Huang uint32_t asic_id; 648770911a3SEric Huang uint16_t flags; 649770911a3SEric Huang uint16_t entry_size; 650770911a3SEric Huang uint32_t total_size; 651770911a3SEric Huang uint32_t num_of_entries; 652770911a3SEric Huang uint8_t type; 653770911a3SEric Huang uint8_t mode; 654770911a3SEric Huang uint8_t filler_0[2]; 655770911a3SEric Huang uint32_t filler_1[2]; 656770911a3SEric Huang }; 657770911a3SEric Huang 658770911a3SEric Huang typedef struct SMU7_Discrete_Log_Header_Table SMU7_Discrete_Log_Header_Table; 659770911a3SEric Huang 660770911a3SEric Huang struct SMU7_Discrete_Log_Cntl { 661770911a3SEric Huang uint8_t Enabled; 662770911a3SEric Huang uint8_t Type; 663770911a3SEric Huang uint8_t padding[2]; 664770911a3SEric Huang uint32_t BufferSize; 665770911a3SEric Huang uint32_t SamplesLogged; 666770911a3SEric Huang uint32_t SampleSize; 667770911a3SEric Huang uint32_t AddrL; 668770911a3SEric Huang uint32_t AddrH; 669770911a3SEric Huang }; 670770911a3SEric Huang 671770911a3SEric Huang typedef struct SMU7_Discrete_Log_Cntl SMU7_Discrete_Log_Cntl; 672770911a3SEric Huang 673770911a3SEric Huang #define CAC_ACC_NW_NUM_OF_SIGNALS 87 674770911a3SEric Huang 675770911a3SEric Huang struct SMU7_Discrete_Cac_Collection_Table { 676770911a3SEric Huang uint32_t temperature; 677770911a3SEric Huang uint32_t cac_acc_nw[CAC_ACC_NW_NUM_OF_SIGNALS]; 678770911a3SEric Huang }; 679770911a3SEric Huang 680770911a3SEric Huang typedef struct SMU7_Discrete_Cac_Collection_Table SMU7_Discrete_Cac_Collection_Table; 681770911a3SEric Huang 682770911a3SEric Huang struct SMU7_Discrete_Cac_Verification_Table { 683770911a3SEric Huang uint32_t VddcTotalPower; 684770911a3SEric Huang uint32_t VddcLeakagePower; 685770911a3SEric Huang uint32_t VddcConstantPower; 686770911a3SEric Huang uint32_t VddcGfxDynamicPower; 687770911a3SEric Huang uint32_t VddcUvdDynamicPower; 688770911a3SEric Huang uint32_t VddcVceDynamicPower; 689770911a3SEric Huang uint32_t VddcAcpDynamicPower; 690770911a3SEric Huang uint32_t VddcPcieDynamicPower; 691770911a3SEric Huang uint32_t VddcDceDynamicPower; 692770911a3SEric Huang uint32_t VddcCurrent; 693770911a3SEric Huang uint32_t VddcVoltage; 694770911a3SEric Huang uint32_t VddciTotalPower; 695770911a3SEric Huang uint32_t VddciLeakagePower; 696770911a3SEric Huang uint32_t VddciConstantPower; 697770911a3SEric Huang uint32_t VddciDynamicPower; 698770911a3SEric Huang uint32_t Vddr1TotalPower; 699770911a3SEric Huang uint32_t Vddr1LeakagePower; 700770911a3SEric Huang uint32_t Vddr1ConstantPower; 701770911a3SEric Huang uint32_t Vddr1DynamicPower; 702770911a3SEric Huang uint32_t spare[4]; 703770911a3SEric Huang uint32_t temperature; 704770911a3SEric Huang }; 705770911a3SEric Huang 706770911a3SEric Huang typedef struct SMU7_Discrete_Cac_Verification_Table SMU7_Discrete_Cac_Verification_Table; 707770911a3SEric Huang 708770911a3SEric Huang struct SMU7_Discrete_Pm_Status_Table { 709770911a3SEric Huang //Thermal entities 710770911a3SEric Huang int32_t T_meas_max[SMU73_THERMAL_INPUT_LOOP_COUNT]; 711770911a3SEric Huang int32_t T_meas_acc[SMU73_THERMAL_INPUT_LOOP_COUNT]; 712770911a3SEric Huang int32_t T_meas_acc_cnt[SMU73_THERMAL_INPUT_LOOP_COUNT]; 713770911a3SEric Huang uint32_t T_hbm_acc; 714770911a3SEric Huang 715770911a3SEric Huang //Voltage domains 716770911a3SEric Huang uint32_t I_calc_max; 717770911a3SEric Huang uint32_t I_calc_acc; 718770911a3SEric Huang uint32_t P_meas_acc; 719770911a3SEric Huang uint32_t V_meas_load_acc; 720770911a3SEric Huang uint32_t I_meas_acc; 721770911a3SEric Huang uint32_t P_meas_acc_vddci; 722770911a3SEric Huang uint32_t V_meas_load_acc_vddci; 723770911a3SEric Huang uint32_t I_meas_acc_vddci; 724770911a3SEric Huang 725770911a3SEric Huang //Frequency 726770911a3SEric Huang uint16_t Sclk_dpm_residency[8]; 727770911a3SEric Huang uint16_t Uvd_dpm_residency[8]; 728770911a3SEric Huang uint16_t Vce_dpm_residency[8]; 729770911a3SEric Huang 730770911a3SEric Huang //Chip 731770911a3SEric Huang uint32_t P_roc_acc; 732770911a3SEric Huang uint32_t PkgPwr_max; 733770911a3SEric Huang uint32_t PkgPwr_acc; 734770911a3SEric Huang uint32_t MclkSwitchingTime_max; 735770911a3SEric Huang uint32_t MclkSwitchingTime_acc; 736770911a3SEric Huang uint32_t FanPwm_acc; 737770911a3SEric Huang uint32_t FanRpm_acc; 738770911a3SEric Huang uint32_t Gfx_busy_acc; 739770911a3SEric Huang uint32_t Mc_busy_acc; 740770911a3SEric Huang uint32_t Fps_acc; 741770911a3SEric Huang 742770911a3SEric Huang uint32_t AccCnt; 743770911a3SEric Huang }; 744770911a3SEric Huang 745770911a3SEric Huang typedef struct SMU7_Discrete_Pm_Status_Table SMU7_Discrete_Pm_Status_Table; 746770911a3SEric Huang 747770911a3SEric Huang //FIXME THESE NEED TO BE UPDATED 748770911a3SEric Huang #define SMU7_SCLK_CAC 0x561 749770911a3SEric Huang #define SMU7_MCLK_CAC 0xF9 750770911a3SEric Huang #define SMU7_VCLK_CAC 0x2DE 751770911a3SEric Huang #define SMU7_DCLK_CAC 0x2DE 752770911a3SEric Huang #define SMU7_ECLK_CAC 0x25E 753770911a3SEric Huang #define SMU7_ACLK_CAC 0x25E 754770911a3SEric Huang #define SMU7_SAMCLK_CAC 0x25E 755770911a3SEric Huang #define SMU7_DISPCLK_CAC 0x100 756770911a3SEric Huang #define SMU7_CAC_CONSTANT 0x2EE3430 757770911a3SEric Huang #define SMU7_CAC_CONSTANT_SHIFT 18 758770911a3SEric Huang 759770911a3SEric Huang #define SMU7_VDDCI_MCLK_CONST 1765 760770911a3SEric Huang #define SMU7_VDDCI_MCLK_CONST_SHIFT 16 761770911a3SEric Huang #define SMU7_VDDCI_VDDCI_CONST 50958 762770911a3SEric Huang #define SMU7_VDDCI_VDDCI_CONST_SHIFT 14 763770911a3SEric Huang #define SMU7_VDDCI_CONST 11781 764770911a3SEric Huang #define SMU7_VDDCI_STROBE_PWR 1331 765770911a3SEric Huang 766770911a3SEric Huang #define SMU7_VDDR1_CONST 693 767770911a3SEric Huang #define SMU7_VDDR1_CAC_WEIGHT 20 768770911a3SEric Huang #define SMU7_VDDR1_CAC_WEIGHT_SHIFT 19 769770911a3SEric Huang #define SMU7_VDDR1_STROBE_PWR 512 770770911a3SEric Huang 771770911a3SEric Huang #define SMU7_AREA_COEFF_UVD 0xA78 772770911a3SEric Huang #define SMU7_AREA_COEFF_VCE 0x190A 773770911a3SEric Huang #define SMU7_AREA_COEFF_ACP 0x22D1 774770911a3SEric Huang #define SMU7_AREA_COEFF_SAMU 0x534 775770911a3SEric Huang 776770911a3SEric Huang //ThermOutMode values 777770911a3SEric Huang #define SMU7_THERM_OUT_MODE_DISABLE 0x0 778770911a3SEric Huang #define SMU7_THERM_OUT_MODE_THERM_ONLY 0x1 779770911a3SEric Huang #define SMU7_THERM_OUT_MODE_THERM_VRHOT 0x2 780770911a3SEric Huang 781770911a3SEric Huang #pragma pack(pop) 782770911a3SEric Huang 783770911a3SEric Huang #endif 784770911a3SEric Huang 785