mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Add firmware util interface for sysman windows
Related-To: LOCI-3132 Signed-off-by: Mayank Raghuwanshi <mayank.raghuwanshi@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b416845fd0
commit
281c98dcf9
@@ -10,6 +10,7 @@
|
||||
#include "shared/source/helpers/string.h"
|
||||
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
|
||||
#include <linux/pci_regs.h>
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
class FirmwareUtil;
|
||||
|
||||
class LinuxDiagnosticsImp : public OsDiagnostics, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "level_zero/tools/source/sysman/ecc/linux/os_ecc_imp.h"
|
||||
|
||||
#include "level_zero/tools/source/sysman/ecc/ecc_imp.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "shared/source/helpers/string.h"
|
||||
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
static const std::string mtdDescriptor("/proc/mtd");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
class FirmwareUtil;
|
||||
|
||||
class LinuxFirmwareImp : public OsFirmware, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
|
||||
const std::string iafPath = "device/";
|
||||
const std::string iafDirectory = "iaf.";
|
||||
|
||||
@@ -1,40 +1,41 @@
|
||||
#
|
||||
# Copyright (C) 2020-2021 Intel Corporation
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(igsc_FOUND)
|
||||
set(L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL
|
||||
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util_imp.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/igsc_wrapper.h
|
||||
)
|
||||
if(igsc_VERSION VERSION_LESS 0.3)
|
||||
message(STATUS "default igsc version: ${igsc_VERSION}")
|
||||
set(L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL_HELPER
|
||||
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_HELPER
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util_imp_helper.cpp
|
||||
)
|
||||
else()
|
||||
message(STATUS "IGSC version: ${igsc_VERSION}")
|
||||
set(L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL_HELPER
|
||||
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_HELPER
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}firmware_util_imp_helper.cpp
|
||||
)
|
||||
endif()
|
||||
add_subdirectories()
|
||||
else()
|
||||
set(L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL
|
||||
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util_imp_stub.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/igsc_wrapper.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL}
|
||||
${L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL_HELPER}
|
||||
)
|
||||
endif()
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL}
|
||||
${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_HELPER}
|
||||
)
|
||||
|
||||
# Make our source files visible to parent
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_LINUX ${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_LINUX})
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTILITY ${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTILITY})
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -10,21 +10,16 @@
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/igsc_wrapper.h"
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#ifdef IGSC_PRESENT
|
||||
#include "igsc_lib.h"
|
||||
#else
|
||||
typedef struct igsc_device_info {
|
||||
} igsc_device_info_t;
|
||||
#endif
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace L0 {
|
||||
class FirmwareUtil {
|
||||
public:
|
||||
static FirmwareUtil *create(const std::string &pciBDF);
|
||||
static FirmwareUtil *create(uint16_t domain, uint8_t bus, uint8_t device, uint8_t function);
|
||||
virtual ze_result_t fwDeviceInit() = 0;
|
||||
virtual ze_result_t getFirstDevice(igsc_device_info *) = 0;
|
||||
virtual ze_result_t getFwVersion(std::string fwType, std::string &firmwareVersion) = 0;
|
||||
@@ -1,16 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/linux/firmware_util/firmware_util_imp.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util_imp.h"
|
||||
|
||||
#include "shared/source/utilities/directory.h"
|
||||
|
||||
namespace L0 {
|
||||
const std::string fwUtilLibraryFile = "libigsc.so.0";
|
||||
const std::string fwDeviceInitByDevice = "igsc_device_init_by_device_info";
|
||||
const std::string fwDeviceGetDeviceInfo = "igsc_device_get_device_info";
|
||||
const std::string fwDeviceFwVersion = "igsc_device_fw_version";
|
||||
@@ -60,6 +59,8 @@ static void progressFunc(uint32_t done, uint32_t total, void *ctx) {
|
||||
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stdout, "Progess: %d/%d:%d/%\n", done, total, percent);
|
||||
}
|
||||
|
||||
FirmwareUtilImp::OsLibraryLoadPtr FirmwareUtilImp::osLibraryLoadFunction(NEO::OsLibrary::load);
|
||||
|
||||
ze_result_t FirmwareUtilImp::getFirstDevice(igsc_device_info *info) {
|
||||
igsc_device_iterator *iter;
|
||||
int ret = deviceIteratorCreate(&iter);
|
||||
@@ -172,9 +173,8 @@ ze_result_t FirmwareUtilImp::fwFlashOprom(void *pImage, uint32_t size) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
FirmwareUtilImp::FirmwareUtilImp(const std::string &pciBDF) {
|
||||
NEO::parseBdfString(pciBDF.c_str(), domain, bus, device, function);
|
||||
};
|
||||
FirmwareUtilImp::FirmwareUtilImp(uint16_t domain, uint8_t bus, uint8_t device, uint8_t function) : domain(domain), bus(bus), device(device), function(function) {
|
||||
}
|
||||
|
||||
FirmwareUtilImp::~FirmwareUtilImp() {
|
||||
if (nullptr != libraryHandle) {
|
||||
@@ -184,10 +184,10 @@ FirmwareUtilImp::~FirmwareUtilImp() {
|
||||
}
|
||||
};
|
||||
|
||||
FirmwareUtil *FirmwareUtil::create(const std::string &pciBDF) {
|
||||
FirmwareUtilImp *pFwUtilImp = new FirmwareUtilImp(pciBDF);
|
||||
FirmwareUtil *FirmwareUtil::create(uint16_t domain, uint8_t bus, uint8_t device, uint8_t function) {
|
||||
FirmwareUtilImp *pFwUtilImp = new FirmwareUtilImp(domain, bus, device, function);
|
||||
UNRECOVERABLE_IF(nullptr == pFwUtilImp);
|
||||
pFwUtilImp->libraryHandle = NEO::OsLibrary::load(fwUtilLibraryFile);
|
||||
pFwUtilImp->libraryHandle = FirmwareUtilImp::osLibraryLoadFunction(FirmwareUtilImp::fwUtilLibraryName);
|
||||
if (pFwUtilImp->libraryHandle == nullptr || pFwUtilImp->loadEntryPoints() == false) {
|
||||
if (nullptr != pFwUtilImp->libraryHandle) {
|
||||
delete pFwUtilImp->libraryHandle;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/tools/source/sysman/linux/firmware_util/firmware_util.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
|
||||
#include <cinttypes>
|
||||
#include <mutex>
|
||||
@@ -64,7 +64,7 @@ extern pIgscDeviceClose deviceClose;
|
||||
|
||||
class FirmwareUtilImp : public FirmwareUtil, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
FirmwareUtilImp(const std::string &pciBDF);
|
||||
FirmwareUtilImp(uint16_t domain, uint8_t bus, uint8_t device, uint8_t function);
|
||||
~FirmwareUtilImp() override;
|
||||
ze_result_t fwDeviceInit() override;
|
||||
ze_result_t getFirstDevice(igsc_device_info *) override;
|
||||
@@ -86,6 +86,9 @@ class FirmwareUtilImp : public FirmwareUtil, NEO::NonCopyableOrMovableClass {
|
||||
ze_result_t fwFlashIafPsc(void *pImage, uint32_t size);
|
||||
ze_result_t fwCallGetstatusExt(uint32_t &supportedTests, uint32_t &ifrApplied, uint32_t &prevErrors, uint32_t &pendingReset);
|
||||
|
||||
using OsLibraryLoadPtr = std::add_pointer<NEO::OsLibrary *(const std::string &)>::type;
|
||||
static OsLibraryLoadPtr osLibraryLoadFunction;
|
||||
static std::string fwUtilLibraryName;
|
||||
std::string fwDevicePath{};
|
||||
struct igsc_device_handle fwDeviceHandle = {};
|
||||
bool loadEntryPoints();
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/tools/source/sysman/linux/firmware_util/firmware_util_imp.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util_imp.h"
|
||||
|
||||
std::vector<std ::string> deviceSupportedFwTypes = {"GSC", "OptionROM"};
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
namespace L0 {
|
||||
FirmwareUtil *FirmwareUtil::create(uint16_t domain, uint8_t bus, uint8_t device, uint8_t function) {
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace L0
|
||||
15
level_zero/tools/source/sysman/firmware_util/igsc_wrapper.h
Normal file
15
level_zero/tools/source/sysman/firmware_util/igsc_wrapper.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifdef IGSC_PRESENT
|
||||
#pragma warning(disable : 4200)
|
||||
#include "igsc_lib.h"
|
||||
#else
|
||||
typedef struct igsc_device_info {
|
||||
} igsc_device_info_t;
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_firmware_util_enumeration.cpp
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_LINUX}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Make our source files visible to parent
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_LINUX ${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_LINUX})
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
std::string FirmwareUtilImp::fwUtilLibraryName = "libigsc.so.0";
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_firmware_util_enumeration.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_WINDOWS}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Make our source files visible to parent
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_WINDOWS ${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_WINDOWS})
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
std::string FirmwareUtilImp::fwUtilLibraryName = "igsc.dll";
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
#include "level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/linux/firmware_util/firmware_util.h"
|
||||
namespace L0 {
|
||||
FirmwareUtil *FirmwareUtil::create(const std::string &pciBDF) {
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace L0
|
||||
@@ -11,9 +11,10 @@
|
||||
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
#include "level_zero/tools/source/sysman/linux/fs_access.h"
|
||||
|
||||
#include "sysman/linux/firmware_util/firmware_util.h"
|
||||
#include "sysman/firmware_util/firmware_util.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
@@ -52,14 +53,15 @@ ze_result_t LinuxSysmanImp::init() {
|
||||
}
|
||||
|
||||
void LinuxSysmanImp::createFwUtilInterface() {
|
||||
std::string realRootPath;
|
||||
auto result = pSysfsAccess->getRealPath("device", realRootPath);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
ze_pci_ext_properties_t pPciProperties;
|
||||
if (ZE_RESULT_SUCCESS != pDevice->getPciProperties(&pPciProperties)) {
|
||||
return;
|
||||
}
|
||||
auto rootPciPathOfGpuDevice = getPciRootPortDirectoryPath(realRootPath);
|
||||
auto loc = realRootPath.find_last_of('/');
|
||||
pFwUtilInterface = FirmwareUtil::create(realRootPath.substr(loc + 1, std::string::npos));
|
||||
uint16_t domain = static_cast<uint16_t>(pPciProperties.address.domain);
|
||||
uint8_t bus = static_cast<uint8_t>(pPciProperties.address.bus);
|
||||
uint8_t device = static_cast<uint8_t>(pPciProperties.address.device);
|
||||
uint8_t function = static_cast<uint8_t>(pPciProperties.address.function);
|
||||
pFwUtilInterface = FirmwareUtil::create(domain, bus, device, function);
|
||||
}
|
||||
|
||||
ze_result_t LinuxSysmanImp::createPmtHandles() {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/tools/source/sysman/linux/firmware_util/firmware_util.h"
|
||||
#include "level_zero/tools/source/sysman/linux/fs_access.h"
|
||||
#include "level_zero/tools/source/sysman/linux/pmt/pmt.h"
|
||||
#include "level_zero/tools/source/sysman/linux/pmu/pmu_imp.h"
|
||||
@@ -23,6 +22,7 @@
|
||||
namespace L0 {
|
||||
|
||||
class PmuInterface;
|
||||
class FirmwareUtil;
|
||||
|
||||
class ExecutionEnvironmentRefCountRestore {
|
||||
public:
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
#include "level_zero/tools/source/sysman/ras/linux/os_ras_imp_prelim.h"
|
||||
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||
|
||||
#include "level_zero/core/source/driver/driver_handle.h"
|
||||
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
|
||||
#include "level_zero/tools/source/sysman/windows/kmd_sys_manager.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
ze_result_t WddmSysmanImp::init() {
|
||||
@@ -26,6 +30,25 @@ ze_result_t WddmSysmanImp::init() {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void WddmSysmanImp::createFwUtilInterface() {
|
||||
ze_pci_ext_properties_t pPciProperties;
|
||||
if (ZE_RESULT_SUCCESS != pDevice->getPciProperties(&pPciProperties)) {
|
||||
return;
|
||||
}
|
||||
uint16_t domain = static_cast<uint16_t>(pPciProperties.address.domain);
|
||||
uint8_t bus = static_cast<uint8_t>(pPciProperties.address.bus);
|
||||
uint8_t device = static_cast<uint8_t>(pPciProperties.address.device);
|
||||
uint8_t function = static_cast<uint8_t>(pPciProperties.address.function);
|
||||
pFwUtilInterface = FirmwareUtil::create(domain, bus, device, function);
|
||||
}
|
||||
|
||||
FirmwareUtil *WddmSysmanImp::getFwUtilInterface() {
|
||||
if (pFwUtilInterface == nullptr) {
|
||||
createFwUtilInterface();
|
||||
}
|
||||
return pFwUtilInterface;
|
||||
}
|
||||
|
||||
Device *WddmSysmanImp::getDeviceHandle() {
|
||||
return pDevice;
|
||||
}
|
||||
@@ -44,11 +67,19 @@ WddmSysmanImp::WddmSysmanImp(SysmanDeviceImp *pParentSysmanDeviceImp) {
|
||||
this->pParentSysmanDeviceImp = pParentSysmanDeviceImp;
|
||||
}
|
||||
|
||||
void WddmSysmanImp::releaseFwUtilInterface() {
|
||||
if (nullptr != pFwUtilInterface) {
|
||||
delete pFwUtilInterface;
|
||||
pFwUtilInterface = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
WddmSysmanImp::~WddmSysmanImp() {
|
||||
if (nullptr != pKmdSysManager) {
|
||||
delete pKmdSysManager;
|
||||
pKmdSysManager = nullptr;
|
||||
}
|
||||
releaseFwUtilInterface();
|
||||
}
|
||||
|
||||
OsSysman *OsSysman::create(SysmanDeviceImp *pParentSysmanDeviceImp) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "level_zero/tools/source/sysman/windows/kmd_sys_manager.h"
|
||||
|
||||
namespace L0 {
|
||||
class FirmwareUtil;
|
||||
|
||||
class WddmSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
@@ -25,16 +26,20 @@ class WddmSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass {
|
||||
ze_result_t init() override;
|
||||
|
||||
KmdSysManager &getKmdSysManager();
|
||||
FirmwareUtil *getFwUtilInterface();
|
||||
NEO::Wddm &getWddm();
|
||||
Device *getDeviceHandle();
|
||||
void releaseFwUtilInterface();
|
||||
|
||||
protected:
|
||||
FirmwareUtil *pFwUtilInterface = nullptr;
|
||||
KmdSysManager *pKmdSysManager = nullptr;
|
||||
Device *pDevice = nullptr;
|
||||
|
||||
private:
|
||||
SysmanDeviceImp *pParentSysmanDeviceImp = nullptr;
|
||||
NEO::Wddm *pWddm = nullptr;
|
||||
void createFwUtilInterface();
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user