Home | History | Annotate | Line # | Download | only in inc
      1  1.1  riastrad /*	$NetBSD: hardwaremanager.h,v 1.2 2021/12/18 23:45:26 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright 2015 Advanced Micro Devices, Inc.
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice shall be included in
     14  1.1  riastrad  * all copies or substantial portions of the Software.
     15  1.1  riastrad  *
     16  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  1.1  riastrad  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  1.1  riastrad  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  1.1  riastrad  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  1.1  riastrad  * OTHER DEALINGS IN THE SOFTWARE.
     23  1.1  riastrad  *
     24  1.1  riastrad  */
     25  1.1  riastrad #ifndef _HARDWARE_MANAGER_H_
     26  1.1  riastrad #define _HARDWARE_MANAGER_H_
     27  1.1  riastrad 
     28  1.1  riastrad 
     29  1.1  riastrad 
     30  1.1  riastrad struct pp_hwmgr;
     31  1.1  riastrad struct pp_hw_power_state;
     32  1.1  riastrad struct pp_power_state;
     33  1.1  riastrad enum amd_dpm_forced_level;
     34  1.1  riastrad struct PP_TemperatureRange;
     35  1.1  riastrad 
     36  1.1  riastrad 
     37  1.1  riastrad struct phm_fan_speed_info {
     38  1.1  riastrad 	uint32_t min_percent;
     39  1.1  riastrad 	uint32_t max_percent;
     40  1.1  riastrad 	uint32_t min_rpm;
     41  1.1  riastrad 	uint32_t max_rpm;
     42  1.1  riastrad 	bool supports_percent_read;
     43  1.1  riastrad 	bool supports_percent_write;
     44  1.1  riastrad 	bool supports_rpm_read;
     45  1.1  riastrad 	bool supports_rpm_write;
     46  1.1  riastrad };
     47  1.1  riastrad 
     48  1.1  riastrad /* Automatic Power State Throttling */
     49  1.1  riastrad enum PHM_AutoThrottleSource
     50  1.1  riastrad {
     51  1.1  riastrad     PHM_AutoThrottleSource_Thermal,
     52  1.1  riastrad     PHM_AutoThrottleSource_External
     53  1.1  riastrad };
     54  1.1  riastrad 
     55  1.1  riastrad typedef enum PHM_AutoThrottleSource PHM_AutoThrottleSource;
     56  1.1  riastrad 
     57  1.1  riastrad enum phm_platform_caps {
     58  1.1  riastrad 	PHM_PlatformCaps_AtomBiosPpV1 = 0,
     59  1.1  riastrad 	PHM_PlatformCaps_PowerPlaySupport,
     60  1.1  riastrad 	PHM_PlatformCaps_ACOverdriveSupport,
     61  1.1  riastrad 	PHM_PlatformCaps_BacklightSupport,
     62  1.1  riastrad 	PHM_PlatformCaps_ThermalController,
     63  1.1  riastrad 	PHM_PlatformCaps_BiosPowerSourceControl,
     64  1.1  riastrad 	PHM_PlatformCaps_DisableVoltageTransition,
     65  1.1  riastrad 	PHM_PlatformCaps_DisableEngineTransition,
     66  1.1  riastrad 	PHM_PlatformCaps_DisableMemoryTransition,
     67  1.1  riastrad 	PHM_PlatformCaps_DynamicPowerManagement,
     68  1.1  riastrad 	PHM_PlatformCaps_EnableASPML0s,
     69  1.1  riastrad 	PHM_PlatformCaps_EnableASPML1,
     70  1.1  riastrad 	PHM_PlatformCaps_OD5inACSupport,
     71  1.1  riastrad 	PHM_PlatformCaps_OD5inDCSupport,
     72  1.1  riastrad 	PHM_PlatformCaps_SoftStateOD5,
     73  1.1  riastrad 	PHM_PlatformCaps_NoOD5Support,
     74  1.1  riastrad 	PHM_PlatformCaps_ContinuousHardwarePerformanceRange,
     75  1.1  riastrad 	PHM_PlatformCaps_ActivityReporting,
     76  1.1  riastrad 	PHM_PlatformCaps_EnableBackbias,
     77  1.1  riastrad 	PHM_PlatformCaps_OverdriveDisabledByPowerBudget,
     78  1.1  riastrad 	PHM_PlatformCaps_ShowPowerBudgetWarning,
     79  1.1  riastrad 	PHM_PlatformCaps_PowerBudgetWaiverAvailable,
     80  1.1  riastrad 	PHM_PlatformCaps_GFXClockGatingSupport,
     81  1.1  riastrad 	PHM_PlatformCaps_MMClockGatingSupport,
     82  1.1  riastrad 	PHM_PlatformCaps_AutomaticDCTransition,
     83  1.1  riastrad 	PHM_PlatformCaps_GeminiPrimary,
     84  1.1  riastrad 	PHM_PlatformCaps_MemorySpreadSpectrumSupport,
     85  1.1  riastrad 	PHM_PlatformCaps_EngineSpreadSpectrumSupport,
     86  1.1  riastrad 	PHM_PlatformCaps_StepVddc,
     87  1.1  riastrad 	PHM_PlatformCaps_DynamicPCIEGen2Support,
     88  1.1  riastrad 	PHM_PlatformCaps_SMC,
     89  1.1  riastrad 	PHM_PlatformCaps_FaultyInternalThermalReading,          /* Internal thermal controller reports faulty temperature value when DAC2 is active */
     90  1.1  riastrad 	PHM_PlatformCaps_EnableVoltageControl,                  /* indicates voltage can be controlled */
     91  1.1  riastrad 	PHM_PlatformCaps_EnableSideportControl,                 /* indicates Sideport can be controlled */
     92  1.1  riastrad 	PHM_PlatformCaps_VideoPlaybackEEUNotification,          /* indicates EEU notification of video start/stop is required */
     93  1.1  riastrad 	PHM_PlatformCaps_TurnOffPll_ASPML1,                     /* PCIE Turn Off PLL in ASPM L1 */
     94  1.1  riastrad 	PHM_PlatformCaps_EnableHTLinkControl,                   /* indicates HT Link can be controlled by ACPI or CLMC overridden/automated mode. */
     95  1.1  riastrad 	PHM_PlatformCaps_PerformanceStateOnly,                  /* indicates only performance power state to be used on current system. */
     96  1.1  riastrad 	PHM_PlatformCaps_ExclusiveModeAlwaysHigh,               /* In Exclusive (3D) mode always stay in High state. */
     97  1.1  riastrad 	PHM_PlatformCaps_DisableMGClockGating,                  /* to disable Medium Grain Clock Gating or not */
     98  1.1  riastrad 	PHM_PlatformCaps_DisableMGCGTSSM,                       /* TO disable Medium Grain Clock Gating Shader Complex control */
     99  1.1  riastrad 	PHM_PlatformCaps_UVDAlwaysHigh,                         /* In UVD mode always stay in High state */
    100  1.1  riastrad 	PHM_PlatformCaps_DisablePowerGating,                    /* to disable power gating */
    101  1.1  riastrad 	PHM_PlatformCaps_CustomThermalPolicy,                   /* indicates only performance power state to be used on current system. */
    102  1.1  riastrad 	PHM_PlatformCaps_StayInBootState,                       /* Stay in Boot State, do not do clock/voltage or PCIe Lane and Gen switching (RV7xx and up). */
    103  1.1  riastrad 	PHM_PlatformCaps_SMCAllowSeparateSWThermalState,        /* SMC use separate SW thermal state, instead of the default SMC thermal policy. */
    104  1.1  riastrad 	PHM_PlatformCaps_MultiUVDStateSupport,                  /* Powerplay state table supports multi UVD states. */
    105  1.1  riastrad 	PHM_PlatformCaps_EnableSCLKDeepSleepForUVD,             /* With HW ECOs, we don't need to disable SCLK Deep Sleep for UVD state. */
    106  1.1  riastrad 	PHM_PlatformCaps_EnableMCUHTLinkControl,                /* Enable HT link control by MCU */
    107  1.1  riastrad 	PHM_PlatformCaps_ABM,                                   /* ABM support.*/
    108  1.1  riastrad 	PHM_PlatformCaps_KongThermalPolicy,                     /* A thermal policy specific for Kong */
    109  1.1  riastrad 	PHM_PlatformCaps_SwitchVDDNB,                           /* if the users want to switch VDDNB */
    110  1.1  riastrad 	PHM_PlatformCaps_ULPS,                                  /* support ULPS mode either through ACPI state or ULPS state */
    111  1.1  riastrad 	PHM_PlatformCaps_NativeULPS,                            /* hardware capable of ULPS state (other than through the ACPI state) */
    112  1.1  riastrad 	PHM_PlatformCaps_EnableMVDDControl,                     /* indicates that memory voltage can be controlled */
    113  1.1  riastrad 	PHM_PlatformCaps_ControlVDDCI,                          /* Control VDDCI separately from VDDC. */
    114  1.1  riastrad 	PHM_PlatformCaps_DisableDCODT,                          /* indicates if DC ODT apply or not */
    115  1.1  riastrad 	PHM_PlatformCaps_DynamicACTiming,                       /* if the SMC dynamically re-programs MC SEQ register values */
    116  1.1  riastrad 	PHM_PlatformCaps_EnableThermalIntByGPIO,                /* enable throttle control through GPIO */
    117  1.1  riastrad 	PHM_PlatformCaps_BootStateOnAlert,                      /* Go to boot state on alerts, e.g. on an AC->DC transition. */
    118  1.1  riastrad 	PHM_PlatformCaps_DontWaitForVBlankOnAlert,              /* Do NOT wait for VBLANK during an alert (e.g. AC->DC transition). */
    119  1.1  riastrad 	PHM_PlatformCaps_Force3DClockSupport,                   /* indicates if the platform supports force 3D clock. */
    120  1.1  riastrad 	PHM_PlatformCaps_MicrocodeFanControl,                   /* Fan is controlled by the SMC microcode. */
    121  1.1  riastrad 	PHM_PlatformCaps_AdjustUVDPriorityForSP,
    122  1.1  riastrad 	PHM_PlatformCaps_DisableLightSleep,                     /* Light sleep for evergreen family. */
    123  1.1  riastrad 	PHM_PlatformCaps_DisableMCLS,                           /* MC Light sleep */
    124  1.1  riastrad 	PHM_PlatformCaps_RegulatorHot,                          /* Enable throttling on 'regulator hot' events. */
    125  1.1  riastrad 	PHM_PlatformCaps_BACO,                                  /* Support Bus Alive Chip Off mode */
    126  1.1  riastrad 	PHM_PlatformCaps_DisableDPM,                            /* Disable DPM, supported from Llano */
    127  1.1  riastrad 	PHM_PlatformCaps_DynamicM3Arbiter,                      /* support dynamically change m3 arbitor parameters */
    128  1.1  riastrad 	PHM_PlatformCaps_SclkDeepSleep,                         /* support sclk deep sleep */
    129  1.1  riastrad 	PHM_PlatformCaps_DynamicPatchPowerState,                /* this ASIC supports to patch power state dynamically */
    130  1.1  riastrad 	PHM_PlatformCaps_ThermalAutoThrottling,                 /* enabling auto thermal throttling, */
    131  1.1  riastrad 	PHM_PlatformCaps_SumoThermalPolicy,                     /* A thermal policy specific for Sumo */
    132  1.1  riastrad 	PHM_PlatformCaps_PCIEPerformanceRequest,                /* support to change RC voltage */
    133  1.1  riastrad 	PHM_PlatformCaps_BLControlledByGPU,                     /* support varibright */
    134  1.1  riastrad 	PHM_PlatformCaps_PowerContainment,                      /* support DPM2 power containment (AKA TDP clamping) */
    135  1.1  riastrad 	PHM_PlatformCaps_SQRamping,                             /* support DPM2 SQ power throttle */
    136  1.1  riastrad 	PHM_PlatformCaps_CAC,                                   /* support Capacitance * Activity power estimation */
    137  1.1  riastrad 	PHM_PlatformCaps_NIChipsets,                            /* Northern Island and beyond chipsets */
    138  1.1  riastrad 	PHM_PlatformCaps_TrinityChipsets,                       /* Trinity chipset */
    139  1.1  riastrad 	PHM_PlatformCaps_EvergreenChipsets,                     /* Evergreen family chipset */
    140  1.1  riastrad 	PHM_PlatformCaps_PowerControl,                          /* Cayman and beyond chipsets */
    141  1.1  riastrad 	PHM_PlatformCaps_DisableLSClockGating,                  /* to disable Light Sleep control for HDP memories */
    142  1.1  riastrad 	PHM_PlatformCaps_BoostState,                            /* this ASIC supports boost state */
    143  1.1  riastrad 	PHM_PlatformCaps_UserMaxClockForMultiDisplays,          /* indicates if max memory clock is used for all status when multiple displays are connected */
    144  1.1  riastrad 	PHM_PlatformCaps_RegWriteDelay,                         /* indicates if back to back reg write delay is required */
    145  1.1  riastrad 	PHM_PlatformCaps_NonABMSupportInPPLib,                  /* ABM is not supported in PPLIB, (moved from PPLIB to DAL) */
    146  1.1  riastrad 	PHM_PlatformCaps_GFXDynamicMGPowerGating,               /* Enable Dynamic MG PowerGating on Trinity */
    147  1.1  riastrad 	PHM_PlatformCaps_DisableSMUUVDHandshake,                /* Disable SMU UVD Handshake */
    148  1.1  riastrad 	PHM_PlatformCaps_DTE,                                   /* Support Digital Temperature Estimation */
    149  1.1  riastrad 	PHM_PlatformCaps_W5100Specifc_SmuSkipMsgDTE,            /* This is for the feature requested by David B., and Tonny W.*/
    150  1.1  riastrad 	PHM_PlatformCaps_UVDPowerGating,                        /* enable UVD power gating, supported from Llano */
    151  1.1  riastrad 	PHM_PlatformCaps_UVDDynamicPowerGating,                 /* enable UVD Dynamic power gating, supported from UVD5 */
    152  1.1  riastrad 	PHM_PlatformCaps_VCEPowerGating,                        /* Enable VCE power gating, supported for TN and later ASICs */
    153  1.1  riastrad 	PHM_PlatformCaps_SamuPowerGating,                       /* Enable SAMU power gating, supported for KV and later ASICs */
    154  1.1  riastrad 	PHM_PlatformCaps_UVDDPM,                                /* UVD clock DPM */
    155  1.1  riastrad 	PHM_PlatformCaps_VCEDPM,                                /* VCE clock DPM */
    156  1.1  riastrad 	PHM_PlatformCaps_SamuDPM,                               /* SAMU clock DPM */
    157  1.1  riastrad 	PHM_PlatformCaps_AcpDPM,                                /* ACP clock DPM */
    158  1.1  riastrad 	PHM_PlatformCaps_SclkDeepSleepAboveLow,                 /* Enable SCLK Deep Sleep on all DPM states */
    159  1.1  riastrad 	PHM_PlatformCaps_DynamicUVDState,                       /* Dynamic UVD State */
    160  1.1  riastrad 	PHM_PlatformCaps_WantSAMClkWithDummyBackEnd,            /* Set SAM Clk With Dummy Back End */
    161  1.1  riastrad 	PHM_PlatformCaps_WantUVDClkWithDummyBackEnd,            /* Set UVD Clk With Dummy Back End */
    162  1.1  riastrad 	PHM_PlatformCaps_WantVCEClkWithDummyBackEnd,            /* Set VCE Clk With Dummy Back End */
    163  1.1  riastrad 	PHM_PlatformCaps_WantACPClkWithDummyBackEnd,            /* Set SAM Clk With Dummy Back End */
    164  1.1  riastrad 	PHM_PlatformCaps_OD6inACSupport,                        /* indicates that the ASIC/back end supports OD6 */
    165  1.1  riastrad 	PHM_PlatformCaps_OD6inDCSupport,                        /* indicates that the ASIC/back end supports OD6 in DC */
    166  1.1  riastrad 	PHM_PlatformCaps_EnablePlatformPowerManagement,         /* indicates that Platform Power Management feature is supported */
    167  1.1  riastrad 	PHM_PlatformCaps_SurpriseRemoval,                       /* indicates that surprise removal feature is requested */
    168  1.1  riastrad 	PHM_PlatformCaps_NewCACVoltage,                         /* indicates new CAC voltage table support */
    169  1.1  riastrad 	PHM_PlatformCaps_DiDtSupport,                           /* for dI/dT feature */
    170  1.1  riastrad 	PHM_PlatformCaps_DBRamping,                             /* for dI/dT feature */
    171  1.1  riastrad 	PHM_PlatformCaps_TDRamping,                             /* for dI/dT feature */
    172  1.1  riastrad 	PHM_PlatformCaps_TCPRamping,                            /* for dI/dT feature */
    173  1.1  riastrad 	PHM_PlatformCaps_DBRRamping,                            /* for dI/dT feature */
    174  1.1  riastrad 	PHM_PlatformCaps_DiDtEDCEnable,                         /* for dI/dT feature */
    175  1.1  riastrad 	PHM_PlatformCaps_GCEDC,                                 /* for dI/dT feature */
    176  1.1  riastrad 	PHM_PlatformCaps_PSM,                                   /* for dI/dT feature */
    177  1.1  riastrad 	PHM_PlatformCaps_EnableSMU7ThermalManagement,           /* SMC will manage thermal events */
    178  1.1  riastrad 	PHM_PlatformCaps_FPS,                                   /* FPS support */
    179  1.1  riastrad 	PHM_PlatformCaps_ACP,                                   /* ACP support */
    180  1.1  riastrad 	PHM_PlatformCaps_SclkThrottleLowNotification,           /* SCLK Throttle Low Notification */
    181  1.1  riastrad 	PHM_PlatformCaps_XDMAEnabled,                           /* XDMA engine is enabled */
    182  1.1  riastrad 	PHM_PlatformCaps_UseDummyBackEnd,                       /* use dummy back end */
    183  1.1  riastrad 	PHM_PlatformCaps_EnableDFSBypass,                       /* Enable DFS bypass */
    184  1.1  riastrad 	PHM_PlatformCaps_VddNBDirectRequest,
    185  1.1  riastrad 	PHM_PlatformCaps_PauseMMSessions,
    186  1.1  riastrad 	PHM_PlatformCaps_UnTabledHardwareInterface,             /* Tableless/direct call hardware interface for CI and newer ASICs */
    187  1.1  riastrad 	PHM_PlatformCaps_SMU7,                                  /* indicates that vpuRecoveryBegin without SMU shutdown */
    188  1.1  riastrad 	PHM_PlatformCaps_RevertGPIO5Polarity,                   /* indicates revert GPIO5 plarity table support */
    189  1.1  riastrad 	PHM_PlatformCaps_Thermal2GPIO17,                        /* indicates thermal2GPIO17 table support */
    190  1.1  riastrad 	PHM_PlatformCaps_ThermalOutGPIO,                        /* indicates ThermalOutGPIO support, pin number is assigned by VBIOS */
    191  1.1  riastrad 	PHM_PlatformCaps_DisableMclkSwitchingForFrameLock,      /* Disable memory clock switch during Framelock */
    192  1.1  riastrad 	PHM_PlatformCaps_ForceMclkHigh,                         /* Disable memory clock switching by forcing memory clock high */
    193  1.1  riastrad 	PHM_PlatformCaps_VRHotGPIOConfigurable,                 /* indicates VR_HOT GPIO configurable */
    194  1.1  riastrad 	PHM_PlatformCaps_TempInversion,                         /* enable Temp Inversion feature */
    195  1.1  riastrad 	PHM_PlatformCaps_IOIC3,
    196  1.1  riastrad 	PHM_PlatformCaps_ConnectedStandby,
    197  1.1  riastrad 	PHM_PlatformCaps_EVV,
    198  1.1  riastrad 	PHM_PlatformCaps_EnableLongIdleBACOSupport,
    199  1.1  riastrad 	PHM_PlatformCaps_CombinePCCWithThermalSignal,
    200  1.1  riastrad 	PHM_PlatformCaps_DisableUsingActualTemperatureForPowerCalc,
    201  1.1  riastrad 	PHM_PlatformCaps_StablePState,
    202  1.1  riastrad 	PHM_PlatformCaps_OD6PlusinACSupport,
    203  1.1  riastrad 	PHM_PlatformCaps_OD6PlusinDCSupport,
    204  1.1  riastrad 	PHM_PlatformCaps_ODThermalLimitUnlock,
    205  1.1  riastrad 	PHM_PlatformCaps_ReducePowerLimit,
    206  1.1  riastrad 	PHM_PlatformCaps_ODFuzzyFanControlSupport,
    207  1.1  riastrad 	PHM_PlatformCaps_GeminiRegulatorFanControlSupport,
    208  1.1  riastrad 	PHM_PlatformCaps_ControlVDDGFX,
    209  1.1  riastrad 	PHM_PlatformCaps_BBBSupported,
    210  1.1  riastrad 	PHM_PlatformCaps_DisableVoltageIsland,
    211  1.1  riastrad 	PHM_PlatformCaps_FanSpeedInTableIsRPM,
    212  1.1  riastrad 	PHM_PlatformCaps_GFXClockGatingManagedInCAIL,
    213  1.1  riastrad 	PHM_PlatformCaps_IcelandULPSSWWorkAround,
    214  1.1  riastrad 	PHM_PlatformCaps_FPSEnhancement,
    215  1.1  riastrad 	PHM_PlatformCaps_LoadPostProductionFirmware,
    216  1.1  riastrad 	PHM_PlatformCaps_VpuRecoveryInProgress,
    217  1.1  riastrad 	PHM_PlatformCaps_Falcon_QuickTransition,
    218  1.1  riastrad 	PHM_PlatformCaps_AVFS,
    219  1.1  riastrad 	PHM_PlatformCaps_ClockStretcher,
    220  1.1  riastrad 	PHM_PlatformCaps_TablelessHardwareInterface,
    221  1.1  riastrad 	PHM_PlatformCaps_EnableDriverEVV,
    222  1.1  riastrad 	PHM_PlatformCaps_SPLLShutdownSupport,
    223  1.1  riastrad 	PHM_PlatformCaps_VirtualBatteryState,
    224  1.1  riastrad 	PHM_PlatformCaps_IgnoreForceHighClockRequestsInAPUs,
    225  1.1  riastrad 	PHM_PlatformCaps_DisableMclkSwitchForVR,
    226  1.1  riastrad 	PHM_PlatformCaps_SMU8,
    227  1.1  riastrad 	PHM_PlatformCaps_VRHotPolarityHigh,
    228  1.1  riastrad 	PHM_PlatformCaps_IPS_UlpsExclusive,
    229  1.1  riastrad 	PHM_PlatformCaps_SMCtoPPLIBAcdcGpioScheme,
    230  1.1  riastrad 	PHM_PlatformCaps_GeminiAsymmetricPower,
    231  1.1  riastrad 	PHM_PlatformCaps_OCLPowerOptimization,
    232  1.1  riastrad 	PHM_PlatformCaps_MaxPCIEBandWidth,
    233  1.1  riastrad 	PHM_PlatformCaps_PerfPerWattOptimizationSupport,
    234  1.1  riastrad 	PHM_PlatformCaps_UVDClientMCTuning,
    235  1.1  riastrad 	PHM_PlatformCaps_ODNinACSupport,
    236  1.1  riastrad 	PHM_PlatformCaps_ODNinDCSupport,
    237  1.1  riastrad 	PHM_PlatformCaps_OD8inACSupport,
    238  1.1  riastrad 	PHM_PlatformCaps_OD8inDCSupport,
    239  1.1  riastrad 	PHM_PlatformCaps_UMDPState,
    240  1.1  riastrad 	PHM_PlatformCaps_AutoWattmanSupport,
    241  1.1  riastrad 	PHM_PlatformCaps_AutoWattmanEnable_CCCState,
    242  1.1  riastrad 	PHM_PlatformCaps_FreeSyncActive,
    243  1.1  riastrad 	PHM_PlatformCaps_EnableShadowPstate,
    244  1.1  riastrad 	PHM_PlatformCaps_customThermalManagement,
    245  1.1  riastrad 	PHM_PlatformCaps_staticFanControl,
    246  1.1  riastrad 	PHM_PlatformCaps_Virtual_System,
    247  1.1  riastrad 	PHM_PlatformCaps_LowestUclkReservedForUlv,
    248  1.1  riastrad 	PHM_PlatformCaps_EnableBoostState,
    249  1.1  riastrad 	PHM_PlatformCaps_AVFSSupport,
    250  1.1  riastrad 	PHM_PlatformCaps_ThermalPolicyDelay,
    251  1.1  riastrad 	PHM_PlatformCaps_CustomFanControlSupport,
    252  1.1  riastrad 	PHM_PlatformCaps_BAMACO,
    253  1.1  riastrad 	PHM_PlatformCaps_Max
    254  1.1  riastrad };
    255  1.1  riastrad 
    256  1.1  riastrad #define PHM_MAX_NUM_CAPS_BITS_PER_FIELD (sizeof(uint32_t)*8)
    257  1.1  riastrad 
    258  1.1  riastrad /* Number of uint32_t entries used by CAPS table */
    259  1.1  riastrad #define PHM_MAX_NUM_CAPS_ULONG_ENTRIES \
    260  1.1  riastrad 	((PHM_PlatformCaps_Max + ((PHM_MAX_NUM_CAPS_BITS_PER_FIELD) - 1)) / (PHM_MAX_NUM_CAPS_BITS_PER_FIELD))
    261  1.1  riastrad 
    262  1.1  riastrad struct pp_hw_descriptor {
    263  1.1  riastrad 	uint32_t hw_caps[PHM_MAX_NUM_CAPS_ULONG_ENTRIES];
    264  1.1  riastrad };
    265  1.1  riastrad 
    266  1.1  riastrad enum PHM_PerformanceLevelDesignation {
    267  1.1  riastrad 	PHM_PerformanceLevelDesignation_Activity,
    268  1.1  riastrad 	PHM_PerformanceLevelDesignation_PowerContainment
    269  1.1  riastrad };
    270  1.1  riastrad 
    271  1.1  riastrad typedef enum PHM_PerformanceLevelDesignation PHM_PerformanceLevelDesignation;
    272  1.1  riastrad 
    273  1.1  riastrad struct PHM_PerformanceLevel {
    274  1.1  riastrad     uint32_t    coreClock;
    275  1.1  riastrad     uint32_t    memory_clock;
    276  1.1  riastrad     uint32_t  vddc;
    277  1.1  riastrad     uint32_t  vddci;
    278  1.1  riastrad     uint32_t    nonLocalMemoryFreq;
    279  1.1  riastrad     uint32_t nonLocalMemoryWidth;
    280  1.1  riastrad };
    281  1.1  riastrad 
    282  1.1  riastrad typedef struct PHM_PerformanceLevel PHM_PerformanceLevel;
    283  1.1  riastrad 
    284  1.1  riastrad /* Function for setting a platform cap */
    285  1.1  riastrad static inline void phm_cap_set(uint32_t *caps,
    286  1.1  riastrad 			enum phm_platform_caps c)
    287  1.1  riastrad {
    288  1.1  riastrad 	caps[c / PHM_MAX_NUM_CAPS_BITS_PER_FIELD] |= (1UL <<
    289  1.1  riastrad 			     (c & (PHM_MAX_NUM_CAPS_BITS_PER_FIELD - 1)));
    290  1.1  riastrad }
    291  1.1  riastrad 
    292  1.1  riastrad static inline void phm_cap_unset(uint32_t *caps,
    293  1.1  riastrad 			enum phm_platform_caps c)
    294  1.1  riastrad {
    295  1.1  riastrad 	caps[c / PHM_MAX_NUM_CAPS_BITS_PER_FIELD] &= ~(1UL << (c & (PHM_MAX_NUM_CAPS_BITS_PER_FIELD - 1)));
    296  1.1  riastrad }
    297  1.1  riastrad 
    298  1.1  riastrad static inline bool phm_cap_enabled(const uint32_t *caps, enum phm_platform_caps c)
    299  1.1  riastrad {
    300  1.1  riastrad 	return (0 != (caps[c / PHM_MAX_NUM_CAPS_BITS_PER_FIELD] &
    301  1.1  riastrad 		  (1UL << (c & (PHM_MAX_NUM_CAPS_BITS_PER_FIELD - 1)))));
    302  1.1  riastrad }
    303  1.1  riastrad 
    304  1.1  riastrad #define PP_CAP(c) phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, (c))
    305  1.1  riastrad 
    306  1.1  riastrad #define PP_PCIEGenInvalid  0xffff
    307  1.1  riastrad enum PP_PCIEGen {
    308  1.1  riastrad     PP_PCIEGen1 = 0,                /* PCIE 1.0 - Transfer rate of 2.5 GT/s */
    309  1.1  riastrad     PP_PCIEGen2,                    /*PCIE 2.0 - Transfer rate of 5.0 GT/s */
    310  1.1  riastrad     PP_PCIEGen3                     /*PCIE 3.0 - Transfer rate of 8.0 GT/s */
    311  1.1  riastrad };
    312  1.1  riastrad 
    313  1.1  riastrad typedef enum PP_PCIEGen PP_PCIEGen;
    314  1.1  riastrad 
    315  1.1  riastrad #define PP_Min_PCIEGen     PP_PCIEGen1
    316  1.1  riastrad #define PP_Max_PCIEGen     PP_PCIEGen3
    317  1.1  riastrad #define PP_Min_PCIELane    1
    318  1.1  riastrad #define PP_Max_PCIELane    16
    319  1.1  riastrad 
    320  1.1  riastrad enum phm_clock_Type {
    321  1.1  riastrad 	PHM_DispClock = 1,
    322  1.1  riastrad 	PHM_SClock,
    323  1.1  riastrad 	PHM_MemClock
    324  1.1  riastrad };
    325  1.1  riastrad 
    326  1.1  riastrad #define MAX_NUM_CLOCKS 16
    327  1.1  riastrad 
    328  1.1  riastrad struct PP_Clocks {
    329  1.1  riastrad 	uint32_t engineClock;
    330  1.1  riastrad 	uint32_t memoryClock;
    331  1.1  riastrad 	uint32_t BusBandwidth;
    332  1.1  riastrad 	uint32_t engineClockInSR;
    333  1.1  riastrad 	uint32_t dcefClock;
    334  1.1  riastrad 	uint32_t dcefClockInSR;
    335  1.1  riastrad };
    336  1.1  riastrad 
    337  1.1  riastrad struct pp_clock_info {
    338  1.1  riastrad 	uint32_t min_mem_clk;
    339  1.1  riastrad 	uint32_t max_mem_clk;
    340  1.1  riastrad 	uint32_t min_eng_clk;
    341  1.1  riastrad 	uint32_t max_eng_clk;
    342  1.1  riastrad 	uint32_t min_bus_bandwidth;
    343  1.1  riastrad 	uint32_t max_bus_bandwidth;
    344  1.1  riastrad };
    345  1.1  riastrad 
    346  1.1  riastrad struct phm_platform_descriptor {
    347  1.1  riastrad 	uint32_t platformCaps[PHM_MAX_NUM_CAPS_ULONG_ENTRIES];
    348  1.1  riastrad 	uint32_t vbiosInterruptId;
    349  1.1  riastrad 	struct PP_Clocks overdriveLimit;
    350  1.1  riastrad 	struct PP_Clocks clockStep;
    351  1.1  riastrad 	uint32_t hardwareActivityPerformanceLevels;
    352  1.1  riastrad 	uint32_t minimumClocksReductionPercentage;
    353  1.1  riastrad 	uint32_t minOverdriveVDDC;
    354  1.1  riastrad 	uint32_t maxOverdriveVDDC;
    355  1.1  riastrad 	uint32_t overdriveVDDCStep;
    356  1.1  riastrad 	uint32_t hardwarePerformanceLevels;
    357  1.1  riastrad 	uint16_t powerBudget;
    358  1.1  riastrad 	uint32_t TDPLimit;
    359  1.1  riastrad 	uint32_t nearTDPLimit;
    360  1.1  riastrad 	uint32_t nearTDPLimitAdjusted;
    361  1.1  riastrad 	uint32_t SQRampingThreshold;
    362  1.1  riastrad 	uint32_t CACLeakage;
    363  1.1  riastrad 	uint16_t TDPODLimit;
    364  1.1  riastrad 	uint32_t TDPAdjustment;
    365  1.1  riastrad 	bool TDPAdjustmentPolarity;
    366  1.1  riastrad 	uint16_t LoadLineSlope;
    367  1.1  riastrad 	uint32_t  VidMinLimit;
    368  1.1  riastrad 	uint32_t  VidMaxLimit;
    369  1.1  riastrad 	uint32_t  VidStep;
    370  1.1  riastrad 	uint32_t  VidAdjustment;
    371  1.1  riastrad 	bool VidAdjustmentPolarity;
    372  1.1  riastrad };
    373  1.1  riastrad 
    374  1.1  riastrad struct phm_clocks {
    375  1.1  riastrad 	uint32_t num_of_entries;
    376  1.1  riastrad 	uint32_t clock[MAX_NUM_CLOCKS];
    377  1.1  riastrad };
    378  1.1  riastrad 
    379  1.1  riastrad #define DPMTABLE_OD_UPDATE_SCLK     0x00000001
    380  1.1  riastrad #define DPMTABLE_OD_UPDATE_MCLK     0x00000002
    381  1.1  riastrad #define DPMTABLE_UPDATE_SCLK        0x00000004
    382  1.1  riastrad #define DPMTABLE_UPDATE_MCLK        0x00000008
    383  1.1  riastrad #define DPMTABLE_OD_UPDATE_VDDC     0x00000010
    384  1.1  riastrad #define DPMTABLE_UPDATE_SOCCLK      0x00000020
    385  1.1  riastrad 
    386  1.1  riastrad struct phm_odn_performance_level {
    387  1.1  riastrad 	uint32_t clock;
    388  1.1  riastrad 	uint32_t vddc;
    389  1.1  riastrad 	bool enabled;
    390  1.1  riastrad };
    391  1.1  riastrad 
    392  1.1  riastrad struct phm_odn_clock_levels {
    393  1.1  riastrad 	uint32_t size;
    394  1.1  riastrad 	uint32_t options;
    395  1.1  riastrad 	uint32_t flags;
    396  1.1  riastrad 	uint32_t num_of_pl;
    397  1.1  riastrad 	/* variable-sized array, specify by num_of_pl. */
    398  1.1  riastrad 	struct phm_odn_performance_level entries[8];
    399  1.1  riastrad };
    400  1.1  riastrad 
    401  1.1  riastrad extern int phm_disable_clock_power_gatings(struct pp_hwmgr *hwmgr);
    402  1.1  riastrad extern int phm_powerdown_uvd(struct pp_hwmgr *hwmgr);
    403  1.1  riastrad extern int phm_setup_asic(struct pp_hwmgr *hwmgr);
    404  1.1  riastrad extern int phm_enable_dynamic_state_management(struct pp_hwmgr *hwmgr);
    405  1.1  riastrad extern int phm_disable_dynamic_state_management(struct pp_hwmgr *hwmgr);
    406  1.1  riastrad extern bool phm_is_hw_access_blocked(struct pp_hwmgr *hwmgr);
    407  1.1  riastrad extern int phm_block_hw_access(struct pp_hwmgr *hwmgr, bool block);
    408  1.1  riastrad extern int phm_set_power_state(struct pp_hwmgr *hwmgr,
    409  1.1  riastrad 		    const struct pp_hw_power_state *pcurrent_state,
    410  1.1  riastrad 		 const struct pp_hw_power_state *pnew_power_state);
    411  1.1  riastrad 
    412  1.1  riastrad extern int phm_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
    413  1.1  riastrad 				   struct pp_power_state *adjusted_ps,
    414  1.1  riastrad 			     const struct pp_power_state *current_ps);
    415  1.1  riastrad 
    416  1.1  riastrad extern int phm_apply_clock_adjust_rules(struct pp_hwmgr *hwmgr);
    417  1.1  riastrad 
    418  1.1  riastrad extern int phm_force_dpm_levels(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_level level);
    419  1.1  riastrad extern int phm_pre_display_configuration_changed(struct pp_hwmgr *hwmgr);
    420  1.1  riastrad extern int phm_display_configuration_changed(struct pp_hwmgr *hwmgr);
    421  1.1  riastrad extern int phm_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr);
    422  1.1  riastrad extern int phm_register_irq_handlers(struct pp_hwmgr *hwmgr);
    423  1.1  riastrad extern int phm_start_thermal_controller(struct pp_hwmgr *hwmgr);
    424  1.1  riastrad extern int phm_stop_thermal_controller(struct pp_hwmgr *hwmgr);
    425  1.1  riastrad extern bool phm_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr);
    426  1.1  riastrad 
    427  1.1  riastrad extern int phm_check_states_equal(struct pp_hwmgr *hwmgr,
    428  1.1  riastrad 				 const struct pp_hw_power_state *pstate1,
    429  1.1  riastrad 				 const struct pp_hw_power_state *pstate2,
    430  1.1  riastrad 				 bool *equal);
    431  1.1  riastrad 
    432  1.1  riastrad extern int phm_store_dal_configuration_data(struct pp_hwmgr *hwmgr,
    433  1.1  riastrad 		const struct amd_pp_display_configuration *display_config);
    434  1.1  riastrad 
    435  1.1  riastrad extern int phm_get_dal_power_level(struct pp_hwmgr *hwmgr,
    436  1.1  riastrad 		struct amd_pp_simple_clock_info *info);
    437  1.1  riastrad 
    438  1.1  riastrad extern int phm_set_cpu_power_state(struct pp_hwmgr *hwmgr);
    439  1.1  riastrad 
    440  1.1  riastrad extern int phm_power_down_asic(struct pp_hwmgr *hwmgr);
    441  1.1  riastrad 
    442  1.1  riastrad extern int phm_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *state,
    443  1.1  riastrad 				PHM_PerformanceLevelDesignation designation, uint32_t index,
    444  1.1  riastrad 				PHM_PerformanceLevel *level);
    445  1.1  riastrad 
    446  1.1  riastrad extern int phm_get_clock_info(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *state,
    447  1.1  riastrad 			struct pp_clock_info *pclock_info,
    448  1.1  riastrad 			PHM_PerformanceLevelDesignation designation);
    449  1.1  riastrad 
    450  1.1  riastrad extern int phm_get_current_shallow_sleep_clocks(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *state, struct pp_clock_info *clock_info);
    451  1.1  riastrad 
    452  1.1  riastrad extern int phm_get_clock_by_type(struct pp_hwmgr *hwmgr, enum amd_pp_clock_type type, struct amd_pp_clocks *clocks);
    453  1.1  riastrad 
    454  1.1  riastrad extern int phm_get_clock_by_type_with_latency(struct pp_hwmgr *hwmgr,
    455  1.1  riastrad 		enum amd_pp_clock_type type,
    456  1.1  riastrad 		struct pp_clock_levels_with_latency *clocks);
    457  1.1  riastrad extern int phm_get_clock_by_type_with_voltage(struct pp_hwmgr *hwmgr,
    458  1.1  riastrad 		enum amd_pp_clock_type type,
    459  1.1  riastrad 		struct pp_clock_levels_with_voltage *clocks);
    460  1.1  riastrad extern int phm_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr,
    461  1.1  riastrad 						void *clock_ranges);
    462  1.1  riastrad extern int phm_display_clock_voltage_request(struct pp_hwmgr *hwmgr,
    463  1.1  riastrad 		struct pp_display_clock_request *clock);
    464  1.1  riastrad 
    465  1.1  riastrad extern int phm_get_max_high_clocks(struct pp_hwmgr *hwmgr, struct amd_pp_simple_clock_info *clocks);
    466  1.1  riastrad extern int phm_disable_smc_firmware_ctf(struct pp_hwmgr *hwmgr);
    467  1.1  riastrad 
    468  1.1  riastrad extern int phm_set_active_display_count(struct pp_hwmgr *hwmgr, uint32_t count);
    469  1.1  riastrad 
    470  1.1  riastrad #endif /* _HARDWARE_MANAGER_H_ */
    471  1.1  riastrad 
    472