Moved all the constants used in sysman to the single header file

Change-Id: I0bfa02e68c9aba1cc5d3105c37630b30b03e1b54
Signed-off-by: Kanhaiya <kanhaiya.singh@intel.com>
This commit is contained in:
Kanhaiya
2020-09-16 11:24:22 +05:30
committed by sys_ocldev
parent 2a69b1ed78
commit 723e852c09
12 changed files with 54 additions and 36 deletions

View File

@@ -9,6 +9,8 @@
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/os_interface/linux/drm_neo.h"
#include "level_zero/tools/source/sysman/sysman_const.h"
#include "sysman/engine/os_engine.h"
namespace L0 {
class PmuInterface;
@@ -35,7 +37,6 @@ class LinuxEngineImp : public OsEngine, NEO::NonCopyableOrMovableClass {
private:
void init();
const uint32_t microSecondsToNanoSeconds = 1000u;
int64_t fd = -1;
};

View File

@@ -10,15 +10,13 @@
#include "level_zero/core/source/device/device.h"
#include "level_zero/tools/source/sysman/global_operations/global_operations_imp.h"
#include "level_zero/tools/source/sysman/linux/fs_access.h"
#include "level_zero/tools/source/sysman/sysman_const.h"
#include <level_zero/zet_api.h>
#include <csignal>
namespace L0 {
const std::string vendorIntel("Intel(R) Corporation");
const std::string unknown("Unknown");
const std::string intelPciId("0x8086");
const std::string LinuxGlobalOperationsImp::deviceDir("device");
const std::string LinuxGlobalOperationsImp::vendorFile("device/vendor");
const std::string LinuxGlobalOperationsImp::deviceFile("device/device");
@@ -33,7 +31,7 @@ const std::string LinuxGlobalOperationsImp::agamaVersionFile("/sys/module/i915/a
// with engine enum defined in leve-zero spec
// Note that entries with int 2 and 3(represented by i915 as CLASS_VIDEO and CLASS_VIDEO_ENHANCE)
// are both mapped to MEDIA, as CLASS_VIDEO represents any media fixed-function hardware.
const std::map<int, zes_engine_type_flags_t> engineMap = {
static const std::map<int, zes_engine_type_flags_t> engineMap = {
{0, ZES_ENGINE_TYPE_FLAG_3D},
{1, ZES_ENGINE_TYPE_FLAG_DMA},
{2, ZES_ENGINE_TYPE_FLAG_MEDIA},

View File

@@ -8,14 +8,14 @@
#pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "level_zero/tools/source/sysman/sysman_const.h"
#include "sysman/memory/os_memory.h"
#include "sysman/windows/os_sysman_imp.h"
namespace L0 {
class KmdSysManager;
constexpr uint32_t MbpsToBytesPerSecond = 125000;
class WddmMemoryImp : public OsMemory, NEO::NonCopyableOrMovableClass {
public:
ze_result_t getProperties(zes_mem_properties_t *pProperties) override;

View File

@@ -8,6 +8,7 @@
#include "level_zero/tools/source/sysman/pci/linux/os_pci_imp.h"
#include "level_zero/tools/source/sysman/linux/fs_access.h"
#include "level_zero/tools/source/sysman/sysman_const.h"
#include "sysman/linux/os_sysman_imp.h"
#include "sysman/pci/pci_imp.h"
@@ -18,9 +19,6 @@ const std::string LinuxPciImp::deviceDir("device");
const std::string LinuxPciImp::resourceFile("device/resource");
const std::string LinuxPciImp::maxLinkSpeedFile("device/max_link_speed");
const std::string LinuxPciImp::maxLinkWidthFile("device/max_link_width");
constexpr uint8_t maxPciBars = 6;
// Linux kernel would report 255 link width, as an indication of unknown.
constexpr uint32_t unknownPcieLinkWidth = 255u;
std::string LinuxPciImp::changeDirNLevelsUp(std::string realRootPath, uint8_t nLevel) {
size_t loc;

View File

@@ -6,26 +6,10 @@
*/
#pragma once
#include "level_zero/tools/source/sysman/sysman_const.h"
#include <level_zero/zes_api.h>
namespace L0 {
namespace PciLinkSpeeds {
constexpr double Pci2_5GigatransfersPerSecond = 2.5;
constexpr double Pci5_0GigatransfersPerSecond = 5.0;
constexpr double Pci8_0GigatransfersPerSecond = 8.0;
constexpr double Pci16_0GigatransfersPerSecond = 16.0;
constexpr double Pci32_0GigatransfersPerSecond = 32.0;
} // namespace PciLinkSpeeds
enum PciGenerations {
PciGen1 = 1,
PciGen2,
PciGen3,
PciGen4,
PciGen5,
};
class Pci {
public:
virtual ~Pci(){};

View File

@@ -8,6 +8,7 @@
#include "level_zero/tools/source/sysman/power/linux/os_power_imp.h"
#include "level_zero/tools/source/sysman/linux/pmt.h"
#include "level_zero/tools/source/sysman/sysman_const.h"
#include "sysman/linux/os_sysman_imp.h"

View File

@@ -26,6 +26,4 @@ class OsPower {
virtual ~OsPower() = default;
};
constexpr uint64_t convertJouleToMicroJoule = 1000000u;
} // namespace L0

View File

@@ -18,7 +18,6 @@ const std::string LinuxSchedulerImp::defaultTimesliceDurationMilliSecs(".default
const std::string LinuxSchedulerImp::heartbeatIntervalMilliSecs("heartbeat_interval_ms");
const std::string LinuxSchedulerImp::defaultHeartbeatIntervalMilliSecs(".defaults/heartbeat_interval_ms");
const std::string LinuxSchedulerImp::engineDir("engine");
constexpr uint16_t milliSecsToMicroSecs = 1000;
ze_result_t LinuxSchedulerImp::getProperties(zes_sched_properties_t &schedProperties) {
schedProperties.onSubdevice = false;

View File

@@ -9,10 +9,9 @@
#include "shared/source/helpers/debug_helpers.h"
namespace L0 {
#include "level_zero/tools/source/sysman/sysman_const.h"
constexpr uint64_t minTimeoutModeHeartbeat = 5000u;
constexpr uint64_t minTimeoutInMicroSeconds = 1000u;
namespace L0 {
ze_result_t SchedulerImp::setExclusiveMode(ze_bool_t *pNeedReload) {
uint64_t timeslice = 0, timeout = 0, heartbeat = 0;

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <string>
const std::string vendorIntel("Intel(R) Corporation");
const std::string unknown("Unknown");
const std::string intelPciId("0x8086");
constexpr uint32_t MbpsToBytesPerSecond = 125000;
namespace PciLinkSpeeds {
constexpr double Pci2_5GigatransfersPerSecond = 2.5;
constexpr double Pci5_0GigatransfersPerSecond = 5.0;
constexpr double Pci8_0GigatransfersPerSecond = 8.0;
constexpr double Pci16_0GigatransfersPerSecond = 16.0;
constexpr double Pci32_0GigatransfersPerSecond = 32.0;
} // namespace PciLinkSpeeds
enum PciGenerations {
PciGen1 = 1,
PciGen2,
PciGen3,
PciGen4,
PciGen5,
};
constexpr uint8_t maxPciBars = 6;
// Linux kernel would report 255 link width, as an indication of unknown.
constexpr uint32_t unknownPcieLinkWidth = 255u;
constexpr uint32_t microSecondsToNanoSeconds = 1000u;
constexpr uint64_t convertJouleToMicroJoule = 1000000u;
constexpr uint64_t minTimeoutModeHeartbeat = 5000u;
constexpr uint64_t minTimeoutInMicroSeconds = 1000u;
constexpr uint16_t milliSecsToMicroSecs = 1000;
constexpr uint64_t numSocTemperatureEntries = 7;
constexpr uint32_t numCoreTemperatureEntries = 4;

View File

@@ -12,8 +12,6 @@
#include "sysman/linux/os_sysman_imp.h"
namespace L0 {
constexpr uint64_t numSocTemperatureEntries = 7;
constexpr uint32_t numCoreTemperatureEntries = 4;
ze_result_t LinuxTemperatureImp::getProperties(zes_temp_properties_t *pProperties) {
pProperties->type = type;

View File

@@ -513,4 +513,4 @@ struct ResponseProperty {
uint8_t dataBuffer[MaxPropertyBufferSize] = {0};
};
} // namespace KmdSysman
} // namespace L0
} // namespace L0