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 _HARDWARE_MANAGER_H_ 248c2ecf20Sopenharmony_ci#define _HARDWARE_MANAGER_H_ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistruct pp_hwmgr; 298c2ecf20Sopenharmony_cistruct pp_hw_power_state; 308c2ecf20Sopenharmony_cistruct pp_power_state; 318c2ecf20Sopenharmony_cienum amd_dpm_forced_level; 328c2ecf20Sopenharmony_cistruct PP_TemperatureRange; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistruct phm_fan_speed_info { 368c2ecf20Sopenharmony_ci uint32_t min_percent; 378c2ecf20Sopenharmony_ci uint32_t max_percent; 388c2ecf20Sopenharmony_ci uint32_t min_rpm; 398c2ecf20Sopenharmony_ci uint32_t max_rpm; 408c2ecf20Sopenharmony_ci bool supports_percent_read; 418c2ecf20Sopenharmony_ci bool supports_percent_write; 428c2ecf20Sopenharmony_ci bool supports_rpm_read; 438c2ecf20Sopenharmony_ci bool supports_rpm_write; 448c2ecf20Sopenharmony_ci}; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci/* Automatic Power State Throttling */ 478c2ecf20Sopenharmony_cienum PHM_AutoThrottleSource 488c2ecf20Sopenharmony_ci{ 498c2ecf20Sopenharmony_ci PHM_AutoThrottleSource_Thermal, 508c2ecf20Sopenharmony_ci PHM_AutoThrottleSource_External 518c2ecf20Sopenharmony_ci}; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_citypedef enum PHM_AutoThrottleSource PHM_AutoThrottleSource; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cienum phm_platform_caps { 568c2ecf20Sopenharmony_ci PHM_PlatformCaps_AtomBiosPpV1 = 0, 578c2ecf20Sopenharmony_ci PHM_PlatformCaps_PowerPlaySupport, 588c2ecf20Sopenharmony_ci PHM_PlatformCaps_ACOverdriveSupport, 598c2ecf20Sopenharmony_ci PHM_PlatformCaps_BacklightSupport, 608c2ecf20Sopenharmony_ci PHM_PlatformCaps_ThermalController, 618c2ecf20Sopenharmony_ci PHM_PlatformCaps_BiosPowerSourceControl, 628c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableVoltageTransition, 638c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableEngineTransition, 648c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableMemoryTransition, 658c2ecf20Sopenharmony_ci PHM_PlatformCaps_DynamicPowerManagement, 668c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableASPML0s, 678c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableASPML1, 688c2ecf20Sopenharmony_ci PHM_PlatformCaps_OD5inACSupport, 698c2ecf20Sopenharmony_ci PHM_PlatformCaps_OD5inDCSupport, 708c2ecf20Sopenharmony_ci PHM_PlatformCaps_SoftStateOD5, 718c2ecf20Sopenharmony_ci PHM_PlatformCaps_NoOD5Support, 728c2ecf20Sopenharmony_ci PHM_PlatformCaps_ContinuousHardwarePerformanceRange, 738c2ecf20Sopenharmony_ci PHM_PlatformCaps_ActivityReporting, 748c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableBackbias, 758c2ecf20Sopenharmony_ci PHM_PlatformCaps_OverdriveDisabledByPowerBudget, 768c2ecf20Sopenharmony_ci PHM_PlatformCaps_ShowPowerBudgetWarning, 778c2ecf20Sopenharmony_ci PHM_PlatformCaps_PowerBudgetWaiverAvailable, 788c2ecf20Sopenharmony_ci PHM_PlatformCaps_GFXClockGatingSupport, 798c2ecf20Sopenharmony_ci PHM_PlatformCaps_MMClockGatingSupport, 808c2ecf20Sopenharmony_ci PHM_PlatformCaps_AutomaticDCTransition, 818c2ecf20Sopenharmony_ci PHM_PlatformCaps_GeminiPrimary, 828c2ecf20Sopenharmony_ci PHM_PlatformCaps_MemorySpreadSpectrumSupport, 838c2ecf20Sopenharmony_ci PHM_PlatformCaps_EngineSpreadSpectrumSupport, 848c2ecf20Sopenharmony_ci PHM_PlatformCaps_StepVddc, 858c2ecf20Sopenharmony_ci PHM_PlatformCaps_DynamicPCIEGen2Support, 868c2ecf20Sopenharmony_ci PHM_PlatformCaps_SMC, 878c2ecf20Sopenharmony_ci PHM_PlatformCaps_FaultyInternalThermalReading, /* Internal thermal controller reports faulty temperature value when DAC2 is active */ 888c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableVoltageControl, /* indicates voltage can be controlled */ 898c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableSideportControl, /* indicates Sideport can be controlled */ 908c2ecf20Sopenharmony_ci PHM_PlatformCaps_VideoPlaybackEEUNotification, /* indicates EEU notification of video start/stop is required */ 918c2ecf20Sopenharmony_ci PHM_PlatformCaps_TurnOffPll_ASPML1, /* PCIE Turn Off PLL in ASPM L1 */ 928c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableHTLinkControl, /* indicates HT Link can be controlled by ACPI or CLMC overridden/automated mode. */ 938c2ecf20Sopenharmony_ci PHM_PlatformCaps_PerformanceStateOnly, /* indicates only performance power state to be used on current system. */ 948c2ecf20Sopenharmony_ci PHM_PlatformCaps_ExclusiveModeAlwaysHigh, /* In Exclusive (3D) mode always stay in High state. */ 958c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableMGClockGating, /* to disable Medium Grain Clock Gating or not */ 968c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableMGCGTSSM, /* TO disable Medium Grain Clock Gating Shader Complex control */ 978c2ecf20Sopenharmony_ci PHM_PlatformCaps_UVDAlwaysHigh, /* In UVD mode always stay in High state */ 988c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisablePowerGating, /* to disable power gating */ 998c2ecf20Sopenharmony_ci PHM_PlatformCaps_CustomThermalPolicy, /* indicates only performance power state to be used on current system. */ 1008c2ecf20Sopenharmony_ci PHM_PlatformCaps_StayInBootState, /* Stay in Boot State, do not do clock/voltage or PCIe Lane and Gen switching (RV7xx and up). */ 1018c2ecf20Sopenharmony_ci PHM_PlatformCaps_SMCAllowSeparateSWThermalState, /* SMC use separate SW thermal state, instead of the default SMC thermal policy. */ 1028c2ecf20Sopenharmony_ci PHM_PlatformCaps_MultiUVDStateSupport, /* Powerplay state table supports multi UVD states. */ 1038c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableSCLKDeepSleepForUVD, /* With HW ECOs, we don't need to disable SCLK Deep Sleep for UVD state. */ 1048c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableMCUHTLinkControl, /* Enable HT link control by MCU */ 1058c2ecf20Sopenharmony_ci PHM_PlatformCaps_ABM, /* ABM support.*/ 1068c2ecf20Sopenharmony_ci PHM_PlatformCaps_KongThermalPolicy, /* A thermal policy specific for Kong */ 1078c2ecf20Sopenharmony_ci PHM_PlatformCaps_SwitchVDDNB, /* if the users want to switch VDDNB */ 1088c2ecf20Sopenharmony_ci PHM_PlatformCaps_ULPS, /* support ULPS mode either through ACPI state or ULPS state */ 1098c2ecf20Sopenharmony_ci PHM_PlatformCaps_NativeULPS, /* hardware capable of ULPS state (other than through the ACPI state) */ 1108c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableMVDDControl, /* indicates that memory voltage can be controlled */ 1118c2ecf20Sopenharmony_ci PHM_PlatformCaps_ControlVDDCI, /* Control VDDCI separately from VDDC. */ 1128c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableDCODT, /* indicates if DC ODT apply or not */ 1138c2ecf20Sopenharmony_ci PHM_PlatformCaps_DynamicACTiming, /* if the SMC dynamically re-programs MC SEQ register values */ 1148c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableThermalIntByGPIO, /* enable throttle control through GPIO */ 1158c2ecf20Sopenharmony_ci PHM_PlatformCaps_BootStateOnAlert, /* Go to boot state on alerts, e.g. on an AC->DC transition. */ 1168c2ecf20Sopenharmony_ci PHM_PlatformCaps_DontWaitForVBlankOnAlert, /* Do NOT wait for VBLANK during an alert (e.g. AC->DC transition). */ 1178c2ecf20Sopenharmony_ci PHM_PlatformCaps_Force3DClockSupport, /* indicates if the platform supports force 3D clock. */ 1188c2ecf20Sopenharmony_ci PHM_PlatformCaps_MicrocodeFanControl, /* Fan is controlled by the SMC microcode. */ 1198c2ecf20Sopenharmony_ci PHM_PlatformCaps_AdjustUVDPriorityForSP, 1208c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableLightSleep, /* Light sleep for evergreen family. */ 1218c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableMCLS, /* MC Light sleep */ 1228c2ecf20Sopenharmony_ci PHM_PlatformCaps_RegulatorHot, /* Enable throttling on 'regulator hot' events. */ 1238c2ecf20Sopenharmony_ci PHM_PlatformCaps_BACO, /* Support Bus Alive Chip Off mode */ 1248c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableDPM, /* Disable DPM, supported from Llano */ 1258c2ecf20Sopenharmony_ci PHM_PlatformCaps_DynamicM3Arbiter, /* support dynamically change m3 arbitor parameters */ 1268c2ecf20Sopenharmony_ci PHM_PlatformCaps_SclkDeepSleep, /* support sclk deep sleep */ 1278c2ecf20Sopenharmony_ci PHM_PlatformCaps_DynamicPatchPowerState, /* this ASIC supports to patch power state dynamically */ 1288c2ecf20Sopenharmony_ci PHM_PlatformCaps_ThermalAutoThrottling, /* enabling auto thermal throttling, */ 1298c2ecf20Sopenharmony_ci PHM_PlatformCaps_SumoThermalPolicy, /* A thermal policy specific for Sumo */ 1308c2ecf20Sopenharmony_ci PHM_PlatformCaps_PCIEPerformanceRequest, /* support to change RC voltage */ 1318c2ecf20Sopenharmony_ci PHM_PlatformCaps_BLControlledByGPU, /* support varibright */ 1328c2ecf20Sopenharmony_ci PHM_PlatformCaps_PowerContainment, /* support DPM2 power containment (AKA TDP clamping) */ 1338c2ecf20Sopenharmony_ci PHM_PlatformCaps_SQRamping, /* support DPM2 SQ power throttle */ 1348c2ecf20Sopenharmony_ci PHM_PlatformCaps_CAC, /* support Capacitance * Activity power estimation */ 1358c2ecf20Sopenharmony_ci PHM_PlatformCaps_NIChipsets, /* Northern Island and beyond chipsets */ 1368c2ecf20Sopenharmony_ci PHM_PlatformCaps_TrinityChipsets, /* Trinity chipset */ 1378c2ecf20Sopenharmony_ci PHM_PlatformCaps_EvergreenChipsets, /* Evergreen family chipset */ 1388c2ecf20Sopenharmony_ci PHM_PlatformCaps_PowerControl, /* Cayman and beyond chipsets */ 1398c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableLSClockGating, /* to disable Light Sleep control for HDP memories */ 1408c2ecf20Sopenharmony_ci PHM_PlatformCaps_BoostState, /* this ASIC supports boost state */ 1418c2ecf20Sopenharmony_ci PHM_PlatformCaps_UserMaxClockForMultiDisplays, /* indicates if max memory clock is used for all status when multiple displays are connected */ 1428c2ecf20Sopenharmony_ci PHM_PlatformCaps_RegWriteDelay, /* indicates if back to back reg write delay is required */ 1438c2ecf20Sopenharmony_ci PHM_PlatformCaps_NonABMSupportInPPLib, /* ABM is not supported in PPLIB, (moved from PPLIB to DAL) */ 1448c2ecf20Sopenharmony_ci PHM_PlatformCaps_GFXDynamicMGPowerGating, /* Enable Dynamic MG PowerGating on Trinity */ 1458c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableSMUUVDHandshake, /* Disable SMU UVD Handshake */ 1468c2ecf20Sopenharmony_ci PHM_PlatformCaps_DTE, /* Support Digital Temperature Estimation */ 1478c2ecf20Sopenharmony_ci PHM_PlatformCaps_W5100Specifc_SmuSkipMsgDTE, /* This is for the feature requested by David B., and Tonny W.*/ 1488c2ecf20Sopenharmony_ci PHM_PlatformCaps_UVDPowerGating, /* enable UVD power gating, supported from Llano */ 1498c2ecf20Sopenharmony_ci PHM_PlatformCaps_UVDDynamicPowerGating, /* enable UVD Dynamic power gating, supported from UVD5 */ 1508c2ecf20Sopenharmony_ci PHM_PlatformCaps_VCEPowerGating, /* Enable VCE power gating, supported for TN and later ASICs */ 1518c2ecf20Sopenharmony_ci PHM_PlatformCaps_SamuPowerGating, /* Enable SAMU power gating, supported for KV and later ASICs */ 1528c2ecf20Sopenharmony_ci PHM_PlatformCaps_UVDDPM, /* UVD clock DPM */ 1538c2ecf20Sopenharmony_ci PHM_PlatformCaps_VCEDPM, /* VCE clock DPM */ 1548c2ecf20Sopenharmony_ci PHM_PlatformCaps_SamuDPM, /* SAMU clock DPM */ 1558c2ecf20Sopenharmony_ci PHM_PlatformCaps_AcpDPM, /* ACP clock DPM */ 1568c2ecf20Sopenharmony_ci PHM_PlatformCaps_SclkDeepSleepAboveLow, /* Enable SCLK Deep Sleep on all DPM states */ 1578c2ecf20Sopenharmony_ci PHM_PlatformCaps_DynamicUVDState, /* Dynamic UVD State */ 1588c2ecf20Sopenharmony_ci PHM_PlatformCaps_WantSAMClkWithDummyBackEnd, /* Set SAM Clk With Dummy Back End */ 1598c2ecf20Sopenharmony_ci PHM_PlatformCaps_WantUVDClkWithDummyBackEnd, /* Set UVD Clk With Dummy Back End */ 1608c2ecf20Sopenharmony_ci PHM_PlatformCaps_WantVCEClkWithDummyBackEnd, /* Set VCE Clk With Dummy Back End */ 1618c2ecf20Sopenharmony_ci PHM_PlatformCaps_WantACPClkWithDummyBackEnd, /* Set SAM Clk With Dummy Back End */ 1628c2ecf20Sopenharmony_ci PHM_PlatformCaps_OD6inACSupport, /* indicates that the ASIC/back end supports OD6 */ 1638c2ecf20Sopenharmony_ci PHM_PlatformCaps_OD6inDCSupport, /* indicates that the ASIC/back end supports OD6 in DC */ 1648c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnablePlatformPowerManagement, /* indicates that Platform Power Management feature is supported */ 1658c2ecf20Sopenharmony_ci PHM_PlatformCaps_SurpriseRemoval, /* indicates that surprise removal feature is requested */ 1668c2ecf20Sopenharmony_ci PHM_PlatformCaps_NewCACVoltage, /* indicates new CAC voltage table support */ 1678c2ecf20Sopenharmony_ci PHM_PlatformCaps_DiDtSupport, /* for dI/dT feature */ 1688c2ecf20Sopenharmony_ci PHM_PlatformCaps_DBRamping, /* for dI/dT feature */ 1698c2ecf20Sopenharmony_ci PHM_PlatformCaps_TDRamping, /* for dI/dT feature */ 1708c2ecf20Sopenharmony_ci PHM_PlatformCaps_TCPRamping, /* for dI/dT feature */ 1718c2ecf20Sopenharmony_ci PHM_PlatformCaps_DBRRamping, /* for dI/dT feature */ 1728c2ecf20Sopenharmony_ci PHM_PlatformCaps_DiDtEDCEnable, /* for dI/dT feature */ 1738c2ecf20Sopenharmony_ci PHM_PlatformCaps_GCEDC, /* for dI/dT feature */ 1748c2ecf20Sopenharmony_ci PHM_PlatformCaps_PSM, /* for dI/dT feature */ 1758c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableSMU7ThermalManagement, /* SMC will manage thermal events */ 1768c2ecf20Sopenharmony_ci PHM_PlatformCaps_FPS, /* FPS support */ 1778c2ecf20Sopenharmony_ci PHM_PlatformCaps_ACP, /* ACP support */ 1788c2ecf20Sopenharmony_ci PHM_PlatformCaps_SclkThrottleLowNotification, /* SCLK Throttle Low Notification */ 1798c2ecf20Sopenharmony_ci PHM_PlatformCaps_XDMAEnabled, /* XDMA engine is enabled */ 1808c2ecf20Sopenharmony_ci PHM_PlatformCaps_UseDummyBackEnd, /* use dummy back end */ 1818c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableDFSBypass, /* Enable DFS bypass */ 1828c2ecf20Sopenharmony_ci PHM_PlatformCaps_VddNBDirectRequest, 1838c2ecf20Sopenharmony_ci PHM_PlatformCaps_PauseMMSessions, 1848c2ecf20Sopenharmony_ci PHM_PlatformCaps_UnTabledHardwareInterface, /* Tableless/direct call hardware interface for CI and newer ASICs */ 1858c2ecf20Sopenharmony_ci PHM_PlatformCaps_SMU7, /* indicates that vpuRecoveryBegin without SMU shutdown */ 1868c2ecf20Sopenharmony_ci PHM_PlatformCaps_RevertGPIO5Polarity, /* indicates revert GPIO5 plarity table support */ 1878c2ecf20Sopenharmony_ci PHM_PlatformCaps_Thermal2GPIO17, /* indicates thermal2GPIO17 table support */ 1888c2ecf20Sopenharmony_ci PHM_PlatformCaps_ThermalOutGPIO, /* indicates ThermalOutGPIO support, pin number is assigned by VBIOS */ 1898c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableMclkSwitchingForFrameLock, /* Disable memory clock switch during Framelock */ 1908c2ecf20Sopenharmony_ci PHM_PlatformCaps_ForceMclkHigh, /* Disable memory clock switching by forcing memory clock high */ 1918c2ecf20Sopenharmony_ci PHM_PlatformCaps_VRHotGPIOConfigurable, /* indicates VR_HOT GPIO configurable */ 1928c2ecf20Sopenharmony_ci PHM_PlatformCaps_TempInversion, /* enable Temp Inversion feature */ 1938c2ecf20Sopenharmony_ci PHM_PlatformCaps_IOIC3, 1948c2ecf20Sopenharmony_ci PHM_PlatformCaps_ConnectedStandby, 1958c2ecf20Sopenharmony_ci PHM_PlatformCaps_EVV, 1968c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableLongIdleBACOSupport, 1978c2ecf20Sopenharmony_ci PHM_PlatformCaps_CombinePCCWithThermalSignal, 1988c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableUsingActualTemperatureForPowerCalc, 1998c2ecf20Sopenharmony_ci PHM_PlatformCaps_StablePState, 2008c2ecf20Sopenharmony_ci PHM_PlatformCaps_OD6PlusinACSupport, 2018c2ecf20Sopenharmony_ci PHM_PlatformCaps_OD6PlusinDCSupport, 2028c2ecf20Sopenharmony_ci PHM_PlatformCaps_ODThermalLimitUnlock, 2038c2ecf20Sopenharmony_ci PHM_PlatformCaps_ReducePowerLimit, 2048c2ecf20Sopenharmony_ci PHM_PlatformCaps_ODFuzzyFanControlSupport, 2058c2ecf20Sopenharmony_ci PHM_PlatformCaps_GeminiRegulatorFanControlSupport, 2068c2ecf20Sopenharmony_ci PHM_PlatformCaps_ControlVDDGFX, 2078c2ecf20Sopenharmony_ci PHM_PlatformCaps_BBBSupported, 2088c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableVoltageIsland, 2098c2ecf20Sopenharmony_ci PHM_PlatformCaps_FanSpeedInTableIsRPM, 2108c2ecf20Sopenharmony_ci PHM_PlatformCaps_GFXClockGatingManagedInCAIL, 2118c2ecf20Sopenharmony_ci PHM_PlatformCaps_IcelandULPSSWWorkAround, 2128c2ecf20Sopenharmony_ci PHM_PlatformCaps_FPSEnhancement, 2138c2ecf20Sopenharmony_ci PHM_PlatformCaps_LoadPostProductionFirmware, 2148c2ecf20Sopenharmony_ci PHM_PlatformCaps_VpuRecoveryInProgress, 2158c2ecf20Sopenharmony_ci PHM_PlatformCaps_Falcon_QuickTransition, 2168c2ecf20Sopenharmony_ci PHM_PlatformCaps_AVFS, 2178c2ecf20Sopenharmony_ci PHM_PlatformCaps_ClockStretcher, 2188c2ecf20Sopenharmony_ci PHM_PlatformCaps_TablelessHardwareInterface, 2198c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableDriverEVV, 2208c2ecf20Sopenharmony_ci PHM_PlatformCaps_SPLLShutdownSupport, 2218c2ecf20Sopenharmony_ci PHM_PlatformCaps_VirtualBatteryState, 2228c2ecf20Sopenharmony_ci PHM_PlatformCaps_IgnoreForceHighClockRequestsInAPUs, 2238c2ecf20Sopenharmony_ci PHM_PlatformCaps_DisableMclkSwitchForVR, 2248c2ecf20Sopenharmony_ci PHM_PlatformCaps_SMU8, 2258c2ecf20Sopenharmony_ci PHM_PlatformCaps_VRHotPolarityHigh, 2268c2ecf20Sopenharmony_ci PHM_PlatformCaps_IPS_UlpsExclusive, 2278c2ecf20Sopenharmony_ci PHM_PlatformCaps_SMCtoPPLIBAcdcGpioScheme, 2288c2ecf20Sopenharmony_ci PHM_PlatformCaps_GeminiAsymmetricPower, 2298c2ecf20Sopenharmony_ci PHM_PlatformCaps_OCLPowerOptimization, 2308c2ecf20Sopenharmony_ci PHM_PlatformCaps_MaxPCIEBandWidth, 2318c2ecf20Sopenharmony_ci PHM_PlatformCaps_PerfPerWattOptimizationSupport, 2328c2ecf20Sopenharmony_ci PHM_PlatformCaps_UVDClientMCTuning, 2338c2ecf20Sopenharmony_ci PHM_PlatformCaps_ODNinACSupport, 2348c2ecf20Sopenharmony_ci PHM_PlatformCaps_ODNinDCSupport, 2358c2ecf20Sopenharmony_ci PHM_PlatformCaps_OD8inACSupport, 2368c2ecf20Sopenharmony_ci PHM_PlatformCaps_OD8inDCSupport, 2378c2ecf20Sopenharmony_ci PHM_PlatformCaps_UMDPState, 2388c2ecf20Sopenharmony_ci PHM_PlatformCaps_AutoWattmanSupport, 2398c2ecf20Sopenharmony_ci PHM_PlatformCaps_AutoWattmanEnable_CCCState, 2408c2ecf20Sopenharmony_ci PHM_PlatformCaps_FreeSyncActive, 2418c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableShadowPstate, 2428c2ecf20Sopenharmony_ci PHM_PlatformCaps_customThermalManagement, 2438c2ecf20Sopenharmony_ci PHM_PlatformCaps_staticFanControl, 2448c2ecf20Sopenharmony_ci PHM_PlatformCaps_Virtual_System, 2458c2ecf20Sopenharmony_ci PHM_PlatformCaps_LowestUclkReservedForUlv, 2468c2ecf20Sopenharmony_ci PHM_PlatformCaps_EnableBoostState, 2478c2ecf20Sopenharmony_ci PHM_PlatformCaps_AVFSSupport, 2488c2ecf20Sopenharmony_ci PHM_PlatformCaps_ThermalPolicyDelay, 2498c2ecf20Sopenharmony_ci PHM_PlatformCaps_CustomFanControlSupport, 2508c2ecf20Sopenharmony_ci PHM_PlatformCaps_BAMACO, 2518c2ecf20Sopenharmony_ci PHM_PlatformCaps_Max 2528c2ecf20Sopenharmony_ci}; 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci#define PHM_MAX_NUM_CAPS_BITS_PER_FIELD (sizeof(uint32_t)*8) 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci/* Number of uint32_t entries used by CAPS table */ 2578c2ecf20Sopenharmony_ci#define PHM_MAX_NUM_CAPS_ULONG_ENTRIES \ 2588c2ecf20Sopenharmony_ci ((PHM_PlatformCaps_Max + ((PHM_MAX_NUM_CAPS_BITS_PER_FIELD) - 1)) / (PHM_MAX_NUM_CAPS_BITS_PER_FIELD)) 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_cistruct pp_hw_descriptor { 2618c2ecf20Sopenharmony_ci uint32_t hw_caps[PHM_MAX_NUM_CAPS_ULONG_ENTRIES]; 2628c2ecf20Sopenharmony_ci}; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_cienum PHM_PerformanceLevelDesignation { 2658c2ecf20Sopenharmony_ci PHM_PerformanceLevelDesignation_Activity, 2668c2ecf20Sopenharmony_ci PHM_PerformanceLevelDesignation_PowerContainment 2678c2ecf20Sopenharmony_ci}; 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_citypedef enum PHM_PerformanceLevelDesignation PHM_PerformanceLevelDesignation; 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_cistruct PHM_PerformanceLevel { 2728c2ecf20Sopenharmony_ci uint32_t coreClock; 2738c2ecf20Sopenharmony_ci uint32_t memory_clock; 2748c2ecf20Sopenharmony_ci uint32_t vddc; 2758c2ecf20Sopenharmony_ci uint32_t vddci; 2768c2ecf20Sopenharmony_ci uint32_t nonLocalMemoryFreq; 2778c2ecf20Sopenharmony_ci uint32_t nonLocalMemoryWidth; 2788c2ecf20Sopenharmony_ci}; 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_citypedef struct PHM_PerformanceLevel PHM_PerformanceLevel; 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci/* Function for setting a platform cap */ 2838c2ecf20Sopenharmony_cistatic inline void phm_cap_set(uint32_t *caps, 2848c2ecf20Sopenharmony_ci enum phm_platform_caps c) 2858c2ecf20Sopenharmony_ci{ 2868c2ecf20Sopenharmony_ci caps[c / PHM_MAX_NUM_CAPS_BITS_PER_FIELD] |= (1UL << 2878c2ecf20Sopenharmony_ci (c & (PHM_MAX_NUM_CAPS_BITS_PER_FIELD - 1))); 2888c2ecf20Sopenharmony_ci} 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_cistatic inline void phm_cap_unset(uint32_t *caps, 2918c2ecf20Sopenharmony_ci enum phm_platform_caps c) 2928c2ecf20Sopenharmony_ci{ 2938c2ecf20Sopenharmony_ci caps[c / PHM_MAX_NUM_CAPS_BITS_PER_FIELD] &= ~(1UL << (c & (PHM_MAX_NUM_CAPS_BITS_PER_FIELD - 1))); 2948c2ecf20Sopenharmony_ci} 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_cistatic inline bool phm_cap_enabled(const uint32_t *caps, enum phm_platform_caps c) 2978c2ecf20Sopenharmony_ci{ 2988c2ecf20Sopenharmony_ci return (0 != (caps[c / PHM_MAX_NUM_CAPS_BITS_PER_FIELD] & 2998c2ecf20Sopenharmony_ci (1UL << (c & (PHM_MAX_NUM_CAPS_BITS_PER_FIELD - 1))))); 3008c2ecf20Sopenharmony_ci} 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci#define PP_CAP(c) phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, (c)) 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci#define PP_PCIEGenInvalid 0xffff 3058c2ecf20Sopenharmony_cienum PP_PCIEGen { 3068c2ecf20Sopenharmony_ci PP_PCIEGen1 = 0, /* PCIE 1.0 - Transfer rate of 2.5 GT/s */ 3078c2ecf20Sopenharmony_ci PP_PCIEGen2, /*PCIE 2.0 - Transfer rate of 5.0 GT/s */ 3088c2ecf20Sopenharmony_ci PP_PCIEGen3 /*PCIE 3.0 - Transfer rate of 8.0 GT/s */ 3098c2ecf20Sopenharmony_ci}; 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_citypedef enum PP_PCIEGen PP_PCIEGen; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci#define PP_Min_PCIEGen PP_PCIEGen1 3148c2ecf20Sopenharmony_ci#define PP_Max_PCIEGen PP_PCIEGen3 3158c2ecf20Sopenharmony_ci#define PP_Min_PCIELane 1 3168c2ecf20Sopenharmony_ci#define PP_Max_PCIELane 16 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cienum phm_clock_Type { 3198c2ecf20Sopenharmony_ci PHM_DispClock = 1, 3208c2ecf20Sopenharmony_ci PHM_SClock, 3218c2ecf20Sopenharmony_ci PHM_MemClock 3228c2ecf20Sopenharmony_ci}; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci#define MAX_NUM_CLOCKS 16 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_cistruct PP_Clocks { 3278c2ecf20Sopenharmony_ci uint32_t engineClock; 3288c2ecf20Sopenharmony_ci uint32_t memoryClock; 3298c2ecf20Sopenharmony_ci uint32_t BusBandwidth; 3308c2ecf20Sopenharmony_ci uint32_t engineClockInSR; 3318c2ecf20Sopenharmony_ci uint32_t dcefClock; 3328c2ecf20Sopenharmony_ci uint32_t dcefClockInSR; 3338c2ecf20Sopenharmony_ci}; 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_cistruct pp_clock_info { 3368c2ecf20Sopenharmony_ci uint32_t min_mem_clk; 3378c2ecf20Sopenharmony_ci uint32_t max_mem_clk; 3388c2ecf20Sopenharmony_ci uint32_t min_eng_clk; 3398c2ecf20Sopenharmony_ci uint32_t max_eng_clk; 3408c2ecf20Sopenharmony_ci uint32_t min_bus_bandwidth; 3418c2ecf20Sopenharmony_ci uint32_t max_bus_bandwidth; 3428c2ecf20Sopenharmony_ci}; 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_cistruct phm_platform_descriptor { 3458c2ecf20Sopenharmony_ci uint32_t platformCaps[PHM_MAX_NUM_CAPS_ULONG_ENTRIES]; 3468c2ecf20Sopenharmony_ci uint32_t vbiosInterruptId; 3478c2ecf20Sopenharmony_ci struct PP_Clocks overdriveLimit; 3488c2ecf20Sopenharmony_ci struct PP_Clocks clockStep; 3498c2ecf20Sopenharmony_ci uint32_t hardwareActivityPerformanceLevels; 3508c2ecf20Sopenharmony_ci uint32_t minimumClocksReductionPercentage; 3518c2ecf20Sopenharmony_ci uint32_t minOverdriveVDDC; 3528c2ecf20Sopenharmony_ci uint32_t maxOverdriveVDDC; 3538c2ecf20Sopenharmony_ci uint32_t overdriveVDDCStep; 3548c2ecf20Sopenharmony_ci uint32_t hardwarePerformanceLevels; 3558c2ecf20Sopenharmony_ci uint16_t powerBudget; 3568c2ecf20Sopenharmony_ci uint32_t TDPLimit; 3578c2ecf20Sopenharmony_ci uint32_t nearTDPLimit; 3588c2ecf20Sopenharmony_ci uint32_t nearTDPLimitAdjusted; 3598c2ecf20Sopenharmony_ci uint32_t SQRampingThreshold; 3608c2ecf20Sopenharmony_ci uint32_t CACLeakage; 3618c2ecf20Sopenharmony_ci uint16_t TDPODLimit; 3628c2ecf20Sopenharmony_ci uint32_t TDPAdjustment; 3638c2ecf20Sopenharmony_ci bool TDPAdjustmentPolarity; 3648c2ecf20Sopenharmony_ci uint16_t LoadLineSlope; 3658c2ecf20Sopenharmony_ci uint32_t VidMinLimit; 3668c2ecf20Sopenharmony_ci uint32_t VidMaxLimit; 3678c2ecf20Sopenharmony_ci uint32_t VidStep; 3688c2ecf20Sopenharmony_ci uint32_t VidAdjustment; 3698c2ecf20Sopenharmony_ci bool VidAdjustmentPolarity; 3708c2ecf20Sopenharmony_ci}; 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_cistruct phm_clocks { 3738c2ecf20Sopenharmony_ci uint32_t num_of_entries; 3748c2ecf20Sopenharmony_ci uint32_t clock[MAX_NUM_CLOCKS]; 3758c2ecf20Sopenharmony_ci}; 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci#define DPMTABLE_OD_UPDATE_SCLK 0x00000001 3788c2ecf20Sopenharmony_ci#define DPMTABLE_OD_UPDATE_MCLK 0x00000002 3798c2ecf20Sopenharmony_ci#define DPMTABLE_UPDATE_SCLK 0x00000004 3808c2ecf20Sopenharmony_ci#define DPMTABLE_UPDATE_MCLK 0x00000008 3818c2ecf20Sopenharmony_ci#define DPMTABLE_OD_UPDATE_VDDC 0x00000010 3828c2ecf20Sopenharmony_ci#define DPMTABLE_UPDATE_SOCCLK 0x00000020 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_cistruct phm_odn_performance_level { 3858c2ecf20Sopenharmony_ci uint32_t clock; 3868c2ecf20Sopenharmony_ci uint32_t vddc; 3878c2ecf20Sopenharmony_ci bool enabled; 3888c2ecf20Sopenharmony_ci}; 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_cistruct phm_odn_clock_levels { 3918c2ecf20Sopenharmony_ci uint32_t size; 3928c2ecf20Sopenharmony_ci uint32_t options; 3938c2ecf20Sopenharmony_ci uint32_t flags; 3948c2ecf20Sopenharmony_ci uint32_t num_of_pl; 3958c2ecf20Sopenharmony_ci /* variable-sized array, specify by num_of_pl. */ 3968c2ecf20Sopenharmony_ci struct phm_odn_performance_level entries[8]; 3978c2ecf20Sopenharmony_ci}; 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_ciextern int phm_disable_clock_power_gatings(struct pp_hwmgr *hwmgr); 4008c2ecf20Sopenharmony_ciextern int phm_powerdown_uvd(struct pp_hwmgr *hwmgr); 4018c2ecf20Sopenharmony_ciextern int phm_setup_asic(struct pp_hwmgr *hwmgr); 4028c2ecf20Sopenharmony_ciextern int phm_enable_dynamic_state_management(struct pp_hwmgr *hwmgr); 4038c2ecf20Sopenharmony_ciextern int phm_disable_dynamic_state_management(struct pp_hwmgr *hwmgr); 4048c2ecf20Sopenharmony_ciextern bool phm_is_hw_access_blocked(struct pp_hwmgr *hwmgr); 4058c2ecf20Sopenharmony_ciextern int phm_block_hw_access(struct pp_hwmgr *hwmgr, bool block); 4068c2ecf20Sopenharmony_ciextern int phm_set_power_state(struct pp_hwmgr *hwmgr, 4078c2ecf20Sopenharmony_ci const struct pp_hw_power_state *pcurrent_state, 4088c2ecf20Sopenharmony_ci const struct pp_hw_power_state *pnew_power_state); 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ciextern int phm_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, 4118c2ecf20Sopenharmony_ci struct pp_power_state *adjusted_ps, 4128c2ecf20Sopenharmony_ci const struct pp_power_state *current_ps); 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_ciextern int phm_apply_clock_adjust_rules(struct pp_hwmgr *hwmgr); 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ciextern int phm_force_dpm_levels(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_level level); 4178c2ecf20Sopenharmony_ciextern int phm_pre_display_configuration_changed(struct pp_hwmgr *hwmgr); 4188c2ecf20Sopenharmony_ciextern int phm_display_configuration_changed(struct pp_hwmgr *hwmgr); 4198c2ecf20Sopenharmony_ciextern int phm_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr); 4208c2ecf20Sopenharmony_ciextern int phm_register_irq_handlers(struct pp_hwmgr *hwmgr); 4218c2ecf20Sopenharmony_ciextern int phm_start_thermal_controller(struct pp_hwmgr *hwmgr); 4228c2ecf20Sopenharmony_ciextern int phm_stop_thermal_controller(struct pp_hwmgr *hwmgr); 4238c2ecf20Sopenharmony_ciextern bool phm_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr); 4248c2ecf20Sopenharmony_ci 4258c2ecf20Sopenharmony_ciextern int phm_check_states_equal(struct pp_hwmgr *hwmgr, 4268c2ecf20Sopenharmony_ci const struct pp_hw_power_state *pstate1, 4278c2ecf20Sopenharmony_ci const struct pp_hw_power_state *pstate2, 4288c2ecf20Sopenharmony_ci bool *equal); 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_ciextern int phm_store_dal_configuration_data(struct pp_hwmgr *hwmgr, 4318c2ecf20Sopenharmony_ci const struct amd_pp_display_configuration *display_config); 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_ciextern int phm_get_dal_power_level(struct pp_hwmgr *hwmgr, 4348c2ecf20Sopenharmony_ci struct amd_pp_simple_clock_info *info); 4358c2ecf20Sopenharmony_ci 4368c2ecf20Sopenharmony_ciextern int phm_set_cpu_power_state(struct pp_hwmgr *hwmgr); 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ciextern int phm_power_down_asic(struct pp_hwmgr *hwmgr); 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ciextern int phm_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *state, 4418c2ecf20Sopenharmony_ci PHM_PerformanceLevelDesignation designation, uint32_t index, 4428c2ecf20Sopenharmony_ci PHM_PerformanceLevel *level); 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_ciextern int phm_get_clock_info(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *state, 4458c2ecf20Sopenharmony_ci struct pp_clock_info *pclock_info, 4468c2ecf20Sopenharmony_ci PHM_PerformanceLevelDesignation designation); 4478c2ecf20Sopenharmony_ci 4488c2ecf20Sopenharmony_ciextern int phm_get_current_shallow_sleep_clocks(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *state, struct pp_clock_info *clock_info); 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_ciextern int phm_get_clock_by_type(struct pp_hwmgr *hwmgr, enum amd_pp_clock_type type, struct amd_pp_clocks *clocks); 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ciextern int phm_get_clock_by_type_with_latency(struct pp_hwmgr *hwmgr, 4538c2ecf20Sopenharmony_ci enum amd_pp_clock_type type, 4548c2ecf20Sopenharmony_ci struct pp_clock_levels_with_latency *clocks); 4558c2ecf20Sopenharmony_ciextern int phm_get_clock_by_type_with_voltage(struct pp_hwmgr *hwmgr, 4568c2ecf20Sopenharmony_ci enum amd_pp_clock_type type, 4578c2ecf20Sopenharmony_ci struct pp_clock_levels_with_voltage *clocks); 4588c2ecf20Sopenharmony_ciextern int phm_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, 4598c2ecf20Sopenharmony_ci void *clock_ranges); 4608c2ecf20Sopenharmony_ciextern int phm_display_clock_voltage_request(struct pp_hwmgr *hwmgr, 4618c2ecf20Sopenharmony_ci struct pp_display_clock_request *clock); 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ciextern int phm_get_max_high_clocks(struct pp_hwmgr *hwmgr, struct amd_pp_simple_clock_info *clocks); 4648c2ecf20Sopenharmony_ciextern int phm_disable_smc_firmware_ctf(struct pp_hwmgr *hwmgr); 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ciextern int phm_set_active_display_count(struct pp_hwmgr *hwmgr, uint32_t count); 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci#endif /* _HARDWARE_MANAGER_H_ */ 4698c2ecf20Sopenharmony_ci 470