18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2015 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 _SMU73_H_ 248c2ecf20Sopenharmony_ci#define _SMU73_H_ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#pragma pack(push, 1) 278c2ecf20Sopenharmony_cienum SID_OPTION { 288c2ecf20Sopenharmony_ci SID_OPTION_HI, 298c2ecf20Sopenharmony_ci SID_OPTION_LO, 308c2ecf20Sopenharmony_ci SID_OPTION_COUNT 318c2ecf20Sopenharmony_ci}; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cienum Poly3rdOrderCoeff { 348c2ecf20Sopenharmony_ci LEAKAGE_TEMPERATURE_SCALAR, 358c2ecf20Sopenharmony_ci LEAKAGE_VOLTAGE_SCALAR, 368c2ecf20Sopenharmony_ci DYNAMIC_VOLTAGE_SCALAR, 378c2ecf20Sopenharmony_ci POLY_3RD_ORDER_COUNT 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_cistruct SMU7_Poly3rdOrder_Data 418c2ecf20Sopenharmony_ci{ 428c2ecf20Sopenharmony_ci int32_t a; 438c2ecf20Sopenharmony_ci int32_t b; 448c2ecf20Sopenharmony_ci int32_t c; 458c2ecf20Sopenharmony_ci int32_t d; 468c2ecf20Sopenharmony_ci uint8_t a_shift; 478c2ecf20Sopenharmony_ci uint8_t b_shift; 488c2ecf20Sopenharmony_ci uint8_t c_shift; 498c2ecf20Sopenharmony_ci uint8_t x_shift; 508c2ecf20Sopenharmony_ci}; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_citypedef struct SMU7_Poly3rdOrder_Data SMU7_Poly3rdOrder_Data; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_cistruct Power_Calculator_Data 558c2ecf20Sopenharmony_ci{ 568c2ecf20Sopenharmony_ci uint16_t NoLoadVoltage; 578c2ecf20Sopenharmony_ci uint16_t LoadVoltage; 588c2ecf20Sopenharmony_ci uint16_t Resistance; 598c2ecf20Sopenharmony_ci uint16_t Temperature; 608c2ecf20Sopenharmony_ci uint16_t BaseLeakage; 618c2ecf20Sopenharmony_ci uint16_t LkgTempScalar; 628c2ecf20Sopenharmony_ci uint16_t LkgVoltScalar; 638c2ecf20Sopenharmony_ci uint16_t LkgAreaScalar; 648c2ecf20Sopenharmony_ci uint16_t LkgPower; 658c2ecf20Sopenharmony_ci uint16_t DynVoltScalar; 668c2ecf20Sopenharmony_ci uint32_t Cac; 678c2ecf20Sopenharmony_ci uint32_t DynPower; 688c2ecf20Sopenharmony_ci uint32_t TotalCurrent; 698c2ecf20Sopenharmony_ci uint32_t TotalPower; 708c2ecf20Sopenharmony_ci}; 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_citypedef struct Power_Calculator_Data PowerCalculatorData_t; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_cistruct Gc_Cac_Weight_Data 758c2ecf20Sopenharmony_ci{ 768c2ecf20Sopenharmony_ci uint8_t index; 778c2ecf20Sopenharmony_ci uint32_t value; 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_citypedef struct Gc_Cac_Weight_Data GcCacWeight_Data; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_citypedef struct { 848c2ecf20Sopenharmony_ci uint32_t high; 858c2ecf20Sopenharmony_ci uint32_t low; 868c2ecf20Sopenharmony_ci} data_64_t; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_citypedef struct { 898c2ecf20Sopenharmony_ci data_64_t high; 908c2ecf20Sopenharmony_ci data_64_t low; 918c2ecf20Sopenharmony_ci} data_128_t; 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define SMU__NUM_SCLK_DPM_STATE 8 948c2ecf20Sopenharmony_ci#define SMU__NUM_MCLK_DPM_LEVELS 4 958c2ecf20Sopenharmony_ci#define SMU__NUM_LCLK_DPM_LEVELS 8 968c2ecf20Sopenharmony_ci#define SMU__NUM_PCIE_DPM_LEVELS 8 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci#define SMU7_CONTEXT_ID_SMC 1 998c2ecf20Sopenharmony_ci#define SMU7_CONTEXT_ID_VBIOS 2 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_VDDC 16 1028c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_VDDGFX 16 1038c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_VDDCI 8 1048c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_MVDD 4 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#define SMU_MAX_SMIO_LEVELS 4 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_GRAPHICS SMU__NUM_SCLK_DPM_STATE // SCLK + SQ DPM + ULV 1098c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_MEMORY SMU__NUM_MCLK_DPM_LEVELS // MCLK Levels DPM 1108c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_GIO SMU__NUM_LCLK_DPM_LEVELS // LCLK Levels 1118c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_LINK SMU__NUM_PCIE_DPM_LEVELS // PCIe speed and number of lanes. 1128c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_UVD 8 // VCLK/DCLK levels for UVD. 1138c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_VCE 8 // ECLK levels for VCE. 1148c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_ACP 8 // ACLK levels for ACP. 1158c2ecf20Sopenharmony_ci#define SMU73_MAX_LEVELS_SAMU 8 // SAMCLK levels for SAMU. 1168c2ecf20Sopenharmony_ci#define SMU73_MAX_ENTRIES_SMIO 32 // Number of entries in SMIO table. 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci#define DPM_NO_LIMIT 0 1198c2ecf20Sopenharmony_ci#define DPM_NO_UP 1 1208c2ecf20Sopenharmony_ci#define DPM_GO_DOWN 2 1218c2ecf20Sopenharmony_ci#define DPM_GO_UP 3 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci#define SMU7_FIRST_DPM_GRAPHICS_LEVEL 0 1248c2ecf20Sopenharmony_ci#define SMU7_FIRST_DPM_MEMORY_LEVEL 0 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci#define GPIO_CLAMP_MODE_VRHOT 1 1278c2ecf20Sopenharmony_ci#define GPIO_CLAMP_MODE_THERM 2 1288c2ecf20Sopenharmony_ci#define GPIO_CLAMP_MODE_DC 4 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_PCIE_INDEX_SHIFT 0 1318c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_PCIE_INDEX_MASK (0x7<<SCRATCH_B_TARG_PCIE_INDEX_SHIFT) 1328c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_PCIE_INDEX_SHIFT 3 1338c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_PCIE_INDEX_MASK (0x7<<SCRATCH_B_CURR_PCIE_INDEX_SHIFT) 1348c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_UVD_INDEX_SHIFT 6 1358c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_UVD_INDEX_MASK (0x7<<SCRATCH_B_TARG_UVD_INDEX_SHIFT) 1368c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_UVD_INDEX_SHIFT 9 1378c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_UVD_INDEX_MASK (0x7<<SCRATCH_B_CURR_UVD_INDEX_SHIFT) 1388c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_VCE_INDEX_SHIFT 12 1398c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_VCE_INDEX_MASK (0x7<<SCRATCH_B_TARG_VCE_INDEX_SHIFT) 1408c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_VCE_INDEX_SHIFT 15 1418c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_VCE_INDEX_MASK (0x7<<SCRATCH_B_CURR_VCE_INDEX_SHIFT) 1428c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_ACP_INDEX_SHIFT 18 1438c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_ACP_INDEX_MASK (0x7<<SCRATCH_B_TARG_ACP_INDEX_SHIFT) 1448c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_ACP_INDEX_SHIFT 21 1458c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_ACP_INDEX_MASK (0x7<<SCRATCH_B_CURR_ACP_INDEX_SHIFT) 1468c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_SAMU_INDEX_SHIFT 24 1478c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_SAMU_INDEX_MASK (0x7<<SCRATCH_B_TARG_SAMU_INDEX_SHIFT) 1488c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_SAMU_INDEX_SHIFT 27 1498c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_SAMU_INDEX_MASK (0x7<<SCRATCH_B_CURR_SAMU_INDEX_SHIFT) 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci// Virtualization Defines 1528c2ecf20Sopenharmony_ci#define CG_XDMA_MASK 0x1 1538c2ecf20Sopenharmony_ci#define CG_XDMA_SHIFT 0 1548c2ecf20Sopenharmony_ci#define CG_UVD_MASK 0x2 1558c2ecf20Sopenharmony_ci#define CG_UVD_SHIFT 1 1568c2ecf20Sopenharmony_ci#define CG_VCE_MASK 0x4 1578c2ecf20Sopenharmony_ci#define CG_VCE_SHIFT 2 1588c2ecf20Sopenharmony_ci#define CG_SAMU_MASK 0x8 1598c2ecf20Sopenharmony_ci#define CG_SAMU_SHIFT 3 1608c2ecf20Sopenharmony_ci#define CG_GFX_MASK 0x10 1618c2ecf20Sopenharmony_ci#define CG_GFX_SHIFT 4 1628c2ecf20Sopenharmony_ci#define CG_SDMA_MASK 0x20 1638c2ecf20Sopenharmony_ci#define CG_SDMA_SHIFT 5 1648c2ecf20Sopenharmony_ci#define CG_HDP_MASK 0x40 1658c2ecf20Sopenharmony_ci#define CG_HDP_SHIFT 6 1668c2ecf20Sopenharmony_ci#define CG_MC_MASK 0x80 1678c2ecf20Sopenharmony_ci#define CG_MC_SHIFT 7 1688c2ecf20Sopenharmony_ci#define CG_DRM_MASK 0x100 1698c2ecf20Sopenharmony_ci#define CG_DRM_SHIFT 8 1708c2ecf20Sopenharmony_ci#define CG_ROM_MASK 0x200 1718c2ecf20Sopenharmony_ci#define CG_ROM_SHIFT 9 1728c2ecf20Sopenharmony_ci#define CG_BIF_MASK 0x400 1738c2ecf20Sopenharmony_ci#define CG_BIF_SHIFT 10 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci#define SMU73_DTE_ITERATIONS 5 1768c2ecf20Sopenharmony_ci#define SMU73_DTE_SOURCES 3 1778c2ecf20Sopenharmony_ci#define SMU73_DTE_SINKS 1 1788c2ecf20Sopenharmony_ci#define SMU73_NUM_CPU_TES 0 1798c2ecf20Sopenharmony_ci#define SMU73_NUM_GPU_TES 1 1808c2ecf20Sopenharmony_ci#define SMU73_NUM_NON_TES 2 1818c2ecf20Sopenharmony_ci#define SMU73_DTE_FAN_SCALAR_MIN 0x100 1828c2ecf20Sopenharmony_ci#define SMU73_DTE_FAN_SCALAR_MAX 0x166 1838c2ecf20Sopenharmony_ci#define SMU73_DTE_FAN_TEMP_MAX 93 1848c2ecf20Sopenharmony_ci#define SMU73_DTE_FAN_TEMP_MIN 83 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#define SMU73_THERMAL_INPUT_LOOP_COUNT 6 1878c2ecf20Sopenharmony_ci#define SMU73_THERMAL_CLAMP_MODE_COUNT 8 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_cistruct SMU7_HystController_Data 1918c2ecf20Sopenharmony_ci{ 1928c2ecf20Sopenharmony_ci uint16_t waterfall_up; 1938c2ecf20Sopenharmony_ci uint16_t waterfall_down; 1948c2ecf20Sopenharmony_ci uint16_t waterfall_limit; 1958c2ecf20Sopenharmony_ci uint16_t release_cnt; 1968c2ecf20Sopenharmony_ci uint16_t release_limit; 1978c2ecf20Sopenharmony_ci uint16_t spare; 1988c2ecf20Sopenharmony_ci}; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_citypedef struct SMU7_HystController_Data SMU7_HystController_Data; 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_cistruct SMU73_PIDController 2038c2ecf20Sopenharmony_ci{ 2048c2ecf20Sopenharmony_ci uint32_t Ki; 2058c2ecf20Sopenharmony_ci int32_t LFWindupUpperLim; 2068c2ecf20Sopenharmony_ci int32_t LFWindupLowerLim; 2078c2ecf20Sopenharmony_ci uint32_t StatePrecision; 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci uint32_t LfPrecision; 2108c2ecf20Sopenharmony_ci uint32_t LfOffset; 2118c2ecf20Sopenharmony_ci uint32_t MaxState; 2128c2ecf20Sopenharmony_ci uint32_t MaxLfFraction; 2138c2ecf20Sopenharmony_ci uint32_t StateShift; 2148c2ecf20Sopenharmony_ci}; 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_citypedef struct SMU73_PIDController SMU73_PIDController; 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_cistruct SMU7_LocalDpmScoreboard 2198c2ecf20Sopenharmony_ci{ 2208c2ecf20Sopenharmony_ci uint32_t PercentageBusy; 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci int32_t PIDError; 2238c2ecf20Sopenharmony_ci int32_t PIDIntegral; 2248c2ecf20Sopenharmony_ci int32_t PIDOutput; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci uint32_t SigmaDeltaAccum; 2278c2ecf20Sopenharmony_ci uint32_t SigmaDeltaOutput; 2288c2ecf20Sopenharmony_ci uint32_t SigmaDeltaLevel; 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci uint32_t UtilizationSetpoint; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci uint8_t TdpClampMode; 2338c2ecf20Sopenharmony_ci uint8_t TdcClampMode; 2348c2ecf20Sopenharmony_ci uint8_t ThermClampMode; 2358c2ecf20Sopenharmony_ci uint8_t VoltageBusy; 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci int8_t CurrLevel; 2388c2ecf20Sopenharmony_ci int8_t TargLevel; 2398c2ecf20Sopenharmony_ci uint8_t LevelChangeInProgress; 2408c2ecf20Sopenharmony_ci uint8_t UpHyst; 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci uint8_t DownHyst; 2438c2ecf20Sopenharmony_ci uint8_t VoltageDownHyst; 2448c2ecf20Sopenharmony_ci uint8_t DpmEnable; 2458c2ecf20Sopenharmony_ci uint8_t DpmRunning; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci uint8_t DpmForce; 2488c2ecf20Sopenharmony_ci uint8_t DpmForceLevel; 2498c2ecf20Sopenharmony_ci uint8_t DisplayWatermark; 2508c2ecf20Sopenharmony_ci uint8_t McArbIndex; 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci uint32_t MinimumPerfSclk; 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci uint8_t AcpiReq; 2558c2ecf20Sopenharmony_ci uint8_t AcpiAck; 2568c2ecf20Sopenharmony_ci uint8_t GfxClkSlow; 2578c2ecf20Sopenharmony_ci uint8_t GpioClampMode; 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci uint8_t spare2; 2608c2ecf20Sopenharmony_ci uint8_t EnabledLevelsChange; 2618c2ecf20Sopenharmony_ci uint8_t DteClampMode; 2628c2ecf20Sopenharmony_ci uint8_t FpsClampMode; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci uint16_t LevelResidencyCounters [SMU73_MAX_LEVELS_GRAPHICS]; 2658c2ecf20Sopenharmony_ci uint16_t LevelSwitchCounters [SMU73_MAX_LEVELS_GRAPHICS]; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci void (*TargetStateCalculator)(uint8_t); 2688c2ecf20Sopenharmony_ci void (*SavedTargetStateCalculator)(uint8_t); 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci uint16_t AutoDpmInterval; 2718c2ecf20Sopenharmony_ci uint16_t AutoDpmRange; 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci uint8_t FpsEnabled; 2748c2ecf20Sopenharmony_ci uint8_t MaxPerfLevel; 2758c2ecf20Sopenharmony_ci uint8_t AllowLowClkInterruptToHost; 2768c2ecf20Sopenharmony_ci uint8_t FpsRunning; 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci uint32_t MaxAllowedFrequency; 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci uint32_t FilteredSclkFrequency; 2818c2ecf20Sopenharmony_ci uint32_t LastSclkFrequency; 2828c2ecf20Sopenharmony_ci uint32_t FilteredSclkFrequencyCnt; 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci uint8_t LedEnable; 2858c2ecf20Sopenharmony_ci uint8_t LedPin0; 2868c2ecf20Sopenharmony_ci uint8_t LedPin1; 2878c2ecf20Sopenharmony_ci uint8_t LedPin2; 2888c2ecf20Sopenharmony_ci uint32_t LedAndMask; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci uint16_t FpsAlpha; 2918c2ecf20Sopenharmony_ci uint16_t DeltaTime; 2928c2ecf20Sopenharmony_ci uint32_t CurrentFps; 2938c2ecf20Sopenharmony_ci uint32_t FilteredFps; 2948c2ecf20Sopenharmony_ci uint32_t FrameCount; 2958c2ecf20Sopenharmony_ci uint32_t FrameCountLast; 2968c2ecf20Sopenharmony_ci uint16_t FpsTargetScalar; 2978c2ecf20Sopenharmony_ci uint16_t FpsWaterfallLimitScalar; 2988c2ecf20Sopenharmony_ci uint16_t FpsAlphaScalar; 2998c2ecf20Sopenharmony_ci uint16_t spare8; 3008c2ecf20Sopenharmony_ci SMU7_HystController_Data HystControllerData; 3018c2ecf20Sopenharmony_ci}; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_citypedef struct SMU7_LocalDpmScoreboard SMU7_LocalDpmScoreboard; 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci#define SMU7_MAX_VOLTAGE_CLIENTS 12 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_citypedef uint8_t (*VoltageChangeHandler_t)(uint16_t, uint8_t); 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci#define VDDC_MASK 0x00007FFF 3108c2ecf20Sopenharmony_ci#define VDDC_SHIFT 0 3118c2ecf20Sopenharmony_ci#define VDDCI_MASK 0x3FFF8000 3128c2ecf20Sopenharmony_ci#define VDDCI_SHIFT 15 3138c2ecf20Sopenharmony_ci#define PHASES_MASK 0xC0000000 3148c2ecf20Sopenharmony_ci#define PHASES_SHIFT 30 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_citypedef uint32_t SMU_VoltageLevel; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cistruct SMU7_VoltageScoreboard 3198c2ecf20Sopenharmony_ci{ 3208c2ecf20Sopenharmony_ci SMU_VoltageLevel TargetVoltage; 3218c2ecf20Sopenharmony_ci uint16_t MaxVid; 3228c2ecf20Sopenharmony_ci uint8_t HighestVidOffset; 3238c2ecf20Sopenharmony_ci uint8_t CurrentVidOffset; 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci uint16_t CurrentVddc; 3268c2ecf20Sopenharmony_ci uint16_t CurrentVddci; 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci uint8_t ControllerBusy; 3308c2ecf20Sopenharmony_ci uint8_t CurrentVid; 3318c2ecf20Sopenharmony_ci uint8_t CurrentVddciVid; 3328c2ecf20Sopenharmony_ci uint8_t padding; 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ci SMU_VoltageLevel RequestedVoltage[SMU7_MAX_VOLTAGE_CLIENTS]; 3358c2ecf20Sopenharmony_ci SMU_VoltageLevel TargetVoltageState; 3368c2ecf20Sopenharmony_ci uint8_t EnabledRequest[SMU7_MAX_VOLTAGE_CLIENTS]; 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci uint8_t padding2; 3398c2ecf20Sopenharmony_ci uint8_t padding3; 3408c2ecf20Sopenharmony_ci uint8_t ControllerEnable; 3418c2ecf20Sopenharmony_ci uint8_t ControllerRunning; 3428c2ecf20Sopenharmony_ci uint16_t CurrentStdVoltageHiSidd; 3438c2ecf20Sopenharmony_ci uint16_t CurrentStdVoltageLoSidd; 3448c2ecf20Sopenharmony_ci uint8_t OverrideVoltage; 3458c2ecf20Sopenharmony_ci uint8_t padding4; 3468c2ecf20Sopenharmony_ci uint8_t padding5; 3478c2ecf20Sopenharmony_ci uint8_t CurrentPhases; 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci VoltageChangeHandler_t ChangeVddc; 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci VoltageChangeHandler_t ChangeVddci; 3528c2ecf20Sopenharmony_ci VoltageChangeHandler_t ChangePhase; 3538c2ecf20Sopenharmony_ci VoltageChangeHandler_t ChangeMvdd; 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci VoltageChangeHandler_t functionLinks[6]; 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_ci uint16_t * VddcFollower1; 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_ci int16_t Driver_OD_RequestedVidOffset1; 3608c2ecf20Sopenharmony_ci int16_t Driver_OD_RequestedVidOffset2; 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci}; 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_citypedef struct SMU7_VoltageScoreboard SMU7_VoltageScoreboard; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci// ------------------------------------------------------------------------------------------------------------------------- 3678c2ecf20Sopenharmony_ci#define SMU7_MAX_PCIE_LINK_SPEEDS 3 /* 0:Gen1 1:Gen2 2:Gen3 */ 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_cistruct SMU7_PCIeLinkSpeedScoreboard 3708c2ecf20Sopenharmony_ci{ 3718c2ecf20Sopenharmony_ci uint8_t DpmEnable; 3728c2ecf20Sopenharmony_ci uint8_t DpmRunning; 3738c2ecf20Sopenharmony_ci uint8_t DpmForce; 3748c2ecf20Sopenharmony_ci uint8_t DpmForceLevel; 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_ci uint8_t CurrentLinkSpeed; 3778c2ecf20Sopenharmony_ci uint8_t EnabledLevelsChange; 3788c2ecf20Sopenharmony_ci uint16_t AutoDpmInterval; 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci uint16_t AutoDpmRange; 3818c2ecf20Sopenharmony_ci uint16_t AutoDpmCount; 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci uint8_t DpmMode; 3848c2ecf20Sopenharmony_ci uint8_t AcpiReq; 3858c2ecf20Sopenharmony_ci uint8_t AcpiAck; 3868c2ecf20Sopenharmony_ci uint8_t CurrentLinkLevel; 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_ci}; 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_citypedef struct SMU7_PCIeLinkSpeedScoreboard SMU7_PCIeLinkSpeedScoreboard; 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ci// -------------------------------------------------------- CAC table ------------------------------------------------------ 3938c2ecf20Sopenharmony_ci#define SMU7_LKGE_LUT_NUM_OF_TEMP_ENTRIES 16 3948c2ecf20Sopenharmony_ci#define SMU7_LKGE_LUT_NUM_OF_VOLT_ENTRIES 16 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci#define SMU7_SCALE_I 7 3978c2ecf20Sopenharmony_ci#define SMU7_SCALE_R 12 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_cistruct SMU7_PowerScoreboard 4008c2ecf20Sopenharmony_ci{ 4018c2ecf20Sopenharmony_ci uint32_t GpuPower; 4028c2ecf20Sopenharmony_ci 4038c2ecf20Sopenharmony_ci uint32_t VddcPower; 4048c2ecf20Sopenharmony_ci uint32_t VddcVoltage; 4058c2ecf20Sopenharmony_ci uint32_t VddcCurrent; 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci uint32_t MvddPower; 4088c2ecf20Sopenharmony_ci uint32_t MvddVoltage; 4098c2ecf20Sopenharmony_ci uint32_t MvddCurrent; 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_ci uint32_t RocPower; 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_ci uint16_t Telemetry_1_slope; 4148c2ecf20Sopenharmony_ci uint16_t Telemetry_2_slope; 4158c2ecf20Sopenharmony_ci int32_t Telemetry_1_offset; 4168c2ecf20Sopenharmony_ci int32_t Telemetry_2_offset; 4178c2ecf20Sopenharmony_ci}; 4188c2ecf20Sopenharmony_citypedef struct SMU7_PowerScoreboard SMU7_PowerScoreboard; 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci// For FeatureEnables: 4218c2ecf20Sopenharmony_ci#define SMU7_SCLK_DPM_CONFIG_MASK 0x01 4228c2ecf20Sopenharmony_ci#define SMU7_VOLTAGE_CONTROLLER_CONFIG_MASK 0x02 4238c2ecf20Sopenharmony_ci#define SMU7_THERMAL_CONTROLLER_CONFIG_MASK 0x04 4248c2ecf20Sopenharmony_ci#define SMU7_MCLK_DPM_CONFIG_MASK 0x08 4258c2ecf20Sopenharmony_ci#define SMU7_UVD_DPM_CONFIG_MASK 0x10 4268c2ecf20Sopenharmony_ci#define SMU7_VCE_DPM_CONFIG_MASK 0x20 4278c2ecf20Sopenharmony_ci#define SMU7_ACP_DPM_CONFIG_MASK 0x40 4288c2ecf20Sopenharmony_ci#define SMU7_SAMU_DPM_CONFIG_MASK 0x80 4298c2ecf20Sopenharmony_ci#define SMU7_PCIEGEN_DPM_CONFIG_MASK 0x100 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_ci#define SMU7_ACP_MCLK_HANDSHAKE_DISABLE 0x00000001 4328c2ecf20Sopenharmony_ci#define SMU7_ACP_SCLK_HANDSHAKE_DISABLE 0x00000002 4338c2ecf20Sopenharmony_ci#define SMU7_UVD_MCLK_HANDSHAKE_DISABLE 0x00000100 4348c2ecf20Sopenharmony_ci#define SMU7_UVD_SCLK_HANDSHAKE_DISABLE 0x00000200 4358c2ecf20Sopenharmony_ci#define SMU7_VCE_MCLK_HANDSHAKE_DISABLE 0x00010000 4368c2ecf20Sopenharmony_ci#define SMU7_VCE_SCLK_HANDSHAKE_DISABLE 0x00020000 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci// All 'soft registers' should be uint32_t. 4398c2ecf20Sopenharmony_cistruct SMU73_SoftRegisters 4408c2ecf20Sopenharmony_ci{ 4418c2ecf20Sopenharmony_ci uint32_t RefClockFrequency; 4428c2ecf20Sopenharmony_ci uint32_t PmTimerPeriod; 4438c2ecf20Sopenharmony_ci uint32_t FeatureEnables; 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_ci uint32_t PreVBlankGap; 4468c2ecf20Sopenharmony_ci uint32_t VBlankTimeout; 4478c2ecf20Sopenharmony_ci uint32_t TrainTimeGap; 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_ci uint32_t MvddSwitchTime; 4508c2ecf20Sopenharmony_ci uint32_t LongestAcpiTrainTime; 4518c2ecf20Sopenharmony_ci uint32_t AcpiDelay; 4528c2ecf20Sopenharmony_ci uint32_t G5TrainTime; 4538c2ecf20Sopenharmony_ci uint32_t DelayMpllPwron; 4548c2ecf20Sopenharmony_ci uint32_t VoltageChangeTimeout; 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci uint32_t HandshakeDisables; 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_ci uint8_t DisplayPhy1Config; 4598c2ecf20Sopenharmony_ci uint8_t DisplayPhy2Config; 4608c2ecf20Sopenharmony_ci uint8_t DisplayPhy3Config; 4618c2ecf20Sopenharmony_ci uint8_t DisplayPhy4Config; 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ci uint8_t DisplayPhy5Config; 4648c2ecf20Sopenharmony_ci uint8_t DisplayPhy6Config; 4658c2ecf20Sopenharmony_ci uint8_t DisplayPhy7Config; 4668c2ecf20Sopenharmony_ci uint8_t DisplayPhy8Config; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci uint32_t AverageGraphicsActivity; 4698c2ecf20Sopenharmony_ci uint32_t AverageMemoryActivity; 4708c2ecf20Sopenharmony_ci uint32_t AverageGioActivity; 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci uint8_t SClkDpmEnabledLevels; 4738c2ecf20Sopenharmony_ci uint8_t MClkDpmEnabledLevels; 4748c2ecf20Sopenharmony_ci uint8_t LClkDpmEnabledLevels; 4758c2ecf20Sopenharmony_ci uint8_t PCIeDpmEnabledLevels; 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_ci uint8_t UVDDpmEnabledLevels; 4788c2ecf20Sopenharmony_ci uint8_t SAMUDpmEnabledLevels; 4798c2ecf20Sopenharmony_ci uint8_t ACPDpmEnabledLevels; 4808c2ecf20Sopenharmony_ci uint8_t VCEDpmEnabledLevels; 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_ADDR_H; 4838c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_ADDR_L; 4848c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_PHY_ADDR_H; 4858c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_PHY_ADDR_L; 4868c2ecf20Sopenharmony_ci uint32_t DRAM_LOG_BUFF_SIZE; 4878c2ecf20Sopenharmony_ci uint32_t UlvEnterCount; 4888c2ecf20Sopenharmony_ci uint32_t UlvTime; 4898c2ecf20Sopenharmony_ci uint32_t UcodeLoadStatus; 4908c2ecf20Sopenharmony_ci uint32_t Reserved[2]; 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_ci}; 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_citypedef struct SMU73_SoftRegisters SMU73_SoftRegisters; 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_cistruct SMU73_Firmware_Header 4978c2ecf20Sopenharmony_ci{ 4988c2ecf20Sopenharmony_ci uint32_t Digest[5]; 4998c2ecf20Sopenharmony_ci uint32_t Version; 5008c2ecf20Sopenharmony_ci uint32_t HeaderSize; 5018c2ecf20Sopenharmony_ci uint32_t Flags; 5028c2ecf20Sopenharmony_ci uint32_t EntryPoint; 5038c2ecf20Sopenharmony_ci uint32_t CodeSize; 5048c2ecf20Sopenharmony_ci uint32_t ImageSize; 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_ci uint32_t Rtos; 5078c2ecf20Sopenharmony_ci uint32_t SoftRegisters; 5088c2ecf20Sopenharmony_ci uint32_t DpmTable; 5098c2ecf20Sopenharmony_ci uint32_t FanTable; 5108c2ecf20Sopenharmony_ci uint32_t CacConfigTable; 5118c2ecf20Sopenharmony_ci uint32_t CacStatusTable; 5128c2ecf20Sopenharmony_ci 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_ci uint32_t mcRegisterTable; 5158c2ecf20Sopenharmony_ci 5168c2ecf20Sopenharmony_ci 5178c2ecf20Sopenharmony_ci uint32_t mcArbDramTimingTable; 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_ci 5228c2ecf20Sopenharmony_ci uint32_t PmFuseTable; 5238c2ecf20Sopenharmony_ci uint32_t Globals; 5248c2ecf20Sopenharmony_ci uint32_t ClockStretcherTable; 5258c2ecf20Sopenharmony_ci uint32_t Reserved[41]; 5268c2ecf20Sopenharmony_ci uint32_t Signature; 5278c2ecf20Sopenharmony_ci}; 5288c2ecf20Sopenharmony_ci 5298c2ecf20Sopenharmony_citypedef struct SMU73_Firmware_Header SMU73_Firmware_Header; 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_ci#define SMU7_FIRMWARE_HEADER_LOCATION 0x20000 5328c2ecf20Sopenharmony_ci 5338c2ecf20Sopenharmony_cienum DisplayConfig { 5348c2ecf20Sopenharmony_ci PowerDown = 1, 5358c2ecf20Sopenharmony_ci DP54x4, 5368c2ecf20Sopenharmony_ci DP54x2, 5378c2ecf20Sopenharmony_ci DP54x1, 5388c2ecf20Sopenharmony_ci DP27x4, 5398c2ecf20Sopenharmony_ci DP27x2, 5408c2ecf20Sopenharmony_ci DP27x1, 5418c2ecf20Sopenharmony_ci HDMI297, 5428c2ecf20Sopenharmony_ci HDMI162, 5438c2ecf20Sopenharmony_ci LVDS, 5448c2ecf20Sopenharmony_ci DP324x4, 5458c2ecf20Sopenharmony_ci DP324x2, 5468c2ecf20Sopenharmony_ci DP324x1 5478c2ecf20Sopenharmony_ci}; 5488c2ecf20Sopenharmony_ci 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci#define MC_BLOCK_COUNT 1 5518c2ecf20Sopenharmony_ci#define CPL_BLOCK_COUNT 5 5528c2ecf20Sopenharmony_ci#define SE_BLOCK_COUNT 15 5538c2ecf20Sopenharmony_ci#define GC_BLOCK_COUNT 24 5548c2ecf20Sopenharmony_ci 5558c2ecf20Sopenharmony_cistruct SMU7_Local_Cac { 5568c2ecf20Sopenharmony_ci uint8_t BlockId; 5578c2ecf20Sopenharmony_ci uint8_t SignalId; 5588c2ecf20Sopenharmony_ci uint8_t Threshold; 5598c2ecf20Sopenharmony_ci uint8_t Padding; 5608c2ecf20Sopenharmony_ci}; 5618c2ecf20Sopenharmony_ci 5628c2ecf20Sopenharmony_citypedef struct SMU7_Local_Cac SMU7_Local_Cac; 5638c2ecf20Sopenharmony_ci 5648c2ecf20Sopenharmony_cistruct SMU7_Local_Cac_Table { 5658c2ecf20Sopenharmony_ci 5668c2ecf20Sopenharmony_ci SMU7_Local_Cac CplLocalCac[CPL_BLOCK_COUNT]; 5678c2ecf20Sopenharmony_ci SMU7_Local_Cac McLocalCac[MC_BLOCK_COUNT]; 5688c2ecf20Sopenharmony_ci SMU7_Local_Cac SeLocalCac[SE_BLOCK_COUNT]; 5698c2ecf20Sopenharmony_ci SMU7_Local_Cac GcLocalCac[GC_BLOCK_COUNT]; 5708c2ecf20Sopenharmony_ci}; 5718c2ecf20Sopenharmony_ci 5728c2ecf20Sopenharmony_citypedef struct SMU7_Local_Cac_Table SMU7_Local_Cac_Table; 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_ci#if !defined(SMC_MICROCODE) 5758c2ecf20Sopenharmony_ci#pragma pack(pop) 5768c2ecf20Sopenharmony_ci#endif 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_ci// Description of Clock Gating bitmask for Tonga: 5798c2ecf20Sopenharmony_ci// System Clock Gating 5808c2ecf20Sopenharmony_ci#define CG_SYS_BITMASK_FIRST_BIT 0 // First bit of Sys CG bitmask 5818c2ecf20Sopenharmony_ci#define CG_SYS_BITMASK_LAST_BIT 9 // Last bit of Sys CG bitmask 5828c2ecf20Sopenharmony_ci#define CG_SYS_BIF_MGLS_SHIFT 0 5838c2ecf20Sopenharmony_ci#define CG_SYS_ROM_SHIFT 1 5848c2ecf20Sopenharmony_ci#define CG_SYS_MC_MGCG_SHIFT 2 5858c2ecf20Sopenharmony_ci#define CG_SYS_MC_MGLS_SHIFT 3 5868c2ecf20Sopenharmony_ci#define CG_SYS_SDMA_MGCG_SHIFT 4 5878c2ecf20Sopenharmony_ci#define CG_SYS_SDMA_MGLS_SHIFT 5 5888c2ecf20Sopenharmony_ci#define CG_SYS_DRM_MGCG_SHIFT 6 5898c2ecf20Sopenharmony_ci#define CG_SYS_HDP_MGCG_SHIFT 7 5908c2ecf20Sopenharmony_ci#define CG_SYS_HDP_MGLS_SHIFT 8 5918c2ecf20Sopenharmony_ci#define CG_SYS_DRM_MGLS_SHIFT 9 5928c2ecf20Sopenharmony_ci 5938c2ecf20Sopenharmony_ci#define CG_SYS_BIF_MGLS_MASK 0x1 5948c2ecf20Sopenharmony_ci#define CG_SYS_ROM_MASK 0x2 5958c2ecf20Sopenharmony_ci#define CG_SYS_MC_MGCG_MASK 0x4 5968c2ecf20Sopenharmony_ci#define CG_SYS_MC_MGLS_MASK 0x8 5978c2ecf20Sopenharmony_ci#define CG_SYS_SDMA_MGCG_MASK 0x10 5988c2ecf20Sopenharmony_ci#define CG_SYS_SDMA_MGLS_MASK 0x20 5998c2ecf20Sopenharmony_ci#define CG_SYS_DRM_MGCG_MASK 0x40 6008c2ecf20Sopenharmony_ci#define CG_SYS_HDP_MGCG_MASK 0x80 6018c2ecf20Sopenharmony_ci#define CG_SYS_HDP_MGLS_MASK 0x100 6028c2ecf20Sopenharmony_ci#define CG_SYS_DRM_MGLS_MASK 0x200 6038c2ecf20Sopenharmony_ci 6048c2ecf20Sopenharmony_ci// Graphics Clock Gating 6058c2ecf20Sopenharmony_ci#define CG_GFX_BITMASK_FIRST_BIT 16 // First bit of Gfx CG bitmask 6068c2ecf20Sopenharmony_ci#define CG_GFX_BITMASK_LAST_BIT 20 // Last bit of Gfx CG bitmask 6078c2ecf20Sopenharmony_ci#define CG_GFX_CGCG_SHIFT 16 6088c2ecf20Sopenharmony_ci#define CG_GFX_CGLS_SHIFT 17 6098c2ecf20Sopenharmony_ci#define CG_CPF_MGCG_SHIFT 18 6108c2ecf20Sopenharmony_ci#define CG_RLC_MGCG_SHIFT 19 6118c2ecf20Sopenharmony_ci#define CG_GFX_OTHERS_MGCG_SHIFT 20 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_ci#define CG_GFX_CGCG_MASK 0x00010000 6148c2ecf20Sopenharmony_ci#define CG_GFX_CGLS_MASK 0x00020000 6158c2ecf20Sopenharmony_ci#define CG_CPF_MGCG_MASK 0x00040000 6168c2ecf20Sopenharmony_ci#define CG_RLC_MGCG_MASK 0x00080000 6178c2ecf20Sopenharmony_ci#define CG_GFX_OTHERS_MGCG_MASK 0x00100000 6188c2ecf20Sopenharmony_ci 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_ci// Voltage Regulator Configuration 6228c2ecf20Sopenharmony_ci// VR Config info is contained in dpmTable.VRConfig 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_ci#define VRCONF_VDDC_MASK 0x000000FF 6258c2ecf20Sopenharmony_ci#define VRCONF_VDDC_SHIFT 0 6268c2ecf20Sopenharmony_ci#define VRCONF_VDDGFX_MASK 0x0000FF00 6278c2ecf20Sopenharmony_ci#define VRCONF_VDDGFX_SHIFT 8 6288c2ecf20Sopenharmony_ci#define VRCONF_VDDCI_MASK 0x00FF0000 6298c2ecf20Sopenharmony_ci#define VRCONF_VDDCI_SHIFT 16 6308c2ecf20Sopenharmony_ci#define VRCONF_MVDD_MASK 0xFF000000 6318c2ecf20Sopenharmony_ci#define VRCONF_MVDD_SHIFT 24 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_ci#define VR_MERGED_WITH_VDDC 0 6348c2ecf20Sopenharmony_ci#define VR_SVI2_PLANE_1 1 6358c2ecf20Sopenharmony_ci#define VR_SVI2_PLANE_2 2 6368c2ecf20Sopenharmony_ci#define VR_SMIO_PATTERN_1 3 6378c2ecf20Sopenharmony_ci#define VR_SMIO_PATTERN_2 4 6388c2ecf20Sopenharmony_ci#define VR_STATIC_VOLTAGE 5 6398c2ecf20Sopenharmony_ci 6408c2ecf20Sopenharmony_ci// Clock Stretcher Configuration 6418c2ecf20Sopenharmony_ci 6428c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_MAX_ENTRIES 0x4 6438c2ecf20Sopenharmony_ci#define CKS_LOOKUPTable_MAX_ENTRIES 0x4 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_ci// The 'settings' field is subdivided in the following way: 6468c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_DDT_MASK 0x01 6478c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_DDT_SHIFT 0x0 6488c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_STRETCH_AMOUNT_MASK 0x1E 6498c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_STRETCH_AMOUNT_SHIFT 0x1 6508c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_ENABLE_MASK 0x80 6518c2ecf20Sopenharmony_ci#define CLOCK_STRETCHER_SETTING_ENABLE_SHIFT 0x7 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_cistruct SMU_ClockStretcherDataTableEntry { 6548c2ecf20Sopenharmony_ci uint8_t minVID; 6558c2ecf20Sopenharmony_ci uint8_t maxVID; 6568c2ecf20Sopenharmony_ci 6578c2ecf20Sopenharmony_ci 6588c2ecf20Sopenharmony_ci uint16_t setting; 6598c2ecf20Sopenharmony_ci}; 6608c2ecf20Sopenharmony_citypedef struct SMU_ClockStretcherDataTableEntry SMU_ClockStretcherDataTableEntry; 6618c2ecf20Sopenharmony_ci 6628c2ecf20Sopenharmony_cistruct SMU_ClockStretcherDataTable { 6638c2ecf20Sopenharmony_ci SMU_ClockStretcherDataTableEntry ClockStretcherDataTableEntry[CLOCK_STRETCHER_MAX_ENTRIES]; 6648c2ecf20Sopenharmony_ci}; 6658c2ecf20Sopenharmony_citypedef struct SMU_ClockStretcherDataTable SMU_ClockStretcherDataTable; 6668c2ecf20Sopenharmony_ci 6678c2ecf20Sopenharmony_cistruct SMU_CKS_LOOKUPTableEntry { 6688c2ecf20Sopenharmony_ci uint16_t minFreq; 6698c2ecf20Sopenharmony_ci uint16_t maxFreq; 6708c2ecf20Sopenharmony_ci 6718c2ecf20Sopenharmony_ci uint8_t setting; 6728c2ecf20Sopenharmony_ci uint8_t padding[3]; 6738c2ecf20Sopenharmony_ci}; 6748c2ecf20Sopenharmony_citypedef struct SMU_CKS_LOOKUPTableEntry SMU_CKS_LOOKUPTableEntry; 6758c2ecf20Sopenharmony_ci 6768c2ecf20Sopenharmony_cistruct SMU_CKS_LOOKUPTable { 6778c2ecf20Sopenharmony_ci SMU_CKS_LOOKUPTableEntry CKS_LOOKUPTableEntry[CKS_LOOKUPTable_MAX_ENTRIES]; 6788c2ecf20Sopenharmony_ci}; 6798c2ecf20Sopenharmony_citypedef struct SMU_CKS_LOOKUPTable SMU_CKS_LOOKUPTable; 6808c2ecf20Sopenharmony_ci 6818c2ecf20Sopenharmony_cistruct AgmAvfsData_t { 6828c2ecf20Sopenharmony_ci uint16_t avgPsmCount[28]; 6838c2ecf20Sopenharmony_ci uint16_t minPsmCount[28]; 6848c2ecf20Sopenharmony_ci}; 6858c2ecf20Sopenharmony_citypedef struct AgmAvfsData_t AgmAvfsData_t; 6868c2ecf20Sopenharmony_ci 6878c2ecf20Sopenharmony_ci// AVFS DEFINES 6888c2ecf20Sopenharmony_ci 6898c2ecf20Sopenharmony_cienum VFT_COLUMNS { 6908c2ecf20Sopenharmony_ci SCLK0, 6918c2ecf20Sopenharmony_ci SCLK1, 6928c2ecf20Sopenharmony_ci SCLK2, 6938c2ecf20Sopenharmony_ci SCLK3, 6948c2ecf20Sopenharmony_ci SCLK4, 6958c2ecf20Sopenharmony_ci SCLK5, 6968c2ecf20Sopenharmony_ci SCLK6, 6978c2ecf20Sopenharmony_ci SCLK7, 6988c2ecf20Sopenharmony_ci 6998c2ecf20Sopenharmony_ci NUM_VFT_COLUMNS 7008c2ecf20Sopenharmony_ci}; 7018c2ecf20Sopenharmony_ci 7028c2ecf20Sopenharmony_ci#define TEMP_RANGE_MAXSTEPS 12 7038c2ecf20Sopenharmony_cistruct VFT_CELL_t { 7048c2ecf20Sopenharmony_ci uint16_t Voltage; 7058c2ecf20Sopenharmony_ci}; 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_citypedef struct VFT_CELL_t VFT_CELL_t; 7088c2ecf20Sopenharmony_ci 7098c2ecf20Sopenharmony_cistruct VFT_TABLE_t { 7108c2ecf20Sopenharmony_ci VFT_CELL_t Cell[TEMP_RANGE_MAXSTEPS][NUM_VFT_COLUMNS]; 7118c2ecf20Sopenharmony_ci uint16_t AvfsGbv [NUM_VFT_COLUMNS]; 7128c2ecf20Sopenharmony_ci uint16_t BtcGbv [NUM_VFT_COLUMNS]; 7138c2ecf20Sopenharmony_ci uint16_t Temperature [TEMP_RANGE_MAXSTEPS]; 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_ci uint8_t NumTemperatureSteps; 7168c2ecf20Sopenharmony_ci uint8_t padding[3]; 7178c2ecf20Sopenharmony_ci}; 7188c2ecf20Sopenharmony_citypedef struct VFT_TABLE_t VFT_TABLE_t; 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_ci#endif 721