Skip to content

Commit 281c98d

Browse files
Add firmware util interface for sysman windows
Related-To: LOCI-3132 Signed-off-by: Mayank Raghuwanshi <mayank.raghuwanshi@intel.com>
1 parent b416845 commit 281c98d

36 files changed

+350
-166
lines changed

level_zero/CMakeLists.txt

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,23 @@ if(BUILD_WITH_L0)
7575
endif()
7676
endif()
7777

78-
if(UNIX)
79-
# Firmware Update Library
80-
get_filename_component(IGSC_DIR_tmp "${NEO_SOURCE_DIR}/../igsc" ABSOLUTE)
78+
# Firmware Update Library
79+
get_filename_component(IGSC_DIR_tmp "${NEO_SOURCE_DIR}/../igsc" ABSOLUTE)
80+
if(EXISTS "${IGSC_DIR_tmp}/lib/cmake")
81+
find_package(igsc HINTS "${IGSC_DIR_tmp}/lib/cmake")
82+
else()
83+
find_package(igsc)
84+
endif()
85+
if(igsc_FOUND)
86+
add_definitions(-DIGSC_PRESENT=1)
8187
if(EXISTS "${IGSC_DIR_tmp}/lib/cmake")
82-
find_package(igsc HINTS "${IGSC_DIR_tmp}/lib/cmake")
83-
else()
84-
find_package(igsc)
85-
endif()
86-
if(igsc_FOUND)
87-
add_definitions(-DIGSC_PRESENT=1)
88-
if(EXISTS "${IGSC_DIR_tmp}/lib/cmake")
89-
get_filename_component(igsc_INCLUDE_DIR "${NEO_SOURCE_DIR}/../igsc/include" ABSOLUTE)
90-
endif()
91-
message(STATUS "igsc Library headers directory: ${igsc_INCLUDE_DIR}")
92-
message(STATUS "igsc version: ${igsc_VERSION}")
93-
include_directories(SYSTEM ${igsc_INCLUDE_DIR})
94-
else()
95-
message(STATUS "igsc Library headers not available. Building without")
88+
get_filename_component(igsc_INCLUDE_DIR "${NEO_SOURCE_DIR}/../igsc/include" ABSOLUTE)
9689
endif()
90+
message(STATUS "igsc Library headers directory: ${igsc_INCLUDE_DIR}")
91+
message(STATUS "igsc version: ${igsc_VERSION}")
92+
include_directories(SYSTEM ${igsc_INCLUDE_DIR})
93+
else()
94+
message(STATUS "igsc Library headers not available. Building without")
9795
endif()
9896

9997
if(UNIX)

level_zero/tools/source/sysman/diagnostics/linux/os_diagnostics_imp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "shared/source/helpers/string.h"
1111

1212
#include "level_zero/core/source/device/device_imp.h"
13+
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
1314

1415
#include <linux/pci_regs.h>
1516

level_zero/tools/source/sysman/diagnostics/linux/os_diagnostics_imp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "sysman/linux/os_sysman_imp.h"
1414

1515
namespace L0 {
16+
class FirmwareUtil;
1617

1718
class LinuxDiagnosticsImp : public OsDiagnostics, NEO::NonCopyableOrMovableClass {
1819
public:

level_zero/tools/source/sysman/ecc/linux/os_ecc_imp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "level_zero/tools/source/sysman/ecc/linux/os_ecc_imp.h"
99

1010
#include "level_zero/tools/source/sysman/ecc/ecc_imp.h"
11+
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
1112

1213
namespace L0 {
1314

level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2021 Intel Corporation
2+
* Copyright (C) 2020-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -9,6 +9,8 @@
99

1010
#include "shared/source/helpers/string.h"
1111

12+
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
13+
1214
namespace L0 {
1315

1416
static const std::string mtdDescriptor("/proc/mtd");

level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2021 Intel Corporation
2+
* Copyright (C) 2020-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -13,6 +13,7 @@
1313
#include "sysman/linux/os_sysman_imp.h"
1414

1515
namespace L0 {
16+
class FirmwareUtil;
1617

1718
class LinuxFirmwareImp : public OsFirmware, NEO::NonCopyableOrMovableClass {
1819
public:

level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
2-
* Copyright (C) 2021 Intel Corporation
2+
* Copyright (C) 2021-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#include "level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.h"
9+
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
910

1011
namespace L0 {
1112

level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper_prelim.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include "level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.h"
9+
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
910

1011
const std::string iafPath = "device/";
1112
const std::string iafDirectory = "iaf.";

level_zero/tools/source/sysman/linux/firmware_util/CMakeLists.txt renamed to level_zero/tools/source/sysman/firmware_util/CMakeLists.txt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,41 @@
11
#
2-
# Copyright (C) 2020-2021 Intel Corporation
2+
# Copyright (C) 2022 Intel Corporation
33
#
44
# SPDX-License-Identifier: MIT
55
#
66

77
if(igsc_FOUND)
8-
set(L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL
8+
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL
99
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util_imp.cpp
1010
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util_imp.h
1111
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util.h
12+
${CMAKE_CURRENT_SOURCE_DIR}/igsc_wrapper.h
1213
)
1314
if(igsc_VERSION VERSION_LESS 0.3)
1415
message(STATUS "default igsc version: ${igsc_VERSION}")
15-
set(L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL_HELPER
16+
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_HELPER
1617
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util_imp_helper.cpp
1718
)
1819
else()
1920
message(STATUS "IGSC version: ${igsc_VERSION}")
20-
set(L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL_HELPER
21+
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_HELPER
2122
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}firmware_util_imp_helper.cpp
2223
)
2324
endif()
25+
add_subdirectories()
2426
else()
25-
set(L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL
27+
set(L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL
2628
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util_imp_stub.cpp
2729
${CMAKE_CURRENT_SOURCE_DIR}/firmware_util.h
30+
${CMAKE_CURRENT_SOURCE_DIR}/igsc_wrapper.h
2831
)
2932
endif()
3033

31-
if(UNIX)
32-
target_sources(${L0_STATIC_LIB_NAME}
33-
PRIVATE
34-
${L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL}
35-
${L0_SRCS_TOOLS_SYSMAN_LINUX_FIRMWARE_UTIL_HELPER}
36-
)
37-
endif()
34+
target_sources(${L0_STATIC_LIB_NAME}
35+
PRIVATE
36+
${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL}
37+
${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_HELPER}
38+
)
3839

3940
# Make our source files visible to parent
40-
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_LINUX ${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTIL_LINUX})
41+
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTILITY ${L0_SRCS_TOOLS_SYSMAN_FIRMWARE_UTILITY})

level_zero/tools/source/sysman/linux/firmware_util/firmware_util.h renamed to level_zero/tools/source/sysman/firmware_util/firmware_util.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2022 Intel Corporation
2+
* Copyright (C) 2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -10,21 +10,16 @@
1010
#include "shared/source/helpers/non_copyable_or_moveable.h"
1111

1212
#include "level_zero/core/source/device/device.h"
13+
#include "level_zero/tools/source/sysman/firmware_util/igsc_wrapper.h"
1314
#include <level_zero/zes_api.h>
1415

15-
#ifdef IGSC_PRESENT
16-
#include "igsc_lib.h"
17-
#else
18-
typedef struct igsc_device_info {
19-
} igsc_device_info_t;
20-
#endif
2116
#include <string>
2217
#include <vector>
2318

2419
namespace L0 {
2520
class FirmwareUtil {
2621
public:
27-
static FirmwareUtil *create(const std::string &pciBDF);
22+
static FirmwareUtil *create(uint16_t domain, uint8_t bus, uint8_t device, uint8_t function);
2823
virtual ze_result_t fwDeviceInit() = 0;
2924
virtual ze_result_t getFirstDevice(igsc_device_info *) = 0;
3025
virtual ze_result_t getFwVersion(std::string fwType, std::string &firmwareVersion) = 0;

0 commit comments

Comments
 (0)