157e252bfSMichael Neumann /* 257e252bfSMichael Neumann * Copyright 2013 Advanced Micro Devices, Inc. 357e252bfSMichael Neumann * 457e252bfSMichael Neumann * Permission is hereby granted, free of charge, to any person obtaining a 557e252bfSMichael Neumann * copy of this software and associated documentation files (the "Software"), 657e252bfSMichael Neumann * to deal in the Software without restriction, including without limitation 757e252bfSMichael Neumann * the rights to use, copy, modify, merge, publish, distribute, sublicense, 857e252bfSMichael Neumann * and/or sell copies of the Software, and to permit persons to whom the 957e252bfSMichael Neumann * Software is furnished to do so, subject to the following conditions: 1057e252bfSMichael Neumann * 1157e252bfSMichael Neumann * The above copyright notice and this permission notice shall be included in 1257e252bfSMichael Neumann * all copies or substantial portions of the Software. 1357e252bfSMichael Neumann * 1457e252bfSMichael Neumann * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1557e252bfSMichael Neumann * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1657e252bfSMichael Neumann * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1757e252bfSMichael Neumann * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1857e252bfSMichael Neumann * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1957e252bfSMichael Neumann * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2057e252bfSMichael Neumann * OTHER DEALINGS IN THE SOFTWARE. 2157e252bfSMichael Neumann * 2257e252bfSMichael Neumann */ 2357e252bfSMichael Neumann #ifndef PP_SISLANDS_SMC_H 2457e252bfSMichael Neumann #define PP_SISLANDS_SMC_H 2557e252bfSMichael Neumann 2657e252bfSMichael Neumann #include "ppsmc.h" 2757e252bfSMichael Neumann 2857e252bfSMichael Neumann #pragma pack(push, 1) 2957e252bfSMichael Neumann 3057e252bfSMichael Neumann #define SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE 16 3157e252bfSMichael Neumann 3257e252bfSMichael Neumann struct PP_SIslands_Dpm2PerfLevel 3357e252bfSMichael Neumann { 3457e252bfSMichael Neumann uint8_t MaxPS; 3557e252bfSMichael Neumann uint8_t TgtAct; 3657e252bfSMichael Neumann uint8_t MaxPS_StepInc; 3757e252bfSMichael Neumann uint8_t MaxPS_StepDec; 3857e252bfSMichael Neumann uint8_t PSSamplingTime; 3957e252bfSMichael Neumann uint8_t NearTDPDec; 4057e252bfSMichael Neumann uint8_t AboveSafeInc; 4157e252bfSMichael Neumann uint8_t BelowSafeInc; 4257e252bfSMichael Neumann uint8_t PSDeltaLimit; 4357e252bfSMichael Neumann uint8_t PSDeltaWin; 4457e252bfSMichael Neumann uint16_t PwrEfficiencyRatio; 4557e252bfSMichael Neumann uint8_t Reserved[4]; 4657e252bfSMichael Neumann }; 4757e252bfSMichael Neumann 4857e252bfSMichael Neumann typedef struct PP_SIslands_Dpm2PerfLevel PP_SIslands_Dpm2PerfLevel; 4957e252bfSMichael Neumann 5057e252bfSMichael Neumann struct PP_SIslands_DPM2Status 5157e252bfSMichael Neumann { 5257e252bfSMichael Neumann uint32_t dpm2Flags; 5357e252bfSMichael Neumann uint8_t CurrPSkip; 5457e252bfSMichael Neumann uint8_t CurrPSkipPowerShift; 5557e252bfSMichael Neumann uint8_t CurrPSkipTDP; 5657e252bfSMichael Neumann uint8_t CurrPSkipOCP; 5757e252bfSMichael Neumann uint8_t MaxSPLLIndex; 5857e252bfSMichael Neumann uint8_t MinSPLLIndex; 5957e252bfSMichael Neumann uint8_t CurrSPLLIndex; 6057e252bfSMichael Neumann uint8_t InfSweepMode; 6157e252bfSMichael Neumann uint8_t InfSweepDir; 6257e252bfSMichael Neumann uint8_t TDPexceeded; 6357e252bfSMichael Neumann uint8_t reserved; 6457e252bfSMichael Neumann uint8_t SwitchDownThreshold; 6557e252bfSMichael Neumann uint32_t SwitchDownCounter; 6657e252bfSMichael Neumann uint32_t SysScalingFactor; 6757e252bfSMichael Neumann }; 6857e252bfSMichael Neumann 6957e252bfSMichael Neumann typedef struct PP_SIslands_DPM2Status PP_SIslands_DPM2Status; 7057e252bfSMichael Neumann 7157e252bfSMichael Neumann struct PP_SIslands_DPM2Parameters 7257e252bfSMichael Neumann { 7357e252bfSMichael Neumann uint32_t TDPLimit; 7457e252bfSMichael Neumann uint32_t NearTDPLimit; 7557e252bfSMichael Neumann uint32_t SafePowerLimit; 7657e252bfSMichael Neumann uint32_t PowerBoostLimit; 7757e252bfSMichael Neumann uint32_t MinLimitDelta; 7857e252bfSMichael Neumann }; 7957e252bfSMichael Neumann typedef struct PP_SIslands_DPM2Parameters PP_SIslands_DPM2Parameters; 8057e252bfSMichael Neumann 8157e252bfSMichael Neumann struct PP_SIslands_PAPMStatus 8257e252bfSMichael Neumann { 8357e252bfSMichael Neumann uint32_t EstimatedDGPU_T; 8457e252bfSMichael Neumann uint32_t EstimatedDGPU_P; 8557e252bfSMichael Neumann uint32_t EstimatedAPU_T; 8657e252bfSMichael Neumann uint32_t EstimatedAPU_P; 8757e252bfSMichael Neumann uint8_t dGPU_T_Limit_Exceeded; 8857e252bfSMichael Neumann uint8_t reserved[3]; 8957e252bfSMichael Neumann }; 9057e252bfSMichael Neumann typedef struct PP_SIslands_PAPMStatus PP_SIslands_PAPMStatus; 9157e252bfSMichael Neumann 9257e252bfSMichael Neumann struct PP_SIslands_PAPMParameters 9357e252bfSMichael Neumann { 9457e252bfSMichael Neumann uint32_t NearTDPLimitTherm; 9557e252bfSMichael Neumann uint32_t NearTDPLimitPAPM; 9657e252bfSMichael Neumann uint32_t PlatformPowerLimit; 9757e252bfSMichael Neumann uint32_t dGPU_T_Limit; 9857e252bfSMichael Neumann uint32_t dGPU_T_Warning; 9957e252bfSMichael Neumann uint32_t dGPU_T_Hysteresis; 10057e252bfSMichael Neumann }; 10157e252bfSMichael Neumann typedef struct PP_SIslands_PAPMParameters PP_SIslands_PAPMParameters; 10257e252bfSMichael Neumann 10357e252bfSMichael Neumann struct SISLANDS_SMC_SCLK_VALUE 10457e252bfSMichael Neumann { 10557e252bfSMichael Neumann uint32_t vCG_SPLL_FUNC_CNTL; 10657e252bfSMichael Neumann uint32_t vCG_SPLL_FUNC_CNTL_2; 10757e252bfSMichael Neumann uint32_t vCG_SPLL_FUNC_CNTL_3; 10857e252bfSMichael Neumann uint32_t vCG_SPLL_FUNC_CNTL_4; 10957e252bfSMichael Neumann uint32_t vCG_SPLL_SPREAD_SPECTRUM; 11057e252bfSMichael Neumann uint32_t vCG_SPLL_SPREAD_SPECTRUM_2; 11157e252bfSMichael Neumann uint32_t sclk_value; 11257e252bfSMichael Neumann }; 11357e252bfSMichael Neumann 11457e252bfSMichael Neumann typedef struct SISLANDS_SMC_SCLK_VALUE SISLANDS_SMC_SCLK_VALUE; 11557e252bfSMichael Neumann 11657e252bfSMichael Neumann struct SISLANDS_SMC_MCLK_VALUE 11757e252bfSMichael Neumann { 11857e252bfSMichael Neumann uint32_t vMPLL_FUNC_CNTL; 11957e252bfSMichael Neumann uint32_t vMPLL_FUNC_CNTL_1; 12057e252bfSMichael Neumann uint32_t vMPLL_FUNC_CNTL_2; 12157e252bfSMichael Neumann uint32_t vMPLL_AD_FUNC_CNTL; 12257e252bfSMichael Neumann uint32_t vMPLL_DQ_FUNC_CNTL; 12357e252bfSMichael Neumann uint32_t vMCLK_PWRMGT_CNTL; 12457e252bfSMichael Neumann uint32_t vDLL_CNTL; 12557e252bfSMichael Neumann uint32_t vMPLL_SS; 12657e252bfSMichael Neumann uint32_t vMPLL_SS2; 12757e252bfSMichael Neumann uint32_t mclk_value; 12857e252bfSMichael Neumann }; 12957e252bfSMichael Neumann 13057e252bfSMichael Neumann typedef struct SISLANDS_SMC_MCLK_VALUE SISLANDS_SMC_MCLK_VALUE; 13157e252bfSMichael Neumann 13257e252bfSMichael Neumann struct SISLANDS_SMC_VOLTAGE_VALUE 13357e252bfSMichael Neumann { 13457e252bfSMichael Neumann uint16_t value; 13557e252bfSMichael Neumann uint8_t index; 13657e252bfSMichael Neumann uint8_t phase_settings; 13757e252bfSMichael Neumann }; 13857e252bfSMichael Neumann 13957e252bfSMichael Neumann typedef struct SISLANDS_SMC_VOLTAGE_VALUE SISLANDS_SMC_VOLTAGE_VALUE; 14057e252bfSMichael Neumann 14157e252bfSMichael Neumann struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL 14257e252bfSMichael Neumann { 14357e252bfSMichael Neumann uint8_t ACIndex; 14457e252bfSMichael Neumann uint8_t displayWatermark; 14557e252bfSMichael Neumann uint8_t gen2PCIE; 14657e252bfSMichael Neumann uint8_t UVDWatermark; 14757e252bfSMichael Neumann uint8_t VCEWatermark; 14857e252bfSMichael Neumann uint8_t strobeMode; 14957e252bfSMichael Neumann uint8_t mcFlags; 15057e252bfSMichael Neumann uint8_t padding; 15157e252bfSMichael Neumann uint32_t aT; 15257e252bfSMichael Neumann uint32_t bSP; 15357e252bfSMichael Neumann SISLANDS_SMC_SCLK_VALUE sclk; 15457e252bfSMichael Neumann SISLANDS_SMC_MCLK_VALUE mclk; 15557e252bfSMichael Neumann SISLANDS_SMC_VOLTAGE_VALUE vddc; 15657e252bfSMichael Neumann SISLANDS_SMC_VOLTAGE_VALUE mvdd; 15757e252bfSMichael Neumann SISLANDS_SMC_VOLTAGE_VALUE vddci; 15857e252bfSMichael Neumann SISLANDS_SMC_VOLTAGE_VALUE std_vddc; 15957e252bfSMichael Neumann uint8_t hysteresisUp; 16057e252bfSMichael Neumann uint8_t hysteresisDown; 16157e252bfSMichael Neumann uint8_t stateFlags; 16257e252bfSMichael Neumann uint8_t arbRefreshState; 16357e252bfSMichael Neumann uint32_t SQPowerThrottle; 16457e252bfSMichael Neumann uint32_t SQPowerThrottle_2; 16557e252bfSMichael Neumann uint32_t MaxPoweredUpCU; 16657e252bfSMichael Neumann SISLANDS_SMC_VOLTAGE_VALUE high_temp_vddc; 16757e252bfSMichael Neumann SISLANDS_SMC_VOLTAGE_VALUE low_temp_vddc; 16857e252bfSMichael Neumann uint32_t reserved[2]; 16957e252bfSMichael Neumann PP_SIslands_Dpm2PerfLevel dpm2; 17057e252bfSMichael Neumann }; 17157e252bfSMichael Neumann 17257e252bfSMichael Neumann #define SISLANDS_SMC_STROBE_RATIO 0x0F 17357e252bfSMichael Neumann #define SISLANDS_SMC_STROBE_ENABLE 0x10 17457e252bfSMichael Neumann 17557e252bfSMichael Neumann #define SISLANDS_SMC_MC_EDC_RD_FLAG 0x01 17657e252bfSMichael Neumann #define SISLANDS_SMC_MC_EDC_WR_FLAG 0x02 17757e252bfSMichael Neumann #define SISLANDS_SMC_MC_RTT_ENABLE 0x04 17857e252bfSMichael Neumann #define SISLANDS_SMC_MC_STUTTER_EN 0x08 17957e252bfSMichael Neumann #define SISLANDS_SMC_MC_PG_EN 0x10 18057e252bfSMichael Neumann 18157e252bfSMichael Neumann typedef struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL SISLANDS_SMC_HW_PERFORMANCE_LEVEL; 18257e252bfSMichael Neumann 18357e252bfSMichael Neumann struct SISLANDS_SMC_SWSTATE 18457e252bfSMichael Neumann { 18557e252bfSMichael Neumann uint8_t flags; 18657e252bfSMichael Neumann uint8_t levelCount; 18757e252bfSMichael Neumann uint8_t padding2; 18857e252bfSMichael Neumann uint8_t padding3; 18957e252bfSMichael Neumann SISLANDS_SMC_HW_PERFORMANCE_LEVEL levels[1]; 19057e252bfSMichael Neumann }; 19157e252bfSMichael Neumann 19257e252bfSMichael Neumann typedef struct SISLANDS_SMC_SWSTATE SISLANDS_SMC_SWSTATE; 19357e252bfSMichael Neumann 19457e252bfSMichael Neumann #define SISLANDS_SMC_VOLTAGEMASK_VDDC 0 19557e252bfSMichael Neumann #define SISLANDS_SMC_VOLTAGEMASK_MVDD 1 19657e252bfSMichael Neumann #define SISLANDS_SMC_VOLTAGEMASK_VDDCI 2 197*c59a5c48SFrançois Tigeot #define SISLANDS_SMC_VOLTAGEMASK_VDDC_PHASE_SHEDDING 3 19857e252bfSMichael Neumann #define SISLANDS_SMC_VOLTAGEMASK_MAX 4 19957e252bfSMichael Neumann 20057e252bfSMichael Neumann struct SISLANDS_SMC_VOLTAGEMASKTABLE 20157e252bfSMichael Neumann { 20257e252bfSMichael Neumann uint32_t lowMask[SISLANDS_SMC_VOLTAGEMASK_MAX]; 20357e252bfSMichael Neumann }; 20457e252bfSMichael Neumann 20557e252bfSMichael Neumann typedef struct SISLANDS_SMC_VOLTAGEMASKTABLE SISLANDS_SMC_VOLTAGEMASKTABLE; 20657e252bfSMichael Neumann 20757e252bfSMichael Neumann #define SISLANDS_MAX_NO_VREG_STEPS 32 20857e252bfSMichael Neumann 20957e252bfSMichael Neumann struct SISLANDS_SMC_STATETABLE 21057e252bfSMichael Neumann { 21157e252bfSMichael Neumann uint8_t thermalProtectType; 21257e252bfSMichael Neumann uint8_t systemFlags; 21357e252bfSMichael Neumann uint8_t maxVDDCIndexInPPTable; 21457e252bfSMichael Neumann uint8_t extraFlags; 21557e252bfSMichael Neumann uint32_t lowSMIO[SISLANDS_MAX_NO_VREG_STEPS]; 21657e252bfSMichael Neumann SISLANDS_SMC_VOLTAGEMASKTABLE voltageMaskTable; 21757e252bfSMichael Neumann SISLANDS_SMC_VOLTAGEMASKTABLE phaseMaskTable; 21857e252bfSMichael Neumann PP_SIslands_DPM2Parameters dpm2Params; 21957e252bfSMichael Neumann SISLANDS_SMC_SWSTATE initialState; 22057e252bfSMichael Neumann SISLANDS_SMC_SWSTATE ACPIState; 22157e252bfSMichael Neumann SISLANDS_SMC_SWSTATE ULVState; 22257e252bfSMichael Neumann SISLANDS_SMC_SWSTATE driverState; 22357e252bfSMichael Neumann SISLANDS_SMC_HW_PERFORMANCE_LEVEL dpmLevels[SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1]; 22457e252bfSMichael Neumann }; 22557e252bfSMichael Neumann 22657e252bfSMichael Neumann typedef struct SISLANDS_SMC_STATETABLE SISLANDS_SMC_STATETABLE; 22757e252bfSMichael Neumann 22857e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_mclk_chg_timeout 0x0 22957e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_delay_vreg 0xC 23057e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_delay_acpi 0x28 23157e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_seq_index 0x5C 23257e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_mvdd_chg_time 0x60 23357e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_mclk_switch_lim 0x70 23457e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_watermark_threshold 0x78 23557e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_phase_shedding_delay 0x88 23657e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_ulv_volt_change_delay 0x8C 23757e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_mc_block_delay 0x98 23857e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_ticks_per_us 0xA8 23957e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_crtc_index 0xC4 24057e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_mclk_change_block_cp_min 0xC8 24157e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_mclk_change_block_cp_max 0xCC 24257e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_non_ulv_pcie_link_width 0xF4 24357e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_tdr_is_about_to_happen 0xFC 24457e252bfSMichael Neumann #define SI_SMC_SOFT_REGISTER_vr_hot_gpio 0x100 245c6f73aabSFrançois Tigeot #define SI_SMC_SOFT_REGISTER_svi_rework_plat_type 0x118 246c6f73aabSFrançois Tigeot #define SI_SMC_SOFT_REGISTER_svi_rework_gpio_id_svd 0x11c 247c6f73aabSFrançois Tigeot #define SI_SMC_SOFT_REGISTER_svi_rework_gpio_id_svc 0x120 24857e252bfSMichael Neumann 2497dcf36dcSFrançois Tigeot struct PP_SIslands_FanTable 2507dcf36dcSFrançois Tigeot { 2517dcf36dcSFrançois Tigeot uint8_t fdo_mode; 2527dcf36dcSFrançois Tigeot uint8_t padding; 2537dcf36dcSFrançois Tigeot int16_t temp_min; 2547dcf36dcSFrançois Tigeot int16_t temp_med; 2557dcf36dcSFrançois Tigeot int16_t temp_max; 2567dcf36dcSFrançois Tigeot int16_t slope1; 2577dcf36dcSFrançois Tigeot int16_t slope2; 2587dcf36dcSFrançois Tigeot int16_t fdo_min; 2597dcf36dcSFrançois Tigeot int16_t hys_up; 2607dcf36dcSFrançois Tigeot int16_t hys_down; 2617dcf36dcSFrançois Tigeot int16_t hys_slope; 2627dcf36dcSFrançois Tigeot int16_t temp_resp_lim; 2637dcf36dcSFrançois Tigeot int16_t temp_curr; 2647dcf36dcSFrançois Tigeot int16_t slope_curr; 2657dcf36dcSFrançois Tigeot int16_t pwm_curr; 2667dcf36dcSFrançois Tigeot uint32_t refresh_period; 2677dcf36dcSFrançois Tigeot int16_t fdo_max; 2687dcf36dcSFrançois Tigeot uint8_t temp_src; 2697dcf36dcSFrançois Tigeot int8_t padding2; 2707dcf36dcSFrançois Tigeot }; 2717dcf36dcSFrançois Tigeot 2727dcf36dcSFrançois Tigeot typedef struct PP_SIslands_FanTable PP_SIslands_FanTable; 2737dcf36dcSFrançois Tigeot 27457e252bfSMichael Neumann #define SMC_SISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES 16 27557e252bfSMichael Neumann #define SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES 32 27657e252bfSMichael Neumann 27757e252bfSMichael Neumann #define SMC_SISLANDS_SCALE_I 7 27857e252bfSMichael Neumann #define SMC_SISLANDS_SCALE_R 12 27957e252bfSMichael Neumann 28057e252bfSMichael Neumann struct PP_SIslands_CacConfig 28157e252bfSMichael Neumann { 28257e252bfSMichael Neumann uint16_t cac_lkge_lut[SMC_SISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES][SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES]; 28357e252bfSMichael Neumann uint32_t lkge_lut_V0; 28457e252bfSMichael Neumann uint32_t lkge_lut_Vstep; 28557e252bfSMichael Neumann uint32_t WinTime; 28657e252bfSMichael Neumann uint32_t R_LL; 28757e252bfSMichael Neumann uint32_t calculation_repeats; 28857e252bfSMichael Neumann uint32_t l2numWin_TDP; 28957e252bfSMichael Neumann uint32_t dc_cac; 29057e252bfSMichael Neumann uint8_t lts_truncate_n; 29157e252bfSMichael Neumann uint8_t SHIFT_N; 29257e252bfSMichael Neumann uint8_t log2_PG_LKG_SCALE; 29357e252bfSMichael Neumann uint8_t cac_temp; 29457e252bfSMichael Neumann uint32_t lkge_lut_T0; 29557e252bfSMichael Neumann uint32_t lkge_lut_Tstep; 29657e252bfSMichael Neumann }; 29757e252bfSMichael Neumann 29857e252bfSMichael Neumann typedef struct PP_SIslands_CacConfig PP_SIslands_CacConfig; 29957e252bfSMichael Neumann 30057e252bfSMichael Neumann #define SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE 16 30157e252bfSMichael Neumann #define SMC_SISLANDS_MC_REGISTER_ARRAY_SET_COUNT 20 30257e252bfSMichael Neumann 30357e252bfSMichael Neumann struct SMC_SIslands_MCRegisterAddress 30457e252bfSMichael Neumann { 30557e252bfSMichael Neumann uint16_t s0; 30657e252bfSMichael Neumann uint16_t s1; 30757e252bfSMichael Neumann }; 30857e252bfSMichael Neumann 30957e252bfSMichael Neumann typedef struct SMC_SIslands_MCRegisterAddress SMC_SIslands_MCRegisterAddress; 31057e252bfSMichael Neumann 31157e252bfSMichael Neumann struct SMC_SIslands_MCRegisterSet 31257e252bfSMichael Neumann { 31357e252bfSMichael Neumann uint32_t value[SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE]; 31457e252bfSMichael Neumann }; 31557e252bfSMichael Neumann 31657e252bfSMichael Neumann typedef struct SMC_SIslands_MCRegisterSet SMC_SIslands_MCRegisterSet; 31757e252bfSMichael Neumann 31857e252bfSMichael Neumann struct SMC_SIslands_MCRegisters 31957e252bfSMichael Neumann { 32057e252bfSMichael Neumann uint8_t last; 32157e252bfSMichael Neumann uint8_t reserved[3]; 32257e252bfSMichael Neumann SMC_SIslands_MCRegisterAddress address[SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE]; 32357e252bfSMichael Neumann SMC_SIslands_MCRegisterSet data[SMC_SISLANDS_MC_REGISTER_ARRAY_SET_COUNT]; 32457e252bfSMichael Neumann }; 32557e252bfSMichael Neumann 32657e252bfSMichael Neumann typedef struct SMC_SIslands_MCRegisters SMC_SIslands_MCRegisters; 32757e252bfSMichael Neumann 32857e252bfSMichael Neumann struct SMC_SIslands_MCArbDramTimingRegisterSet 32957e252bfSMichael Neumann { 33057e252bfSMichael Neumann uint32_t mc_arb_dram_timing; 33157e252bfSMichael Neumann uint32_t mc_arb_dram_timing2; 33257e252bfSMichael Neumann uint8_t mc_arb_rfsh_rate; 33357e252bfSMichael Neumann uint8_t mc_arb_burst_time; 33457e252bfSMichael Neumann uint8_t padding[2]; 33557e252bfSMichael Neumann }; 33657e252bfSMichael Neumann 33757e252bfSMichael Neumann typedef struct SMC_SIslands_MCArbDramTimingRegisterSet SMC_SIslands_MCArbDramTimingRegisterSet; 33857e252bfSMichael Neumann 33957e252bfSMichael Neumann struct SMC_SIslands_MCArbDramTimingRegisters 34057e252bfSMichael Neumann { 34157e252bfSMichael Neumann uint8_t arb_current; 34257e252bfSMichael Neumann uint8_t reserved[3]; 34357e252bfSMichael Neumann SMC_SIslands_MCArbDramTimingRegisterSet data[16]; 34457e252bfSMichael Neumann }; 34557e252bfSMichael Neumann 34657e252bfSMichael Neumann typedef struct SMC_SIslands_MCArbDramTimingRegisters SMC_SIslands_MCArbDramTimingRegisters; 34757e252bfSMichael Neumann 34857e252bfSMichael Neumann struct SMC_SISLANDS_SPLL_DIV_TABLE 34957e252bfSMichael Neumann { 35057e252bfSMichael Neumann uint32_t freq[256]; 35157e252bfSMichael Neumann uint32_t ss[256]; 35257e252bfSMichael Neumann }; 35357e252bfSMichael Neumann 35457e252bfSMichael Neumann #define SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_MASK 0x01ffffff 35557e252bfSMichael Neumann #define SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT 0 35657e252bfSMichael Neumann #define SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_MASK 0xfe000000 35757e252bfSMichael Neumann #define SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_SHIFT 25 35857e252bfSMichael Neumann #define SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_MASK 0x000fffff 35957e252bfSMichael Neumann #define SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT 0 36057e252bfSMichael Neumann #define SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_MASK 0xfff00000 36157e252bfSMichael Neumann #define SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT 20 36257e252bfSMichael Neumann 36357e252bfSMichael Neumann typedef struct SMC_SISLANDS_SPLL_DIV_TABLE SMC_SISLANDS_SPLL_DIV_TABLE; 36457e252bfSMichael Neumann 36557e252bfSMichael Neumann #define SMC_SISLANDS_DTE_MAX_FILTER_STAGES 5 36657e252bfSMichael Neumann 36757e252bfSMichael Neumann #define SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE 16 36857e252bfSMichael Neumann 36957e252bfSMichael Neumann struct Smc_SIslands_DTE_Configuration 37057e252bfSMichael Neumann { 37157e252bfSMichael Neumann uint32_t tau[SMC_SISLANDS_DTE_MAX_FILTER_STAGES]; 37257e252bfSMichael Neumann uint32_t R[SMC_SISLANDS_DTE_MAX_FILTER_STAGES]; 37357e252bfSMichael Neumann uint32_t K; 37457e252bfSMichael Neumann uint32_t T0; 37557e252bfSMichael Neumann uint32_t MaxT; 37657e252bfSMichael Neumann uint8_t WindowSize; 37757e252bfSMichael Neumann uint8_t Tdep_count; 37857e252bfSMichael Neumann uint8_t temp_select; 37957e252bfSMichael Neumann uint8_t DTE_mode; 38057e252bfSMichael Neumann uint8_t T_limits[SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE]; 38157e252bfSMichael Neumann uint32_t Tdep_tau[SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE]; 38257e252bfSMichael Neumann uint32_t Tdep_R[SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE]; 38357e252bfSMichael Neumann uint32_t Tthreshold; 38457e252bfSMichael Neumann }; 38557e252bfSMichael Neumann 38657e252bfSMichael Neumann typedef struct Smc_SIslands_DTE_Configuration Smc_SIslands_DTE_Configuration; 38757e252bfSMichael Neumann 38857e252bfSMichael Neumann #define SMC_SISLANDS_DTE_STATUS_FLAG_DTE_ON 1 38957e252bfSMichael Neumann 39057e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_LOCATION 0x10000 39157e252bfSMichael Neumann 39257e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_version 0x0 39357e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_flags 0x4 39457e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_softRegisters 0xC 39557e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_stateTable 0x10 39657e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_fanTable 0x14 39757e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_CacConfigTable 0x18 39857e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_mcRegisterTable 0x24 39957e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_mcArbDramAutoRefreshTable 0x30 40057e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_spllTable 0x38 40157e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_DteConfiguration 0x40 40257e252bfSMichael Neumann #define SISLANDS_SMC_FIRMWARE_HEADER_PAPMParameters 0x48 40357e252bfSMichael Neumann 40457e252bfSMichael Neumann #pragma pack(pop) 40557e252bfSMichael Neumann 40657e252bfSMichael Neumann int si_copy_bytes_to_smc(struct radeon_device *rdev, 40757e252bfSMichael Neumann u32 smc_start_address, 40857e252bfSMichael Neumann const u8 *src, u32 byte_count, u32 limit); 40957e252bfSMichael Neumann void si_start_smc(struct radeon_device *rdev); 41057e252bfSMichael Neumann void si_reset_smc(struct radeon_device *rdev); 41157e252bfSMichael Neumann int si_program_jump_on_start(struct radeon_device *rdev); 41257e252bfSMichael Neumann void si_stop_smc_clock(struct radeon_device *rdev); 41357e252bfSMichael Neumann void si_start_smc_clock(struct radeon_device *rdev); 41457e252bfSMichael Neumann bool si_is_smc_running(struct radeon_device *rdev); 41557e252bfSMichael Neumann PPSMC_Result si_send_msg_to_smc(struct radeon_device *rdev, PPSMC_Msg msg); 41657e252bfSMichael Neumann PPSMC_Result si_wait_for_smc_inactive(struct radeon_device *rdev); 41757e252bfSMichael Neumann int si_load_smc_ucode(struct radeon_device *rdev, u32 limit); 41857e252bfSMichael Neumann int si_read_smc_sram_dword(struct radeon_device *rdev, u32 smc_address, 41957e252bfSMichael Neumann u32 *value, u32 limit); 42057e252bfSMichael Neumann int si_write_smc_sram_dword(struct radeon_device *rdev, u32 smc_address, 42157e252bfSMichael Neumann u32 value, u32 limit); 42257e252bfSMichael Neumann 42357e252bfSMichael Neumann #endif 4241cfef1a5SFrançois Tigeot 425