mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
Add support for UUID
Related-To: LOCI-3304 Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
46098e0e17
commit
6a2e016d7f
@@ -9,11 +9,13 @@
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/driver_model_type.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/kernel/kernel_properties.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/os_interface/hw_info_config.inl"
|
||||
#include "shared/source/os_interface/hw_info_config_dg2_and_later.inl"
|
||||
#include "shared/source/os_interface/hw_info_config_xehp_and_later.inl"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/xe_hpg_core/hw_cmds_dg2.h"
|
||||
|
||||
#include "platforms.h"
|
||||
@@ -44,5 +46,37 @@ int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OS
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool HwInfoConfigHw<gfxProduct>::getUuid(Device *device, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) const {
|
||||
|
||||
UNRECOVERABLE_IF(device == nullptr);
|
||||
if (device->getRootDeviceEnvironment().osInterface == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto driverModel = device->getRootDeviceEnvironment().osInterface->getDriverModel();
|
||||
if (driverModel->getDriverModelType() != DriverModelType::DRM) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto pDrm = driverModel->as<Drm>();
|
||||
std::string readString(64u, '\0');
|
||||
errno = 0;
|
||||
if (pDrm->readSysFsAsString("/prelim_csc_unique_id", readString) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char *endPtr = nullptr;
|
||||
uint64_t uuidValue = std::strtoull(readString.data(), &endPtr, 16);
|
||||
if ((endPtr == readString.data()) || (errno != 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uuid.fill(0);
|
||||
memcpy_s(uuid.data(), uuid.size(), &uuidValue, sizeof(uuidValue));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template class HwInfoConfigHw<gfxProduct>;
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user