1837d542aSEvan Quan /* 2837d542aSEvan Quan * Copyright 2013 Advanced Micro Devices, Inc. 3837d542aSEvan Quan * 4837d542aSEvan Quan * Permission is hereby granted, free of charge, to any person obtaining a 5837d542aSEvan Quan * copy of this software and associated documentation files (the "Software"), 6837d542aSEvan Quan * to deal in the Software without restriction, including without limitation 7837d542aSEvan Quan * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8837d542aSEvan Quan * and/or sell copies of the Software, and to permit persons to whom the 9837d542aSEvan Quan * Software is furnished to do so, subject to the following conditions: 10837d542aSEvan Quan * 11837d542aSEvan Quan * The above copyright notice and this permission notice shall be included in 12837d542aSEvan Quan * all copies or substantial portions of the Software. 13837d542aSEvan Quan * 14837d542aSEvan Quan * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15837d542aSEvan Quan * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16837d542aSEvan Quan * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17837d542aSEvan Quan * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18837d542aSEvan Quan * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19837d542aSEvan Quan * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20837d542aSEvan Quan * OTHER DEALINGS IN THE SOFTWARE. 21837d542aSEvan Quan * 22837d542aSEvan Quan */ 23837d542aSEvan Quan #ifndef PP_SISLANDS_SMC_H 24837d542aSEvan Quan #define PP_SISLANDS_SMC_H 25837d542aSEvan Quan 26837d542aSEvan Quan #include "ppsmc.h" 27837d542aSEvan Quan 28837d542aSEvan Quan #pragma pack(push, 1) 29837d542aSEvan Quan 30837d542aSEvan Quan #define SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE 16 31837d542aSEvan Quan 32*5502cf77SRan Sun struct PP_SIslands_Dpm2PerfLevel { 33837d542aSEvan Quan uint8_t MaxPS; 34837d542aSEvan Quan uint8_t TgtAct; 35837d542aSEvan Quan uint8_t MaxPS_StepInc; 36837d542aSEvan Quan uint8_t MaxPS_StepDec; 37837d542aSEvan Quan uint8_t PSSamplingTime; 38837d542aSEvan Quan uint8_t NearTDPDec; 39837d542aSEvan Quan uint8_t AboveSafeInc; 40837d542aSEvan Quan uint8_t BelowSafeInc; 41837d542aSEvan Quan uint8_t PSDeltaLimit; 42837d542aSEvan Quan uint8_t PSDeltaWin; 43837d542aSEvan Quan uint16_t PwrEfficiencyRatio; 44837d542aSEvan Quan uint8_t Reserved[4]; 45837d542aSEvan Quan }; 46837d542aSEvan Quan 47837d542aSEvan Quan typedef struct PP_SIslands_Dpm2PerfLevel PP_SIslands_Dpm2PerfLevel; 48837d542aSEvan Quan 49*5502cf77SRan Sun struct PP_SIslands_DPM2Status { 50837d542aSEvan Quan uint32_t dpm2Flags; 51837d542aSEvan Quan uint8_t CurrPSkip; 52837d542aSEvan Quan uint8_t CurrPSkipPowerShift; 53837d542aSEvan Quan uint8_t CurrPSkipTDP; 54837d542aSEvan Quan uint8_t CurrPSkipOCP; 55837d542aSEvan Quan uint8_t MaxSPLLIndex; 56837d542aSEvan Quan uint8_t MinSPLLIndex; 57837d542aSEvan Quan uint8_t CurrSPLLIndex; 58837d542aSEvan Quan uint8_t InfSweepMode; 59837d542aSEvan Quan uint8_t InfSweepDir; 60837d542aSEvan Quan uint8_t TDPexceeded; 61837d542aSEvan Quan uint8_t reserved; 62837d542aSEvan Quan uint8_t SwitchDownThreshold; 63837d542aSEvan Quan uint32_t SwitchDownCounter; 64837d542aSEvan Quan uint32_t SysScalingFactor; 65837d542aSEvan Quan }; 66837d542aSEvan Quan 67837d542aSEvan Quan typedef struct PP_SIslands_DPM2Status PP_SIslands_DPM2Status; 68837d542aSEvan Quan 69*5502cf77SRan Sun struct PP_SIslands_DPM2Parameters { 70837d542aSEvan Quan uint32_t TDPLimit; 71837d542aSEvan Quan uint32_t NearTDPLimit; 72837d542aSEvan Quan uint32_t SafePowerLimit; 73837d542aSEvan Quan uint32_t PowerBoostLimit; 74837d542aSEvan Quan uint32_t MinLimitDelta; 75837d542aSEvan Quan }; 76837d542aSEvan Quan typedef struct PP_SIslands_DPM2Parameters PP_SIslands_DPM2Parameters; 77837d542aSEvan Quan 78*5502cf77SRan Sun struct PP_SIslands_PAPMStatus { 79837d542aSEvan Quan uint32_t EstimatedDGPU_T; 80837d542aSEvan Quan uint32_t EstimatedDGPU_P; 81837d542aSEvan Quan uint32_t EstimatedAPU_T; 82837d542aSEvan Quan uint32_t EstimatedAPU_P; 83837d542aSEvan Quan uint8_t dGPU_T_Limit_Exceeded; 84837d542aSEvan Quan uint8_t reserved[3]; 85837d542aSEvan Quan }; 86837d542aSEvan Quan typedef struct PP_SIslands_PAPMStatus PP_SIslands_PAPMStatus; 87837d542aSEvan Quan 88*5502cf77SRan Sun struct PP_SIslands_PAPMParameters { 89837d542aSEvan Quan uint32_t NearTDPLimitTherm; 90837d542aSEvan Quan uint32_t NearTDPLimitPAPM; 91837d542aSEvan Quan uint32_t PlatformPowerLimit; 92837d542aSEvan Quan uint32_t dGPU_T_Limit; 93837d542aSEvan Quan uint32_t dGPU_T_Warning; 94837d542aSEvan Quan uint32_t dGPU_T_Hysteresis; 95837d542aSEvan Quan }; 96837d542aSEvan Quan typedef struct PP_SIslands_PAPMParameters PP_SIslands_PAPMParameters; 97837d542aSEvan Quan 98*5502cf77SRan Sun struct SISLANDS_SMC_SCLK_VALUE { 99837d542aSEvan Quan uint32_t vCG_SPLL_FUNC_CNTL; 100837d542aSEvan Quan uint32_t vCG_SPLL_FUNC_CNTL_2; 101837d542aSEvan Quan uint32_t vCG_SPLL_FUNC_CNTL_3; 102837d542aSEvan Quan uint32_t vCG_SPLL_FUNC_CNTL_4; 103837d542aSEvan Quan uint32_t vCG_SPLL_SPREAD_SPECTRUM; 104837d542aSEvan Quan uint32_t vCG_SPLL_SPREAD_SPECTRUM_2; 105837d542aSEvan Quan uint32_t sclk_value; 106837d542aSEvan Quan }; 107837d542aSEvan Quan 108837d542aSEvan Quan typedef struct SISLANDS_SMC_SCLK_VALUE SISLANDS_SMC_SCLK_VALUE; 109837d542aSEvan Quan 110*5502cf77SRan Sun struct SISLANDS_SMC_MCLK_VALUE { 111837d542aSEvan Quan uint32_t vMPLL_FUNC_CNTL; 112837d542aSEvan Quan uint32_t vMPLL_FUNC_CNTL_1; 113837d542aSEvan Quan uint32_t vMPLL_FUNC_CNTL_2; 114837d542aSEvan Quan uint32_t vMPLL_AD_FUNC_CNTL; 115837d542aSEvan Quan uint32_t vMPLL_DQ_FUNC_CNTL; 116837d542aSEvan Quan uint32_t vMCLK_PWRMGT_CNTL; 117837d542aSEvan Quan uint32_t vDLL_CNTL; 118837d542aSEvan Quan uint32_t vMPLL_SS; 119837d542aSEvan Quan uint32_t vMPLL_SS2; 120837d542aSEvan Quan uint32_t mclk_value; 121837d542aSEvan Quan }; 122837d542aSEvan Quan 123837d542aSEvan Quan typedef struct SISLANDS_SMC_MCLK_VALUE SISLANDS_SMC_MCLK_VALUE; 124837d542aSEvan Quan 125*5502cf77SRan Sun struct SISLANDS_SMC_VOLTAGE_VALUE { 126837d542aSEvan Quan uint16_t value; 127837d542aSEvan Quan uint8_t index; 128837d542aSEvan Quan uint8_t phase_settings; 129837d542aSEvan Quan }; 130837d542aSEvan Quan 131837d542aSEvan Quan typedef struct SISLANDS_SMC_VOLTAGE_VALUE SISLANDS_SMC_VOLTAGE_VALUE; 132837d542aSEvan Quan 133*5502cf77SRan Sun struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL { 134837d542aSEvan Quan uint8_t ACIndex; 135837d542aSEvan Quan uint8_t displayWatermark; 136837d542aSEvan Quan uint8_t gen2PCIE; 137837d542aSEvan Quan uint8_t UVDWatermark; 138837d542aSEvan Quan uint8_t VCEWatermark; 139837d542aSEvan Quan uint8_t strobeMode; 140837d542aSEvan Quan uint8_t mcFlags; 141837d542aSEvan Quan uint8_t padding; 142837d542aSEvan Quan uint32_t aT; 143837d542aSEvan Quan uint32_t bSP; 144837d542aSEvan Quan SISLANDS_SMC_SCLK_VALUE sclk; 145837d542aSEvan Quan SISLANDS_SMC_MCLK_VALUE mclk; 146837d542aSEvan Quan SISLANDS_SMC_VOLTAGE_VALUE vddc; 147837d542aSEvan Quan SISLANDS_SMC_VOLTAGE_VALUE mvdd; 148837d542aSEvan Quan SISLANDS_SMC_VOLTAGE_VALUE vddci; 149837d542aSEvan Quan SISLANDS_SMC_VOLTAGE_VALUE std_vddc; 150837d542aSEvan Quan uint8_t hysteresisUp; 151837d542aSEvan Quan uint8_t hysteresisDown; 152837d542aSEvan Quan uint8_t stateFlags; 153837d542aSEvan Quan uint8_t arbRefreshState; 154837d542aSEvan Quan uint32_t SQPowerThrottle; 155837d542aSEvan Quan uint32_t SQPowerThrottle_2; 156837d542aSEvan Quan uint32_t MaxPoweredUpCU; 157837d542aSEvan Quan SISLANDS_SMC_VOLTAGE_VALUE high_temp_vddc; 158837d542aSEvan Quan SISLANDS_SMC_VOLTAGE_VALUE low_temp_vddc; 159837d542aSEvan Quan uint32_t reserved[2]; 160837d542aSEvan Quan PP_SIslands_Dpm2PerfLevel dpm2; 161837d542aSEvan Quan }; 162837d542aSEvan Quan 163837d542aSEvan Quan #define SISLANDS_SMC_STROBE_RATIO 0x0F 164837d542aSEvan Quan #define SISLANDS_SMC_STROBE_ENABLE 0x10 165837d542aSEvan Quan 166837d542aSEvan Quan #define SISLANDS_SMC_MC_EDC_RD_FLAG 0x01 167837d542aSEvan Quan #define SISLANDS_SMC_MC_EDC_WR_FLAG 0x02 168837d542aSEvan Quan #define SISLANDS_SMC_MC_RTT_ENABLE 0x04 169837d542aSEvan Quan #define SISLANDS_SMC_MC_STUTTER_EN 0x08 170837d542aSEvan Quan #define SISLANDS_SMC_MC_PG_EN 0x10 171837d542aSEvan Quan 172837d542aSEvan Quan typedef struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL SISLANDS_SMC_HW_PERFORMANCE_LEVEL; 173837d542aSEvan Quan 174*5502cf77SRan Sun struct SISLANDS_SMC_SWSTATE { 175837d542aSEvan Quan uint8_t flags; 176837d542aSEvan Quan uint8_t levelCount; 177837d542aSEvan Quan uint8_t padding2; 178837d542aSEvan Quan uint8_t padding3; 179837d542aSEvan Quan SISLANDS_SMC_HW_PERFORMANCE_LEVEL levels[]; 180837d542aSEvan Quan }; 181837d542aSEvan Quan 182837d542aSEvan Quan typedef struct SISLANDS_SMC_SWSTATE SISLANDS_SMC_SWSTATE; 183837d542aSEvan Quan 184837d542aSEvan Quan struct SISLANDS_SMC_SWSTATE_SINGLE { 185837d542aSEvan Quan uint8_t flags; 186837d542aSEvan Quan uint8_t levelCount; 187837d542aSEvan Quan uint8_t padding2; 188837d542aSEvan Quan uint8_t padding3; 189837d542aSEvan Quan SISLANDS_SMC_HW_PERFORMANCE_LEVEL level; 190837d542aSEvan Quan }; 191837d542aSEvan Quan 192837d542aSEvan Quan #define SISLANDS_SMC_VOLTAGEMASK_VDDC 0 193837d542aSEvan Quan #define SISLANDS_SMC_VOLTAGEMASK_MVDD 1 194837d542aSEvan Quan #define SISLANDS_SMC_VOLTAGEMASK_VDDCI 2 195837d542aSEvan Quan #define SISLANDS_SMC_VOLTAGEMASK_VDDC_PHASE_SHEDDING 3 196837d542aSEvan Quan #define SISLANDS_SMC_VOLTAGEMASK_MAX 4 197837d542aSEvan Quan 198*5502cf77SRan Sun struct SISLANDS_SMC_VOLTAGEMASKTABLE { 199837d542aSEvan Quan uint32_t lowMask[SISLANDS_SMC_VOLTAGEMASK_MAX]; 200837d542aSEvan Quan }; 201837d542aSEvan Quan 202837d542aSEvan Quan typedef struct SISLANDS_SMC_VOLTAGEMASKTABLE SISLANDS_SMC_VOLTAGEMASKTABLE; 203837d542aSEvan Quan 204837d542aSEvan Quan #define SISLANDS_MAX_NO_VREG_STEPS 32 205837d542aSEvan Quan 206*5502cf77SRan Sun struct SISLANDS_SMC_STATETABLE { 207837d542aSEvan Quan uint8_t thermalProtectType; 208837d542aSEvan Quan uint8_t systemFlags; 209837d542aSEvan Quan uint8_t maxVDDCIndexInPPTable; 210837d542aSEvan Quan uint8_t extraFlags; 211837d542aSEvan Quan uint32_t lowSMIO[SISLANDS_MAX_NO_VREG_STEPS]; 212837d542aSEvan Quan SISLANDS_SMC_VOLTAGEMASKTABLE voltageMaskTable; 213837d542aSEvan Quan SISLANDS_SMC_VOLTAGEMASKTABLE phaseMaskTable; 214837d542aSEvan Quan PP_SIslands_DPM2Parameters dpm2Params; 215837d542aSEvan Quan struct SISLANDS_SMC_SWSTATE_SINGLE initialState; 216837d542aSEvan Quan struct SISLANDS_SMC_SWSTATE_SINGLE ACPIState; 217837d542aSEvan Quan struct SISLANDS_SMC_SWSTATE_SINGLE ULVState; 218837d542aSEvan Quan SISLANDS_SMC_SWSTATE driverState; 219837d542aSEvan Quan SISLANDS_SMC_HW_PERFORMANCE_LEVEL dpmLevels[SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE]; 220837d542aSEvan Quan }; 221837d542aSEvan Quan 222837d542aSEvan Quan typedef struct SISLANDS_SMC_STATETABLE SISLANDS_SMC_STATETABLE; 223837d542aSEvan Quan 224837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_mclk_chg_timeout 0x0 225837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_delay_vreg 0xC 226837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_delay_acpi 0x28 227837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_seq_index 0x5C 228837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_mvdd_chg_time 0x60 229837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_mclk_switch_lim 0x70 230837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_watermark_threshold 0x78 231837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_phase_shedding_delay 0x88 232837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_ulv_volt_change_delay 0x8C 233837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_mc_block_delay 0x98 234837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_ticks_per_us 0xA8 235837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_crtc_index 0xC4 236837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_mclk_change_block_cp_min 0xC8 237837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_mclk_change_block_cp_max 0xCC 238837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_non_ulv_pcie_link_width 0xF4 239837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_tdr_is_about_to_happen 0xFC 240837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_vr_hot_gpio 0x100 241837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_svi_rework_plat_type 0x118 242837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_svi_rework_gpio_id_svd 0x11c 243837d542aSEvan Quan #define SI_SMC_SOFT_REGISTER_svi_rework_gpio_id_svc 0x120 244837d542aSEvan Quan 245*5502cf77SRan Sun struct PP_SIslands_FanTable { 246837d542aSEvan Quan uint8_t fdo_mode; 247837d542aSEvan Quan uint8_t padding; 248837d542aSEvan Quan int16_t temp_min; 249837d542aSEvan Quan int16_t temp_med; 250837d542aSEvan Quan int16_t temp_max; 251837d542aSEvan Quan int16_t slope1; 252837d542aSEvan Quan int16_t slope2; 253837d542aSEvan Quan int16_t fdo_min; 254837d542aSEvan Quan int16_t hys_up; 255837d542aSEvan Quan int16_t hys_down; 256837d542aSEvan Quan int16_t hys_slope; 257837d542aSEvan Quan int16_t temp_resp_lim; 258837d542aSEvan Quan int16_t temp_curr; 259837d542aSEvan Quan int16_t slope_curr; 260837d542aSEvan Quan int16_t pwm_curr; 261837d542aSEvan Quan uint32_t refresh_period; 262837d542aSEvan Quan int16_t fdo_max; 263837d542aSEvan Quan uint8_t temp_src; 264837d542aSEvan Quan int8_t padding2; 265837d542aSEvan Quan }; 266837d542aSEvan Quan 267837d542aSEvan Quan typedef struct PP_SIslands_FanTable PP_SIslands_FanTable; 268837d542aSEvan Quan 269837d542aSEvan Quan #define SMC_SISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES 16 270837d542aSEvan Quan #define SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES 32 271837d542aSEvan Quan 272837d542aSEvan Quan #define SMC_SISLANDS_SCALE_I 7 273837d542aSEvan Quan #define SMC_SISLANDS_SCALE_R 12 274837d542aSEvan Quan 275*5502cf77SRan Sun struct PP_SIslands_CacConfig { 276837d542aSEvan Quan uint16_t cac_lkge_lut[SMC_SISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES][SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES]; 277837d542aSEvan Quan uint32_t lkge_lut_V0; 278837d542aSEvan Quan uint32_t lkge_lut_Vstep; 279837d542aSEvan Quan uint32_t WinTime; 280837d542aSEvan Quan uint32_t R_LL; 281837d542aSEvan Quan uint32_t calculation_repeats; 282837d542aSEvan Quan uint32_t l2numWin_TDP; 283837d542aSEvan Quan uint32_t dc_cac; 284837d542aSEvan Quan uint8_t lts_truncate_n; 285837d542aSEvan Quan uint8_t SHIFT_N; 286837d542aSEvan Quan uint8_t log2_PG_LKG_SCALE; 287837d542aSEvan Quan uint8_t cac_temp; 288837d542aSEvan Quan uint32_t lkge_lut_T0; 289837d542aSEvan Quan uint32_t lkge_lut_Tstep; 290837d542aSEvan Quan }; 291837d542aSEvan Quan 292837d542aSEvan Quan typedef struct PP_SIslands_CacConfig PP_SIslands_CacConfig; 293837d542aSEvan Quan 294837d542aSEvan Quan #define SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE 16 295837d542aSEvan Quan #define SMC_SISLANDS_MC_REGISTER_ARRAY_SET_COUNT 20 296837d542aSEvan Quan 297*5502cf77SRan Sun struct SMC_SIslands_MCRegisterAddress { 298837d542aSEvan Quan uint16_t s0; 299837d542aSEvan Quan uint16_t s1; 300837d542aSEvan Quan }; 301837d542aSEvan Quan 302837d542aSEvan Quan typedef struct SMC_SIslands_MCRegisterAddress SMC_SIslands_MCRegisterAddress; 303837d542aSEvan Quan 304*5502cf77SRan Sun struct SMC_SIslands_MCRegisterSet { 305837d542aSEvan Quan uint32_t value[SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE]; 306837d542aSEvan Quan }; 307837d542aSEvan Quan 308837d542aSEvan Quan typedef struct SMC_SIslands_MCRegisterSet SMC_SIslands_MCRegisterSet; 309837d542aSEvan Quan 310*5502cf77SRan Sun struct SMC_SIslands_MCRegisters { 311837d542aSEvan Quan uint8_t last; 312837d542aSEvan Quan uint8_t reserved[3]; 313837d542aSEvan Quan SMC_SIslands_MCRegisterAddress address[SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE]; 314837d542aSEvan Quan SMC_SIslands_MCRegisterSet data[SMC_SISLANDS_MC_REGISTER_ARRAY_SET_COUNT]; 315837d542aSEvan Quan }; 316837d542aSEvan Quan 317837d542aSEvan Quan typedef struct SMC_SIslands_MCRegisters SMC_SIslands_MCRegisters; 318837d542aSEvan Quan 319*5502cf77SRan Sun struct SMC_SIslands_MCArbDramTimingRegisterSet { 320837d542aSEvan Quan uint32_t mc_arb_dram_timing; 321837d542aSEvan Quan uint32_t mc_arb_dram_timing2; 322837d542aSEvan Quan uint8_t mc_arb_rfsh_rate; 323837d542aSEvan Quan uint8_t mc_arb_burst_time; 324837d542aSEvan Quan uint8_t padding[2]; 325837d542aSEvan Quan }; 326837d542aSEvan Quan 327837d542aSEvan Quan typedef struct SMC_SIslands_MCArbDramTimingRegisterSet SMC_SIslands_MCArbDramTimingRegisterSet; 328837d542aSEvan Quan 329*5502cf77SRan Sun struct SMC_SIslands_MCArbDramTimingRegisters { 330837d542aSEvan Quan uint8_t arb_current; 331837d542aSEvan Quan uint8_t reserved[3]; 332837d542aSEvan Quan SMC_SIslands_MCArbDramTimingRegisterSet data[16]; 333837d542aSEvan Quan }; 334837d542aSEvan Quan 335837d542aSEvan Quan typedef struct SMC_SIslands_MCArbDramTimingRegisters SMC_SIslands_MCArbDramTimingRegisters; 336837d542aSEvan Quan 337*5502cf77SRan Sun struct SMC_SISLANDS_SPLL_DIV_TABLE { 338837d542aSEvan Quan uint32_t freq[256]; 339837d542aSEvan Quan uint32_t ss[256]; 340837d542aSEvan Quan }; 341837d542aSEvan Quan 342837d542aSEvan Quan #define SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_MASK 0x01ffffff 343837d542aSEvan Quan #define SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT 0 344837d542aSEvan Quan #define SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_MASK 0xfe000000 345837d542aSEvan Quan #define SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_SHIFT 25 346837d542aSEvan Quan #define SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_MASK 0x000fffff 347837d542aSEvan Quan #define SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT 0 348837d542aSEvan Quan #define SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_MASK 0xfff00000 349837d542aSEvan Quan #define SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT 20 350837d542aSEvan Quan 351837d542aSEvan Quan typedef struct SMC_SISLANDS_SPLL_DIV_TABLE SMC_SISLANDS_SPLL_DIV_TABLE; 352837d542aSEvan Quan 353837d542aSEvan Quan #define SMC_SISLANDS_DTE_MAX_FILTER_STAGES 5 354837d542aSEvan Quan 355837d542aSEvan Quan #define SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE 16 356837d542aSEvan Quan 357*5502cf77SRan Sun struct Smc_SIslands_DTE_Configuration { 358837d542aSEvan Quan uint32_t tau[SMC_SISLANDS_DTE_MAX_FILTER_STAGES]; 359837d542aSEvan Quan uint32_t R[SMC_SISLANDS_DTE_MAX_FILTER_STAGES]; 360837d542aSEvan Quan uint32_t K; 361837d542aSEvan Quan uint32_t T0; 362837d542aSEvan Quan uint32_t MaxT; 363837d542aSEvan Quan uint8_t WindowSize; 364837d542aSEvan Quan uint8_t Tdep_count; 365837d542aSEvan Quan uint8_t temp_select; 366837d542aSEvan Quan uint8_t DTE_mode; 367837d542aSEvan Quan uint8_t T_limits[SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE]; 368837d542aSEvan Quan uint32_t Tdep_tau[SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE]; 369837d542aSEvan Quan uint32_t Tdep_R[SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE]; 370837d542aSEvan Quan uint32_t Tthreshold; 371837d542aSEvan Quan }; 372837d542aSEvan Quan 373837d542aSEvan Quan typedef struct Smc_SIslands_DTE_Configuration Smc_SIslands_DTE_Configuration; 374837d542aSEvan Quan 375837d542aSEvan Quan #define SMC_SISLANDS_DTE_STATUS_FLAG_DTE_ON 1 376837d542aSEvan Quan 377837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_LOCATION 0x10000 378837d542aSEvan Quan 379837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_version 0x0 380837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_flags 0x4 381837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_softRegisters 0xC 382837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_stateTable 0x10 383837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_fanTable 0x14 384837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_CacConfigTable 0x18 385837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_mcRegisterTable 0x24 386837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_mcArbDramAutoRefreshTable 0x30 387837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_spllTable 0x38 388837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_DteConfiguration 0x40 389837d542aSEvan Quan #define SISLANDS_SMC_FIRMWARE_HEADER_PAPMParameters 0x48 390837d542aSEvan Quan 391837d542aSEvan Quan #pragma pack(pop) 392837d542aSEvan Quan 393837d542aSEvan Quan int amdgpu_si_copy_bytes_to_smc(struct amdgpu_device *adev, 394837d542aSEvan Quan u32 smc_start_address, 395837d542aSEvan Quan const u8 *src, u32 byte_count, u32 limit); 396837d542aSEvan Quan void amdgpu_si_start_smc(struct amdgpu_device *adev); 397837d542aSEvan Quan void amdgpu_si_reset_smc(struct amdgpu_device *adev); 398837d542aSEvan Quan int amdgpu_si_program_jump_on_start(struct amdgpu_device *adev); 399837d542aSEvan Quan void amdgpu_si_smc_clock(struct amdgpu_device *adev, bool enable); 400837d542aSEvan Quan bool amdgpu_si_is_smc_running(struct amdgpu_device *adev); 401837d542aSEvan Quan PPSMC_Result amdgpu_si_send_msg_to_smc(struct amdgpu_device *adev, PPSMC_Msg msg); 402837d542aSEvan Quan PPSMC_Result amdgpu_si_wait_for_smc_inactive(struct amdgpu_device *adev); 403837d542aSEvan Quan int amdgpu_si_load_smc_ucode(struct amdgpu_device *adev, u32 limit); 404837d542aSEvan Quan int amdgpu_si_read_smc_sram_dword(struct amdgpu_device *adev, u32 smc_address, 405837d542aSEvan Quan u32 *value, u32 limit); 406837d542aSEvan Quan int amdgpu_si_write_smc_sram_dword(struct amdgpu_device *adev, u32 smc_address, 407837d542aSEvan Quan u32 value, u32 limit); 408837d542aSEvan Quan 409837d542aSEvan Quan #endif 410837d542aSEvan Quan 411