1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/*
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/tools/source/sysman/linux/os_sysman_driver_imp.h"
#include "shared/source/helpers/debug_helpers.h"
#include "level_zero/tools/source/sysman/events/linux/os_events_imp.h"
#include "level_zero/tools/source/sysman/linux/udev/udev_lib.h"
#include "level_zero/tools/source/sysman/sysman.h"
namespace L0 {
ze_result_t LinuxSysmanDriverImp::eventsListen(uint64_t timeout, uint32_t count, zes_device_handle_t *phDevices, uint32_t *pNumDeviceEvents, zes_event_type_flags_t *pEvents) {
return pLinuxEventsUtil->eventsListen(timeout, count, phDevices, pNumDeviceEvents, pEvents);
}
void LinuxSysmanDriverImp::eventRegister(zes_event_type_flags_t events, SysmanDeviceImp *pSysmanDevice) {
pLinuxEventsUtil->eventRegister(events, pSysmanDevice);
}
L0::UdevLib *LinuxSysmanDriverImp::getUdevLibHandle() {
if (pUdevLib == nullptr) {
pUdevLib = UdevLib::create();
}
return pUdevLib;
}
LinuxSysmanDriverImp::LinuxSysmanDriverImp() {
pLinuxEventsUtil = new LinuxEventsUtil();
}
LinuxSysmanDriverImp::~LinuxSysmanDriverImp() {
if (nullptr != pUdevLib) {
delete pUdevLib;
pUdevLib = nullptr;
}
if (nullptr != pLinuxEventsUtil) {
delete pLinuxEventsUtil;
pLinuxEventsUtil = nullptr;
}
}
OsSysmanDriver *OsSysmanDriver::create() {
LinuxSysmanDriverImp *pLinuxSysmanDriverImp = new LinuxSysmanDriverImp();
DEBUG_BREAK_IF(nullptr == pLinuxSysmanDriverImp);
return static_cast<OsSysmanDriver *>(pLinuxSysmanDriverImp);
}
void __attribute__((destructor)) osSysmanDriverDestructor() {
if (globalOsSysmanDriver != nullptr) {
delete globalOsSysmanDriver;
globalOsSysmanDriver = nullptr;
}
}
} // namespace L0
|