1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

ADL: Updated support for AMD Display Library to 14.0, updated datatypes and added support for OverDrive 7 and 8 based GPUs

This commit is contained in:
Jens Steube 2021-07-26 07:48:56 +02:00
parent 83badbeaf1
commit b53691c8f5
4 changed files with 741 additions and 246 deletions

View File

@ -13,228 +13,602 @@
#include <windows.h>
#endif // _WIN
// Values taken from display-library-14.0.zip
/**
* Declarations from adl_sdk.h and subheaders
* Declarations from adl_defines.h
*/
#define ADL_OK 0
#define ADL_ERR -1
#define ADL_ERR_NOT_SUPPORTED -8
/// ADL function completed successfully
#define ADL_OK 0
/// Generic Error. Most likely one or more of the Escape calls to the driver failed!
#define ADL_ERR -1
#define ADL_MAX_PATH 256
/// Function not supported by the driver
#define ADL_ERR_NOT_SUPPORTED -8
#define ADL_DL_FANCTRL_SPEED_TYPE_PERCENT 1
#define ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED 1
/// Defines the maximum string length
#define ADL_MAX_PATH 256
//values for ADLFanSpeedValue.iSpeedType
#define ADL_DL_FANCTRL_SPEED_TYPE_PERCENT 1
#define ADL_DL_FANCTRL_SPEED_TYPE_RPM 2
//values for ADLFanSpeedValue.iFlags
#define ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED 1
//Define Performance Metrics Log max sensors number
#define ADL_PMLOG_MAX_SENSORS 256
/**
* Declarations from adl_structures.h
*/
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about the graphics adapter.
///
/// This structure is used to store various information about the graphics adapter. This
/// information can be returned to the user. Alternatively, it can be used to access various driver calls to set
/// or fetch various settings upon the user's request.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct AdapterInfo
{
int iSize;
int iAdapterIndex;
char strUDID[ADL_MAX_PATH];
int iBusNumber;
int iDeviceNumber;
int iFunctionNumber;
int iVendorID;
char strAdapterName[ADL_MAX_PATH];
char strDisplayName[ADL_MAX_PATH];
int iPresent;
/// \ALL_STRUCT_MEM
#if defined (_WIN32) || defined (_WIN64) || defined (__CYGWIN__)
int iExist;
char strDriverPath[ADL_MAX_PATH];
char strDriverPathExt[ADL_MAX_PATH];
char strPNPString[ADL_MAX_PATH];
int iOSDisplayIndex;
#endif /* (_WIN32) || (_WIN64) || (__CYGWIN__) */
/// Size of the structure.
int iSize;
/// The ADL index handle. One GPU may be associated with one or two index handles
int iAdapterIndex;
/// The unique device ID associated with this adapter.
char strUDID[ADL_MAX_PATH];
/// The BUS number associated with this adapter.
int iBusNumber;
/// The driver number associated with this adapter.
int iDeviceNumber;
/// The function number.
int iFunctionNumber;
/// The vendor ID associated with this adapter.
int iVendorID;
/// Adapter name.
char strAdapterName[ADL_MAX_PATH];
/// Display name. For example, "\\\\Display0" for Windows or ":0:0" for Linux.
char strDisplayName[ADL_MAX_PATH];
/// Present or not; 1 if present and 0 if not present.It the logical adapter is present, the display name such as \\\\.\\Display1 can be found from OS
int iPresent;
#if defined (__linux__)
int iXScreenNum;
int iDrvIndex;
char strXScreenConfigName[ADL_MAX_PATH];
#endif /* (__linux__) */
#if defined (_WIN32) || defined (_WIN64)
/// \WIN_STRUCT_MEM
/// Exist or not; 1 is exist and 0 is not present.
int iExist;
/// Driver registry path.
char strDriverPath[ADL_MAX_PATH];
/// Driver registry path Ext for.
char strDriverPathExt[ADL_MAX_PATH];
/// PNP string from Windows.
char strPNPString[ADL_MAX_PATH];
/// It is generated from EnumDisplayDevices.
int iOSDisplayIndex;
#endif /* (_WIN32) || (_WIN64) */
#if defined (LINUX)
/// \LNX_STRUCT_MEM
/// Internal X screen number from GPUMapInfo (DEPRICATED use XScreenInfo)
int iXScreenNum;
/// Internal driver index from GPUMapInfo
int iDrvIndex;
/// \deprecated Internal x config file screen identifier name. Use XScreenInfo instead.
char strXScreenConfigName[ADL_MAX_PATH];
#endif /* (LINUX) */
} AdapterInfo, *LPAdapterInfo;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about thermal controller.
///
/// This structure is used to store information about thermal controller.
/// This structure is used by ADL_PM_ThermalDevices_Enum.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLThermalControllerInfo
{
/// Must be set to the size of the structure
int iSize;
/// Possible valies: \ref ADL_DL_THERMAL_DOMAIN_OTHER or \ref ADL_DL_THERMAL_DOMAIN_GPU.
int iThermalDomain;
/// GPU 0, 1, etc.
int iDomainIndex;
/// Possible valies: \ref ADL_DL_THERMAL_FLAG_INTERRUPT or \ref ADL_DL_THERMAL_FLAG_FANCONTROL
int iFlags;
} ADLThermalControllerInfo;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about thermal controller temperature.
///
/// This structure is used to store information about thermal controller temperature.
/// This structure is used by the ADL_PM_Temperature_Get() function.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLTemperature
{
/// Must be set to the size of the structure
int iSize;
/// Temperature in millidegrees Celsius.
int iTemperature;
} ADLTemperature;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about thermal controller fan speed.
///
/// This structure is used to store information about thermal controller fan speed.
/// This structure is used by the ADL_PM_FanSpeedInfo_Get() function.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLFanSpeedInfo
{
/// Must be set to the size of the structure
int iSize;
/// \ref define_fanctrl
int iFlags;
/// Minimum possible fan speed value in percents.
int iMinPercent;
/// Maximum possible fan speed value in percents.
int iMaxPercent;
/// Minimum possible fan speed value in RPM.
int iMinRPM;
/// Maximum possible fan speed value in RPM.
int iMaxRPM;
} ADLFanSpeedInfo;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about fan speed reported by thermal controller.
///
/// This structure is used to store information about fan speed reported by thermal controller.
/// This structure is used by the ADL_Overdrive5_FanSpeed_Get() and ADL_Overdrive5_FanSpeed_Set() functions.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLFanSpeedValue
{
/// Must be set to the size of the structure
int iSize;
/// Possible valies: \ref ADL_DL_FANCTRL_SPEED_TYPE_PERCENT or \ref ADL_DL_FANCTRL_SPEED_TYPE_RPM
int iSpeedType;
/// Fan speed value
int iFanSpeed;
/// The only flag for now is: \ref ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED
int iFlags;
} ADLFanSpeedValue;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about the display device.
///
/// This structure is used to store display device information
/// such as display index, type, name, connection status, mapped adapter and controller indexes,
/// whether or not multiple VPUs are supported, local display connections or not (through Lasso), etc.
/// This information can be returned to the user. Alternatively, it can be used to access various driver calls to set
/// or fetch various display device related settings upon the user's request.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLDisplayID
{
int iDisplayLogicalIndex;
int iDisplayPhysicalIndex;
int iDisplayLogicalAdapterIndex;
int iDisplayPhysicalAdapterIndex;
/// The logical display index belonging to this adapter.
int iDisplayLogicalIndex;
///\brief The physical display index.
/// For example, display index 2 from adapter 2 can be used by current adapter 1.\n
/// So current adapter may enumerate this adapter as logical display 7 but the physical display
/// index is still 2.
int iDisplayPhysicalIndex;
/// The persistent logical adapter index for the display.
int iDisplayLogicalAdapterIndex;
///\brief The persistent physical adapter index for the display.
/// It can be the current adapter or a non-local adapter. \n
/// If this adapter index is different than the current adapter,
/// the Display Non Local flag is set inside DisplayInfoValue.
int iDisplayPhysicalAdapterIndex;
} ADLDisplayID, *LPADLDisplayID;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about the display device.
///
/// This structure is used to store various information about the display device. This
/// information can be returned to the user, or used to access various driver calls to set
/// or fetch various display-device-related settings upon the user's request
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLDisplayInfo
{
ADLDisplayID displayID;
int iDisplayControllerIndex;
char strDisplayName[ADL_MAX_PATH];
char strDisplayManufacturerName[ADL_MAX_PATH];
int iDisplayType;
int iDisplayOutputType;
int iDisplayConnector;
int iDisplayInfoMask;
int iDisplayInfoValue;
/// The DisplayID structure
ADLDisplayID displayID;
///\deprecated The controller index to which the display is mapped.\n Will not be used in the future\n
int iDisplayControllerIndex;
/// The display's EDID name.
char strDisplayName[ADL_MAX_PATH];
/// The display's manufacturer name.
char strDisplayManufacturerName[ADL_MAX_PATH];
/// The Display type. For example: CRT, TV, CV, DFP.
int iDisplayType;
/// The display output type. For example: HDMI, SVIDEO, COMPONMNET VIDEO.
int iDisplayOutputType;
/// The connector type for the device.
int iDisplayConnector;
///\brief The bit mask identifies the number of bits ADLDisplayInfo is currently using. \n
/// It will be the sum all the bit definitions in ADL_DISPLAY_DISPLAYINFO_xxx.
int iDisplayInfoMask;
/// The bit mask identifies the display status. \ref define_displayinfomask
int iDisplayInfoValue;
} ADLDisplayInfo, *LPADLDisplayInfo;
/////////////////////////////////////////////////////////////////////////////////////////////
/// \brief Structure containing information about the BIOS.
///
/// This structure is used to store various information about the Chipset. This
/// information can be returned to the user.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLBiosInfo
{
char strPartNumber[ADL_MAX_PATH];
char strVersion[ADL_MAX_PATH];
char strDate[ADL_MAX_PATH];
char strPartNumber[ADL_MAX_PATH]; ///< Part number.
char strVersion[ADL_MAX_PATH]; ///< Version number.
char strDate[ADL_MAX_PATH]; ///< BIOS date in yyyy/mm/dd hh:mm format.
} ADLBiosInfo, *LPADLBiosInfo;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about current power management related activity.
///
/// This structure is used to store information about current power management related activity.
/// This structure (Overdrive 5 interfaces) is used by the ADL_PM_CurrentActivity_Get() function.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLPMActivity
{
int iSize;
int iEngineClock;
int iMemoryClock;
int iVddc;
int iActivityPercent;
int iCurrentPerformanceLevel;
int iCurrentBusSpeed;
int iCurrentBusLanes;
int iMaximumBusLanes;
int iReserved;
/// Must be set to the size of the structure
int iSize;
/// Current engine clock.
int iEngineClock;
/// Current memory clock.
int iMemoryClock;
/// Current core voltage.
int iVddc;
/// GPU utilization.
int iActivityPercent;
/// Performance level index.
int iCurrentPerformanceLevel;
/// Current PCIE bus speed.
int iCurrentBusSpeed;
/// Number of PCIE bus lanes.
int iCurrentBusLanes;
/// Maximum number of PCIE bus lanes.
int iMaximumBusLanes;
/// Reserved for future purposes.
int iReserved;
} ADLPMActivity;
////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing the range of Overdrive parameter.
///
/// This structure is used to store information about the range of Overdrive parameter.
/// This structure is used by ADLODParameters.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLODParameterRange
{
/// Minimum parameter value.
int iMin;
/// Maximum parameter value.
int iMax;
/// Parameter step value.
int iStep;
} ADLODParameterRange;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Overdrive parameters.
///
/// This structure is used to store information about Overdrive parameters.
/// This structure is used by the ADL_Overdrive5_ODParameters_Get() function.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLODParameters
{
/// Must be set to the size of the structure
int iSize;
/// Number of standard performance states.
int iNumberOfPerformanceLevels;
/// Indicates whether the GPU is capable to measure its activity.
int iActivityReportingSupported;
/// Indicates whether the GPU supports discrete performance levels or performance range.
int iDiscretePerformanceLevels;
/// Reserved for future use.
int iReserved;
/// Engine clock range.
ADLODParameterRange sEngineClock;
/// Memory clock range.
ADLODParameterRange sMemoryClock;
/// Core voltage range.
ADLODParameterRange sVddc;
} ADLODParameters;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Overdrive 6 fan speed information
///
/// This structure is used to store information about Overdrive 6 fan speed information
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ADLOD6FanSpeedInfo
{
/// Contains a bitmap of the valid fan speed type flags. Possible values: \ref ADL_OD6_FANSPEED_TYPE_PERCENT, \ref ADL_OD6_FANSPEED_TYPE_RPM, \ref ADL_OD6_FANSPEED_USER_DEFINED
int iSpeedType;
/// Contains current fan speed in percent (if valid flag exists in iSpeedType)
int iFanSpeedPercent;
/// Contains current fan speed in RPM (if valid flag exists in iSpeedType)
int iFanSpeedRPM;
/// Value for future extension
int iExtValue;
/// Mask for future extension
int iExtMask;
} ADLOD6FanSpeedInfo;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Overdrive 6 fan speed value
///
/// This structure is used to store information about Overdrive 6 fan speed value
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ADLOD6FanSpeedValue
{
/// Indicates the units of the fan speed. Possible values: \ref ADL_OD6_FANSPEED_TYPE_PERCENT, \ref ADL_OD6_FANSPEED_TYPE_RPM
int iSpeedType;
/// Fan speed value (units as indicated above)
int iFanSpeed;
/// Value for future extension
int iExtValue;
/// Mask for future extension
int iExtMask;
} ADLOD6FanSpeedValue;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about current Overdrive 6 performance status.
///
/// This structure is used to store information about current Overdrive 6 performance status.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ADLOD6CurrentStatus
{
/// Current engine clock in 10 KHz.
int iEngineClock;
/// Current memory clock in 10 KHz.
int iMemoryClock;
/// Current GPU activity in percent. This
/// indicates how "busy" the GPU is.
int iActivityPercent;
/// Not used. Reserved for future use.
int iCurrentPerformanceLevel;
/// Current PCI-E bus speed
int iCurrentBusSpeed;
/// Current PCI-E bus # of lanes
int iCurrentBusLanes;
/// Maximum possible PCI-E bus # of lanes
int iMaximumBusLanes;
/// Value for future extension
int iExtValue;
/// Mask for future extension
int iExtMask;
} ADLOD6CurrentStatus;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Overdrive 6 clock range
///
/// This structure is used to store information about Overdrive 6 clock range
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ADLOD6ParameterRange
{
/// The starting value of the clock range
int iMin;
/// The ending value of the clock range
int iMax;
/// The minimum increment between clock values
int iStep;
} ADLOD6ParameterRange;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Overdrive 6 capabilities
///
/// This structure is used to store information about Overdrive 6 capabilities
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ADLOD6Capabilities
{
/// Contains a bitmap of the OD6 capability flags. Possible values: \ref ADL_OD6_CAPABILITY_SCLK_CUSTOMIZATION,
/// \ref ADL_OD6_CAPABILITY_MCLK_CUSTOMIZATION, \ref ADL_OD6_CAPABILITY_GPU_ACTIVITY_MONITOR
int iCapabilities;
/// Contains a bitmap indicating the power states
/// supported by OD6. Currently only the performance state
/// is supported. Possible Values: \ref ADL_OD6_SUPPORTEDSTATE_PERFORMANCE
int iSupportedStates;
/// Number of levels. OD6 will always use 2 levels, which describe
/// the minimum to maximum clock ranges.
/// The 1st level indicates the minimum clocks, and the 2nd level
/// indicates the maximum clocks.
int iNumberOfPerformanceLevels;
/// Contains the hard limits of the sclk range. Overdrive
/// clocks cannot be set outside this range.
ADLOD6ParameterRange sEngineClockRange;
/// Contains the hard limits of the mclk range. Overdrive
/// clocks cannot be set outside this range.
ADLOD6ParameterRange sMemoryClockRange;
/// Value for future extension
int iExtValue;
/// Mask for future extension
int iExtMask;
} ADLOD6Capabilities;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Overdrive level.
///
/// This structure is used to store information about Overdrive level.
/// This structure is used by ADLODPerformanceLevels.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLODPerformanceLevel
{
/// Engine clock.
int iEngineClock;
/// Memory clock.
int iMemoryClock;
/// Core voltage.
int iVddc;
} ADLODPerformanceLevel;
/*
* Attention: we had to change this struct due to an out-of-bound problem mentioned here:
* https://github.com/hashcat/hashcat/issues/244
* the change: ADLODPerformanceLevel aLevels [1] -> ADLODPerformanceLevel aLevels [2]
*/
typedef struct ADLODPerformanceLevels
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Overdrive 6 clock values.
///
/// This structure is used to store information about Overdrive 6 clock values.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ADLOD6PerformanceLevel
{
int iSize;
int iReserved;
ADLODPerformanceLevel aLevels [2];
} ADLODPerformanceLevels;
/// Engine (core) clock.
int iEngineClock;
/// Memory clock.
int iMemoryClock;
typedef struct ADLOD6FanSpeedInfo
{
int iSpeedType;
int iFanSpeedPercent;
int iFanSpeedRPM;
int iExtValue;
int iExtMask;
} ADLOD6FanSpeedInfo;
typedef struct ADLOD6FanSpeedValue
{
int iSpeedType;
int iFanSpeed;
int iExtValue;
int iExtMask;
} ADLOD6FanSpeedValue;
typedef struct ADLOD6CurrentStatus
{
int iEngineClock;
int iMemoryClock;
int iActivityPercent;
int iCurrentPerformanceLevel;
int iCurrentBusSpeed;
int iCurrentBusLanes;
int iMaximumBusLanes;
int iExtValue;
int iExtMask;
} ADLOD6CurrentStatus;
typedef struct ADLOD6ParameterRange
{
int iMin;
int iMax;
int iStep;
} ADLOD6ParameterRange;
typedef struct ADLOD6Capabilities
{
int iCapabilities;
int iSupportedStates;
int iNumberOfPerformanceLevels;
ADLOD6ParameterRange sEngineClockRange;
ADLOD6ParameterRange sMemoryClockRange;
int iExtValue;
int iExtMask;
} ADLOD6Capabilities;
typedef struct ADLOD6PerformanceLevel
{
int iEngineClock;
int iMemoryClock;
} ADLOD6PerformanceLevel;
/*
* Attention: we had to change this struct due to an out-of-bound problem mentioned here:
* https://github.com/hashcat/hashcat/issues/244
* the change: ADLOD6PerformanceLevel aLevels [1] -> ADLOD6PerformanceLevel aLevels [2]
*/
typedef struct ADLOD6StateInfo
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Overdrive 6 clocks.
///
/// This structure is used to store information about Overdrive 6 clocks. This is a
/// variable-sized structure. iNumberOfPerformanceLevels indicate how many elements
/// are contained in the aLevels array.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ADLOD6StateInfo
{
int iNumberOfPerformanceLevels;
int iExtValue;
int iExtMask;
ADLOD6PerformanceLevel aLevels [2];
/// Number of levels. OD6 uses clock ranges instead of discrete performance levels.
/// iNumberOfPerformanceLevels is always 2. The 1st level indicates the minimum clocks
/// in the range. The 2nd level indicates the maximum clocks in the range.
int iNumberOfPerformanceLevels;
/// Value for future extension
int iExtValue;
/// Mask for future extension
int iExtMask;
/// Variable-sized array of levels.
/// The number of elements in the array is specified by iNumberofPerformanceLevels.
ADLOD6PerformanceLevel aLevels [1];
} ADLOD6StateInfo;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Overdrive performance levels.
///
/// This structure is used to store information about Overdrive performance levels.
/// This structure is used by the ADL_Overdrive5_ODPerformanceLevels_Get() and ADL_Overdrive5_ODPerformanceLevels_Set() functions.
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct ADLODPerformanceLevels
{
/// Must be set to sizeof( \ref ADLODPerformanceLevels ) + sizeof( \ref ADLODPerformanceLevel ) * (ADLODParameters.iNumberOfPerformanceLevels - 1)
int iSize;
int iReserved;
/// Array of performance state descriptors. Must have ADLODParameters.iNumberOfPerformanceLevels elements.
ADLODPerformanceLevel aLevels [1];
} ADLODPerformanceLevels;
/////////////////////////////////////////////////////////////////////////////////////////////
///\brief Structure containing information about Performance Metrics data
///
/// This structure is used to store information about Performance Metrics data output
/// \nosubgrouping
////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ADLSingleSensorData
{
int supported;
int value;
} ADLSingleSensorData;
typedef struct _ADLPMLogDataOutput
{
int size;
ADLSingleSensorData sensors[ADL_PMLOG_MAX_SENSORS];
}ADLPMLogDataOutput;
typedef enum _ADLSensorType
{
SENSOR_MAXTYPES = 0,
PMLOG_CLK_GFXCLK = 1,
PMLOG_CLK_MEMCLK = 2,
PMLOG_CLK_SOCCLK = 3,
PMLOG_CLK_UVDCLK1 = 4,
PMLOG_CLK_UVDCLK2 = 5,
PMLOG_CLK_VCECLK = 6,
PMLOG_CLK_VCNCLK = 7,
PMLOG_TEMPERATURE_EDGE = 8,
PMLOG_TEMPERATURE_MEM = 9,
PMLOG_TEMPERATURE_VRVDDC = 10,
PMLOG_TEMPERATURE_VRMVDD = 11,
PMLOG_TEMPERATURE_LIQUID = 12,
PMLOG_TEMPERATURE_PLX = 13,
PMLOG_FAN_RPM = 14,
PMLOG_FAN_PERCENTAGE = 15,
PMLOG_SOC_VOLTAGE = 16,
PMLOG_SOC_POWER = 17,
PMLOG_SOC_CURRENT = 18,
PMLOG_INFO_ACTIVITY_GFX = 19,
PMLOG_INFO_ACTIVITY_MEM = 20,
PMLOG_GFX_VOLTAGE = 21,
PMLOG_MEM_VOLTAGE = 22,
PMLOG_ASIC_POWER = 23,
PMLOG_TEMPERATURE_VRSOC = 24,
PMLOG_TEMPERATURE_VRMVDD0 = 25,
PMLOG_TEMPERATURE_VRMVDD1 = 26,
PMLOG_TEMPERATURE_HOTSPOT = 27,
PMLOG_TEMPERATURE_GFX = 28,
PMLOG_TEMPERATURE_SOC = 29,
PMLOG_GFX_POWER = 30,
PMLOG_GFX_CURRENT = 31,
PMLOG_TEMPERATURE_CPU = 32,
PMLOG_CPU_POWER = 33,
PMLOG_CLK_CPUCLK = 34,
PMLOG_THROTTLER_STATUS = 35,
PMLOG_CLK_VCN1CLK1 = 36,
PMLOG_CLK_VCN1CLK2 = 37,
PMLOG_SMART_POWERSHIFT_CPU = 38,
PMLOG_SMART_POWERSHIFT_DGPU = 39,
PMLOG_MAX_SENSORS_REAL
} ADLSensorType;
/// \brief Handle to ADL client context.
///
/// ADL clients obtain context handle from initial call to \ref ADL2_Main_Control_Create.
/// Clients have to pass the handle to each subsequent ADL call and finally destroy
/// the context with call to \ref ADL2_Main_Control_Destroy
/// \nosubgrouping
typedef void *ADL_CONTEXT_HANDLE;
#if defined (__MSC_VER)
#define ADL_API_CALL __cdecl
#elif defined (_WIN32) || defined (__WIN32__)
@ -251,62 +625,53 @@ typedef void* (ADL_API_CALL *ADL_MAIN_MALLOC_CALLBACK )( int );
typedef int HM_ADAPTER_ADL;
typedef struct struct_ADLOD6MemClockState
{
ADLOD6StateInfo state;
ADLOD6PerformanceLevel level;
} ADLOD6MemClockState;
typedef int (ADL_API_CALL *ADL_MAIN_CONTROL_DESTROY) (void);
typedef int (ADL_API_CALL *ADL_MAIN_CONTROL_CREATE) (ADL_MAIN_MALLOC_CALLBACK, int);
typedef int (ADL_API_CALL *ADL_ADAPTER_NUMBEROFADAPTERS_GET) (int *);
typedef int (ADL_API_CALL *ADL_ADAPTER_ADAPTERINFO_GET) (LPAdapterInfo, int);
typedef int (ADL_API_CALL *ADL_DISPLAY_DISPLAYINFO_GET) (int, int *, ADLDisplayInfo **, int);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_TEMPERATURE_GET) (int, int, ADLTemperature *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TEMPERATURE_GET) (int, int *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_CURRENTACTIVITY_GET) (int, ADLPMActivity *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_THERMALDEVICES_ENUM) (int, int, ADLThermalControllerInfo *);
typedef int (ADL_API_CALL *ADL_ADAPTER_ID_GET) (int, int *);
typedef int (ADL_API_CALL *ADL_ADAPTER_VIDEOBIOSINFO_GET) (int, ADLBiosInfo *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_FANSPEEDINFO_GET) (int, int, ADLFanSpeedInfo *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_FANSPEED_GET) (int, int, ADLFanSpeedValue *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_FANSPEED_GET) (int, ADLOD6FanSpeedInfo *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_ODPARAMETERS_GET) (int, ADLODParameters *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET) (int, int, ADLODPerformanceLevels *);
typedef int (ADL_API_CALL *ADL_ADAPTER_ACTIVE_GET) (int, int *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE_CAPS) (int, int *, int *, int *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_CURRENTSTATUS_GET) (int, ADLOD6CurrentStatus *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_STATEINFO_GET) (int, int, ADLOD6MemClockState *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_CAPABILITIES_GET) (int, ADLOD6Capabilities *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET) (int, int *, int *);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET) (int, ADLOD6ParameterRange *);
typedef int (ADL_API_CALL *ADL_ADAPTER_ACTIVE_GET ) ( int, int* );
typedef int (ADL_API_CALL *ADL_ADAPTER_ADAPTERINFO_GET ) ( LPAdapterInfo, int );
typedef int (ADL_API_CALL *ADL_ADAPTER_NUMBEROFADAPTERS_GET ) ( int* );
typedef int (ADL_API_CALL *ADL_DISPLAY_DISPLAYINFO_GET ) ( int, int *, ADLDisplayInfo **, int );
typedef int (ADL_API_CALL *ADL_MAIN_CONTROL_CREATE )(ADL_MAIN_MALLOC_CALLBACK, int );
typedef int (ADL_API_CALL *ADL_MAIN_CONTROL_DESTROY )();
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_CURRENTACTIVITY_GET ) (int iAdapterIndex, ADLPMActivity *lpActivity);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_FANSPEEDINFO_GET ) (int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_FANSPEED_GET ) (int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_ODPARAMETERS_GET ) (int iAdapterIndex, ADLODParameters *lpOdParameters);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET ) (int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_TEMPERATURE_GET ) (int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature);
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_THERMALDEVICES_ENUM ) (int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_CAPABILITIES_GET ) (int iAdapterIndex, ADLOD6Capabilities *lpODCapabilities);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_CURRENTSTATUS_GET )(int iAdapterIndex, ADLOD6CurrentStatus *lpCurrentStatus);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_FANSPEED_GET )(int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_STATEINFO_GET )(int iAdapterIndex, int iStateType, ADLOD6StateInfo *lpStateInfo);
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TEMPERATURE_GET )(int iAdapterIndex, int *lpTemperature);
typedef int (ADL_API_CALL *ADL_OVERDRIVE_CAPS ) (int iAdapterIndex, int *iSupported, int *iEnabled, int *iVersion);
typedef int (ADL_API_CALL *ADL2_OVERDRIVE_CAPS) (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * iSupported, int * iEnabled, int * iVersion);
typedef int (ADL_API_CALL *ADL2_NEW_QUERYPMLOGDATA_GET) (ADL_CONTEXT_HANDLE, int, ADLPMLogDataOutput*);
typedef struct hm_adl_lib
{
hc_dynlib_t lib;
ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy;
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get;
ADL_ADAPTER_ACTIVE_GET ADL_Adapter_Active_Get;
ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get;
ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get;
ADL_DISPLAY_DISPLAYINFO_GET ADL_Display_DisplayInfo_Get;
ADL_ADAPTER_ID_GET ADL_Adapter_ID_Get;
ADL_ADAPTER_VIDEOBIOSINFO_GET ADL_Adapter_VideoBiosInfo_Get;
ADL_OVERDRIVE5_THERMALDEVICES_ENUM ADL_Overdrive5_ThermalDevices_Enum;
ADL_OVERDRIVE5_TEMPERATURE_GET ADL_Overdrive5_Temperature_Get;
ADL_OVERDRIVE6_TEMPERATURE_GET ADL_Overdrive6_Temperature_Get;
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy;
ADL_OVERDRIVE5_CURRENTACTIVITY_GET ADL_Overdrive5_CurrentActivity_Get;
ADL_OVERDRIVE5_FANSPEEDINFO_GET ADL_Overdrive5_FanSpeedInfo_Get;
ADL_OVERDRIVE5_FANSPEED_GET ADL_Overdrive5_FanSpeed_Get;
ADL_OVERDRIVE6_FANSPEED_GET ADL_Overdrive6_FanSpeed_Get;
ADL_ADAPTER_ACTIVE_GET ADL_Adapter_Active_Get;
ADL_OVERDRIVE_CAPS ADL_Overdrive_Caps;
ADL_OVERDRIVE5_ODPARAMETERS_GET ADL_Overdrive5_ODParameters_Get;
ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET ADL_Overdrive5_ODPerformanceLevels_Get;
ADL_OVERDRIVE5_TEMPERATURE_GET ADL_Overdrive5_Temperature_Get;
ADL_OVERDRIVE5_THERMALDEVICES_ENUM ADL_Overdrive5_ThermalDevices_Enum;
ADL_OVERDRIVE6_CAPABILITIES_GET ADL_Overdrive6_Capabilities_Get;
ADL_OVERDRIVE6_STATEINFO_GET ADL_Overdrive6_StateInfo_Get;
ADL_OVERDRIVE6_CURRENTSTATUS_GET ADL_Overdrive6_CurrentStatus_Get;
ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET ADL_Overdrive6_TargetTemperatureData_Get;
ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET ADL_Overdrive6_TargetTemperatureRangeInfo_Get;
ADL_OVERDRIVE6_FANSPEED_GET ADL_Overdrive6_FanSpeed_Get;
ADL_OVERDRIVE6_STATEINFO_GET ADL_Overdrive6_StateInfo_Get;
ADL_OVERDRIVE6_TEMPERATURE_GET ADL_Overdrive6_Temperature_Get;
ADL_OVERDRIVE_CAPS ADL_Overdrive_Caps;
ADL2_OVERDRIVE_CAPS ADL2_Overdrive_Caps;
ADL2_NEW_QUERYPMLOGDATA_GET ADL2_New_QueryPMLogData_Get;
} hm_adl_lib_t;
@ -326,6 +691,8 @@ int hm_ADL_Overdrive_CurrentActivity_Get (void *hashcat_ctx, int iAdapterIndex,
int hm_ADL_Overdrive5_FanSpeed_Get (void *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
int hm_ADL_Overdrive6_FanSpeed_Get (void *hashcat_ctx, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo);
int hm_ADL_Overdrive_Caps (void *hashcat_ctx, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version);
int hm_ADL_Overdrive6_TargetTemperatureData_Get (void *hashcat_ctx, int iAdapterIndex, int *cur_temp, int *default_temp);
int hm_ADL2_Overdrive_Caps (void *hashcat_ctx, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version);
int hm_ADL2_New_QueryPMLogData_Get (void *hashcat_ctx, int iAdapterIndex, ADLPMLogDataOutput *lpDataOutput);
#endif // _EXT_ADL_H

View File

@ -1799,8 +1799,6 @@ typedef struct hwmon_ctx
hm_attrs_t *hm_device;
ADLOD6MemClockState *od_clock_mem_status;
} hwmon_ctx_t;
#if defined (__APPLE__)

View File

@ -50,27 +50,27 @@ int adl_init (void *hashcat_ctx)
return -1;
}
HC_LOAD_FUNC(adl, ADL_Main_Control_Destroy, ADL_MAIN_CONTROL_DESTROY, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Main_Control_Create, ADL_MAIN_CONTROL_CREATE, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_NumberOfAdapters_Get, ADL_ADAPTER_NUMBEROFADAPTERS_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_Active_Get, ADL_ADAPTER_ACTIVE_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_AdapterInfo_Get, ADL_ADAPTER_ADAPTERINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_NumberOfAdapters_Get, ADL_ADAPTER_NUMBEROFADAPTERS_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Display_DisplayInfo_Get, ADL_DISPLAY_DISPLAYINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_ID_Get, ADL_ADAPTER_ID_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_VideoBiosInfo_Get, ADL_ADAPTER_VIDEOBIOSINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_ThermalDevices_Enum, ADL_OVERDRIVE5_THERMALDEVICES_ENUM, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_Temperature_Get, ADL_OVERDRIVE5_TEMPERATURE_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_Temperature_Get, ADL_OVERDRIVE6_TEMPERATURE_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Main_Control_Create, ADL_MAIN_CONTROL_CREATE, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Main_Control_Destroy, ADL_MAIN_CONTROL_DESTROY, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_CurrentActivity_Get, ADL_OVERDRIVE5_CURRENTACTIVITY_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeedInfo_Get, ADL_OVERDRIVE5_FANSPEEDINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeed_Get, ADL_OVERDRIVE5_FANSPEED_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Get, ADL_OVERDRIVE6_FANSPEED_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_Active_Get, ADL_ADAPTER_ACTIVE_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive_Caps, ADL_OVERDRIVE_CAPS, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODParameters_Get, ADL_OVERDRIVE5_ODPARAMETERS_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODPerformanceLevels_Get, ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_Temperature_Get, ADL_OVERDRIVE5_TEMPERATURE_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_ThermalDevices_Enum, ADL_OVERDRIVE5_THERMALDEVICES_ENUM, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_Capabilities_Get, ADL_OVERDRIVE6_CAPABILITIES_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_StateInfo_Get, ADL_OVERDRIVE6_STATEINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_CurrentStatus_Get, ADL_OVERDRIVE6_CURRENTSTATUS_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_TargetTemperatureData_Get, ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_TargetTemperatureRangeInfo_Get, ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Get, ADL_OVERDRIVE6_FANSPEED_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_StateInfo_Get, ADL_OVERDRIVE6_STATEINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_Temperature_Get, ADL_OVERDRIVE6_TEMPERATURE_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive_Caps, ADL_OVERDRIVE_CAPS, ADL, 0);
HC_LOAD_FUNC(adl, ADL2_Overdrive_Caps, ADL2_OVERDRIVE_CAPS, ADL, 1);
HC_LOAD_FUNC(adl, ADL2_New_QueryPMLogData_Get, ADL2_NEW_QUERYPMLOGDATA_GET, ADL, 1);
return 0;
}
@ -270,17 +270,42 @@ int hm_ADL_Overdrive_Caps (void *hashcat_ctx, int iAdapterIndex, int *od_support
return 0;
}
int hm_ADL_Overdrive6_TargetTemperatureData_Get (void *hashcat_ctx, int iAdapterIndex, int *cur_temp, int *default_temp)
int hm_ADL2_Overdrive_Caps (void *hashcat_ctx, int iAdapterIndex, int *iSupported, int *iEnabled, int *iVersion)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Overdrive6_TargetTemperatureData_Get (iAdapterIndex, cur_temp, default_temp);
// Not sure if that makes any sense...
if (adl->ADL2_Overdrive_Caps == NULL)
{
return hm_ADL_Overdrive_Caps (hashcat_ctx, iAdapterIndex, iSupported, iEnabled, iVersion);
}
const int ADL_rc = adl->ADL2_Overdrive_Caps (NULL, iAdapterIndex, iSupported, iEnabled, iVersion);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Overdrive6_TargetTemperatureData_Get(): %d", ADL_rc);
event_log_error (hashcat_ctx, "ADL2_Overdrive_Caps(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL2_New_QueryPMLogData_Get (void *hashcat_ctx, int iAdapterIndex, ADLPMLogDataOutput *lpDataOutput)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL2_New_QueryPMLogData_Get (NULL, iAdapterIndex, lpDataOutput);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL2_New_QueryPMLogData_Get(): %d", ADL_rc);
return -1;
}

View File

@ -109,19 +109,7 @@ int hm_get_threshold_slowdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, cons
}
else if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6)
{
int CurrentValue = 0;
int DefaultValue = 0;
if (hm_ADL_Overdrive6_TargetTemperatureData_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &CurrentValue, &DefaultValue) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].threshold_slowdown_get_supported = false;
return -1;
}
// the return value has never been tested since hm_ADL_Overdrive6_TargetTemperatureData_Get() never worked on any system. expect problems.
return DefaultValue;
}
}
}
@ -346,6 +334,22 @@ int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
return Temperature / 1000;
}
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 8)
{
ADLPMLogDataOutput odlpDataOutput;
memset (&odlpDataOutput, 0, sizeof (ADLPMLogDataOutput));
if (hm_ADL2_New_QueryPMLogData_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &odlpDataOutput) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false;
return -1;
}
return odlpDataOutput.sensors[PMLOG_TEMPERATURE_EDGE].value;
}
}
if (hwmon_ctx->hm_sysfs_amdgpu)
@ -431,8 +435,37 @@ int hm_get_fanpolicy_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int bac
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6)
{
ADLOD6FanSpeedInfo lpFanSpeedInfo;
memset (&lpFanSpeedInfo, 0, sizeof (lpFanSpeedInfo));
if (hm_ADL_Overdrive6_FanSpeed_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &lpFanSpeedInfo) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].fanpolicy_get_supported = false;
hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false;
return -1;
}
return 1;
}
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 8)
{
ADLPMLogDataOutput odlpDataOutput;
memset (&odlpDataOutput, 0, sizeof (ADLPMLogDataOutput));
if (hm_ADL2_New_QueryPMLogData_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &odlpDataOutput) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].fanpolicy_get_supported = false;
hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false;
return -1;
}
return odlpDataOutput.sensors[PMLOG_FAN_PERCENTAGE].supported;
}
}
if (hwmon_ctx->hm_sysfs_amdgpu)
@ -542,6 +575,22 @@ int hm_get_fanspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back
return faninfo.iFanSpeedPercent;
}
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 8)
{
ADLPMLogDataOutput odlpDataOutput;
memset (&odlpDataOutput, 0, sizeof (ADLPMLogDataOutput));
if (hm_ADL2_New_QueryPMLogData_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &odlpDataOutput) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false;
return -1;
}
return odlpDataOutput.sensors[PMLOG_FAN_PERCENTAGE].value;
}
}
if (hwmon_ctx->hm_sysfs_amdgpu)
@ -617,18 +666,23 @@ int hm_get_buslanes_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back
{
if (hwmon_ctx->hm_adl)
{
ADLPMActivity PMActivity;
PMActivity.iSize = sizeof (ADLPMActivity);
if (hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &PMActivity) == -1)
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5)
{
hwmon_ctx->hm_device[backend_device_idx].buslanes_get_supported = false;
ADLPMActivity PMActivity;
return -1;
PMActivity.iSize = sizeof (ADLPMActivity);
if (hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &PMActivity) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].buslanes_get_supported = false;
return -1;
}
return PMActivity.iCurrentBusLanes;
}
return PMActivity.iCurrentBusLanes;
// NO OD8
}
if (hwmon_ctx->hm_sysfs_amdgpu)
@ -704,18 +758,37 @@ int hm_get_utilization_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
{
if (hwmon_ctx->hm_adl)
{
ADLPMActivity PMActivity;
PMActivity.iSize = sizeof (ADLPMActivity);
if (hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &PMActivity) == -1)
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5)
{
hwmon_ctx->hm_device[backend_device_idx].utilization_get_supported = false;
ADLPMActivity PMActivity;
return -1;
PMActivity.iSize = sizeof (ADLPMActivity);
if (hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &PMActivity) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].utilization_get_supported = false;
return -1;
}
return PMActivity.iActivityPercent;
}
return PMActivity.iActivityPercent;
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 8)
{
ADLPMLogDataOutput odlpDataOutput;
memset (&odlpDataOutput, 0, sizeof (ADLPMLogDataOutput));
if (hm_ADL2_New_QueryPMLogData_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &odlpDataOutput) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].utilization_get_supported = false;
return -1;
}
return odlpDataOutput.sensors[PMLOG_INFO_ACTIVITY_GFX].value;
}
}
if (hwmon_ctx->hm_sysfs_amdgpu)
@ -808,18 +881,37 @@ int hm_get_memoryspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
{
if (hwmon_ctx->hm_adl)
{
ADLPMActivity PMActivity;
PMActivity.iSize = sizeof (ADLPMActivity);
if (hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &PMActivity) == -1)
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5)
{
hwmon_ctx->hm_device[backend_device_idx].memoryspeed_get_supported = false;
ADLPMActivity PMActivity;
return -1;
PMActivity.iSize = sizeof (ADLPMActivity);
if (hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &PMActivity) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].memoryspeed_get_supported = false;
return -1;
}
return PMActivity.iMemoryClock / 100;
}
return PMActivity.iMemoryClock / 100;
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 8)
{
ADLPMLogDataOutput odlpDataOutput;
memset (&odlpDataOutput, 0, sizeof (ADLPMLogDataOutput));
if (hm_ADL2_New_QueryPMLogData_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &odlpDataOutput) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].memoryspeed_get_supported = false;
return -1;
}
return odlpDataOutput.sensors[PMLOG_CLK_MEMCLK].value;
}
}
if (hwmon_ctx->hm_sysfs_amdgpu)
@ -895,18 +987,37 @@ int hm_get_corespeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int bac
{
if (hwmon_ctx->hm_adl)
{
ADLPMActivity PMActivity;
PMActivity.iSize = sizeof (ADLPMActivity);
if (hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &PMActivity) == -1)
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5)
{
hwmon_ctx->hm_device[backend_device_idx].corespeed_get_supported = false;
ADLPMActivity PMActivity;
return -1;
PMActivity.iSize = sizeof (ADLPMActivity);
if (hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &PMActivity) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].corespeed_get_supported = false;
return -1;
}
return PMActivity.iEngineClock / 100;
}
return PMActivity.iEngineClock / 100;
if (hwmon_ctx->hm_device[backend_device_idx].od_version == 8)
{
ADLPMLogDataOutput odlpDataOutput;
memset (&odlpDataOutput, 0, sizeof (ADLPMLogDataOutput));
if (hm_ADL2_New_QueryPMLogData_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &odlpDataOutput) == -1)
{
hwmon_ctx->hm_device[backend_device_idx].corespeed_get_supported = false;
return -1;
}
return odlpDataOutput.sensors[PMLOG_CLK_GFXCLK].value;
}
}
if (hwmon_ctx->hm_sysfs_amdgpu)
@ -1400,7 +1511,9 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
int od_enabled = 0;
int od_version = 0;
hm_ADL_Overdrive_Caps (hashcat_ctx, lpAdapterInfo[i].iAdapterIndex, &od_supported, &od_enabled, &od_version);
hm_ADL2_Overdrive_Caps (hashcat_ctx, lpAdapterInfo[i].iAdapterIndex, &od_supported, &od_enabled, &od_version);
if (od_version < 8) od_version = 5;
hm_adapters_adl[device_id].od_version = od_version;
@ -1534,12 +1647,6 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
hwmon_ctx->enabled = true;
/**
* save buffer required for later restores
*/
hwmon_ctx->od_clock_mem_status = (ADLOD6MemClockState *) hccalloc (backend_ctx->backend_devices_cnt, sizeof (ADLOD6MemClockState));
/**
* HM devices: copy
*/
@ -1795,8 +1902,6 @@ void hwmon_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
// free memory
hcfree (hwmon_ctx->od_clock_mem_status);
hcfree (hwmon_ctx->hm_device);
memset (hwmon_ctx, 0, sizeof (hwmon_ctx_t));