Files
compute-runtime/level_zero/tools/source/sysman/linux/os_sysman_imp.cpp
Mateusz Hoppe 307a5cb822 Link tools and experimental sources to object library
Related-To: NEO-4480

Change-Id: I16da4434ec24753eabdb1bce9e38ed2e1e83ed6c
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
2020-03-23 08:57:19 +01:00

42 lines
1.0 KiB
C++

/*
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/tools/source/sysman/linux/os_sysman_imp.h"
#include "level_zero/tools/source/sysman/linux/sysfs_access.h"
namespace L0 {
ze_result_t LinuxSysmanImp::init() {
Device *pDevice = Device::fromHandle(pParentSysmanImp->hCoreDevice);
NEO::OSInterface &OsInterface = pDevice->getOsInterface();
NEO::Drm *pDrm = OsInterface.get()->getDrm();
int fd = pDrm->getFileDescriptor();
pSysfsAccess = SysfsAccess::create(fd);
UNRECOVERABLE_IF(nullptr == pSysfsAccess);
return ZE_RESULT_SUCCESS;
}
SysfsAccess &LinuxSysmanImp::getSysfsAccess() {
UNRECOVERABLE_IF(nullptr == pSysfsAccess);
return *pSysfsAccess;
}
LinuxSysmanImp::~LinuxSysmanImp() {
if (nullptr != pSysfsAccess) {
delete pSysfsAccess;
}
}
OsSysman *OsSysman::create(SysmanImp *pParentSysmanImp) {
LinuxSysmanImp *pLinuxSysmanImp = new LinuxSysmanImp(pParentSysmanImp);
return static_cast<OsSysman *>(pLinuxSysmanImp);
}
} // namespace L0