18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2017 Advanced Micro Devices, Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 128c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 158c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 178c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 188c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 198c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 208c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_ci#ifndef SMU75_H 248c2ecf20Sopenharmony_ci#define SMU75_H 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#pragma pack(push, 1) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_citypedef struct { 298c2ecf20Sopenharmony_ci uint32_t high; 308c2ecf20Sopenharmony_ci uint32_t low; 318c2ecf20Sopenharmony_ci} data_64_t; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_citypedef struct { 348c2ecf20Sopenharmony_ci data_64_t high; 358c2ecf20Sopenharmony_ci data_64_t low; 368c2ecf20Sopenharmony_ci} data_128_t; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define SMU__DGPU_ONLY 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define SMU__NUM_SCLK_DPM_STATE 8 418c2ecf20Sopenharmony_ci#define SMU__NUM_MCLK_DPM_LEVELS 4 428c2ecf20Sopenharmony_ci#define SMU__NUM_LCLK_DPM_LEVELS 8 438c2ecf20Sopenharmony_ci#define SMU__NUM_PCIE_DPM_LEVELS 8 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define SMU7_CONTEXT_ID_SMC 1 468c2ecf20Sopenharmony_ci#define SMU7_CONTEXT_ID_VBIOS 2 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_VDDC 16 498c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_VDDGFX 16 508c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_VDDCI 8 518c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_MVDD 4 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define SMU_MAX_SMIO_LEVELS 4 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_GRAPHICS SMU__NUM_SCLK_DPM_STATE 568c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_MEMORY SMU__NUM_MCLK_DPM_LEVELS 578c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_GIO SMU__NUM_LCLK_DPM_LEVELS 588c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_LINK SMU__NUM_PCIE_DPM_LEVELS 598c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_UVD 8 608c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_VCE 8 618c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_ACP 8 628c2ecf20Sopenharmony_ci#define SMU75_MAX_LEVELS_SAMU 8 638c2ecf20Sopenharmony_ci#define SMU75_MAX_ENTRIES_SMIO 32 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define DPM_NO_LIMIT 0 668c2ecf20Sopenharmony_ci#define DPM_NO_UP 1 678c2ecf20Sopenharmony_ci#define DPM_GO_DOWN 2 688c2ecf20Sopenharmony_ci#define DPM_GO_UP 3 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#define SMU7_FIRST_DPM_GRAPHICS_LEVEL 0 718c2ecf20Sopenharmony_ci#define SMU7_FIRST_DPM_MEMORY_LEVEL 0 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define GPIO_CLAMP_MODE_VRHOT 1 748c2ecf20Sopenharmony_ci#define GPIO_CLAMP_MODE_THERM 2 758c2ecf20Sopenharmony_ci#define GPIO_CLAMP_MODE_DC 4 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_PCIE_INDEX_SHIFT 0 788c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_PCIE_INDEX_MASK (0x7<<SCRATCH_B_TARG_PCIE_INDEX_SHIFT) 798c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_PCIE_INDEX_SHIFT 3 808c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_PCIE_INDEX_MASK (0x7<<SCRATCH_B_CURR_PCIE_INDEX_SHIFT) 818c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_UVD_INDEX_SHIFT 6 828c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_UVD_INDEX_MASK (0x7<<SCRATCH_B_TARG_UVD_INDEX_SHIFT) 838c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_UVD_INDEX_SHIFT 9 848c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_UVD_INDEX_MASK (0x7<<SCRATCH_B_CURR_UVD_INDEX_SHIFT) 858c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_VCE_INDEX_SHIFT 12 868c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_VCE_INDEX_MASK (0x7<<SCRATCH_B_TARG_VCE_INDEX_SHIFT) 878c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_VCE_INDEX_SHIFT 15 888c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_VCE_INDEX_MASK (0x7<<SCRATCH_B_CURR_VCE_INDEX_SHIFT) 898c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_ACP_INDEX_SHIFT 18 908c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_ACP_INDEX_MASK (0x7<<SCRATCH_B_TARG_ACP_INDEX_SHIFT) 918c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_ACP_INDEX_SHIFT 21 928c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_ACP_INDEX_MASK (0x7<<SCRATCH_B_CURR_ACP_INDEX_SHIFT) 938c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_SAMU_INDEX_SHIFT 24 948c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_SAMU_INDEX_MASK (0x7<<SCRATCH_B_TARG_SAMU_INDEX_SHIFT) 958c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_SAMU_INDEX_SHIFT 27 968c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_SAMU_INDEX_MASK (0x7<<SCRATCH_B_CURR_SAMU_INDEX_SHIFT) 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* Virtualization Defines */ 998c2ecf20Sopenharmony_ci#define CG_XDMA_MASK 0x1 1008c2ecf20Sopenharmony_ci#define CG_XDMA_SHIFT 0 1018c2ecf20Sopenharmony_ci#define CG_UVD_MASK 0x2 1028c2ecf20Sopenharmony_ci#define CG_UVD_SHIFT 1 1038c2ecf20Sopenharmony_ci#define CG_VCE_MASK 0x4 1048c2ecf20Sopenharmony_ci#define CG_VCE_SHIFT 2 1058c2ecf20Sopenharmony_ci#define CG_SAMU_MASK 0x8 1068c2ecf20Sopenharmony_ci#define CG_SAMU_SHIFT 3 1078c2ecf20Sopenharmony_ci#define CG_GFX_MASK 0x10 1088c2ecf20Sopenharmony_ci#define CG_GFX_SHIFT 4 1098c2ecf20Sopenharmony_ci#define CG_SDMA_MASK 0x20 1108c2ecf20Sopenharmony_ci#define CG_SDMA_SHIFT 5 1118c2ecf20Sopenharmony_ci#define CG_HDP_MASK 0x40 1128c2ecf20Sopenharmony_ci#define CG_HDP_SHIFT 6 1138c2ecf20Sopenharmony_ci#define CG_MC_MASK 0x80 1148c2ecf20Sopenharmony_ci#define CG_MC_SHIFT 7 1158c2ecf20Sopenharmony_ci#define CG_DRM_MASK 0x100 1168c2ecf20Sopenharmony_ci#define CG_DRM_SHIFT 8 1178c2ecf20Sopenharmony_ci#define CG_ROM_MASK 0x200 1188c2ecf20Sopenharmony_ci#define CG_ROM_SHIFT 9 1198c2ecf20Sopenharmony_ci#define CG_BIF_MASK 0x400 1208c2ecf20Sopenharmony_ci#define CG_BIF_SHIFT 10 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci#if defined SMU__DGPU_ONLY 1238c2ecf20Sopenharmony_ci#define SMU75_DTE_ITERATIONS 5 1248c2ecf20Sopenharmony_ci#define SMU75_DTE_SOURCES 3 1258c2ecf20Sopenharmony_ci#define SMU75_DTE_SINKS 1 1268c2ecf20Sopenharmony_ci#define SMU75_NUM_CPU_TES 0 1278c2ecf20Sopenharmony_ci#define SMU75_NUM_GPU_TES 1 1288c2ecf20Sopenharmony_ci#define SMU75_NUM_NON_TES 2 1298c2ecf20Sopenharmony_ci#define SMU75_DTE_FAN_SCALAR_MIN 0x100 1308c2ecf20Sopenharmony_ci#define SMU75_DTE_FAN_SCALAR_MAX 0x166 1318c2ecf20Sopenharmony_ci#define SMU75_DTE_FAN_TEMP_MAX 93 1328c2ecf20Sopenharmony_ci#define SMU75_DTE_FAN_TEMP_MIN 83 1338c2ecf20Sopenharmony_ci#endif 1348c2ecf20Sopenharmony_ci#define SMU75_THERMAL_INPUT_LOOP_COUNT 2 1358c2ecf20Sopenharmony_ci#define SMU75_THERMAL_CLAMP_MODE_COUNT 2 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci#define EXP_M1_1 93 1388c2ecf20Sopenharmony_ci#define EXP_M2_1 195759 1398c2ecf20Sopenharmony_ci#define EXP_B_1 111176531 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci#define EXP_M1_2 67 1428c2ecf20Sopenharmony_ci#define EXP_M2_2 153720 1438c2ecf20Sopenharmony_ci#define EXP_B_2 94415767 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define EXP_M1_3 48 1468c2ecf20Sopenharmony_ci#define EXP_M2_3 119796 1478c2ecf20Sopenharmony_ci#define EXP_B_3 79195279 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci#define EXP_M1_4 550 1508c2ecf20Sopenharmony_ci#define EXP_M2_4 1484190 1518c2ecf20Sopenharmony_ci#define EXP_B_4 1051432828 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci#define EXP_M1_5 394 1548c2ecf20Sopenharmony_ci#define EXP_M2_5 1143049 1558c2ecf20Sopenharmony_ci#define EXP_B_5 864288432 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_cistruct SMU7_HystController_Data { 1588c2ecf20Sopenharmony_ci uint16_t waterfall_up; 1598c2ecf20Sopenharmony_ci uint16_t waterfall_down; 1608c2ecf20Sopenharmony_ci uint16_t waterfall_limit; 1618c2ecf20Sopenharmony_ci uint16_t release_cnt; 1628c2ecf20Sopenharmony_ci uint16_t release_limit; 1638c2ecf20Sopenharmony_ci uint16_t spare; 1648c2ecf20Sopenharmony_ci}; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_citypedef struct SMU7_HystController_Data SMU7_HystController_Data; 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_cistruct SMU75_PIDController { 1698c2ecf20Sopenharmony_ci uint32_t Ki; 1708c2ecf20Sopenharmony_ci int32_t LFWindupUpperLim; 1718c2ecf20Sopenharmony_ci int32_t LFWindupLowerLim; 1728c2ecf20Sopenharmony_ci uint32_t StatePrecision; 1738c2ecf20Sopenharmony_ci uint32_t LfPrecision; 1748c2ecf20Sopenharmony_ci uint32_t LfOffset; 1758c2ecf20Sopenharmony_ci uint32_t MaxState; 1768c2ecf20Sopenharmony_ci uint32_t MaxLfFraction; 1778c2ecf20Sopenharmony_ci uint32_t StateShift; 1788c2ecf20Sopenharmony_ci}; 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_citypedef struct SMU75_PIDController SMU75_PIDController; 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_cistruct SMU7_LocalDpmScoreboard { 1838c2ecf20Sopenharmony_ci uint32_t PercentageBusy; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci int32_t PIDError; 1868c2ecf20Sopenharmony_ci int32_t PIDIntegral; 1878c2ecf20Sopenharmony_ci int32_t PIDOutput; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci uint32_t SigmaDeltaAccum; 1908c2ecf20Sopenharmony_ci uint32_t SigmaDeltaOutput; 1918c2ecf20Sopenharmony_ci uint32_t SigmaDeltaLevel; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci uint32_t UtilizationSetpoint; 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci uint8_t TdpClampMode; 1968c2ecf20Sopenharmony_ci uint8_t TdcClampMode; 1978c2ecf20Sopenharmony_ci uint8_t ThermClampMode; 1988c2ecf20Sopenharmony_ci uint8_t VoltageBusy; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci int8_t CurrLevel; 2018c2ecf20Sopenharmony_ci int8_t TargLevel; 2028c2ecf20Sopenharmony_ci uint8_t LevelChangeInProgress; 2038c2ecf20Sopenharmony_ci uint8_t UpHyst; 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci uint8_t DownHyst; 2068c2ecf20Sopenharmony_ci uint8_t VoltageDownHyst; 2078c2ecf20Sopenharmony_ci uint8_t DpmEnable; 2088c2ecf20Sopenharmony_ci uint8_t DpmRunning; 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci uint8_t DpmForce; 2118c2ecf20Sopenharmony_ci uint8_t DpmForceLevel; 2128c2ecf20Sopenharmony_ci uint8_t DisplayWatermark; 2138c2ecf20Sopenharmony_ci uint8_t McArbIndex; 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci uint32_t MinimumPerfSclk; 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci uint8_t AcpiReq; 2188c2ecf20Sopenharmony_ci uint8_t AcpiAck; 2198c2ecf20Sopenharmony_ci uint8_t GfxClkSlow; 2208c2ecf20Sopenharmony_ci uint8_t GpioClampMode; 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci uint8_t EnableModeSwitchRLCNotification; 2238c2ecf20Sopenharmony_ci uint8_t EnabledLevelsChange; 2248c2ecf20Sopenharmony_ci uint8_t DteClampMode; 2258c2ecf20Sopenharmony_ci uint8_t FpsClampMode; 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci uint16_t LevelResidencyCounters [SMU75_MAX_LEVELS_GRAPHICS]; 2288c2ecf20Sopenharmony_ci uint16_t LevelSwitchCounters [SMU75_MAX_LEVELS_GRAPHICS]; 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci void (*TargetStateCalculator)(uint8_t); 2318c2ecf20Sopenharmony_ci void (*SavedTargetStateCalculator)(uint8_t); 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci uint16_t AutoDpmInterval; 2348c2ecf20Sopenharmony_ci uint16_t AutoDpmRange; 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci uint8_t FpsEnabled; 2378c2ecf20Sopenharmony_ci uint8_t MaxPerfLevel; 2388c2ecf20Sopenharmony_ci uint8_t AllowLowClkInterruptToHost; 2398c2ecf20Sopenharmony_ci uint8_t FpsRunning; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci uint32_t MaxAllowedFrequency; 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci uint32_t FilteredSclkFrequency; 2448c2ecf20Sopenharmony_ci uint32_t LastSclkFrequency; 2458c2ecf20Sopenharmony_ci uint32_t FilteredSclkFrequencyCnt; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci uint8_t MinPerfLevel; 2488c2ecf20Sopenharmony_ci#ifdef SMU__FIRMWARE_SCKS_PRESENT__1 2498c2ecf20Sopenharmony_ci uint8_t ScksClampMode; 2508c2ecf20Sopenharmony_ci uint8_t padding[2]; 2518c2ecf20Sopenharmony_ci#else 2528c2ecf20Sopenharmony_ci uint8_t padding[3]; 2538c2ecf20Sopenharmony_ci#endif 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci uint16_t FpsAlpha; 2568c2ecf20Sopenharmony_ci uint16_t DeltaTime; 2578c2ecf20Sopenharmony_ci uint32_t CurrentFps; 2588c2ecf20Sopenharmony_ci uint32_t FilteredFps; 2598c2ecf20Sopenharmony_ci uint32_t FrameCount; 2608c2ecf20Sopenharmony_ci uint32_t FrameCountLast; 2618c2ecf20Sopenharmony_ci uint16_t FpsTargetScalar; 2628c2ecf20Sopenharmony_ci uint16_t FpsWaterfallLimitScalar; 2638c2ecf20Sopenharmony_ci uint16_t FpsAlphaScalar; 2648c2ecf20Sopenharmony_ci uint16_t spare8; 2658c2ecf20Sopenharmony_ci SMU7_HystController_Data HystControllerData; 2668c2ecf20Sopenharmony_ci}; 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_citypedef struct SMU7_LocalDpmScoreboard SMU7_LocalDpmScoreboard; 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci#define SMU7_MAX_VOLTAGE_CLIENTS 12 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_citypedef uint8_t (*VoltageChangeHandler_t)(uint16_t, uint8_t); 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci#define VDDC_MASK 0x00007FFF 2758c2ecf20Sopenharmony_ci#define VDDC_SHIFT 0 2768c2ecf20Sopenharmony_ci#define VDDCI_MASK 0x3FFF8000 2778c2ecf20Sopenharmony_ci#define VDDCI_SHIFT 15 2788c2ecf20Sopenharmony_ci#define PHASES_MASK 0xC0000000 2798c2ecf20Sopenharmony_ci#define PHASES_SHIFT 30 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_citypedef uint32_t SMU_VoltageLevel; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_cistruct SMU7_VoltageScoreboard { 2848c2ecf20Sopenharmony_ci SMU_VoltageLevel TargetVoltage; 2858c2ecf20Sopenharmony_ci uint16_t MaxVid; 2868c2ecf20Sopenharmony_ci uint8_t HighestVidOffset; 2878c2ecf20Sopenharmony_ci uint8_t CurrentVidOffset; 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci uint16_t CurrentVddc; 2908c2ecf20Sopenharmony_ci uint16_t CurrentVddci; 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci uint8_t ControllerBusy; 2938c2ecf20Sopenharmony_ci uint8_t CurrentVid; 2948c2ecf20Sopenharmony_ci uint8_t CurrentVddciVid; 2958c2ecf20Sopenharmony_ci uint8_t padding; 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci SMU_VoltageLevel RequestedVoltage[SMU7_MAX_VOLTAGE_CLIENTS]; 2988c2ecf20Sopenharmony_ci SMU_VoltageLevel TargetVoltageState; 2998c2ecf20Sopenharmony_ci uint8_t EnabledRequest[SMU7_MAX_VOLTAGE_CLIENTS]; 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci uint8_t padding2; 3028c2ecf20Sopenharmony_ci uint8_t padding3; 3038c2ecf20Sopenharmony_ci uint8_t ControllerEnable; 3048c2ecf20Sopenharmony_ci uint8_t ControllerRunning; 3058c2ecf20Sopenharmony_ci uint16_t CurrentStdVoltageHiSidd; 3068c2ecf20Sopenharmony_ci uint16_t CurrentStdVoltageLoSidd; 3078c2ecf20Sopenharmony_ci uint8_t OverrideVoltage; 3088c2ecf20Sopenharmony_ci uint8_t padding4; 3098c2ecf20Sopenharmony_ci uint8_t padding5; 3108c2ecf20Sopenharmony_ci uint8_t CurrentPhases; 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci VoltageChangeHandler_t ChangeVddc; 3138c2ecf20Sopenharmony_ci VoltageChangeHandler_t ChangeVddci; 3148c2ecf20Sopenharmony_ci VoltageChangeHandler_t ChangePhase; 3158c2ecf20Sopenharmony_ci VoltageChangeHandler_t ChangeMvdd; 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci VoltageChangeHandler_t functionLinks[6]; 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci uint16_t * VddcFollower1; 3208c2ecf20Sopenharmony_ci int16_t Driver_OD_RequestedVidOffset1; 3218c2ecf20Sopenharmony_ci int16_t Driver_OD_RequestedVidOffset2; 3228c2ecf20Sopenharmony_ci}; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_citypedef struct SMU7_VoltageScoreboard SMU7_VoltageScoreboard; 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci#define SMU7_MAX_PCIE_LINK_SPEEDS 3 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_cistruct SMU7_PCIeLinkSpeedScoreboard { 3298c2ecf20Sopenharmony_ci uint8_t DpmEnable; 3308c2ecf20Sopenharmony_ci uint8_t DpmRunning; 3318c2ecf20Sopenharmony_ci uint8_t DpmForce; 3328c2ecf20Sopenharmony_ci uint8_t DpmForceLevel; 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ci uint8_t CurrentLinkSpeed; 3358c2ecf20Sopenharmony_ci uint8_t EnabledLevelsChange; 3368c2ecf20Sopenharmony_ci uint16_t AutoDpmInterval; 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci uint16_t AutoDpmRange; 3398c2ecf20Sopenharmony_ci uint16_t AutoDpmCount; 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ci uint8_t DpmMode; 3428c2ecf20Sopenharmony_ci uint8_t AcpiReq; 3438c2ecf20Sopenharmony_ci uint8_t AcpiAck; 3448c2ecf20Sopenharmony_ci uint8_t CurrentLinkLevel; 3458c2ecf20Sopenharmony_ci}; 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_citypedef struct SMU7_PCIeLinkSpeedScoreboard SMU7_PCIeLinkSpeedScoreboard; 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci#define SMU7_LKGE_LUT_NUM_OF_TEMP_ENTRIES 16 3508c2ecf20Sopenharmony_ci#define SMU7_LKGE_LUT_NUM_OF_VOLT_ENTRIES 16 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_ci#define SMU7_SCALE_I 7 3538c2ecf20Sopenharmony_ci#define SMU7_SCALE_R 12 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_cistruct SMU7_PowerScoreboard { 3568c2ecf20Sopenharmony_ci uint32_t GpuPower; 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci uint32_t VddcPower; 3598c2ecf20Sopenharmony_ci uint32_t VddcVoltage; 3608c2ecf20Sopenharmony_ci uint32_t VddcCurrent; 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci uint32_t VddciPower; 3638c2ecf20Sopenharmony_ci uint32_t VddciVoltage; 3648c2ecf20Sopenharmony_ci uint32_t VddciCurrent; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci uint32_t RocPower; 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ci uint16_t Telemetry_1_slope; 3698c2ecf20Sopenharmony_ci uint16_t Telemetry_2_slope; 3708c2ecf20Sopenharmony_ci int32_t Telemetry_1_offset; 3718c2ecf20Sopenharmony_ci int32_t Telemetry_2_offset; 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ci uint8_t MCLK_patch_flag; 3748c2ecf20Sopenharmony_ci uint8_t reserved[3]; 3758c2ecf20Sopenharmony_ci}; 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_citypedef struct SMU7_PowerScoreboard SMU7_PowerScoreboard; 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci#define SMU7_SCLK_DPM_CONFIG_MASK 0x01 3808c2ecf20Sopenharmony_ci#define SMU7_VOLTAGE_CONTROLLER_CONFIG_MASK 0x02 3818c2ecf20Sopenharmony_ci#define SMU7_THERMAL_CONTROLLER_CONFIG_MASK 0x04 3828c2ecf20Sopenharmony_ci#define SMU7_MCLK_DPM_CONFIG_MASK 0x08 3838c2ecf20Sopenharmony_ci#define SMU7_UVD_DPM_CONFIG_MASK 0x10 3848c2ecf20Sopenharmony_ci#define SMU7_VCE_DPM_CONFIG_MASK 0x20 3858c2ecf20Sopenharmony_ci#define SMU7_ACP_DPM_CONFIG_MASK 0x40 3868c2ecf20Sopenharmony_ci#define SMU7_SAMU_DPM_CONFIG_MASK 0x80 3878c2ecf20Sopenharmony_ci#define SMU7_PCIEGEN_DPM_CONFIG_MASK 0x100 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci#define SMU7_ACP_MCLK_HANDSHAKE_DISABLE 0x00000001 3908c2ecf20Sopenharmony_ci#define SMU7_ACP_SCLK_HANDSHAKE_DISABLE 0x00000002 3918c2ecf20Sopenharmony_ci#define SMU7_UVD_MCLK_HANDSHAKE_DISABLE 0x00000100 3928c2ecf20Sopenharmony_ci#define SMU7_UVD_SCLK_HANDSHAKE_DISABLE 0x00000200 3938c2ecf20Sopenharmony_ci#define SMU7_VCE_MCLK_HANDSHAKE_DISABLE 0x00010000 3948c2ecf20Sopenharmony_ci#define SMU7_VCE_SCLK_HANDSHAKE_DISABLE 0x00020000 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_cistruct SMU75_SoftRegisters { 3978c2ecf20Sopenharmony_ci uint32_t RefClockFrequency; 3988c2ecf20Sopenharmony_ci uint32_t PmTimerPeriod; 3998c2ecf20Sopenharmony_ci uint32_t FeatureEnables; 4008c2ecf20Sopenharmony_ci#if defined (SMU__DGPU_ONLY) 4018c2ecf20Sopenharmony_ci uint32_t PreVBlankGap; 4028c2ecf20Sopenharmony_ci uint32_t VBlankTimeout; 4038c2ecf20Sopenharmony_ci uint32_t TrainTimeGap; 4048c2ecf20Sopenharmony_ci uint32_t MvddSwitchTime; 4058c2ecf20Sopenharmony_ci uint32_t LongestAcpiTrainTime; 4068c2ecf20Sopenharmony_ci uint32_t AcpiDelay; 4078c2ecf20Sopenharmony_ci uint32_t G5TrainTime; 4088c2ecf20Sopenharmony_ci uint32_t DelayMpllPwron; 4098c2ecf20Sopenharmony_ci uint32_t VoltageChangeTimeout; 4108c2ecf20Sopenharmony_ci#endif 4118c2ecf20Sopenharmony_ci uint32_t HandshakeDisables; 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_ci uint8_t DisplayPhy1Config; 4148c2ecf20Sopenharmony_ci uint8_t DisplayPhy2Config; 4158c2ecf20Sopenharmony_ci uint8_t DisplayPhy3Config; 4168c2ecf20Sopenharmony_ci uint8_t DisplayPhy4Config; 4178c2ecf20Sopenharmony_ci 4188c2ecf20Sopenharmony_ci uint8_t DisplayPhy5Config; 4198c2ecf20Sopenharmony_ci uint8_t DisplayPhy6Config; 4208c2ecf20Sopenharmony_ci uint8_t DisplayPhy7Config; 4218c2ecf20Sopenharmony_ci uint8_t DisplayPhy8Config; 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_ci uint32_t AverageGraphicsActivity; 4248c2ecf20Sopenharmony_ci uint32_t AverageMemoryActivity; 4258c2ecf20Sopenharmony_ci uint32_t AverageGioActivity; 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_ci uint8_t SClkDpmEnabledLevels; 4288c2ecf20Sopenharmony_ci uint8_t MClkDpmEnabledLevels; 4298c2ecf20Sopenharmony_ci uint8_t LClkDpmEnabledLevels; 4308c2ecf20Sopenharmony_ci uint8_t PCIeDpmEnabledLevels; 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci uint8_t UVDDpmEnabledLevels; 4338c2ecf20Sopenharmony_ci uint8_t SAMUDpmEnabledLevels; 4348c2ecf20Sopenharmony_ci uint8_t ACPDpmEnabledLevels; 4358c2ecf20Sopenharmony_ci uint8_t VCEDpmEnabledLevels; 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_ADDR_H; 4388c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_ADDR_L; 4398c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_PHY_ADDR_H; 4408c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_PHY_ADDR_L; 4418c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_BUFF_SIZE; 4428c2ecf20Sopenharmony_ci uint32_t UlvEnterCount; 4438c2ecf20Sopenharmony_ci uint32_t UlvTime; 4448c2ecf20Sopenharmony_ci uint32_t UcodeLoadStatus; 4458c2ecf20Sopenharmony_ci uint32_t AllowMvddSwitch; 4468c2ecf20Sopenharmony_ci uint8_t Activity_Weight; 4478c2ecf20Sopenharmony_ci uint8_t Reserved8[3]; 4488c2ecf20Sopenharmony_ci}; 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_citypedef struct SMU75_SoftRegisters SMU75_SoftRegisters; 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_cistruct SMU75_Firmware_Header { 4538c2ecf20Sopenharmony_ci uint32_t Digest[5]; 4548c2ecf20Sopenharmony_ci uint32_t Version; 4558c2ecf20Sopenharmony_ci uint32_t HeaderSize; 4568c2ecf20Sopenharmony_ci uint32_t Flags; 4578c2ecf20Sopenharmony_ci uint32_t EntryPoint; 4588c2ecf20Sopenharmony_ci uint32_t CodeSize; 4598c2ecf20Sopenharmony_ci uint32_t ImageSize; 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci uint32_t Rtos; 4628c2ecf20Sopenharmony_ci uint32_t SoftRegisters; 4638c2ecf20Sopenharmony_ci uint32_t DpmTable; 4648c2ecf20Sopenharmony_ci uint32_t FanTable; 4658c2ecf20Sopenharmony_ci uint32_t CacConfigTable; 4668c2ecf20Sopenharmony_ci uint32_t CacStatusTable; 4678c2ecf20Sopenharmony_ci uint32_t mcRegisterTable; 4688c2ecf20Sopenharmony_ci uint32_t mcArbDramTimingTable; 4698c2ecf20Sopenharmony_ci uint32_t PmFuseTable; 4708c2ecf20Sopenharmony_ci uint32_t Globals; 4718c2ecf20Sopenharmony_ci uint32_t ClockStretcherTable; 4728c2ecf20Sopenharmony_ci uint32_t VftTable; 4738c2ecf20Sopenharmony_ci uint32_t Reserved1; 4748c2ecf20Sopenharmony_ci uint32_t AvfsCksOff_AvfsGbvTable; 4758c2ecf20Sopenharmony_ci uint32_t AvfsCksOff_BtcGbvTable; 4768c2ecf20Sopenharmony_ci uint32_t MM_AvfsTable; 4778c2ecf20Sopenharmony_ci uint32_t PowerSharingTable; 4788c2ecf20Sopenharmony_ci uint32_t AvfsTable; 4798c2ecf20Sopenharmony_ci uint32_t AvfsCksOffGbvTable; 4808c2ecf20Sopenharmony_ci uint32_t AvfsMeanNSigma; 4818c2ecf20Sopenharmony_ci uint32_t AvfsSclkOffsetTable; 4828c2ecf20Sopenharmony_ci uint32_t Reserved[12]; 4838c2ecf20Sopenharmony_ci uint32_t Signature; 4848c2ecf20Sopenharmony_ci}; 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_citypedef struct SMU75_Firmware_Header SMU75_Firmware_Header; 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci#define SMU7_FIRMWARE_HEADER_LOCATION 0x20000 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_cienum DisplayConfig { 4918c2ecf20Sopenharmony_ci PowerDown = 1, 4928c2ecf20Sopenharmony_ci DP54x4, 4938c2ecf20Sopenharmony_ci DP54x2, 4948c2ecf20Sopenharmony_ci DP54x1, 4958c2ecf20Sopenharmony_ci DP27x4, 4968c2ecf20Sopenharmony_ci DP27x2, 4978c2ecf20Sopenharmony_ci DP27x1, 4988c2ecf20Sopenharmony_ci HDMI297, 4998c2ecf20Sopenharmony_ci HDMI162, 5008c2ecf20Sopenharmony_ci LVDS, 5018c2ecf20Sopenharmony_ci DP324x4, 5028c2ecf20Sopenharmony_ci DP324x2, 5038c2ecf20Sopenharmony_ci DP324x1 5048c2ecf20Sopenharmony_ci}; 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_ci#define MC_BLOCK_COUNT 1 5078c2ecf20Sopenharmony_ci#define CPL_BLOCK_COUNT 5 5088c2ecf20Sopenharmony_ci#define SE_BLOCK_COUNT 15 5098c2ecf20Sopenharmony_ci#define GC_BLOCK_COUNT 24 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_cistruct SMU7_Local_Cac { 5128c2ecf20Sopenharmony_ci uint8_t BlockId; 5138c2ecf20Sopenharmony_ci uint8_t SignalId; 5148c2ecf20Sopenharmony_ci uint8_t Threshold; 5158c2ecf20Sopenharmony_ci uint8_t Padding; 5168c2ecf20Sopenharmony_ci}; 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_citypedef struct SMU7_Local_Cac SMU7_Local_Cac; 5198c2ecf20Sopenharmony_ci 5208c2ecf20Sopenharmony_cistruct SMU7_Local_Cac_Table { 5218c2ecf20Sopenharmony_ci SMU7_Local_Cac CplLocalCac[CPL_BLOCK_COUNT]; 5228c2ecf20Sopenharmony_ci SMU7_Local_Cac McLocalCac[MC_BLOCK_COUNT]; 5238c2ecf20Sopenharmony_ci SMU7_Local_Cac SeLocalCac[SE_BLOCK_COUNT]; 5248c2ecf20Sopenharmony_ci SMU7_Local_Cac GcLocalCac[GC_BLOCK_COUNT]; 5258c2ecf20Sopenharmony_ci}; 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_citypedef struct SMU7_Local_Cac_Table SMU7_Local_Cac_Table; 5288c2ecf20Sopenharmony_ci 5298c2ecf20Sopenharmony_ci#pragma pack(pop) 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_ci#define CG_SYS_BITMASK_FIRST_BIT 0 5328c2ecf20Sopenharmony_ci#define CG_SYS_BITMASK_LAST_BIT 10 5338c2ecf20Sopenharmony_ci#define CG_SYS_BIF_MGLS_SHIFT 0 5348c2ecf20Sopenharmony_ci#define CG_SYS_ROM_SHIFT 1 5358c2ecf20Sopenharmony_ci#define CG_SYS_MC_MGCG_SHIFT 2 5368c2ecf20Sopenharmony_ci#define CG_SYS_MC_MGLS_SHIFT 3 5378c2ecf20Sopenharmony_ci#define CG_SYS_SDMA_MGCG_SHIFT 4 5388c2ecf20Sopenharmony_ci#define CG_SYS_SDMA_MGLS_SHIFT 5 5398c2ecf20Sopenharmony_ci#define CG_SYS_DRM_MGCG_SHIFT 6 5408c2ecf20Sopenharmony_ci#define CG_SYS_HDP_MGCG_SHIFT 7 5418c2ecf20Sopenharmony_ci#define CG_SYS_HDP_MGLS_SHIFT 8 5428c2ecf20Sopenharmony_ci#define CG_SYS_DRM_MGLS_SHIFT 9 5438c2ecf20Sopenharmony_ci#define CG_SYS_BIF_MGCG_SHIFT 10 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci#define CG_SYS_BIF_MGLS_MASK 0x1 5468c2ecf20Sopenharmony_ci#define CG_SYS_ROM_MASK 0x2 5478c2ecf20Sopenharmony_ci#define CG_SYS_MC_MGCG_MASK 0x4 5488c2ecf20Sopenharmony_ci#define CG_SYS_MC_MGLS_MASK 0x8 5498c2ecf20Sopenharmony_ci#define CG_SYS_SDMA_MGCG_MASK 0x10 5508c2ecf20Sopenharmony_ci#define CG_SYS_SDMA_MGLS_MASK 0x20 5518c2ecf20Sopenharmony_ci#define CG_SYS_DRM_MGCG_MASK 0x40 5528c2ecf20Sopenharmony_ci#define CG_SYS_HDP_MGCG_MASK 0x80 5538c2ecf20Sopenharmony_ci#define CG_SYS_HDP_MGLS_MASK 0x100 5548c2ecf20Sopenharmony_ci#define CG_SYS_DRM_MGLS_MASK 0x200 5558c2ecf20Sopenharmony_ci#define CG_SYS_BIF_MGCG_MASK 0x400 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci#define CG_GFX_BITMASK_FIRST_BIT 16 5588c2ecf20Sopenharmony_ci#define CG_GFX_BITMASK_LAST_BIT 24 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci#define CG_GFX_CGCG_SHIFT 16 5618c2ecf20Sopenharmony_ci#define CG_GFX_CGLS_SHIFT 17 5628c2ecf20Sopenharmony_ci#define CG_CPF_MGCG_SHIFT 18 5638c2ecf20Sopenharmony_ci#define CG_RLC_MGCG_SHIFT 19 5648c2ecf20Sopenharmony_ci#define CG_GFX_OTHERS_MGCG_SHIFT 20 5658c2ecf20Sopenharmony_ci#define CG_GFX_3DCG_SHIFT 21 5668c2ecf20Sopenharmony_ci#define CG_GFX_3DLS_SHIFT 22 5678c2ecf20Sopenharmony_ci#define CG_GFX_RLC_LS_SHIFT 23 5688c2ecf20Sopenharmony_ci#define CG_GFX_CP_LS_SHIFT 24 5698c2ecf20Sopenharmony_ci 5708c2ecf20Sopenharmony_ci#define CG_GFX_CGCG_MASK 0x00010000 5718c2ecf20Sopenharmony_ci#define CG_GFX_CGLS_MASK 0x00020000 5728c2ecf20Sopenharmony_ci#define CG_CPF_MGCG_MASK 0x00040000 5738c2ecf20Sopenharmony_ci#define CG_RLC_MGCG_MASK 0x00080000 5748c2ecf20Sopenharmony_ci#define CG_GFX_OTHERS_MGCG_MASK 0x00100000 5758c2ecf20Sopenharmony_ci#define CG_GFX_3DCG_MASK 0x00200000 5768c2ecf20Sopenharmony_ci#define CG_GFX_3DLS_MASK 0x00400000 5778c2ecf20Sopenharmony_ci#define CG_GFX_RLC_LS_MASK 0x00800000 5788c2ecf20Sopenharmony_ci#define CG_GFX_CP_LS_MASK 0x01000000 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_ci 5818c2ecf20Sopenharmony_ci#define VRCONF_VDDC_MASK 0x000000FF 5828c2ecf20Sopenharmony_ci#define VRCONF_VDDC_SHIFT 0 5838c2ecf20Sopenharmony_ci#define VRCONF_VDDGFX_MASK 0x0000FF00 5848c2ecf20Sopenharmony_ci#define VRCONF_VDDGFX_SHIFT 8 5858c2ecf20Sopenharmony_ci#define VRCONF_VDDCI_MASK 0x00FF0000 5868c2ecf20Sopenharmony_ci#define VRCONF_VDDCI_SHIFT 16 5878c2ecf20Sopenharmony_ci#define VRCONF_MVDD_MASK 0xFF000000 5888c2ecf20Sopenharmony_ci#define VRCONF_MVDD_SHIFT 24 5898c2ecf20Sopenharmony_ci 5908c2ecf20Sopenharmony_ci#define VR_MERGED_WITH_VDDC 0 5918c2ecf20Sopenharmony_ci#define VR_SVI2_PLANE_1 1 5928c2ecf20Sopenharmony_ci#define VR_SVI2_PLANE_2 2 5938c2ecf20Sopenharmony_ci#define VR_SMIO_PATTERN_1 3 5948c2ecf20Sopenharmony_ci#define VR_SMIO_PATTERN_2 4 5958c2ecf20Sopenharmony_ci#define VR_STATIC_VOLTAGE 5 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_MAX_ENTRIES 0x4 5988c2ecf20Sopenharmony_ci#define CKS_LOOKUPTable_MAX_ENTRIES 0x4 5998c2ecf20Sopenharmony_ci 6008c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_DDT_MASK 0x01 6018c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_DDT_SHIFT 0x0 6028c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_STRETCH_AMOUNT_MASK 0x1E 6038c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_STRETCH_AMOUNT_SHIFT 0x1 6048c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_ENABLE_MASK 0x80 6058c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_ENABLE_SHIFT 0x7 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_cistruct SMU_ClockStretcherDataTableEntry { 6088c2ecf20Sopenharmony_ci uint8_t minVID; 6098c2ecf20Sopenharmony_ci uint8_t maxVID; 6108c2ecf20Sopenharmony_ci 6118c2ecf20Sopenharmony_ci uint16_t setting; 6128c2ecf20Sopenharmony_ci}; 6138c2ecf20Sopenharmony_citypedef struct SMU_ClockStretcherDataTableEntry SMU_ClockStretcherDataTableEntry; 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_cistruct SMU_ClockStretcherDataTable { 6168c2ecf20Sopenharmony_ci SMU_ClockStretcherDataTableEntry ClockStretcherDataTableEntry[CLOCK_STRETCHER_MAX_ENTRIES]; 6178c2ecf20Sopenharmony_ci}; 6188c2ecf20Sopenharmony_citypedef struct SMU_ClockStretcherDataTable SMU_ClockStretcherDataTable; 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_cistruct SMU_CKS_LOOKUPTableEntry { 6218c2ecf20Sopenharmony_ci uint16_t minFreq; 6228c2ecf20Sopenharmony_ci uint16_t maxFreq; 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_ci uint8_t setting; 6258c2ecf20Sopenharmony_ci uint8_t padding[3]; 6268c2ecf20Sopenharmony_ci}; 6278c2ecf20Sopenharmony_citypedef struct SMU_CKS_LOOKUPTableEntry SMU_CKS_LOOKUPTableEntry; 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_cistruct SMU_CKS_LOOKUPTable { 6308c2ecf20Sopenharmony_ci SMU_CKS_LOOKUPTableEntry CKS_LOOKUPTableEntry[CKS_LOOKUPTable_MAX_ENTRIES]; 6318c2ecf20Sopenharmony_ci}; 6328c2ecf20Sopenharmony_citypedef struct SMU_CKS_LOOKUPTable SMU_CKS_LOOKUPTable; 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_cistruct AgmAvfsData_t { 6358c2ecf20Sopenharmony_ci uint16_t avgPsmCount[28]; 6368c2ecf20Sopenharmony_ci uint16_t minPsmCount[28]; 6378c2ecf20Sopenharmony_ci}; 6388c2ecf20Sopenharmony_citypedef struct AgmAvfsData_t AgmAvfsData_t; 6398c2ecf20Sopenharmony_ci 6408c2ecf20Sopenharmony_cienum VFT_COLUMNS { 6418c2ecf20Sopenharmony_ci SCLK0, 6428c2ecf20Sopenharmony_ci SCLK1, 6438c2ecf20Sopenharmony_ci SCLK2, 6448c2ecf20Sopenharmony_ci SCLK3, 6458c2ecf20Sopenharmony_ci SCLK4, 6468c2ecf20Sopenharmony_ci SCLK5, 6478c2ecf20Sopenharmony_ci SCLK6, 6488c2ecf20Sopenharmony_ci SCLK7, 6498c2ecf20Sopenharmony_ci 6508c2ecf20Sopenharmony_ci NUM_VFT_COLUMNS 6518c2ecf20Sopenharmony_ci}; 6528c2ecf20Sopenharmony_cienum { 6538c2ecf20Sopenharmony_ci SCS_FUSE_T0, 6548c2ecf20Sopenharmony_ci SCS_FUSE_T1, 6558c2ecf20Sopenharmony_ci NUM_SCS_FUSE_TEMPERATURE 6568c2ecf20Sopenharmony_ci}; 6578c2ecf20Sopenharmony_cienum { 6588c2ecf20Sopenharmony_ci SCKS_ON, 6598c2ecf20Sopenharmony_ci SCKS_OFF, 6608c2ecf20Sopenharmony_ci NUM_SCKS_STATE_TYPES 6618c2ecf20Sopenharmony_ci}; 6628c2ecf20Sopenharmony_ci 6638c2ecf20Sopenharmony_ci#define VFT_TABLE_DEFINED 6648c2ecf20Sopenharmony_ci 6658c2ecf20Sopenharmony_ci#define TEMP_RANGE_MAXSTEPS 12 6668c2ecf20Sopenharmony_cistruct VFT_CELL_t { 6678c2ecf20Sopenharmony_ci uint16_t Voltage; 6688c2ecf20Sopenharmony_ci}; 6698c2ecf20Sopenharmony_ci 6708c2ecf20Sopenharmony_citypedef struct VFT_CELL_t VFT_CELL_t; 6718c2ecf20Sopenharmony_ci#ifdef SMU__FIRMWARE_SCKS_PRESENT__1 6728c2ecf20Sopenharmony_cistruct SCS_CELL_t { 6738c2ecf20Sopenharmony_ci uint16_t PsmCnt[NUM_SCKS_STATE_TYPES]; 6748c2ecf20Sopenharmony_ci}; 6758c2ecf20Sopenharmony_citypedef struct SCS_CELL_t SCS_CELL_t; 6768c2ecf20Sopenharmony_ci#endif 6778c2ecf20Sopenharmony_ci 6788c2ecf20Sopenharmony_cistruct VFT_TABLE_t { 6798c2ecf20Sopenharmony_ci VFT_CELL_t Cell[TEMP_RANGE_MAXSTEPS][NUM_VFT_COLUMNS]; 6808c2ecf20Sopenharmony_ci uint16_t AvfsGbv [NUM_VFT_COLUMNS]; 6818c2ecf20Sopenharmony_ci uint16_t BtcGbv [NUM_VFT_COLUMNS]; 6828c2ecf20Sopenharmony_ci int16_t Temperature [TEMP_RANGE_MAXSTEPS]; 6838c2ecf20Sopenharmony_ci 6848c2ecf20Sopenharmony_ci#ifdef SMU__FIRMWARE_SCKS_PRESENT__1 6858c2ecf20Sopenharmony_ci SCS_CELL_t ScksCell[TEMP_RANGE_MAXSTEPS][NUM_VFT_COLUMNS]; 6868c2ecf20Sopenharmony_ci#endif 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_ci uint8_t NumTemperatureSteps; 6898c2ecf20Sopenharmony_ci uint8_t padding[3]; 6908c2ecf20Sopenharmony_ci}; 6918c2ecf20Sopenharmony_citypedef struct VFT_TABLE_t VFT_TABLE_t; 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_ci#define BTCGB_VDROOP_TABLE_MAX_ENTRIES 2 6948c2ecf20Sopenharmony_ci#define AVFSGB_VDROOP_TABLE_MAX_ENTRIES 2 6958c2ecf20Sopenharmony_ci 6968c2ecf20Sopenharmony_cistruct GB_VDROOP_TABLE_t { 6978c2ecf20Sopenharmony_ci int32_t a0; 6988c2ecf20Sopenharmony_ci int32_t a1; 6998c2ecf20Sopenharmony_ci int32_t a2; 7008c2ecf20Sopenharmony_ci uint32_t spare; 7018c2ecf20Sopenharmony_ci}; 7028c2ecf20Sopenharmony_citypedef struct GB_VDROOP_TABLE_t GB_VDROOP_TABLE_t; 7038c2ecf20Sopenharmony_ci 7048c2ecf20Sopenharmony_cistruct SMU_QuadraticCoeffs { 7058c2ecf20Sopenharmony_ci int32_t m1; 7068c2ecf20Sopenharmony_ci int32_t b; 7078c2ecf20Sopenharmony_ci 7088c2ecf20Sopenharmony_ci int16_t m2; 7098c2ecf20Sopenharmony_ci uint8_t m1_shift; 7108c2ecf20Sopenharmony_ci uint8_t m2_shift; 7118c2ecf20Sopenharmony_ci}; 7128c2ecf20Sopenharmony_citypedef struct SMU_QuadraticCoeffs SMU_QuadraticCoeffs; 7138c2ecf20Sopenharmony_ci 7148c2ecf20Sopenharmony_cistruct AVFS_Margin_t { 7158c2ecf20Sopenharmony_ci VFT_CELL_t Cell[NUM_VFT_COLUMNS]; 7168c2ecf20Sopenharmony_ci}; 7178c2ecf20Sopenharmony_citypedef struct AVFS_Margin_t AVFS_Margin_t; 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_cistruct AVFS_CksOff_Gbv_t { 7208c2ecf20Sopenharmony_ci VFT_CELL_t Cell[NUM_VFT_COLUMNS]; 7218c2ecf20Sopenharmony_ci}; 7228c2ecf20Sopenharmony_citypedef struct AVFS_CksOff_Gbv_t AVFS_CksOff_Gbv_t; 7238c2ecf20Sopenharmony_ci 7248c2ecf20Sopenharmony_cistruct AVFS_CksOff_AvfsGbv_t { 7258c2ecf20Sopenharmony_ci VFT_CELL_t Cell[NUM_VFT_COLUMNS]; 7268c2ecf20Sopenharmony_ci}; 7278c2ecf20Sopenharmony_citypedef struct AVFS_CksOff_AvfsGbv_t AVFS_CksOff_AvfsGbv_t; 7288c2ecf20Sopenharmony_ci 7298c2ecf20Sopenharmony_cistruct AVFS_CksOff_BtcGbv_t { 7308c2ecf20Sopenharmony_ci VFT_CELL_t Cell[NUM_VFT_COLUMNS]; 7318c2ecf20Sopenharmony_ci}; 7328c2ecf20Sopenharmony_citypedef struct AVFS_CksOff_BtcGbv_t AVFS_CksOff_BtcGbv_t; 7338c2ecf20Sopenharmony_ci 7348c2ecf20Sopenharmony_cistruct AVFS_meanNsigma_t { 7358c2ecf20Sopenharmony_ci uint32_t Aconstant[3]; 7368c2ecf20Sopenharmony_ci uint16_t DC_tol_sigma; 7378c2ecf20Sopenharmony_ci uint16_t Platform_mean; 7388c2ecf20Sopenharmony_ci uint16_t Platform_sigma; 7398c2ecf20Sopenharmony_ci uint16_t PSM_Age_CompFactor; 7408c2ecf20Sopenharmony_ci uint8_t Static_Voltage_Offset[NUM_VFT_COLUMNS]; 7418c2ecf20Sopenharmony_ci}; 7428c2ecf20Sopenharmony_citypedef struct AVFS_meanNsigma_t AVFS_meanNsigma_t; 7438c2ecf20Sopenharmony_ci 7448c2ecf20Sopenharmony_cistruct AVFS_Sclk_Offset_t { 7458c2ecf20Sopenharmony_ci uint16_t Sclk_Offset[8]; 7468c2ecf20Sopenharmony_ci}; 7478c2ecf20Sopenharmony_citypedef struct AVFS_Sclk_Offset_t AVFS_Sclk_Offset_t; 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_cistruct Power_Sharing_t { 7508c2ecf20Sopenharmony_ci uint32_t EnergyCounter; 7518c2ecf20Sopenharmony_ci uint32_t EngeryThreshold; 7528c2ecf20Sopenharmony_ci uint64_t AM_SCLK_CNT; 7538c2ecf20Sopenharmony_ci uint64_t AM_0_BUSY_CNT; 7548c2ecf20Sopenharmony_ci}; 7558c2ecf20Sopenharmony_citypedef struct Power_Sharing_t Power_Sharing_t; 7568c2ecf20Sopenharmony_ci 7578c2ecf20Sopenharmony_ci 7588c2ecf20Sopenharmony_ci#endif 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_ci 761