2020-03-06 18:09:57 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "level_zero/tools/source/sysman/sysman_imp.h"
|
|
|
|
|
2020-03-19 13:21:57 +08:00
|
|
|
#include "level_zero/core/source/driver/driver.h"
|
|
|
|
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
2020-03-22 15:52:57 +08:00
|
|
|
#include "level_zero/tools/source/sysman/pci/pci_imp.h"
|
2020-03-06 18:09:57 +08:00
|
|
|
#include "level_zero/tools/source/sysman/sysman.h"
|
2020-03-22 15:52:57 +08:00
|
|
|
#include "level_zero/tools/source/sysman/sysman_device/sysman_device_imp.h"
|
2020-03-06 18:09:57 +08:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace L0 {
|
|
|
|
|
|
|
|
SysmanImp::SysmanImp(ze_device_handle_t hDevice) {
|
|
|
|
hCoreDevice = hDevice;
|
|
|
|
pOsSysman = OsSysman::create(this);
|
2020-03-13 18:01:09 +08:00
|
|
|
UNRECOVERABLE_IF(nullptr == pOsSysman);
|
2020-03-06 18:09:57 +08:00
|
|
|
pPci = new PciImp(pOsSysman);
|
|
|
|
pSysmanDevice = new SysmanDeviceImp(pOsSysman, hCoreDevice);
|
|
|
|
pFrequencyHandleContext = new FrequencyHandleContext(pOsSysman);
|
|
|
|
pStandbyHandleContext = new StandbyHandleContext(pOsSysman);
|
2020-03-13 18:01:09 +08:00
|
|
|
pMemoryHandleContext = new MemoryHandleContext(pOsSysman, hCoreDevice);
|
2020-03-06 18:09:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SysmanImp::~SysmanImp() {
|
2020-03-13 18:01:09 +08:00
|
|
|
if (pMemoryHandleContext) {
|
|
|
|
delete pMemoryHandleContext;
|
|
|
|
}
|
|
|
|
if (pStandbyHandleContext) {
|
|
|
|
delete pStandbyHandleContext;
|
|
|
|
}
|
|
|
|
if (pFrequencyHandleContext) {
|
|
|
|
delete pFrequencyHandleContext;
|
|
|
|
}
|
|
|
|
if (pSysmanDevice) {
|
|
|
|
delete pSysmanDevice;
|
|
|
|
}
|
|
|
|
if (pPci) {
|
|
|
|
delete pPci;
|
|
|
|
}
|
2020-03-06 18:09:57 +08:00
|
|
|
delete pOsSysman;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SysmanImp::init() {
|
|
|
|
pOsSysman->init();
|
2020-03-13 18:01:09 +08:00
|
|
|
if (pFrequencyHandleContext) {
|
|
|
|
pFrequencyHandleContext->init();
|
|
|
|
}
|
|
|
|
if (pStandbyHandleContext) {
|
|
|
|
pStandbyHandleContext->init();
|
|
|
|
}
|
|
|
|
if (pMemoryHandleContext) {
|
|
|
|
pMemoryHandleContext->init();
|
|
|
|
}
|
|
|
|
if (pPci) {
|
|
|
|
pPci->init();
|
|
|
|
}
|
|
|
|
if (pSysmanDevice) {
|
|
|
|
pSysmanDevice->init();
|
|
|
|
}
|
2020-03-06 18:09:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::deviceGetProperties(zet_sysman_properties_t *pProperties) {
|
|
|
|
return pSysmanDevice->deviceGetProperties(pProperties);
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::schedulerGetCurrentMode(zet_sched_mode_t *pMode) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::schedulerGetTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::schedulerGetTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::schedulerSetTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::schedulerSetTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::schedulerSetExclusiveMode(ze_bool_t *pNeedReboot) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::schedulerSetComputeUnitDebugMode(ze_bool_t *pNeedReboot) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::processesGetState(uint32_t *pCount, zet_process_state_t *pProcesses) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::deviceReset() {
|
2020-03-20 00:36:29 +08:00
|
|
|
return pSysmanDevice->reset();
|
2020-03-06 18:09:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::deviceGetRepairStatus(zet_repair_status_t *pRepairStatus) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::pciGetProperties(zet_pci_properties_t *pProperties) {
|
|
|
|
return pPci->pciStaticProperties(pProperties);
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::pciGetState(zet_pci_state_t *pState) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::pciGetBars(uint32_t *pCount, zet_pci_bar_properties_t *pProperties) {
|
|
|
|
return pPci->pciGetInitializedBars(pCount, pProperties);
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::pciGetStats(zet_pci_stats_t *pStats) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::powerGet(uint32_t *pCount, zet_sysman_pwr_handle_t *phPower) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::frequencyGet(uint32_t *pCount, zet_sysman_freq_handle_t *phFrequency) {
|
|
|
|
return pFrequencyHandleContext->frequencyGet(pCount, phFrequency);
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::engineGet(uint32_t *pCount, zet_sysman_engine_handle_t *phEngine) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::standbyGet(uint32_t *pCount, zet_sysman_standby_handle_t *phStandby) {
|
|
|
|
return pStandbyHandleContext->standbyGet(pCount, phStandby);
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::firmwareGet(uint32_t *pCount, zet_sysman_firmware_handle_t *phFirmware) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::memoryGet(uint32_t *pCount, zet_sysman_mem_handle_t *phMemory) {
|
2020-03-13 18:01:09 +08:00
|
|
|
return pMemoryHandleContext->memoryGet(pCount, phMemory);
|
2020-03-06 18:09:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::fabricPortGet(uint32_t *pCount, zet_sysman_fabric_port_handle_t *phPort) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::temperatureGet(uint32_t *pCount, zet_sysman_temp_handle_t *phTemperature) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::psuGet(uint32_t *pCount, zet_sysman_psu_handle_t *phPsu) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::fanGet(uint32_t *pCount, zet_sysman_fan_handle_t *phFan) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::ledGet(uint32_t *pCount, zet_sysman_led_handle_t *phLed) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::rasGet(uint32_t *pCount, zet_sysman_ras_handle_t *phRas) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::eventGet(zet_sysman_event_handle_t *phEvent) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ze_result_t SysmanImp::diagnosticsGet(uint32_t *pCount, zet_sysman_diag_handle_t *phDiagnostics) {
|
|
|
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace L0
|