mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 04:12:57 +08:00
42 lines
1017 B
C++
42 lines
1017 B
C++
|
|
/*
|
||
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
||
|
|
*
|
||
|
|
* SPDX-License-Identifier: MIT
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include "sysman/linux/os_sysman_imp.h"
|
||
|
|
|
||
|
|
#include "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
|