diff --git a/docs/changes.txt b/docs/changes.txt index b73cb00d3..709ca8706 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -44,6 +44,7 @@ - Alias Devices: Show a warning in case the user specifically listed a device to use which in a later step is skipped because it is an alias of another active device - Backend Information: Added new column showing the PCI Address per CUDA/OpenCL device to easier identify broken cards +- CPU Affinity: Allow mask up to 64 processors in Windows and remove call to SetThreadAffinityMask as SetProcessAffinityMask limits all threads in process - Debug Rules: HEX-ify rules debug non-rules outputs that contain colons - KeePass: Increase supported size for KeePass 1 databases from 300kB to 16MB - Potfile: Disable potfile for hash-mode 99999 diff --git a/src/hwmon.c b/src/hwmon.c index 093b7b3bd..0810d7956 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -97,49 +97,50 @@ int hm_get_threshold_slowdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, cons if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (hwmon_ctx->hm_adl) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) { - if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) - { - - } - else if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6) + if (hwmon_ctx->hm_adl) { - 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) + if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) { - hwmon_ctx->hm_device[backend_device_idx].threshold_slowdown_get_supported = false; - return -1; } + 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. + // the return value has never been tested since hm_ADL_Overdrive6_TargetTemperatureData_Get() never worked on any system. expect problems. - return DefaultValue; + return DefaultValue; + } } } - } - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - if (hwmon_ctx->hm_nvml) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { - int target = 0; - - if (hm_NVML_nvmlDeviceGetTemperatureThreshold (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, (unsigned int *) &target) == -1) + if (hwmon_ctx->hm_nvml) { - hwmon_ctx->hm_device[backend_device_idx].threshold_slowdown_get_supported = false; + int target = 0; - return -1; - } + if (hm_NVML_nvmlDeviceGetTemperatureThreshold (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, (unsigned int *) &target) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].threshold_slowdown_get_supported = false; + + return -1; + } - return target; + return target; + } } } } @@ -177,37 +178,38 @@ int hm_get_threshold_shutdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, cons if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (hwmon_ctx->hm_adl) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) { - if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) + if (hwmon_ctx->hm_adl) { + if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) + { - } - else if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6) - { + } + else if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6) + { + } } } - } - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - if (hwmon_ctx->hm_nvml) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { - int target = 0; - - if (hm_NVML_nvmlDeviceGetTemperatureThreshold (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_TEMPERATURE_THRESHOLD_SHUTDOWN, (unsigned int *) &target) == -1) + if (hwmon_ctx->hm_nvml) { - hwmon_ctx->hm_device[backend_device_idx].threshold_shutdown_get_supported = false; + int target = 0; - return -1; - } + if (hm_NVML_nvmlDeviceGetTemperatureThreshold (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_TEMPERATURE_THRESHOLD_SHUTDOWN, (unsigned int *) &target) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].threshold_shutdown_get_supported = false; - return target; + return -1; + } + + return target; + } } } } @@ -245,104 +247,123 @@ int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - #if defined (__APPLE__) - if (backend_ctx->devices_param[backend_device_idx].opencl_platform_vendor_id == VENDOR_ID_APPLE) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_CPU) { - if (hwmon_ctx->hm_iokit) + #if defined (__APPLE__) + if (backend_ctx->devices_param[backend_device_idx].opencl_platform_vendor_id == VENDOR_ID_APPLE) { - double temperature = 0.0; - - char *key = NULL; - - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) key = HM_IOKIT_SMC_CPU_PROXIMITY; - else + if (hwmon_ctx->hm_iokit) { - key = HM_IOKIT_SMC_GPU_PROXIMITY; + double temperature = 0.0; - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_INTEL_BEIGNET) + char *key = HM_IOKIT_SMC_CPU_PROXIMITY; + + if (hm_IOKIT_SMCGetTemperature(hashcat_ctx, key, &temperature) == -1) { - key = HM_IOKIT_SMC_PECI_GPU; - } - } + hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false; - if (hm_IOKIT_SMCGetTemperature(hashcat_ctx, key, &temperature) == -1) - { - hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false; + return -1; + } - return -1; + return (int) temperature; } - - return (int) temperature; } + #endif } - #else - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - #endif - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (hwmon_ctx->hm_adl) + #if defined (__APPLE__) + if (backend_ctx->devices_param[backend_device_idx].opencl_platform_vendor_id == VENDOR_ID_APPLE) { - if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) + if (hwmon_ctx->hm_iokit) { - ADLTemperature Temperature; + double temperature = 0.0; - Temperature.iSize = sizeof (ADLTemperature); + char *key = HM_IOKIT_SMC_GPU_PROXIMITY; - if (hm_ADL_Overdrive5_Temperature_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, 0, &Temperature) == -1) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_INTEL_BEIGNET) + { + key = HM_IOKIT_SMC_PECI_GPU; + } + + if (hm_IOKIT_SMCGetTemperature (hashcat_ctx, key, &temperature) == -1) { hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false; return -1; } - return Temperature.iTemperature / 1000; + return (int) temperature; + } + } + #endif + + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + { + if (hwmon_ctx->hm_adl) + { + if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) + { + ADLTemperature Temperature; + + Temperature.iSize = sizeof (ADLTemperature); + + if (hm_ADL_Overdrive5_Temperature_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, 0, &Temperature) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false; + + return -1; + } + + return Temperature.iTemperature / 1000; + } + + if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6) + { + int Temperature = 0; + + if (hm_ADL_Overdrive6_Temperature_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &Temperature) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false; + + return -1; + } + + return Temperature / 1000; + } } - if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6) + if (hwmon_ctx->hm_sysfs) { - int Temperature = 0; + int temperature = 0; - if (hm_ADL_Overdrive6_Temperature_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &Temperature) == -1) + if (hm_SYSFS_get_temperature_current (hashcat_ctx, backend_device_idx, &temperature) == -1) { hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false; return -1; } - return Temperature / 1000; + return temperature; } } - if (hwmon_ctx->hm_sysfs) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { - int temperature = 0; - - if (hm_SYSFS_get_temperature_current (hashcat_ctx, backend_device_idx, &temperature) == -1) + if (hwmon_ctx->hm_nvml) { - hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false; - - return -1; - } - - return temperature; - } - } + int temperature = 0; - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - if (hwmon_ctx->hm_nvml) - { - int temperature = 0; + if (hm_NVML_nvmlDeviceGetTemperature (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_TEMPERATURE_GPU, (u32 *) &temperature) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false; - if (hm_NVML_nvmlDeviceGetTemperature (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_TEMPERATURE_GPU, (u32 *) &temperature) == -1) - { - hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false; + return -1; + } - return -1; + return temperature; } - - return temperature; } } } @@ -368,48 +389,49 @@ int hm_get_fanpolicy_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int bac if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (hwmon_ctx->hm_adl) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) { - if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) + if (hwmon_ctx->hm_adl) { - ADLFanSpeedValue lpFanSpeedValue; + if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) + { + ADLFanSpeedValue lpFanSpeedValue; - memset (&lpFanSpeedValue, 0, sizeof (lpFanSpeedValue)); + memset (&lpFanSpeedValue, 0, sizeof (lpFanSpeedValue)); - lpFanSpeedValue.iSize = sizeof (lpFanSpeedValue); - lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT; + lpFanSpeedValue.iSize = sizeof (lpFanSpeedValue); + lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT; - if (hm_ADL_Overdrive5_FanSpeed_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, 0, &lpFanSpeedValue) == -1) - { - hwmon_ctx->hm_device[backend_device_idx].fanpolicy_get_supported = false; - hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false; + if (hm_ADL_Overdrive5_FanSpeed_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, 0, &lpFanSpeedValue) == -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; + } + + return (lpFanSpeedValue.iFanSpeed & ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED) ? 0 : 1; } - return (lpFanSpeedValue.iFanSpeed & ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED) ? 0 : 1; + if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6) + { + return 1; + } } - if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6) + if (hwmon_ctx->hm_sysfs) { return 1; } } - if (hwmon_ctx->hm_sysfs) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { return 1; } } - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - return 1; - } } hwmon_ctx->hm_device[backend_device_idx].fanpolicy_get_supported = false; @@ -421,7 +443,7 @@ int hm_get_fanpolicy_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int bac #if defined(__APPLE__) int hm_get_fanspeed_apple (hashcat_ctx_t *hashcat_ctx, char *fan_speed_buf) { - hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; + hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; if (hwmon_ctx->enabled == false) return -1; @@ -465,78 +487,79 @@ int hm_get_fanspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (hwmon_ctx->hm_adl) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) { - if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) + if (hwmon_ctx->hm_adl) { - ADLFanSpeedValue lpFanSpeedValue; + if (hwmon_ctx->hm_device[backend_device_idx].od_version == 5) + { + ADLFanSpeedValue lpFanSpeedValue; - memset (&lpFanSpeedValue, 0, sizeof (lpFanSpeedValue)); + memset (&lpFanSpeedValue, 0, sizeof (lpFanSpeedValue)); - lpFanSpeedValue.iSize = sizeof (lpFanSpeedValue); - lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT; - lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED; + lpFanSpeedValue.iSize = sizeof (lpFanSpeedValue); + lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT; + lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED; - if (hm_ADL_Overdrive5_FanSpeed_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, 0, &lpFanSpeedValue) == -1) - { - hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false; + if (hm_ADL_Overdrive5_FanSpeed_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, 0, &lpFanSpeedValue) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false; - return -1; + return -1; + } + + return lpFanSpeedValue.iFanSpeed; } - return lpFanSpeedValue.iFanSpeed; + if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6) + { + ADLOD6FanSpeedInfo faninfo; + + memset (&faninfo, 0, sizeof (faninfo)); + + if (hm_ADL_Overdrive6_FanSpeed_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &faninfo) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false; + + return -1; + } + + return faninfo.iFanSpeedPercent; + } } - if (hwmon_ctx->hm_device[backend_device_idx].od_version == 6) + if (hwmon_ctx->hm_sysfs) { - ADLOD6FanSpeedInfo faninfo; - - memset (&faninfo, 0, sizeof (faninfo)); + int speed = 0; - if (hm_ADL_Overdrive6_FanSpeed_Get (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].adl, &faninfo) == -1) + if (hm_SYSFS_get_fan_speed_current (hashcat_ctx, backend_device_idx, &speed) == -1) { hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false; return -1; } - return faninfo.iFanSpeedPercent; + return speed; } } - if (hwmon_ctx->hm_sysfs) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { - int speed = 0; - - if (hm_SYSFS_get_fan_speed_current (hashcat_ctx, backend_device_idx, &speed) == -1) + if (hwmon_ctx->hm_nvml) { - hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false; - - return -1; - } + int speed = 0; - return speed; - } - } - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - if (hwmon_ctx->hm_nvml) - { - int speed = 0; + if (hm_NVML_nvmlDeviceGetFanSpeed (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, (u32 *) &speed) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false; - if (hm_NVML_nvmlDeviceGetFanSpeed (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, (u32 *) &speed) == -1) - { - hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false; + return -1; + } - return -1; + return speed; } - - return speed; } } } @@ -574,55 +597,56 @@ int hm_get_buslanes_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (hwmon_ctx->hm_adl) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) { - ADLPMActivity PMActivity; + if (hwmon_ctx->hm_adl) + { + ADLPMActivity PMActivity; - PMActivity.iSize = sizeof (ADLPMActivity); + 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; + 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 -1; + return PMActivity.iCurrentBusLanes; } - return PMActivity.iCurrentBusLanes; - } + if (hwmon_ctx->hm_sysfs) + { + int lanes; - if (hwmon_ctx->hm_sysfs) - { - int lanes; + if (hm_SYSFS_get_pp_dpm_pcie (hashcat_ctx, backend_device_idx, &lanes) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].buslanes_get_supported = false; - if (hm_SYSFS_get_pp_dpm_pcie (hashcat_ctx, backend_device_idx, &lanes) == -1) - { - hwmon_ctx->hm_device[backend_device_idx].buslanes_get_supported = false; + return -1; + } - return -1; + return lanes; } - - return lanes; } - } - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - if (hwmon_ctx->hm_nvml) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { - unsigned int currLinkWidth; - - if (hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, &currLinkWidth) == -1) + if (hwmon_ctx->hm_nvml) { - hwmon_ctx->hm_device[backend_device_idx].buslanes_get_supported = false; + unsigned int currLinkWidth; - return -1; - } + if (hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, &currLinkWidth) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].buslanes_get_supported = false; + + return -1; + } - return currLinkWidth; + return currLinkWidth; + } } } } @@ -660,55 +684,56 @@ int hm_get_utilization_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (hwmon_ctx->hm_adl) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) { - ADLPMActivity PMActivity; + if (hwmon_ctx->hm_adl) + { + ADLPMActivity PMActivity; - PMActivity.iSize = sizeof (ADLPMActivity); + 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; + 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 -1; + return PMActivity.iActivityPercent; } - return PMActivity.iActivityPercent; - } + if (hwmon_ctx->hm_sysfs) + { + int util; - if (hwmon_ctx->hm_sysfs) - { - int util; + if (hm_SYSFS_get_gpu_busy_percent (hashcat_ctx, backend_device_idx, &util) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].utilization_get_supported = false; - if (hm_SYSFS_get_gpu_busy_percent (hashcat_ctx, backend_device_idx, &util) == -1) - { - hwmon_ctx->hm_device[backend_device_idx].utilization_get_supported = false; + return -1; + } - return -1; + return util; } - - return util; } - } - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - if (hwmon_ctx->hm_nvml) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { - nvmlUtilization_t utilization; - - if (hm_NVML_nvmlDeviceGetUtilizationRates (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, &utilization) == -1) + if (hwmon_ctx->hm_nvml) { - hwmon_ctx->hm_device[backend_device_idx].utilization_get_supported = false; + nvmlUtilization_t utilization; - return -1; - } + if (hm_NVML_nvmlDeviceGetUtilizationRates (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, &utilization) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].utilization_get_supported = false; - return utilization.gpu; + return -1; + } + + return utilization.gpu; + } } } } @@ -746,55 +771,56 @@ int hm_get_memoryspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (hwmon_ctx->hm_adl) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) { - ADLPMActivity PMActivity; + if (hwmon_ctx->hm_adl) + { + ADLPMActivity PMActivity; - PMActivity.iSize = sizeof (ADLPMActivity); + 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; + 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 -1; + } + + return PMActivity.iMemoryClock / 100; } - return PMActivity.iMemoryClock / 100; - } + if (hwmon_ctx->hm_sysfs) + { + int clockfreq; - if (hwmon_ctx->hm_sysfs) - { - int clockfreq; + if (hm_SYSFS_get_pp_dpm_mclk (hashcat_ctx, backend_device_idx, &clockfreq) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].memoryspeed_get_supported = false; - if (hm_SYSFS_get_pp_dpm_mclk (hashcat_ctx, backend_device_idx, &clockfreq) == -1) - { - hwmon_ctx->hm_device[backend_device_idx].memoryspeed_get_supported = false; + return -1; + } - return -1; + return clockfreq; } - - return clockfreq; } - } - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - if (hwmon_ctx->hm_nvml) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { - unsigned int clockfreq; - - if (hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_CLOCK_MEM, &clockfreq) == -1) + if (hwmon_ctx->hm_nvml) { - hwmon_ctx->hm_device[backend_device_idx].memoryspeed_get_supported = false; + unsigned int clockfreq; - return -1; - } + if (hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_CLOCK_MEM, &clockfreq) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].memoryspeed_get_supported = false; - return clockfreq; + return -1; + } + + return clockfreq; + } } } } @@ -832,55 +858,56 @@ int hm_get_corespeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int bac if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (hwmon_ctx->hm_adl) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) { - ADLPMActivity PMActivity; + if (hwmon_ctx->hm_adl) + { + ADLPMActivity PMActivity; - PMActivity.iSize = sizeof (ADLPMActivity); + 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; + 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 -1; + return PMActivity.iEngineClock / 100; } - return PMActivity.iEngineClock / 100; - } + if (hwmon_ctx->hm_sysfs) + { + int clockfreq; - if (hwmon_ctx->hm_sysfs) - { - int clockfreq; + if (hm_SYSFS_get_pp_dpm_sclk (hashcat_ctx, backend_device_idx, &clockfreq) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].corespeed_get_supported = false; - if (hm_SYSFS_get_pp_dpm_sclk (hashcat_ctx, backend_device_idx, &clockfreq) == -1) - { - hwmon_ctx->hm_device[backend_device_idx].corespeed_get_supported = false; + return -1; + } - return -1; + return clockfreq; } - - return clockfreq; } - } - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - if (hwmon_ctx->hm_nvml) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { - unsigned int clockfreq; - - if (hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_CLOCK_SM, &clockfreq) == -1) + if (hwmon_ctx->hm_nvml) { - hwmon_ctx->hm_device[backend_device_idx].corespeed_get_supported = false; + unsigned int clockfreq; - return -1; - } + if (hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, NVML_CLOCK_SM, &clockfreq) == -1) + { + hwmon_ctx->hm_device[backend_device_idx].corespeed_get_supported = false; - return clockfreq; + return -1; + } + + return clockfreq; + } } } } @@ -947,55 +974,56 @@ int hm_get_throttle_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back if (backend_ctx->devices_param[backend_device_idx].is_opencl == true) { - if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1; - - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) { - } + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD) + { + } - if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) - { - if (hwmon_ctx->hm_nvml) + if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_NV) { - /* this is triggered by mask generator, too. therefore useless - unsigned long long clocksThrottleReasons = 0; - unsigned long long supportedThrottleReasons = 0; + if (hwmon_ctx->hm_nvml) + { + /* this is triggered by mask generator, too. therefore useless + unsigned long long clocksThrottleReasons = 0; + unsigned long long supportedThrottleReasons = 0; - if (hm_NVML_nvmlDeviceGetCurrentClocksThrottleReasons (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, &clocksThrottleReasons) == -1) return -1; - if (hm_NVML_nvmlDeviceGetSupportedClocksThrottleReasons (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, &supportedThrottleReasons) == -1) return -1; + if (hm_NVML_nvmlDeviceGetCurrentClocksThrottleReasons (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, &clocksThrottleReasons) == -1) return -1; + if (hm_NVML_nvmlDeviceGetSupportedClocksThrottleReasons (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvml, &supportedThrottleReasons) == -1) return -1; - clocksThrottleReasons &= supportedThrottleReasons; - clocksThrottleReasons &= ~nvmlClocksThrottleReasonGpuIdle; - clocksThrottleReasons &= ~nvmlClocksThrottleReasonApplicationsClocksSetting; - clocksThrottleReasons &= ~nvmlClocksThrottleReasonUnknown; + clocksThrottleReasons &= supportedThrottleReasons; + clocksThrottleReasons &= ~nvmlClocksThrottleReasonGpuIdle; + clocksThrottleReasons &= ~nvmlClocksThrottleReasonApplicationsClocksSetting; + clocksThrottleReasons &= ~nvmlClocksThrottleReasonUnknown; - if (backend_ctx->kernel_power_final) - { - clocksThrottleReasons &= ~nvmlClocksThrottleReasonHwSlowdown; - } + if (backend_ctx->kernel_power_final) + { + clocksThrottleReasons &= ~nvmlClocksThrottleReasonHwSlowdown; + } - return (clocksThrottleReasons != nvmlClocksThrottleReasonNone); - */ - } + return (clocksThrottleReasons != nvmlClocksThrottleReasonNone); + */ + } - if (hwmon_ctx->hm_nvapi) - { - NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info; - NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status; + if (hwmon_ctx->hm_nvapi) + { + NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info; + NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status; - memset (&perfPolicies_info, 0, sizeof (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1)); - memset (&perfPolicies_status, 0, sizeof (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1)); + memset (&perfPolicies_info, 0, sizeof (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1)); + memset (&perfPolicies_status, 0, sizeof (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1)); - perfPolicies_info.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1, 1); - perfPolicies_status.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1, 1); + perfPolicies_info.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1, 1); + perfPolicies_status.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1, 1); - hm_NvAPI_GPU_GetPerfPoliciesInfo (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvapi, &perfPolicies_info); + hm_NvAPI_GPU_GetPerfPoliciesInfo (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvapi, &perfPolicies_info); - perfPolicies_status.info_value = perfPolicies_info.info_value; + perfPolicies_status.info_value = perfPolicies_info.info_value; - hm_NvAPI_GPU_GetPerfPoliciesStatus (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvapi, &perfPolicies_status); + hm_NvAPI_GPU_GetPerfPoliciesStatus (hashcat_ctx, hwmon_ctx->hm_device[backend_device_idx].nvapi, &perfPolicies_status); - return perfPolicies_status.throttle & 2; + return perfPolicies_status.throttle & 2; + } } } } @@ -1486,95 +1514,120 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx) if (device_param->is_opencl == true) { - #if defined(__APPLE__) - if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE) + if (device_param->opencl_device_type & CL_DEVICE_TYPE_CPU) { - if (hwmon_ctx->hm_iokit) + #if defined(__APPLE__) + if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE) { - hwmon_ctx->hm_device[backend_devices_idx].iokit = hm_adapters_iokit[device_id].iokit; - hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_iokit[device_id].buslanes_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_iokit[device_id].corespeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_iokit[device_id].fanspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_iokit[device_id].fanpolicy_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_iokit[device_id].memoryspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_iokit[device_id].temperature_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_iokit[device_id].threshold_shutdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_iokit[device_id].threshold_slowdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_iokit[device_id].throttle_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_iokit[device_id].utilization_get_supported; + if (hwmon_ctx->hm_iokit) + { + hwmon_ctx->hm_device[backend_devices_idx].iokit = hm_adapters_iokit[device_id].iokit; + hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_iokit[device_id].buslanes_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_iokit[device_id].corespeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_iokit[device_id].fanspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_iokit[device_id].fanpolicy_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_iokit[device_id].memoryspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_iokit[device_id].temperature_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_iokit[device_id].threshold_shutdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_iokit[device_id].threshold_slowdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_iokit[device_id].throttle_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_iokit[device_id].utilization_get_supported; + } } + #endif } - #else - if ((device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) continue; - #endif - if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD) - { - hwmon_ctx->hm_device[backend_devices_idx].adl = hm_adapters_adl[device_id].adl; - hwmon_ctx->hm_device[backend_devices_idx].sysfs = hm_adapters_sysfs[device_id].sysfs; - if (hwmon_ctx->hm_adl) + if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) + { + #if defined(__APPLE__) + if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE) { - hwmon_ctx->hm_device[backend_devices_idx].od_version = hm_adapters_adl[device_id].od_version; - - hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_adl[device_id].buslanes_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_adl[device_id].corespeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_adl[device_id].fanspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_adl[device_id].fanpolicy_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_adl[device_id].memoryspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_adl[device_id].temperature_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_adl[device_id].threshold_shutdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_adl[device_id].threshold_slowdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_adl[device_id].throttle_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_adl[device_id].utilization_get_supported; + if (hwmon_ctx->hm_iokit) + { + hwmon_ctx->hm_device[backend_devices_idx].iokit = hm_adapters_iokit[device_id].iokit; + hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_iokit[device_id].buslanes_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_iokit[device_id].corespeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_iokit[device_id].fanspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_iokit[device_id].fanpolicy_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_iokit[device_id].memoryspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_iokit[device_id].temperature_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_iokit[device_id].threshold_shutdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_iokit[device_id].threshold_slowdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_iokit[device_id].throttle_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_iokit[device_id].utilization_get_supported; + } } + #endif - if (hwmon_ctx->hm_sysfs) + if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD) { - hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_sysfs[device_id].buslanes_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_sysfs[device_id].corespeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_sysfs[device_id].fanspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_sysfs[device_id].fanpolicy_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_sysfs[device_id].memoryspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_sysfs[device_id].temperature_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_sysfs[device_id].threshold_shutdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_sysfs[device_id].threshold_slowdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_sysfs[device_id].throttle_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_sysfs[device_id].utilization_get_supported; - } - } + hwmon_ctx->hm_device[backend_devices_idx].adl = hm_adapters_adl[device_id].adl; + hwmon_ctx->hm_device[backend_devices_idx].sysfs = hm_adapters_sysfs[device_id].sysfs; - if (device_param->opencl_device_vendor_id == VENDOR_ID_NV) - { - hwmon_ctx->hm_device[backend_devices_idx].nvapi = hm_adapters_nvapi[device_id].nvapi; - hwmon_ctx->hm_device[backend_devices_idx].nvml = hm_adapters_nvml[device_id].nvml; + if (hwmon_ctx->hm_adl) + { + hwmon_ctx->hm_device[backend_devices_idx].od_version = hm_adapters_adl[device_id].od_version; + + hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_adl[device_id].buslanes_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_adl[device_id].corespeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_adl[device_id].fanspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_adl[device_id].fanpolicy_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_adl[device_id].memoryspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_adl[device_id].temperature_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_adl[device_id].threshold_shutdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_adl[device_id].threshold_slowdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_adl[device_id].throttle_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_adl[device_id].utilization_get_supported; + } - if (hwmon_ctx->hm_nvml) - { - hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_nvml[device_id].buslanes_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_nvml[device_id].corespeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_nvml[device_id].fanspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_nvml[device_id].fanpolicy_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_nvml[device_id].memoryspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_nvml[device_id].temperature_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_nvml[device_id].threshold_shutdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_nvml[device_id].threshold_slowdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_nvml[device_id].throttle_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_nvml[device_id].utilization_get_supported; + if (hwmon_ctx->hm_sysfs) + { + hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_sysfs[device_id].buslanes_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_sysfs[device_id].corespeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_sysfs[device_id].fanspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_sysfs[device_id].fanpolicy_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_sysfs[device_id].memoryspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_sysfs[device_id].temperature_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_sysfs[device_id].threshold_shutdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_sysfs[device_id].threshold_slowdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_sysfs[device_id].throttle_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_sysfs[device_id].utilization_get_supported; + } } - if (hwmon_ctx->hm_nvapi) + if (device_param->opencl_device_vendor_id == VENDOR_ID_NV) { - hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_nvapi[device_id].buslanes_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_nvapi[device_id].corespeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_nvapi[device_id].fanspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_nvapi[device_id].fanpolicy_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_nvapi[device_id].memoryspeed_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_nvapi[device_id].temperature_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_nvapi[device_id].threshold_shutdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_nvapi[device_id].threshold_slowdown_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_nvapi[device_id].throttle_get_supported; - hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_nvapi[device_id].utilization_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].nvapi = hm_adapters_nvapi[device_id].nvapi; + hwmon_ctx->hm_device[backend_devices_idx].nvml = hm_adapters_nvml[device_id].nvml; + + if (hwmon_ctx->hm_nvml) + { + hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_nvml[device_id].buslanes_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_nvml[device_id].corespeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_nvml[device_id].fanspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_nvml[device_id].fanpolicy_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_nvml[device_id].memoryspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_nvml[device_id].temperature_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_nvml[device_id].threshold_shutdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_nvml[device_id].threshold_slowdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_nvml[device_id].throttle_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_nvml[device_id].utilization_get_supported; + } + + if (hwmon_ctx->hm_nvapi) + { + hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_nvapi[device_id].buslanes_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_nvapi[device_id].corespeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_nvapi[device_id].fanspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_nvapi[device_id].fanpolicy_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_nvapi[device_id].memoryspeed_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_nvapi[device_id].temperature_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_nvapi[device_id].threshold_shutdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_nvapi[device_id].threshold_slowdown_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_nvapi[device_id].throttle_get_supported; + hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_nvapi[device_id].utilization_get_supported; + } } } }