Restructure the folder
Move rocm_smi related function to rocm_smi folder. Move amd_smi to top level include/ and src/ folder. Remove obsolte oam folder. Change the CMakeLists.txt to update folder locations. Change-Id: I52e6be739e49f3b0545865f25364787f5985e9c3
Tá an tiomantas seo le fáil i:
+76
-41
@@ -18,7 +18,7 @@ if (NOT DEFINED CPACK_RESOURCE_FILE_LICENSE)
|
|||||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(ROCM_SMI "rocm_smi")
|
set(ROCM_SMI "amd_smi")
|
||||||
set(ROCM_SMI_COMPONENT "lib${ROCM_SMI}")
|
set(ROCM_SMI_COMPONENT "lib${ROCM_SMI}")
|
||||||
set(ROCM_SMI_TARGET "${ROCM_SMI}64")
|
set(ROCM_SMI_TARGET "${ROCM_SMI}64")
|
||||||
set(ROCM_SMI_LIB_NAME "lib${ROCM_SMI_TARGET}")
|
set(ROCM_SMI_LIB_NAME "lib${ROCM_SMI_TARGET}")
|
||||||
@@ -111,26 +111,28 @@ else ()
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(COMMON_SRC_DIR "${PROJECT_SOURCE_DIR}/src")
|
set(COMMON_SRC_DIR "${PROJECT_SOURCE_DIR}/src")
|
||||||
set(COMMON_INC_DIR "${PROJECT_SOURCE_DIR}/include/rocm_smi")
|
set(ROCM_SRC_DIR "${PROJECT_SOURCE_DIR}/rocm_smi/src")
|
||||||
|
set(AMDSMI_SRC_DIR "${PROJECT_SOURCE_DIR}/src/amd_smi")
|
||||||
|
set(COMMON_INC_DIR "${PROJECT_SOURCE_DIR}/include/amd_smi")
|
||||||
|
set(AMDSMI_INC_DIR "${PROJECT_SOURCE_DIR}/include/amd_smi")
|
||||||
|
set(ROCM_INC_DIR "${PROJECT_SOURCE_DIR}/rocm_smi/include/rocm_smi")
|
||||||
set(SHR_MUTEX_DIR "${PROJECT_SOURCE_DIR}/third_party/shared_mutex")
|
set(SHR_MUTEX_DIR "${PROJECT_SOURCE_DIR}/third_party/shared_mutex")
|
||||||
set(AMDSMI_SRC_DIR "${PROJECT_SOURCE_DIR}/amd_smi/src")
|
|
||||||
set(AMDSMI_INC_DIR "${PROJECT_SOURCE_DIR}/amd_smi/include")
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/third_party/shared_mutex
|
${CMAKE_CURRENT_SOURCE_DIR}/third_party/shared_mutex
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/amd_smi/include
|
${CMAKE_CURRENT_SOURCE_DIR}/amd_smi/include
|
||||||
/usr/include/libdrm)
|
/usr/include/libdrm)
|
||||||
|
|
||||||
set(CMN_SRC_LIST "${COMMON_SRC_DIR}/rocm_smi_device.cc")
|
set(CMN_SRC_LIST "${ROCM_SRC_DIR}/rocm_smi_device.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_SRC_DIR}/rocm_smi_main.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${ROCM_SRC_DIR}/rocm_smi_main.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_SRC_DIR}/rocm_smi_monitor.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${ROCM_SRC_DIR}/rocm_smi_monitor.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_SRC_DIR}/rocm_smi_power_mon.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${ROCM_SRC_DIR}/rocm_smi_power_mon.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_SRC_DIR}/rocm_smi_utils.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${ROCM_SRC_DIR}/rocm_smi_utils.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_SRC_DIR}/rocm_smi_counters.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${ROCM_SRC_DIR}/rocm_smi_counters.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_SRC_DIR}/rocm_smi_kfd.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${ROCM_SRC_DIR}/rocm_smi_kfd.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_SRC_DIR}/rocm_smi_io_link.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${ROCM_SRC_DIR}/rocm_smi_io_link.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_SRC_DIR}/rocm_smi_gpu_metrics.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${ROCM_SRC_DIR}/rocm_smi_gpu_metrics.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_SRC_DIR}/rocm_smi.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${ROCM_SRC_DIR}/rocm_smi.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${SHR_MUTEX_DIR}/shared_mutex.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${SHR_MUTEX_DIR}/shared_mutex.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_SRC_DIR}/amd_smi.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_SRC_DIR}/amd_smi.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_SRC_DIR}/amd_smi_common.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_SRC_DIR}/amd_smi_common.cc")
|
||||||
@@ -140,35 +142,68 @@ set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_SRC_DIR}/amd_smi_system.cc")
|
|||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_SRC_DIR}/amd_smi_drm.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_SRC_DIR}/amd_smi_drm.cc")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_SRC_DIR}/amd_smi_lib_loader.cc")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_SRC_DIR}/amd_smi_lib_loader.cc")
|
||||||
|
|
||||||
set(CMN_INC_LIST "${COMMON_INC_DIR}/rocm_smi_device.h")
|
set(CMN_INC_LIST "${ROCM_INC_DIR}/rocm_smi_device.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi_main.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi_main.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi_monitor.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi_monitor.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi_power_mon.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi_power_mon.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi_utils.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi_utils.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi_common.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi_common.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi_exception.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi_exception.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi_counters.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi_counters.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi_kfd.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi_kfd.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi_io_link.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi_io_link.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${COMMON_INC_DIR}/rocm_smi.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${ROCM_INC_DIR}/rocm_smi.h")
|
||||||
set(CMN_INC_LIST ${CMN_INC_LIST} "${SHR_MUTEX_DIR}/shared_mutex.h")
|
set(CMN_INC_LIST ${CMN_INC_LIST} "${SHR_MUTEX_DIR}/shared_mutex.h")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_INC_DIR}/amd_smi.h")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_INC_DIR}/amd_smi.h")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_INC_DIR}/impl/amd_smi_common.h")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_INC_DIR}/impl/amd_smi_common.h")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_INC_DIR}/impl/amd_smi_device.h")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_INC_DIR}/impl/amd_smi_device.h")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_INC_DIR}/impl/amd_smi_gpu_device.h")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_INC_DIR}/impl/amd_smi_gpu_device.h")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_INC_DIR}/impl/amd_smi_socket.h")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_INC_DIR}/impl/amd_smi_socket.h")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_INC_DIR}/impl/amd_smi_system.h")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_INC_DIR}/impl/amd_smi_system.h")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_INC_DIR}/impl/amd_smi_drm.h")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_INC_DIR}/impl/amd_smi_drm.h")
|
||||||
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${AMDSMI_INC_DIR}/impl/amd_smi_lib_loader.h")
|
set(CMN_SRC_LIST ${CMN_SRC_LIST} "${COMMON_INC_DIR}/impl/amd_smi_lib_loader.h")
|
||||||
|
|
||||||
add_subdirectory("rocm_smi")
|
add_subdirectory("rocm_smi")
|
||||||
add_subdirectory("amd_smi")
|
|
||||||
add_subdirectory("oam")
|
|
||||||
|
|
||||||
option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorg with backward compatibility" ON)
|
# Examples and docs
|
||||||
if(FILE_REORG_BACKWARD_COMPATIBILITY)
|
set(SMI_EXAMPLE_EXE "amd_smi_ex")
|
||||||
include(rocm_smi-backward-compat.cmake)
|
add_executable(${SMI_EXAMPLE_EXE} "example/amd_smi_example.cc")
|
||||||
endif()
|
target_link_libraries(${SMI_EXAMPLE_EXE} ${ROCM_SMI_TARGET})
|
||||||
|
add_dependencies(${SMI_EXAMPLE_EXE} ${ROCM_SMI_TARGET})
|
||||||
|
|
||||||
|
# Generate Doxygen documentation
|
||||||
|
find_package(Doxygen)
|
||||||
|
find_package(LATEX COMPONENTS PDFLATEX)
|
||||||
|
|
||||||
|
if (DOXYGEN_FOUND AND LATEX_FOUND)
|
||||||
|
set (RSMI_MANUAL_NAME "AMD_SMI_Manual")
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/amd_smi_doxygen.cfg
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
|
||||||
|
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||||
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/docs/amd_smi_doxygen.cfg
|
||||||
|
"${AMDSMI_INC_DIR}/amd_smi.h"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
|
||||||
|
COMMAND make > /dev/null
|
||||||
|
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/docs/${RSMI_MANUAL_NAME}_new.pdf
|
||||||
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/latex)
|
||||||
|
|
||||||
|
add_custom_target(amdsmi_docs DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf)
|
||||||
|
|
||||||
|
add_dependencies(${ROCM_SMI_TARGET} amdsmi_docs)
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
|
||||||
|
DESTINATION share/doc/${ROCM_SMI} RENAME ${RSMI_MANUAL_NAME}.pdf)
|
||||||
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.md
|
||||||
|
DESTINATION share/doc/${ROCM_SMI}/)
|
||||||
|
else()
|
||||||
|
message("Doxygen or Latex is not found. Will not generate documents.")
|
||||||
|
endif(DOXYGEN_FOUND AND LATEX_FOUND)
|
||||||
|
|
||||||
|
|
||||||
#TODO: Should use GNUInstallDirs to match distro standards
|
#TODO: Should use GNUInstallDirs to match distro standards
|
||||||
#This need fix in subdirectory CMakefile as well
|
#This need fix in subdirectory CMakefile as well
|
||||||
#include(GNUInstallDirs)
|
#include(GNUInstallDirs)
|
||||||
@@ -179,7 +214,7 @@ set(BIN_INSTALL_DIR "bin")
|
|||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
rocm_smi-config.cmake.in
|
amd_smi-config.cmake.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rocm_smi-config.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/rocm_smi-config.cmake
|
||||||
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/rocm_smi
|
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/rocm_smi
|
||||||
PATH_VARS LIB_INSTALL_DIR INCLUDE_INSTALL_DIR BIN_INSTALL_DIR
|
PATH_VARS LIB_INSTALL_DIR INCLUDE_INSTALL_DIR BIN_INSTALL_DIR
|
||||||
@@ -201,7 +236,7 @@ install(
|
|||||||
|
|
||||||
# Create cmake target
|
# Create cmake target
|
||||||
# Add all targets to the build-tree export set
|
# Add all targets to the build-tree export set
|
||||||
export(TARGETS ${ROCM_SMI_TARGET} ${OAM_TARGET}
|
export(TARGETS ${ROCM_SMI_TARGET}
|
||||||
FILE "${PROJECT_BINARY_DIR}/rcom_smi_target.cmake")
|
FILE "${PROJECT_BINARY_DIR}/rcom_smi_target.cmake")
|
||||||
|
|
||||||
# Export the package for use from the build-tree
|
# Export the package for use from the build-tree
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
#
|
|
||||||
# Minimum version of cmake required
|
|
||||||
#
|
|
||||||
|
|
||||||
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
|
|
||||||
message(" CMake AMD SMI (Library) ")
|
|
||||||
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
|
|
||||||
|
|
||||||
## Verbose output.
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
||||||
|
|
||||||
# Required Defines first:
|
|
||||||
|
|
||||||
message("")
|
|
||||||
message("Build Configuration:")
|
|
||||||
message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR})
|
|
||||||
|
|
||||||
# Will still use the rocm_smi lib for now.
|
|
||||||
set(ROCM_SMI "rocm_smi")
|
|
||||||
set(ROCM_SMI_COMPONENT "lib${ROCM_SMI}")
|
|
||||||
set(ROCM_SMI_TARGET "${ROCM_SMI}64")
|
|
||||||
|
|
||||||
set(SMI_EXAMPLE_EXE "amd_smi_ex")
|
|
||||||
add_executable(${SMI_EXAMPLE_EXE} "example/amd_smi_example.cc")
|
|
||||||
target_link_libraries(${SMI_EXAMPLE_EXE} ${ROCM_SMI_TARGET})
|
|
||||||
|
|
||||||
# Generate Doxygen documentation
|
|
||||||
find_package(Doxygen)
|
|
||||||
find_package(LATEX COMPONENTS PDFLATEX)
|
|
||||||
|
|
||||||
if (DOXYGEN_FOUND AND LATEX_FOUND)
|
|
||||||
set (RSMI_MANUAL_NAME "AMD_SMI_Manual")
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/amd_smi_doxygen.cfg
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
|
|
||||||
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/docs/amd_smi_doxygen.cfg
|
|
||||||
"${AMDSMI_INC_DIR}/amd_smi.h"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
|
|
||||||
COMMAND make > /dev/null
|
|
||||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/docs/${RSMI_MANUAL_NAME}_new.pdf
|
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/latex)
|
|
||||||
|
|
||||||
add_custom_target(amdsmi_docs DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf)
|
|
||||||
|
|
||||||
add_dependencies(${ROCM_SMI_TARGET} amdsmi_docs)
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
|
|
||||||
DESTINATION share/doc/${ROCM_SMI} RENAME ${RSMI_MANUAL_NAME}.pdf)
|
|
||||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../README.md
|
|
||||||
DESTINATION share/doc/${ROCM_SMI}/)
|
|
||||||
else()
|
|
||||||
message("Doxygen or Latex is not found. Will not generate documents.")
|
|
||||||
endif(DOXYGEN_FOUND AND LATEX_FOUND)
|
|
||||||
|
|
||||||
@@ -760,7 +760,7 @@ WARN_LOGFILE =
|
|||||||
# Note: If this tag is empty the current directory is searched.
|
# Note: If this tag is empty the current directory is searched.
|
||||||
|
|
||||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../README.md \
|
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../README.md \
|
||||||
@CMAKE_CURRENT_SOURCE_DIR@/../amd_smi/include/amd_smi.h
|
@CMAKE_CURRENT_SOURCE_DIR@/../include/amd_smi/amd_smi.h
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
|
|
||||||
#define CHK_AMDSMI_RET(RET) { \
|
#define CHK_AMDSMI_RET(RET) { \
|
||||||
if (RET != AMDSMI_STATUS_SUCCESS) { \
|
if (RET != AMDSMI_STATUS_SUCCESS) { \
|
||||||
@@ -51,8 +51,7 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
#include "rocm_smi/kfd_ioctl.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization flags
|
* @brief Initialization flags
|
||||||
*
|
*
|
||||||
@@ -550,11 +549,11 @@ typedef struct {
|
|||||||
* Event notification event types
|
* Event notification event types
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AMDSMI_EVT_NOTIF_VMFAULT = KFD_SMI_EVENT_VMFAULT, //!< VM page fault
|
AMDSMI_EVT_NOTIF_VMFAULT = 1, //!< VM page fault
|
||||||
AMDSMI_EVT_NOTIF_FIRST = AMDSMI_EVT_NOTIF_VMFAULT,
|
AMDSMI_EVT_NOTIF_FIRST = AMDSMI_EVT_NOTIF_VMFAULT,
|
||||||
AMDSMI_EVT_NOTIF_THERMAL_THROTTLE = KFD_SMI_EVENT_THERMAL_THROTTLE,
|
AMDSMI_EVT_NOTIF_THERMAL_THROTTLE = 2,
|
||||||
AMDSMI_EVT_NOTIF_GPU_PRE_RESET = KFD_SMI_EVENT_GPU_PRE_RESET,
|
AMDSMI_EVT_NOTIF_GPU_PRE_RESET = 3,
|
||||||
AMDSMI_EVT_NOTIF_GPU_POST_RESET = KFD_SMI_EVENT_GPU_POST_RESET,
|
AMDSMI_EVT_NOTIF_GPU_POST_RESET = 4,
|
||||||
|
|
||||||
AMDSMI_EVT_NOTIF_LAST = AMDSMI_EVT_NOTIF_GPU_POST_RESET
|
AMDSMI_EVT_NOTIF_LAST = AMDSMI_EVT_NOTIF_GPU_POST_RESET
|
||||||
} amdsmi_evt_notification_type_t;
|
} amdsmi_evt_notification_type_t;
|
||||||
+1
-1
@@ -44,7 +44,7 @@
|
|||||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
|
#ifndef AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
|
||||||
#define AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
|
#define AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
|
||||||
|
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
namespace smi {
|
namespace smi {
|
||||||
@@ -48,8 +48,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex> // NOLINT
|
#include <mutex> // NOLINT
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "impl/amd_smi_lib_loader.h"
|
#include "amd_smi/impl/amd_smi_lib_loader.h"
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
namespace smi {
|
namespace smi {
|
||||||
+3
-3
@@ -44,9 +44,9 @@
|
|||||||
#ifndef AMD_SMI_INCLUDE_IMPL_AMD_SMI_GPU_DEVICE_H_
|
#ifndef AMD_SMI_INCLUDE_IMPL_AMD_SMI_GPU_DEVICE_H_
|
||||||
#define AMD_SMI_INCLUDE_IMPL_AMD_SMI_GPU_DEVICE_H_
|
#define AMD_SMI_INCLUDE_IMPL_AMD_SMI_GPU_DEVICE_H_
|
||||||
|
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "impl/amd_smi_device.h"
|
#include "amd_smi/impl/amd_smi_device.h"
|
||||||
#include "impl/amd_smi_drm.h"
|
#include "amd_smi/impl/amd_smi_drm.h"
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
namespace smi {
|
namespace smi {
|
||||||
+1
-1
@@ -26,7 +26,7 @@ THE SOFTWARE.
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <mutex> // NOLINT(build/c++11)
|
#include <mutex> // NOLINT(build/c++11)
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
|
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
+2
-2
@@ -47,8 +47,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "impl/amd_smi_device.h"
|
#include "amd_smi/impl/amd_smi_device.h"
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
namespace smi {
|
namespace smi {
|
||||||
+4
-4
@@ -46,10 +46,10 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "impl/amd_smi_socket.h"
|
#include "amd_smi/impl/amd_smi_socket.h"
|
||||||
#include "impl/amd_smi_device.h"
|
#include "amd_smi/impl/amd_smi_device.h"
|
||||||
#include "impl/amd_smi_drm.h"
|
#include "amd_smi/impl/amd_smi_drm.h"
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
namespace smi {
|
namespace smi {
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
#
|
|
||||||
# Minimum version of cmake required
|
|
||||||
#
|
|
||||||
|
|
||||||
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
|
|
||||||
message(" CMake OAM (Library) ")
|
|
||||||
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
|
|
||||||
|
|
||||||
## Verbose output.
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
||||||
|
|
||||||
# Required Defines first:
|
|
||||||
|
|
||||||
message("")
|
|
||||||
message("Build Configuration:")
|
|
||||||
# message("-----------BuildType: " ${CMAKE_BUILD_TYPE})
|
|
||||||
# message("------------Compiler: " ${CMAKE_CXX_COMPILER})
|
|
||||||
# message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION})
|
|
||||||
message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR})
|
|
||||||
# message("--------Proj Bld Dir: " ${PROJECT_BINARY_DIR})
|
|
||||||
# message("--------Proj Lib Dir: " ${PROJECT_BINARY_DIR}/lib)
|
|
||||||
# message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin)
|
|
||||||
# message("--------RSMI Lib Dir: " ${RSMI_LIB_DIR})
|
|
||||||
# message("--------RSMI Inc Dir: " ${OAM_INC_DIR})
|
|
||||||
# message("")
|
|
||||||
|
|
||||||
set(OAM_ROOT "${PROJECT_SOURCE_DIR}/oam")
|
|
||||||
set(OAM_NAME "oam")
|
|
||||||
set(OAM_COMPONENT "lib${OAM_NAME}")
|
|
||||||
set(OAM_TARGET "${OAM_NAME}")
|
|
||||||
|
|
||||||
################# Determine the library version #########################
|
|
||||||
set(SO_VERSION_GIT_TAG_PREFIX "oam_so_ver")
|
|
||||||
|
|
||||||
# VERSION_* variables should be set by get_version_from_tag
|
|
||||||
message("Package version: ${PKG_VERSION_STR}")
|
|
||||||
|
|
||||||
# Debian package specific variables
|
|
||||||
# Set a default value for the package version
|
|
||||||
get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
|
|
||||||
|
|
||||||
# VERSION_* variables should be set by get_version_from_tag
|
|
||||||
if ( ${ROCM_PATCH_VERSION} )
|
|
||||||
set ( VERSION_PATCH ${ROCM_PATCH_VERSION})
|
|
||||||
set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
|
||||||
else()
|
|
||||||
set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
|
|
||||||
endif ()
|
|
||||||
set(${OAM_NAME}_VERSION_MAJOR "${VERSION_MAJOR}")
|
|
||||||
set(${OAM_NAME}_VERSION_MINOR "${VERSION_MINOR}")
|
|
||||||
set(${OAM_NAME}_VERSION_PATCH "0")
|
|
||||||
set(${OAM_NAME}_VERSION_BUILD "0")
|
|
||||||
message("SOVERSION: ${SO_VERSION_STRING}")
|
|
||||||
|
|
||||||
|
|
||||||
# Create a configure file to get version info from within library
|
|
||||||
configure_file(
|
|
||||||
"${OAM_ROOT}/src/${OAM_TARGET}Config.in"
|
|
||||||
"${OAM_ROOT}/include/oam/${OAM_TARGET}Config.h")
|
|
||||||
|
|
||||||
set(OAM_SRC_DIR "src")
|
|
||||||
set(OAM_INC_DIR "include")
|
|
||||||
set(OAM_DOCS_DIR "docs")
|
|
||||||
|
|
||||||
set(OAM_SRC_LIST ${CMN_SRC_LIST} "${OAM_SRC_DIR}/amd_oam.cc")
|
|
||||||
|
|
||||||
set(OAM_INC_LIST ${COMMON_INC_DIR} "${OAM_INC_DIR}")
|
|
||||||
set(OAM_EXAMPLE_EXE "oam_ex")
|
|
||||||
|
|
||||||
add_executable(${OAM_EXAMPLE_EXE} "example/oam_example.c")
|
|
||||||
target_include_directories(${OAM_EXAMPLE_EXE} PRIVATE ${OAM_INC_LIST})
|
|
||||||
target_link_libraries(${OAM_EXAMPLE_EXE} ${OAM_TARGET})
|
|
||||||
add_library(${OAM_TARGET} ${CMN_SRC_LIST} ${OAM_SRC_LIST}
|
|
||||||
${CMN_INC_LIST} ${OAM_INC_LIST})
|
|
||||||
target_link_libraries(${OAM_TARGET} pthread rt dl)
|
|
||||||
target_include_directories(${OAM_TARGET} PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include ${COMMON_PROJ_ROOT}/common/shared_mutex)
|
|
||||||
|
|
||||||
## Set the VERSION and SOVERSION values
|
|
||||||
set_property(TARGET ${OAM_TARGET} PROPERTY
|
|
||||||
SOVERSION "${VERSION_MAJOR}")
|
|
||||||
set_property(TARGET ${OAM_TARGET} PROPERTY
|
|
||||||
VERSION "${SO_VERSION_STRING}")
|
|
||||||
|
|
||||||
## If the library is a release, strip the target library
|
|
||||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL Release)
|
|
||||||
if(${BUILD_SHARED_LIBS}) #striping only for .so
|
|
||||||
add_custom_command(
|
|
||||||
TARGET ${OAM_TARGET}
|
|
||||||
POST_BUILD COMMAND ${CMAKE_STRIP} lib${OAM_TARGET}.so)
|
|
||||||
endif()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# use the target_include_directories() command to specify the include directories for the target
|
|
||||||
target_include_directories(${OAM_TARGET}
|
|
||||||
PUBLIC
|
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
|
||||||
"$<INSTALL_INTERFACE:{OAM_NAME}/include>")
|
|
||||||
|
|
||||||
|
|
||||||
## Add the install directives for the runtime library.
|
|
||||||
install(TARGETS ${OAM_TARGET}
|
|
||||||
EXPORT rocm_smiTargets
|
|
||||||
LIBRARY DESTINATION lib
|
|
||||||
ARCHIVE DESTINATION lib
|
|
||||||
COMPONENT ${OAM_COMPONENT})
|
|
||||||
install(FILES ${COMMON_SRC_ROOT}/oam/include/oam/oam_mapi.h
|
|
||||||
${COMMON_SRC_ROOT}/oam/include/oam/amd_oam.h
|
|
||||||
DESTINATION include/oam)
|
|
||||||
|
|
||||||
# Generate Doxygen documentation
|
|
||||||
if (DOXYGEN_FOUND)
|
|
||||||
configure_file(${OAM_DOCS_DIR}/docs/rsmi_doxygen.cfg
|
|
||||||
${OAM_DOCS_DIR}/Doxyfile @ONLY)
|
|
||||||
add_custom_target(doc
|
|
||||||
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
COMMENT "Generating AMD OAM API documentation with Doxygen" VERBATIM)
|
|
||||||
endif(DOXYGEN_FOUND)
|
|
||||||
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include "oam/oam_mapi.h"
|
|
||||||
#include "oam/amd_oam.h"
|
|
||||||
|
|
||||||
const oam_ops_t amd_oam_ops = {
|
|
||||||
.init = amdoam_init,
|
|
||||||
.free = amdoam_free,
|
|
||||||
// .get_mapi_version = amdoam_get_mapi_version,
|
|
||||||
.discover_devices = amdoam_discover_devices,
|
|
||||||
.get_dev_properties = amdoam_get_dev_properties,
|
|
||||||
.get_pci_properties = amdoam_get_pci_properties,
|
|
||||||
.get_sensors_count = amdoam_get_sensors_count,
|
|
||||||
.get_error_description = amdoam_get_error_description,
|
|
||||||
.get_sensors_info = amdoam_get_sensors_info,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int get_sensor_info(uint32_t device_id, oam_sensor_type_t type,
|
|
||||||
uint32_t num_sensors, char unit[]) {
|
|
||||||
uint32_t j;
|
|
||||||
oam_sensor_info_t *sensor_info = calloc(num_sensors,
|
|
||||||
sizeof(oam_sensor_info_t));
|
|
||||||
if (!sensor_info) {
|
|
||||||
printf("Allocating power_info failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
amd_oam_ops.get_sensors_info(device_id, type, num_sensors, sensor_info);
|
|
||||||
for ( j = 0; j < num_sensors ; j++) {
|
|
||||||
printf("\tSensor Name : %s \n", sensor_info[j].sensor_name);
|
|
||||||
printf("\tSensor Type : %d \n", sensor_info[j].sensor_type);
|
|
||||||
printf("\tSensor Value : %ld %s\n", sensor_info[j].value, unit);
|
|
||||||
}
|
|
||||||
free(sensor_info);
|
|
||||||
printf("\t**************************************\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
uint32_t dev_cnt = 0;
|
|
||||||
oam_mapi_version_t version;
|
|
||||||
oam_dev_properties_t *devs_prop;
|
|
||||||
int i;
|
|
||||||
oam_pci_info_t pci_info;
|
|
||||||
oam_sensor_count_t sensor_count;
|
|
||||||
const char *string;
|
|
||||||
|
|
||||||
if (amd_oam_ops.init()) {
|
|
||||||
printf("init failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// amd_oam_ops.get_mapi_version(&version);
|
|
||||||
if (!amd_oam_ops.discover_devices(&dev_cnt))
|
|
||||||
printf("%d AMD devices are discovered\n", dev_cnt);
|
|
||||||
if (!dev_cnt) {
|
|
||||||
printf("No devices are found.\n");
|
|
||||||
return amd_oam_ops.free();
|
|
||||||
}
|
|
||||||
devs_prop = calloc(dev_cnt, sizeof(oam_dev_properties_t));
|
|
||||||
if (!devs_prop) {
|
|
||||||
printf("Allocating dev_prop failed\n");
|
|
||||||
return amd_oam_ops.free();
|
|
||||||
}
|
|
||||||
|
|
||||||
amd_oam_ops.get_dev_properties(dev_cnt, devs_prop);
|
|
||||||
for (i = 0; i < dev_cnt; i++) {
|
|
||||||
printf("Device %d:\n", i);
|
|
||||||
printf("\tdevice id %d\n", devs_prop[i].device_id);
|
|
||||||
printf("\tdevice_vendor %s\n", devs_prop[i].device_vendor);
|
|
||||||
printf("\tdevice_name %s\n", devs_prop[i].device_name);
|
|
||||||
printf("\tsku_name %s\n", devs_prop[i].sku_name);
|
|
||||||
printf("\tboard_name %s\n", devs_prop[i].board_name);
|
|
||||||
printf("\tboard_revision %s\n", devs_prop[i].board_revision);
|
|
||||||
printf("\tboard_serial_number %s\n",
|
|
||||||
devs_prop[i].board_serial_number);
|
|
||||||
|
|
||||||
if (!amd_oam_ops.get_pci_properties(
|
|
||||||
devs_prop[i].device_id, &pci_info)) {
|
|
||||||
printf("\tPCI domain : 0x%d \n", pci_info.domain);
|
|
||||||
printf("\tPCI bus : 0x%d \n", pci_info.bus);
|
|
||||||
printf("\tPCI device : 0x%d \n", pci_info.device);
|
|
||||||
printf("\tPCI function : 0x%d \n", pci_info.function);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\t**************************************\n");
|
|
||||||
if (amd_oam_ops.get_sensors_count(
|
|
||||||
devs_prop[i].device_id, &sensor_count))
|
|
||||||
continue;
|
|
||||||
printf("\tNumber of Power Sensors : %d \n",
|
|
||||||
sensor_count.num_power_sensors);
|
|
||||||
if (get_sensor_info(devs_prop[i].device_id,OAM_SENSOR_TYPE_POWER,
|
|
||||||
sensor_count.num_power_sensors, "uW"))
|
|
||||||
goto failure;
|
|
||||||
|
|
||||||
printf("\tNumber of Voltage Sensors : %d \n",
|
|
||||||
sensor_count.num_voltage_sensors);
|
|
||||||
if (get_sensor_info(devs_prop[i].device_id, OAM_SENSOR_TYPE_VOLTAGE,
|
|
||||||
sensor_count.num_voltage_sensors, "mV"))
|
|
||||||
goto failure;
|
|
||||||
|
|
||||||
printf("\tNumber of Current Sensors : %d \n",
|
|
||||||
sensor_count.num_current_sensors);
|
|
||||||
if (get_sensor_info(devs_prop[i].device_id, OAM_SENSOR_TYPE_CURRENT,
|
|
||||||
sensor_count.num_current_sensors, "A"))
|
|
||||||
goto failure;
|
|
||||||
|
|
||||||
printf("\tNumber of Temperature Sensors : %d \n",
|
|
||||||
sensor_count.num_temperature_sensors);
|
|
||||||
if (get_sensor_info(devs_prop[i].device_id, OAM_SENSOR_TYPE_TEMP,
|
|
||||||
sensor_count.num_temperature_sensors, "mC"))
|
|
||||||
goto failure;
|
|
||||||
|
|
||||||
printf("\tNumber of Fan Sensors : %d \n", sensor_count.num_fans);
|
|
||||||
if (get_sensor_info(devs_prop[i].device_id, OAM_SENSOR_TYPE_FAN_SPEED,
|
|
||||||
sensor_count.num_fans, "rpm"))
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd_oam_ops.get_error_description(1, &string);
|
|
||||||
printf("error code 1: %s\n", string);
|
|
||||||
|
|
||||||
failure:
|
|
||||||
free(devs_prop);
|
|
||||||
amd_oam_ops.free();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* MIT License
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 Open Compute Project
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OAM_INCLUDE_OAM_AMD_OAM_H_
|
|
||||||
#define OAM_INCLUDE_OAM_AMD_OAM_H_
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#include <cstdint>
|
|
||||||
#else
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#include "oam/oam_mapi.h"
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
AMDOAM_STATUS_SUCCESS = 0x0,
|
|
||||||
/* copy RSMI errors */
|
|
||||||
AMDOAM_STATUS_INVALID_ARGS,
|
|
||||||
AMDOAM_STATUS_NOT_SUPPORTED,
|
|
||||||
AMDOAM_STATUS_FILE_ERROR,
|
|
||||||
AMDOAM_STATUS_PERMISSION,
|
|
||||||
AMDOAM_STATUS_OUT_OF_RESOURCES,
|
|
||||||
AMDOAM_STATUS_INTERNAL_EXCEPTION,
|
|
||||||
AMDOAM_STATUS_INPUT_OUT_OF_BOUNDS,
|
|
||||||
AMDOAM_STATUS_INIT_ERROR,
|
|
||||||
/* end of RSMI error code */
|
|
||||||
AMDOAM_STATUS_ERROR, // Generic error return if not otherwise specified
|
|
||||||
AMDOAM_STATUS_NOT_FOUND,
|
|
||||||
} amdoam_status_t;
|
|
||||||
|
|
||||||
int amdoam_init(void);
|
|
||||||
int amdoam_free(void);
|
|
||||||
// int amdoam_get_mapi_version(oam_mapi_version_t *version);
|
|
||||||
int amdoam_discover_devices(uint32_t *device_count);
|
|
||||||
int amdoam_get_dev_properties(uint32_t dev_inx,
|
|
||||||
oam_dev_properties_t *prop);
|
|
||||||
int amdoam_get_pci_properties(uint32_t device_id, oam_pci_info_t *pci_info);
|
|
||||||
int amdoam_get_sensors_count(uint32_t device_id,
|
|
||||||
oam_sensor_count_t *sensor_count);
|
|
||||||
int amdoam_get_error_description(int code, const char **description);
|
|
||||||
int amdoam_get_sensors_info(uint32_t device_id, oam_sensor_type_t type,
|
|
||||||
uint32_t num_sensors, oam_sensor_info_t sensor_info[]);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif // __cplusplus
|
|
||||||
#endif // OAM_INCLUDE_OAM_AMD_OAM_H_
|
|
||||||
@@ -1,635 +0,0 @@
|
|||||||
/*
|
|
||||||
* MIT License
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 Open Compute Project
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OAM_INCLUDE_OAM_OAM_MAPI_H_
|
|
||||||
#define OAM_INCLUDE_OAM_OAM_MAPI_H_
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file oam_mapi.h
|
|
||||||
* \brief OAM management and monitoring library API definitions
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_mapi_version_t
|
|
||||||
* \brief OAM library API version
|
|
||||||
* \details TBD
|
|
||||||
* All the libraries versions are expected to be backward compatible.
|
|
||||||
* The major version increment indicates a new API has been added.
|
|
||||||
* Minor version increment indicates an interface change.
|
|
||||||
*/
|
|
||||||
typedef struct oam_mapi_version {
|
|
||||||
uint32_t major;
|
|
||||||
uint32_t minor;
|
|
||||||
} oam_mapi_version_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_dev_properties_t
|
|
||||||
* \brief Network identifier for the device
|
|
||||||
* \details Immutable network identifier for the device.
|
|
||||||
* This is unique across the entire network.
|
|
||||||
*/
|
|
||||||
typedef struct oam_net_dev_id {
|
|
||||||
/*!< unique network identifier for the device */
|
|
||||||
int network_id;
|
|
||||||
} oam_net_dev_id_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* various lengths for device properties
|
|
||||||
*/
|
|
||||||
#define DEVICE_VENDOR_LEN 128
|
|
||||||
#define DEVICE_NAME_LEN 128
|
|
||||||
#define DEVICE_SKU_LEN 128
|
|
||||||
#define BOARD_NAME_LEN 128
|
|
||||||
#define BOARD_REVISION_LEN 128
|
|
||||||
#define BOARD_SERIAL_NUM_LEN 128
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_dev_properties_t
|
|
||||||
* \brief TBD
|
|
||||||
* \details TBD
|
|
||||||
*/
|
|
||||||
typedef struct oam_dev_properties {
|
|
||||||
/*!< Immutable local identifier for the device */
|
|
||||||
uint32_t device_id;
|
|
||||||
/*!< vendor name */
|
|
||||||
char device_vendor[DEVICE_VENDOR_LEN];
|
|
||||||
/*!< Device name */
|
|
||||||
char device_name[DEVICE_NAME_LEN];
|
|
||||||
/*!< SKU name */
|
|
||||||
char sku_name[DEVICE_SKU_LEN];
|
|
||||||
/*!< Board name */
|
|
||||||
char board_name[BOARD_NAME_LEN];
|
|
||||||
/*!< Board revision */
|
|
||||||
char board_revision[BOARD_REVISION_LEN];
|
|
||||||
/*!<
|
|
||||||
* Board Serial Number or UUID any other identifier, which can be used
|
|
||||||
* to identify devices uniquely and physically.
|
|
||||||
*/
|
|
||||||
char board_serial_number[BOARD_SERIAL_NUM_LEN];
|
|
||||||
} oam_dev_properties_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_sensor_count_t
|
|
||||||
* \brief TBD
|
|
||||||
* \details TBD
|
|
||||||
* Various sensor related information
|
|
||||||
*/
|
|
||||||
typedef struct oam_sensor_count {
|
|
||||||
uint32_t num_temperature_sensors;
|
|
||||||
uint32_t num_power_sensors;
|
|
||||||
uint32_t num_voltage_sensors;
|
|
||||||
uint32_t num_current_sensors;
|
|
||||||
uint32_t num_fans;
|
|
||||||
} oam_sensor_count_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_sensor_type_t
|
|
||||||
* \brief Sensor types
|
|
||||||
* \details This enumerated type defines available sensors types.
|
|
||||||
*/
|
|
||||||
typedef enum oam_sensor_type {
|
|
||||||
OAM_SENSOR_TYPE_POWER = 0,
|
|
||||||
OAM_SENSOR_TYPE_VOLTAGE,
|
|
||||||
OAM_SENSOR_TYPE_CURRENT,
|
|
||||||
OAM_SENSOR_TYPE_TEMP,
|
|
||||||
OAM_SENSOR_TYPE_FAN_SPEED,
|
|
||||||
OAM_SENSOR_TYPE_UNKNOWN
|
|
||||||
} oam_sensor_type_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_power_sensor_scale_t
|
|
||||||
* \brief scale for power measurements
|
|
||||||
* \details This enumerated type defines available scales for power measurements
|
|
||||||
*/
|
|
||||||
typedef enum oam_power_sensor_scale {
|
|
||||||
OAM_POWER_SCALE_uW = 0,
|
|
||||||
OAM_POWER_SCALE_mW,
|
|
||||||
OAM_POWER_SCALE_W,
|
|
||||||
} oam_power_sensor_scale_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_voltage_sensor_scale_t
|
|
||||||
* \brief scale for voltage measurements
|
|
||||||
* \details This enumerated type defines available scales for voltage measurements
|
|
||||||
*/
|
|
||||||
typedef enum oam_voltage_sensor_scale {
|
|
||||||
OAM_VOLTAGE_SCALE_uV = 0,
|
|
||||||
OAM_VOLTAGE_SCALE_mV,
|
|
||||||
OAM_VOLTAGE_SCALE_V,
|
|
||||||
} oam_voltage_sensor_scale_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_current_sensor_scale_t
|
|
||||||
* \brief scale for current measurements
|
|
||||||
* \details This enumerated type defines available scales for current measurements
|
|
||||||
*/
|
|
||||||
typedef enum oam_current_sensor_scale {
|
|
||||||
OAM_CURRENT_SCALE_uA = 0,
|
|
||||||
OAM_CURRENT_SCALE_mA,
|
|
||||||
OAM_CURRENT_SCALE_A,
|
|
||||||
} oam_current_sensor_scale_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_temp_sensor_scale_t
|
|
||||||
* \brief scale for temp measurements
|
|
||||||
* \details This enumerated type defines available scales for temp measurements
|
|
||||||
*/
|
|
||||||
typedef enum oam_temp_sensor_scale {
|
|
||||||
OAM_TEMP_SCALE_C = 0,
|
|
||||||
OAM_TEMP_SCALE_F
|
|
||||||
} oam_temp_sensor_scale_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_fan_sensor_scale_t
|
|
||||||
* \brief scale for power measurements
|
|
||||||
* \details This enumerated type defines available scales for power measurements
|
|
||||||
*/
|
|
||||||
typedef enum oam_fan_sensor_scale {
|
|
||||||
OAM_FAN_SPEED_Hz = 0,
|
|
||||||
OAM_FAN_SPEED_KHz,
|
|
||||||
OAM_FAN_SPEED_MHz
|
|
||||||
} oam_fan_sensor_scale_t;
|
|
||||||
|
|
||||||
typedef union oam_sensor_scale {
|
|
||||||
oam_power_sensor_scale_t power_scale;
|
|
||||||
oam_voltage_sensor_scale_t volate_scale;
|
|
||||||
oam_current_sensor_scale_t current_scale;
|
|
||||||
oam_temp_sensor_scale_t temp_scale;
|
|
||||||
oam_fan_sensor_scale_t fan_scale;
|
|
||||||
} oam_sensor_scale_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_dev_handle_t
|
|
||||||
* \brief Device handle
|
|
||||||
* \details Device handle obtained using open call
|
|
||||||
* The same handle is used by all the APIs which are used to perform
|
|
||||||
* specific operation on that device.
|
|
||||||
*/
|
|
||||||
typedef struct oam_dev_handle {
|
|
||||||
void *handle;
|
|
||||||
} oam_dev_handle_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_dev_mode_t
|
|
||||||
* \brief Device open modes
|
|
||||||
* \details This enumerated type defines modes in which the device can be opened
|
|
||||||
* For some operations e.g. health check user should open the device
|
|
||||||
* in exclusive mode, so that if there are many applications using the same
|
|
||||||
* device there are no side effects.
|
|
||||||
*/
|
|
||||||
typedef enum oam_dev_mode {
|
|
||||||
OAM_DEV_MODE_EXCLUSIVE = 0,
|
|
||||||
OAM_DEV_MODE_NONEXLUSIVE = 1,
|
|
||||||
OAM_DEV_MODE_UNKNOWN = 0xFF
|
|
||||||
} oam_dev_mode_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \def OAM_SENSOR_NAME_MAX
|
|
||||||
* \brief length of sensor name
|
|
||||||
*/
|
|
||||||
#define OAM_SENSOR_NAME_MAX 256
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_sensor_info_t
|
|
||||||
* \brief Sensor information
|
|
||||||
* \details Structure to store various info of sensors.
|
|
||||||
*/
|
|
||||||
typedef struct oam_sensor_info {
|
|
||||||
char sensor_name[OAM_SENSOR_NAME_MAX];
|
|
||||||
oam_sensor_type_t sensor_type;
|
|
||||||
oam_sensor_scale_t scale;
|
|
||||||
int64_t value;
|
|
||||||
} oam_sensor_info_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_dev_error_count_t
|
|
||||||
* \brief Device error information
|
|
||||||
* \details Various types of errors reported by device.
|
|
||||||
*/
|
|
||||||
typedef struct oam_dev_error_count {
|
|
||||||
uint32_t total_error_count;
|
|
||||||
uint32_t fatal_error_count;
|
|
||||||
uint32_t unknown_error_count;
|
|
||||||
uint32_t ecc_error_count;
|
|
||||||
} oam_dev_error_count_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_firmware_version_t
|
|
||||||
* \brief Device error information
|
|
||||||
* \details Structure to store various firmware versions of OAM module
|
|
||||||
*/
|
|
||||||
typedef struct oam_firmware_version {
|
|
||||||
oam_mapi_version_t device_boot_fw_version;
|
|
||||||
oam_mapi_version_t device_fw_version;
|
|
||||||
oam_mapi_version_t board_boot_fw_version;
|
|
||||||
oam_mapi_version_t board_fw_version;
|
|
||||||
} oam_firmware_version_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_pci_info_t
|
|
||||||
* \brief PCI information for the device
|
|
||||||
* \details Structure to store PCI (Domain, BDF) information of the device
|
|
||||||
*/
|
|
||||||
typedef struct oam_pci_info {
|
|
||||||
uint16_t domain;
|
|
||||||
uint8_t bus;
|
|
||||||
uint8_t device;
|
|
||||||
uint8_t function;
|
|
||||||
} oam_pci_info_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_net_port_state_t
|
|
||||||
* \brief Network port state
|
|
||||||
* \details This enumerated type defines various states of the network port
|
|
||||||
*/
|
|
||||||
typedef enum oam_net_port_state {
|
|
||||||
OAM_NET_PORT_DISABLED = 0,
|
|
||||||
OAM_NET_PORT_ENABLED = 1
|
|
||||||
} oam_net_port_state_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_net_port_status_t
|
|
||||||
* \brief Network port status
|
|
||||||
* \details This enumerated type defines various status of the network port
|
|
||||||
*/
|
|
||||||
typedef enum oam_net_port_status {
|
|
||||||
OAM_NET_PORT_UP = 0,
|
|
||||||
OAM_NET_PORT_DOWN = 1,
|
|
||||||
} oam_net_port_status_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_net_port_id_t
|
|
||||||
* \brief Network port identifiers
|
|
||||||
* \details This enumerated type defines various identifiers for network ports
|
|
||||||
*/
|
|
||||||
typedef enum oam_net_port_id {
|
|
||||||
OAM_NET_PORT0 = 0,
|
|
||||||
OAM_NET_PORT1 = 1,
|
|
||||||
OAM_NET_PORT2 = 2,
|
|
||||||
OAM_NET_PORT_MAX = 0xFFFF
|
|
||||||
} oam_net_port_id_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_firmware_modes_t
|
|
||||||
* \brief Supported mode to update firmware on device
|
|
||||||
* \details This enumerated type defines various modes which are supported by
|
|
||||||
* the device to update firmware.
|
|
||||||
*/
|
|
||||||
typedef enum oam_firmware_modes {
|
|
||||||
OAM_DOWNLOAD_ONLY = 0,
|
|
||||||
OAM_DOWNLOAD_ACTIVATE = 1
|
|
||||||
} oam_firmware_modes_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \def OAM_NET_PORT_NAME
|
|
||||||
* \brief length of network port name
|
|
||||||
*/
|
|
||||||
#define OAM_NET_PORT_NAME 256
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_net_port_desc
|
|
||||||
* \brief Network port description
|
|
||||||
* \details Structure to store additional details about the network port
|
|
||||||
*/
|
|
||||||
typedef struct oam_net_port_desc {
|
|
||||||
char name[OAM_NET_PORT_NAME];
|
|
||||||
} oam_net_port_desc_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \def OAM_DEV_HOST_NAME
|
|
||||||
* \brief length of host name
|
|
||||||
*/
|
|
||||||
#define OAM_DEV_HOST_NAME 256
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_net_dev_info_t
|
|
||||||
* \brief Information about the device on a network
|
|
||||||
* \details Structure to store additional details about the network device
|
|
||||||
* on a particular network.
|
|
||||||
*/
|
|
||||||
typedef struct oam_net_dev_info {
|
|
||||||
oam_net_dev_id_t net_dev_id;
|
|
||||||
char host_name[OAM_DEV_HOST_NAME];
|
|
||||||
oam_pci_info_t pci_info;
|
|
||||||
} oam_net_dev_info_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_neighbour_info_t
|
|
||||||
* \brief Information about device neighburs
|
|
||||||
* \details Structure to store information about device neighbours on the
|
|
||||||
* network
|
|
||||||
*/
|
|
||||||
typedef struct oam_neighbour_info {
|
|
||||||
oam_net_port_id_t device_port;
|
|
||||||
oam_net_dev_info_t device_info;
|
|
||||||
} oam_neighbour_info_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_dev_tpc_id_t
|
|
||||||
* \brief TPC identifiers
|
|
||||||
* \details This enumerated type defines various identifiers for TPCs
|
|
||||||
*/
|
|
||||||
typedef enum oam_dev_tpc_id {
|
|
||||||
OAM_DEV_TPC0,
|
|
||||||
OAM_DEV_TPC1,
|
|
||||||
OAM_DEV_TPC2,
|
|
||||||
OAM_DEV_TPC_MAX
|
|
||||||
} oam_dev_tpc_id_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \def OAM_TPC_NAME
|
|
||||||
* \brief length of TPC name
|
|
||||||
*/
|
|
||||||
#define OAM_TPC_NAME 256
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_tpc_desc_t
|
|
||||||
* \brief TPC description
|
|
||||||
* \details Structure to store information about TPC e.g. name corresponding
|
|
||||||
* to the id etc.
|
|
||||||
*/
|
|
||||||
typedef struct oam_tpc_desc {
|
|
||||||
char name[256];
|
|
||||||
} oam_tpc_desc_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_dev_tpc_stats_t
|
|
||||||
* \brief TPC statistical information
|
|
||||||
* \details Structure to store information about TPC statistical information
|
|
||||||
* e.g. TPC utilization
|
|
||||||
*/
|
|
||||||
typedef struct oam_dev_tpc_stats {
|
|
||||||
double util;
|
|
||||||
} oam_dev_tpc_stats_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum oam_dev_mem_id_t
|
|
||||||
* \brief Device memory identifiers
|
|
||||||
* \details This enumerated type defines various identifiers for device memories
|
|
||||||
*/
|
|
||||||
typedef enum oam_dev_mem_id {
|
|
||||||
OAM_DEV_MEM0,
|
|
||||||
OAM_DEV_MEM1,
|
|
||||||
OAM_DEV_MEM2,
|
|
||||||
OAM_DEV_MEM_MAX
|
|
||||||
} oam_dev_mem_id_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_mem_desc_t
|
|
||||||
* \brief Device memory description
|
|
||||||
* \details Structure to store additional details about device memories port
|
|
||||||
*/
|
|
||||||
typedef struct oam_mem_desc {
|
|
||||||
char name[256];
|
|
||||||
} oam_mem_desc_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_dev_mem_stats_t
|
|
||||||
* \brief Device memory statistical information
|
|
||||||
* \details Structure to store various statastical information about device
|
|
||||||
* memory.
|
|
||||||
*/
|
|
||||||
typedef struct oam_dev_mem_stats {
|
|
||||||
uint32_t total_mem;
|
|
||||||
uint32_t allocated_mem;
|
|
||||||
uint32_t free_mem;
|
|
||||||
} oam_dev_mem_stats_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_net_port_pkt_stats_t
|
|
||||||
* \brief Device network port statistical information
|
|
||||||
* \details Structure to store various statastical information about the network
|
|
||||||
* packets on a given port.
|
|
||||||
*/
|
|
||||||
typedef struct oam_net_port_pkt_stats {
|
|
||||||
uint64_t rx_count;
|
|
||||||
uint64_t tx_count;
|
|
||||||
uint64_t rx_errors;
|
|
||||||
uint64_t tx_errors;
|
|
||||||
} oam_net_port_pkt_stats_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct oam_ops_t
|
|
||||||
* \brief OAM Device operations
|
|
||||||
* \details Structure provides list of APIs which needs to be
|
|
||||||
* supported by the OAM library.
|
|
||||||
*/
|
|
||||||
typedef struct oam_ops {
|
|
||||||
/*!<
|
|
||||||
* to initialise library instance and perform version compatibility
|
|
||||||
* check
|
|
||||||
*/
|
|
||||||
int (*init)(void);
|
|
||||||
int (*free)(void);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To get error description from the error code
|
|
||||||
*/
|
|
||||||
int (*get_error_description)(int error_code, const char **error_description);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To retrieve the OAM Management interface version
|
|
||||||
*/
|
|
||||||
int (*get_mapi_version)(oam_mapi_version_t *version);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To retrieve the number of devices present/discovered by the library
|
|
||||||
*/
|
|
||||||
int (*discover_devices)(uint32_t *device_count);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To retrieve device properties for each discovered devices
|
|
||||||
*/
|
|
||||||
int (*get_dev_properties)(uint32_t device_count,
|
|
||||||
oam_dev_properties_t *devices);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To retrieve PCI properties of the device
|
|
||||||
*/
|
|
||||||
int (*get_pci_properties)(uint32_t device_id, oam_pci_info_t *pci_info);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To query the number of various sensors present
|
|
||||||
*/
|
|
||||||
int (*get_sensors_count)(uint32_t device_id,
|
|
||||||
oam_sensor_count_t *sensor_count);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* Open the device and obtain handle
|
|
||||||
*/
|
|
||||||
int (*open_device)(uint32_t *dev_id, oam_dev_mode_t mode,
|
|
||||||
oam_dev_handle_t *handle);
|
|
||||||
int (*close_device)(oam_dev_handle_t *handle);
|
|
||||||
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To read various sensor values for a given sensor type
|
|
||||||
*/
|
|
||||||
int (*get_sensors_info)(uint32_t device_id,
|
|
||||||
oam_sensor_type_t type,
|
|
||||||
uint32_t num_sensors,
|
|
||||||
oam_sensor_info_t sensor_info[]);
|
|
||||||
/*!<
|
|
||||||
* To read current error count of the device
|
|
||||||
*/
|
|
||||||
int (*get_device_error_count)(oam_dev_handle_t *handle,
|
|
||||||
oam_dev_error_count_t *count);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To update firmware on the device
|
|
||||||
* fw_image contains a null terminated string which specifies complete
|
|
||||||
* path where the firmware image is located
|
|
||||||
*/
|
|
||||||
int (*download_firmware)(uint32_t *device_id, char *fw_image,
|
|
||||||
oam_firmware_modes_t mode);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To query firmware versions
|
|
||||||
*/
|
|
||||||
int (*get_firmware_version)(uint32_t *device_id,
|
|
||||||
oam_firmware_version_t *version);
|
|
||||||
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* to get network id from device id
|
|
||||||
*/
|
|
||||||
int (*get_net_dev_id)(uint32_t *device_id, oam_net_dev_id_t *net_device);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* Network management APIs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* discover network.
|
|
||||||
*/
|
|
||||||
int (*discover_network)(int *net_dev_count);
|
|
||||||
int (*get_dev_net_properties)(oam_net_dev_info_t *net_dev_info);
|
|
||||||
|
|
||||||
int (*get_neighbour_count)(uint32_t *device,
|
|
||||||
oam_net_port_id_t local_port_id,
|
|
||||||
uint32_t *neighbor_count);
|
|
||||||
|
|
||||||
int (*get_neighbours_info)(uint32_t *device,
|
|
||||||
oam_net_port_id_t local_port_id,
|
|
||||||
uint32_t *neighbors_count,
|
|
||||||
oam_neighbour_info_t *neighbours_info);
|
|
||||||
|
|
||||||
int (*configure_network)(oam_net_dev_id_t *net_devices,
|
|
||||||
uint32_t *net_device_count,
|
|
||||||
char *network_name);
|
|
||||||
|
|
||||||
int (*destroy_network)(char *network_name);
|
|
||||||
|
|
||||||
int (*query_network)(char *network_name, oam_net_dev_info_t *devices,
|
|
||||||
uint32_t *device_count);
|
|
||||||
|
|
||||||
int (*get_network_count)(uint32_t *network_count);
|
|
||||||
int (*list_networks)(char *network_names[]);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* Various statistics related to blocks
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To query number of ports
|
|
||||||
*/
|
|
||||||
int (*get_net_port_count)(oam_dev_handle_t *handle, uint32_t *count,
|
|
||||||
oam_net_port_id_t *port_ids);
|
|
||||||
|
|
||||||
int (*get_net_port_desc)(oam_dev_handle_t *handle, oam_net_port_id_t *port,
|
|
||||||
oam_net_port_desc_t *desc);
|
|
||||||
|
|
||||||
int (*get_net_port_state)(oam_dev_handle_t *handle, oam_net_port_id_t *port,
|
|
||||||
oam_net_port_state_t *state);
|
|
||||||
|
|
||||||
int (*check_net_port_status)(oam_dev_handle_t *handle,
|
|
||||||
oam_net_port_id_t *port,
|
|
||||||
oam_net_port_status_t *status);
|
|
||||||
int (*get_net_port_pkt_stats)(oam_dev_handle_t *handle,
|
|
||||||
oam_net_port_id_t *port,
|
|
||||||
uint32_t duration_sec,
|
|
||||||
oam_net_port_pkt_stats_t *stats);
|
|
||||||
|
|
||||||
int (*query_net_port_bandwidth)(oam_dev_handle_t *handle,
|
|
||||||
oam_net_port_id_t *port,
|
|
||||||
uint32_t duration_sec,
|
|
||||||
double *bandwidth);
|
|
||||||
|
|
||||||
int (*get_tpc_count)(oam_dev_handle_t *handle, uint32_t *count,
|
|
||||||
oam_dev_tpc_id_t *tpc_ids);
|
|
||||||
|
|
||||||
int (*get_tpc_desc)(oam_dev_handle_t *handle, oam_dev_tpc_id_t *tpc_id,
|
|
||||||
oam_tpc_desc_t *desc);
|
|
||||||
|
|
||||||
int (*get_tpc_stats)(oam_dev_handle_t *handle,
|
|
||||||
oam_dev_tpc_id_t *port,
|
|
||||||
oam_dev_tpc_stats_t *stats,
|
|
||||||
uint32_t duration_sec);
|
|
||||||
|
|
||||||
int (*get_mem_count)(oam_dev_handle_t *handle, uint32_t *count,
|
|
||||||
oam_dev_mem_id_t *mem_ids);
|
|
||||||
|
|
||||||
int (*get_mem_desc)(oam_dev_handle_t *handle, oam_dev_mem_id_t *tpc_id,
|
|
||||||
oam_mem_desc_t *desc);
|
|
||||||
|
|
||||||
int (*get_mem_stats)(oam_dev_handle_t *handle, oam_dev_mem_id_t *mem_id,
|
|
||||||
oam_dev_mem_stats_t *stats);
|
|
||||||
|
|
||||||
/*!<
|
|
||||||
* To check the health of the individual components, libraries
|
|
||||||
* generates test workload to check if the block is functioning properly
|
|
||||||
* or not. So no other workload should be running while calling these
|
|
||||||
* APIs
|
|
||||||
*/
|
|
||||||
int (*check_tpc_health)(uint32_t *device_id, oam_dev_tpc_id_t *tpc_id);
|
|
||||||
int (*check_net_port_health)(uint32_t *device_id, oam_net_port_id_t *port);
|
|
||||||
int (*check_mem_health)(uint32_t *device_id, oam_dev_mem_id_t *port);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Following needs more attention, will work on in next
|
|
||||||
int (*get_fan_speed)(oam_dev_t *oam);
|
|
||||||
int (*set_fan_speed)(oam_dev_t *oam, int speed);
|
|
||||||
|
|
||||||
int (*get_power_cap)(oam_dev_t *oam);
|
|
||||||
int (*set_power_cap)(oam_dev_t *oam, int power);
|
|
||||||
|
|
||||||
int (*get_telemetry)(oam_dev_t *oam);
|
|
||||||
*/
|
|
||||||
|
|
||||||
} oam_ops_t;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // OAM_INCLUDE_OAM_OAM_MAPI_H_
|
|
||||||
@@ -1,392 +0,0 @@
|
|||||||
/*
|
|
||||||
* MIT License
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 Open Compute Project
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <sstream>
|
|
||||||
#include <cstring>
|
|
||||||
#include <iostream>
|
|
||||||
#include <regex> // NOLINT
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include "rocm_smi/rocm_smi_common.h"
|
|
||||||
#include "rocm_smi/rocm_smi_main.h"
|
|
||||||
#include "rocm_smi/rocm_smi_device.h"
|
|
||||||
#include "rocm_smi/rocm_smi_utils.h"
|
|
||||||
#include "rocm_smi/rocm_smi_exception.h"
|
|
||||||
#include "rocm_smi/rocm_smi_counters.h"
|
|
||||||
#include "rocm_smi/rocm_smi_kfd.h"
|
|
||||||
#include "rocm_smi/rocm_smi.h"
|
|
||||||
|
|
||||||
#include "oam/oam_mapi.h"
|
|
||||||
#include "oam/amd_oam.h"
|
|
||||||
|
|
||||||
static const std::map<int, const char *> err_map = {
|
|
||||||
{ AMDOAM_STATUS_INVALID_ARGS, "Invalid arguments" },
|
|
||||||
{ AMDOAM_STATUS_NOT_SUPPORTED, "Feature not supported" },
|
|
||||||
{ AMDOAM_STATUS_FILE_ERROR, "Problem accessing a file" },
|
|
||||||
{ AMDOAM_STATUS_PERMISSION, "Permission denied" },
|
|
||||||
{ AMDOAM_STATUS_OUT_OF_RESOURCES, "Not enough memory or other resource" },
|
|
||||||
{ AMDOAM_STATUS_INTERNAL_EXCEPTION, "An internal exception was caught" },
|
|
||||||
{ AMDOAM_STATUS_INPUT_OUT_OF_BOUNDS,
|
|
||||||
"The provided input is out of allowable or safe range" },
|
|
||||||
{ AMDOAM_STATUS_INIT_ERROR, "AMDOAM is not initialized or init failed" },
|
|
||||||
{ AMDOAM_STATUS_ERROR, "Generic error" },
|
|
||||||
{ AMDOAM_STATUS_NOT_FOUND, "An item was searched for but not found" }
|
|
||||||
};
|
|
||||||
|
|
||||||
#define TRY try {
|
|
||||||
#define CATCH } catch (...) {return handleRSMIException();}
|
|
||||||
|
|
||||||
static bool rsmi_initialized;
|
|
||||||
|
|
||||||
static int rsmi_status_to_amdoam_errorcode(rsmi_status_t status) {
|
|
||||||
if (status > RSMI_STATUS_INIT_ERROR)
|
|
||||||
return -AMDOAM_STATUS_ERROR;
|
|
||||||
else
|
|
||||||
return -1 * static_cast<int>(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int handleRSMIException() {
|
|
||||||
rsmi_status_t ret = amd::smi::handleException();
|
|
||||||
return rsmi_status_to_amdoam_errorcode(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
int amdoam_get_error_description(int code, const char **description) {
|
|
||||||
if (description == nullptr)
|
|
||||||
return -AMDOAM_STATUS_INVALID_ARGS;
|
|
||||||
|
|
||||||
auto search = err_map.find(code);
|
|
||||||
if (search == err_map.end())
|
|
||||||
return -AMDOAM_STATUS_NOT_FOUND;
|
|
||||||
|
|
||||||
*description = search->second;
|
|
||||||
return AMDOAM_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amdoam_init(void) {
|
|
||||||
TRY
|
|
||||||
|
|
||||||
rsmi_status_t status = rsmi_init(0);
|
|
||||||
|
|
||||||
if (status != RSMI_STATUS_SUCCESS)
|
|
||||||
return rsmi_status_to_amdoam_errorcode(status);
|
|
||||||
|
|
||||||
rsmi_initialized = true;
|
|
||||||
return AMDOAM_STATUS_SUCCESS;
|
|
||||||
|
|
||||||
CATCH
|
|
||||||
}
|
|
||||||
|
|
||||||
int amdoam_free(void) {
|
|
||||||
rsmi_status_t status = rsmi_shut_down();
|
|
||||||
|
|
||||||
if (status != RSMI_STATUS_SUCCESS)
|
|
||||||
return rsmi_status_to_amdoam_errorcode(status);
|
|
||||||
|
|
||||||
return AMDOAM_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amdoam_discover_devices(uint32_t *device_count) {
|
|
||||||
rsmi_status_t status;
|
|
||||||
|
|
||||||
if (device_count == nullptr) {
|
|
||||||
return -AMDOAM_STATUS_INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = rsmi_num_monitor_devices(device_count);
|
|
||||||
if (status != RSMI_STATUS_SUCCESS)
|
|
||||||
return rsmi_status_to_amdoam_errorcode(status);
|
|
||||||
|
|
||||||
return AMDOAM_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amdoam_get_pci_properties(uint32_t device_id, oam_pci_info_t *pci_info) {
|
|
||||||
uint64_t bdfid;
|
|
||||||
|
|
||||||
TRY
|
|
||||||
if (pci_info == nullptr) {
|
|
||||||
return -AMDOAM_STATUS_INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
rsmi_status_t status = rsmi_dev_pci_id_get(device_id, &bdfid);
|
|
||||||
if (status != RSMI_STATUS_SUCCESS)
|
|
||||||
return rsmi_status_to_amdoam_errorcode(status);
|
|
||||||
|
|
||||||
pci_info->domain = (uint16_t)(bdfid >> 32) & 0xffff;
|
|
||||||
pci_info->bus = (bdfid >> 8) & 0xff;
|
|
||||||
pci_info->device = (bdfid >> 3) & 0x1f;
|
|
||||||
pci_info->function = bdfid & 0x7;
|
|
||||||
CATCH
|
|
||||||
|
|
||||||
return AMDOAM_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amdoam_get_dev_properties(uint32_t num_devices,
|
|
||||||
oam_dev_properties_t *devices) {
|
|
||||||
const size_t buf_size = 32;
|
|
||||||
char buf[buf_size] = "";
|
|
||||||
uint32_t dev_inx;
|
|
||||||
oam_dev_properties_t *dev = devices;
|
|
||||||
|
|
||||||
TRY
|
|
||||||
if (devices == nullptr)
|
|
||||||
return -AMDOAM_STATUS_INVALID_ARGS;
|
|
||||||
if (!rsmi_initialized)
|
|
||||||
return -AMDOAM_STATUS_INIT_ERROR;
|
|
||||||
|
|
||||||
for (dev_inx = 0; dev_inx < num_devices; dev_inx++) {
|
|
||||||
dev->device_id = dev_inx;
|
|
||||||
/* If fails to get any following properties, it's not treated as a deal
|
|
||||||
* breaker. Variable not filled means that property is not available on
|
|
||||||
* this device or AMD doesn't support that property.
|
|
||||||
*/
|
|
||||||
rsmi_dev_vendor_name_get(dev_inx, dev->device_vendor, DEVICE_VENDOR_LEN);
|
|
||||||
rsmi_dev_name_get(dev_inx, dev->device_name, DEVICE_NAME_LEN);
|
|
||||||
rsmi_dev_vbios_version_get(dev_inx, buf, buf_size);
|
|
||||||
if (std::strlen(buf) > 0) {
|
|
||||||
std::strncpy(dev->sku_name, &buf[4], 6);
|
|
||||||
std::strncpy(dev->board_name, buf, 12);
|
|
||||||
}
|
|
||||||
rsmi_dev_serial_number_get(dev_inx, dev->board_serial_number,
|
|
||||||
BOARD_SERIAL_NUM_LEN);
|
|
||||||
++dev;
|
|
||||||
}
|
|
||||||
CATCH
|
|
||||||
|
|
||||||
return AMDOAM_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint32_t
|
|
||||||
get_num_sensors(std::string hwmon_path, std::string fn_reg) {
|
|
||||||
uint32_t sensor_max = 0;
|
|
||||||
std::string fn_reg_ex = "\\b" + fn_reg + "([0-9]+)([^ ]*)";
|
|
||||||
std::string fn;
|
|
||||||
std::smatch m;
|
|
||||||
int32_t temp = 0;
|
|
||||||
std::string s1("in");
|
|
||||||
std::regex re(fn_reg_ex);
|
|
||||||
auto hwmon_dir = opendir(hwmon_path.c_str());
|
|
||||||
assert(hwmon_dir != nullptr);
|
|
||||||
auto dentry = readdir(hwmon_dir);
|
|
||||||
while (dentry != nullptr) {
|
|
||||||
fn = dentry->d_name;
|
|
||||||
if (std::regex_search(fn, m, re)) {
|
|
||||||
std::string output = std::regex_replace(
|
|
||||||
fn,
|
|
||||||
std::regex("[^0-9]*([0-9]+).*"),
|
|
||||||
std::string("$1"));
|
|
||||||
temp = stoi(output);
|
|
||||||
|
|
||||||
assert(temp >= 0);
|
|
||||||
|
|
||||||
if (s1.compare(fn_reg) == 0)
|
|
||||||
++temp;
|
|
||||||
if (static_cast<uint32_t>(temp) > sensor_max)
|
|
||||||
sensor_max = static_cast<uint32_t>(temp);
|
|
||||||
}
|
|
||||||
dentry = readdir(hwmon_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir(hwmon_dir);
|
|
||||||
return sensor_max;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int amdoam_get_sensors_count(uint32_t device_id,
|
|
||||||
oam_sensor_count_t *sensor_count) {
|
|
||||||
uint32_t dv_ind = device_id;
|
|
||||||
|
|
||||||
TRY
|
|
||||||
if (sensor_count == nullptr)
|
|
||||||
return -AMDOAM_STATUS_INVALID_ARGS;
|
|
||||||
GET_DEV_FROM_INDX
|
|
||||||
assert(dev->monitor() != nullptr);
|
|
||||||
std::string hwmon_path = dev->monitor()->path();
|
|
||||||
sensor_count->num_temperature_sensors = get_num_sensors(hwmon_path, "temp");
|
|
||||||
sensor_count->num_fans = get_num_sensors(hwmon_path, "fan");
|
|
||||||
sensor_count->num_voltage_sensors = get_num_sensors(hwmon_path, "in");
|
|
||||||
sensor_count->num_power_sensors = get_num_sensors(hwmon_path, "power");
|
|
||||||
sensor_count->num_current_sensors = get_num_sensors(hwmon_path, "current");
|
|
||||||
CATCH
|
|
||||||
|
|
||||||
return AMDOAM_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amdoam_get_sensors_info(uint32_t device_id, oam_sensor_type_t type,
|
|
||||||
uint32_t num_sensors, oam_sensor_info_t sensor_info[]) {
|
|
||||||
uint32_t dv_ind = device_id;
|
|
||||||
std::string val_str;
|
|
||||||
uint32_t i;
|
|
||||||
rsmi_status_t status;
|
|
||||||
|
|
||||||
TRY
|
|
||||||
if ((sensor_info == nullptr) || (type >= OAM_SENSOR_TYPE_UNKNOWN))
|
|
||||||
return -AMDOAM_STATUS_INVALID_ARGS;
|
|
||||||
GET_DEV_FROM_INDX
|
|
||||||
assert(dev->monitor() != nullptr);
|
|
||||||
switch (type) {
|
|
||||||
case OAM_SENSOR_TYPE_POWER:
|
|
||||||
for (i = 0; i < num_sensors; i++) {
|
|
||||||
snprintf(sensor_info[i].sensor_name, OAM_SENSOR_NAME_MAX,
|
|
||||||
"POWER_SENSOR_%d", i+1);
|
|
||||||
sensor_info[i].sensor_type = type;
|
|
||||||
status = rsmi_dev_power_ave_get(device_id, i,
|
|
||||||
reinterpret_cast<uint64_t*>(&sensor_info[i].value));
|
|
||||||
if (status != RSMI_STATUS_SUCCESS)
|
|
||||||
return rsmi_status_to_amdoam_errorcode(status);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OAM_SENSOR_TYPE_VOLTAGE:
|
|
||||||
for (i = 0; i < num_sensors; i++) {
|
|
||||||
snprintf(sensor_info[i].sensor_name, OAM_SENSOR_NAME_MAX,
|
|
||||||
"VOLTAGE_SENSOR_%d", i);
|
|
||||||
sensor_info[i].sensor_type = type;
|
|
||||||
status = rsmi_dev_volt_metric_get(device_id, RSMI_VOLT_TYPE_VDDGFX,
|
|
||||||
RSMI_VOLT_CURRENT, &sensor_info[i].value);
|
|
||||||
if (status != RSMI_STATUS_SUCCESS)
|
|
||||||
return rsmi_status_to_amdoam_errorcode(status);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OAM_SENSOR_TYPE_TEMP:
|
|
||||||
for (i = 0; i < num_sensors; i++) {
|
|
||||||
snprintf(sensor_info[i].sensor_name, OAM_SENSOR_NAME_MAX,
|
|
||||||
"TEMP_SENSOR_%d", i+1);
|
|
||||||
sensor_info[i].sensor_type = type;
|
|
||||||
status = rsmi_dev_temp_metric_get(device_id, i, RSMI_TEMP_CURRENT,
|
|
||||||
&sensor_info[i].value);
|
|
||||||
if (status != RSMI_STATUS_SUCCESS)
|
|
||||||
return rsmi_status_to_amdoam_errorcode(status);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OAM_SENSOR_TYPE_FAN_SPEED:
|
|
||||||
for (i = 0; i < num_sensors; i++) {
|
|
||||||
snprintf(sensor_info[i].sensor_name, OAM_SENSOR_NAME_MAX,
|
|
||||||
"FAN_SENSOR_%d", i+1);
|
|
||||||
sensor_info[i].sensor_type = type;
|
|
||||||
status = rsmi_dev_fan_speed_get(device_id, i, &sensor_info[i].value);
|
|
||||||
if (status != RSMI_STATUS_SUCCESS)
|
|
||||||
return rsmi_status_to_amdoam_errorcode(status);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return -AMDOAM_STATUS_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
CATCH
|
|
||||||
|
|
||||||
return AMDOAM_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(x): This function doesn't work for OAM. It's just a version
|
|
||||||
// of rsmi_dev_ecc_count_get(), which has similar functionality.
|
|
||||||
// The purpose here is just to drive refactoring; e.g., making macros
|
|
||||||
// available and previously static functions global.
|
|
||||||
int
|
|
||||||
get_device_error_count(oam_dev_handle_t *handle,
|
|
||||||
oam_dev_error_count_t *count) {
|
|
||||||
std::vector<std::string> val_vec;
|
|
||||||
rsmi_status_t ret;
|
|
||||||
|
|
||||||
TRY
|
|
||||||
// TODO(x): replace with final code...
|
|
||||||
// Below, we are just returning errors for RSMI_GPU_BLOCK_GFX as a
|
|
||||||
// placeholder
|
|
||||||
(void)handle; // Just ignore for now
|
|
||||||
|
|
||||||
rsmi_gpu_block_t block = RSMI_GPU_BLOCK_GFX;
|
|
||||||
|
|
||||||
// The macro CHK_SUPPORT_VAR assumes the existence of a device index variable
|
|
||||||
// "dv_ind". Presumably, the device index will come from the "handle"
|
|
||||||
// pointer. Since I don't know how that will be implemented, for now we
|
|
||||||
// will just make up a device index:
|
|
||||||
uint32_t dv_ind = 0;
|
|
||||||
CHK_SUPPORT_VAR(count, block)
|
|
||||||
|
|
||||||
amd::smi::DevInfoTypes type;
|
|
||||||
switch (block) {
|
|
||||||
case RSMI_GPU_BLOCK_UMC:
|
|
||||||
type = amd::smi::kDevErrCntUMC;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RSMI_GPU_BLOCK_SDMA:
|
|
||||||
type = amd::smi::kDevErrCntSDMA;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RSMI_GPU_BLOCK_GFX:
|
|
||||||
type = amd::smi::kDevErrCntGFX;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RSMI_GPU_BLOCK_MMHUB:
|
|
||||||
type = amd::smi::kDevErrCntMMHUB;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RSMI_GPU_BLOCK_PCIE_BIF:
|
|
||||||
type = amd::smi::kDevErrCntPCIEBIF;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RSMI_GPU_BLOCK_HDP:
|
|
||||||
type = amd::smi::kDevErrCntHDP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RSMI_GPU_BLOCK_XGMI_WAFL:
|
|
||||||
type = amd::smi::kDevErrCntXGMIWAFL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return RSMI_STATUS_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEVICE_MUTEX
|
|
||||||
|
|
||||||
ret = GetDevValueVec(type, dv_ind, &val_vec);
|
|
||||||
|
|
||||||
if (ret == RSMI_STATUS_FILE_ERROR) {
|
|
||||||
return RSMI_STATUS_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
if (ret != RSMI_STATUS_SUCCESS) {
|
|
||||||
return static_cast<int>(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(val_vec.size() == 2);
|
|
||||||
|
|
||||||
std::string junk;
|
|
||||||
std::istringstream fs1(val_vec[0]);
|
|
||||||
|
|
||||||
fs1 >> junk;
|
|
||||||
assert(junk == "ue:");
|
|
||||||
fs1 >> count->total_error_count;
|
|
||||||
|
|
||||||
std::istringstream fs2(val_vec[1]);
|
|
||||||
|
|
||||||
fs2 >> junk;
|
|
||||||
assert(junk == "ce:");
|
|
||||||
fs2 >> count->total_error_count;
|
|
||||||
|
|
||||||
return static_cast<int>(ret);
|
|
||||||
CATCH
|
|
||||||
}
|
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.16.8)
|
|
||||||
|
|
||||||
set(RSMI_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
set(RSMI_WRAPPER_DIR ${RSMI_BUILD_DIR}/wrapper_dir)
|
|
||||||
set(RSMI_WRAPPER_INC_DIR ${RSMI_WRAPPER_DIR}/include/${ROCM_SMI})
|
|
||||||
set(OAM_TARGET_NAME "oam")
|
|
||||||
set(OAM_WRAPPER_INC_DIR ${RSMI_WRAPPER_DIR}/include/${OAM_TARGET_NAME})
|
|
||||||
set(RSMI_WRAPPER_LIB_DIR ${RSMI_WRAPPER_DIR}/${ROCM_SMI}/lib)
|
|
||||||
set(OAM_WRAPPER_LIB_DIR ${RSMI_WRAPPER_DIR}/${OAM_TARGET_NAME}/lib)
|
|
||||||
## package headers
|
|
||||||
set(PUBLIC_RSMI_HEADERS
|
|
||||||
rocm_smi.h
|
|
||||||
${ROCM_SMI_TARGET}Config.h
|
|
||||||
kfd_ioctl.h)
|
|
||||||
set(OAM_HEADERS
|
|
||||||
oam_mapi.h
|
|
||||||
amd_oam.h)
|
|
||||||
|
|
||||||
#Function to generate header template file
|
|
||||||
function(create_header_template)
|
|
||||||
file(WRITE ${RSMI_WRAPPER_DIR}/header.hpp.in "/*
|
|
||||||
Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the \"Software\"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
*/\n\n#ifndef @include_guard@\n#define @include_guard@ \n\n#pragma message(\"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with @prefix_name@\")\n@include_statements@ \n\n#endif")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#use header template file and generate wrapper header files
|
|
||||||
function(generate_wrapper_header)
|
|
||||||
file(MAKE_DIRECTORY ${RSMI_WRAPPER_INC_DIR})
|
|
||||||
set(prefix_name "${prefix_name}${ROCM_SMI}")
|
|
||||||
#Generate wrapper header files from the list
|
|
||||||
foreach(header_file ${PUBLIC_RSMI_HEADERS})
|
|
||||||
# set include guard
|
|
||||||
get_filename_component(INC_GAURD_NAME ${header_file} NAME_WE)
|
|
||||||
string(TOUPPER ${INC_GAURD_NAME} INC_GAURD_NAME)
|
|
||||||
set(include_guard "${include_guard}COMGR_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H")
|
|
||||||
#set #include statement
|
|
||||||
get_filename_component(file_name ${header_file} NAME)
|
|
||||||
set(include_statements "${include_statements}#include \"../../../include/${ROCM_SMI}/${file_name}\"\n")
|
|
||||||
configure_file(${RSMI_WRAPPER_DIR}/header.hpp.in ${RSMI_WRAPPER_INC_DIR}/${file_name})
|
|
||||||
unset(include_guard)
|
|
||||||
unset(include_statements)
|
|
||||||
endforeach()
|
|
||||||
unset(prefix_name)
|
|
||||||
|
|
||||||
#OAM Wrpper Header file generation
|
|
||||||
file(MAKE_DIRECTORY ${OAM_WRAPPER_INC_DIR})
|
|
||||||
set(prefix_name "${prefix_name}${OAM_TARGET_NAME}")
|
|
||||||
#Generate wrapper header files from the list
|
|
||||||
foreach(header_file ${OAM_HEADERS})
|
|
||||||
# set include guard
|
|
||||||
get_filename_component(INC_GAURD_NAME ${header_file} NAME_WE)
|
|
||||||
string(TOUPPER ${INC_GAURD_NAME} INC_GAURD_NAME)
|
|
||||||
set(include_guard "${include_guard}COMGR_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H")
|
|
||||||
#set #include statement
|
|
||||||
get_filename_component(file_name ${header_file} NAME)
|
|
||||||
set(include_statements "${include_statements}#include \"../../../include/${OAM_TARGET_NAME}/${file_name}\"\n")
|
|
||||||
configure_file(${RSMI_WRAPPER_DIR}/header.hpp.in ${OAM_WRAPPER_INC_DIR}/${file_name})
|
|
||||||
unset(include_guard)
|
|
||||||
unset(include_statements)
|
|
||||||
endforeach()
|
|
||||||
unset(prefix_name)
|
|
||||||
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#function to create symlink to libraries
|
|
||||||
function(create_library_symlink)
|
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${RSMI_WRAPPER_LIB_DIR})
|
|
||||||
if(BUILD_SHARED_LIBS)
|
|
||||||
|
|
||||||
#get rsmi lib versions
|
|
||||||
set(SO_VERSION_GIT_TAG_PREFIX "rsmi_so_ver")
|
|
||||||
get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
|
|
||||||
if(${ROCM_PATCH_VERSION})
|
|
||||||
set(VERSION_PATCH ${ROCM_PATCH_VERSION})
|
|
||||||
set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
|
||||||
else()
|
|
||||||
set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#link RSMI library files
|
|
||||||
set(LIB_RSMI "${ROCM_SMI_LIB_NAME}.so")
|
|
||||||
set(library_files "${LIB_RSMI}" "${LIB_RSMI}.${VERSION_MAJOR}" "${LIB_RSMI}.${SO_VERSION_STRING}")
|
|
||||||
else()
|
|
||||||
set(LIB_RSMI "${ROCM_SMI_LIB_NAME}.a")
|
|
||||||
set(library_files "${LIB_RSMI}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
foreach(file_name ${library_files})
|
|
||||||
add_custom_target(link_${file_name} ALL
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
|
||||||
../../lib/${file_name} ${RSMI_WRAPPER_LIB_DIR}/${file_name})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${OAM_WRAPPER_LIB_DIR})
|
|
||||||
if(BUILD_SHARED_LIBS)
|
|
||||||
|
|
||||||
#get OAM lib versions
|
|
||||||
set(SO_VERSION_GIT_TAG_PREFIX "oam_so_ver")
|
|
||||||
get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
|
|
||||||
if(${ROCM_PATCH_VERSION})
|
|
||||||
set(VERSION_PATCH ${ROCM_PATCH_VERSION})
|
|
||||||
set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
|
||||||
else()
|
|
||||||
set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#link OAM library files
|
|
||||||
set(LIB_OAM "lib${OAM_TARGET_NAME}.so")
|
|
||||||
set(library_files "${LIB_OAM}" "${LIB_OAM}.${VERSION_MAJOR}" "${LIB_OAM}.${SO_VERSION_STRING}")
|
|
||||||
else()
|
|
||||||
set(LIB_OAM "lib${OAM_TARGET_NAME}.a")
|
|
||||||
set(library_files "${LIB_OAM}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
foreach(file_name ${library_files})
|
|
||||||
add_custom_target(link_${file_name} ALL
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
|
||||||
../../lib/${file_name} ${OAM_WRAPPER_LIB_DIR}/${file_name})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#Creater a template for header file
|
|
||||||
create_header_template()
|
|
||||||
#Use template header file and generater wrapper header files
|
|
||||||
generate_wrapper_header()
|
|
||||||
install(DIRECTORY ${RSMI_WRAPPER_INC_DIR} DESTINATION ${ROCM_SMI}/include)
|
|
||||||
install(DIRECTORY ${OAM_WRAPPER_INC_DIR} DESTINATION ${OAM_TARGET_NAME}/include)
|
|
||||||
# Create symlink to library files
|
|
||||||
create_library_symlink()
|
|
||||||
install(DIRECTORY ${RSMI_WRAPPER_LIB_DIR} DESTINATION ${ROCM_SMI} COMPONENT lib${ROCM_SMI})
|
|
||||||
install(DIRECTORY ${OAM_WRAPPER_LIB_DIR} DESTINATION ${OAM_TARGET_NAME} COMPONENT lib${OAM_TARGET_NAME} )
|
|
||||||
@@ -24,7 +24,7 @@ message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR})
|
|||||||
# message("--------RSMI Inc Dir: " ${RSMI_INC_DIR})
|
# message("--------RSMI Inc Dir: " ${RSMI_INC_DIR})
|
||||||
# message("")
|
# message("")
|
||||||
|
|
||||||
set(ROCM_SMI "rocm_smi")
|
set(ROCM_SMI "amd_smi")
|
||||||
set(ROCM_SMI_COMPONENT "lib${ROCM_SMI}")
|
set(ROCM_SMI_COMPONENT "lib${ROCM_SMI}")
|
||||||
set(ROCM_SMI_TARGET "${ROCM_SMI}64")
|
set(ROCM_SMI_TARGET "${ROCM_SMI}64")
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ message("SOVERSION: ${SO_VERSION_STRING}")
|
|||||||
# Create a configure file to get version info from within library
|
# Create a configure file to get version info from within library
|
||||||
configure_file(
|
configure_file(
|
||||||
"${PROJECT_SOURCE_DIR}/src/${ROCM_SMI_TARGET}Config.in"
|
"${PROJECT_SOURCE_DIR}/src/${ROCM_SMI_TARGET}Config.in"
|
||||||
"${PROJECT_SOURCE_DIR}/include/rocm_smi/${ROCM_SMI_TARGET}Config.h")
|
"${PROJECT_SOURCE_DIR}/include/amd_smi/${ROCM_SMI_TARGET}Config.h")
|
||||||
|
|
||||||
set(RSMI_SRC_DIR "src")
|
set(RSMI_SRC_DIR "src")
|
||||||
set(RSMI_INC_DIR "include")
|
set(RSMI_INC_DIR "include")
|
||||||
@@ -102,6 +102,8 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL Release)
|
|||||||
POST_BUILD COMMAND ${CMAKE_STRIP} lib${ROCM_SMI_TARGET}.so.${SO_VERSION_STRING})
|
POST_BUILD COMMAND ${CMAKE_STRIP} lib${ROCM_SMI_TARGET}.so.${SO_VERSION_STRING})
|
||||||
endif()
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
#file reorganization changes
|
#file reorganization changes
|
||||||
#rocm_smi.py moved to libexec/rocm_smi. so creating rocm-smi symlink
|
#rocm_smi.py moved to libexec/rocm_smi. so creating rocm-smi symlink
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
||||||
@@ -117,15 +119,15 @@ install(TARGETS ${ROCM_SMI_TARGET}
|
|||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
COMPONENT ${ROCM_SMI_COMPONENT})
|
COMPONENT ${ROCM_SMI_COMPONENT})
|
||||||
|
|
||||||
install(FILES ${COMMON_SRC_ROOT}/include/rocm_smi/rocm_smi.h
|
install(FILES ${COMMON_SRC_ROOT}/include/amd_smi/amd_smi.h
|
||||||
DESTINATION include/rocm_smi)
|
DESTINATION include/rocm_smi)
|
||||||
install(FILES ${COMMON_SRC_ROOT}/include/rocm_smi/${ROCM_SMI_TARGET}Config.h
|
install(FILES ${COMMON_SRC_ROOT}/include/amd_smi/${ROCM_SMI_TARGET}Config.h
|
||||||
DESTINATION include/rocm_smi)
|
DESTINATION include/rocm_smi)
|
||||||
install(FILES ${COMMON_SRC_ROOT}/include/rocm_smi/kfd_ioctl.h
|
install(FILES ${COMMON_SRC_ROOT}/rocm_smi/include/rocm_smi/kfd_ioctl.h
|
||||||
DESTINATION include/rocm_smi)
|
DESTINATION include/rocm_smi)
|
||||||
install(FILES ${COMMON_SRC_ROOT}/python_smi_tools/rsmiBindings.py
|
install(FILES ${COMMON_SRC_ROOT}/rocm_smi/python_smi_tools/rsmiBindings.py
|
||||||
DESTINATION libexec/${ROCM_SMI})
|
DESTINATION libexec/${ROCM_SMI})
|
||||||
install(FILES ${COMMON_SRC_ROOT}/python_smi_tools/rocm_smi.py
|
install(FILES ${COMMON_SRC_ROOT}/rocm_smi/python_smi_tools/rocm_smi.py
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
|
||||||
GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||||
DESTINATION libexec/${ROCM_SMI})
|
DESTINATION libexec/${ROCM_SMI})
|
||||||
@@ -138,13 +140,13 @@ find_package(LATEX COMPONENTS PDFLATEX)
|
|||||||
|
|
||||||
if (DOXYGEN_FOUND AND LATEX_FOUND)
|
if (DOXYGEN_FOUND AND LATEX_FOUND)
|
||||||
set (RSMI_MANUAL_NAME "ROCm_SMI_Manual")
|
set (RSMI_MANUAL_NAME "ROCm_SMI_Manual")
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/amd_smi_doxygen.cfg
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/rocm_smi_doxygen.cfg
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
|
||||||
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/docs/amd_smi_doxygen.cfg
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/docs/rocm_smi_doxygen.cfg
|
||||||
"${COMMON_INC_DIR}/rocm_smi.h"
|
"${ROCM_INC_DIR}/rocm_smi.h"
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
|
||||||
COMMAND make > /dev/null
|
COMMAND make > /dev/null
|
||||||
|
|||||||
@@ -760,7 +760,7 @@ WARN_LOGFILE =
|
|||||||
# Note: If this tag is empty the current directory is searched.
|
# Note: If this tag is empty the current directory is searched.
|
||||||
|
|
||||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../README.md \
|
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../README.md \
|
||||||
@CMAKE_CURRENT_SOURCE_DIR@/../include/rocm_smi/rocm_smi.h
|
@CMAKE_CURRENT_SOURCE_DIR@/../rocm_smi/include/rocm_smi/rocm_smi.h
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||||
@@ -55,14 +55,14 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "impl/amd_smi_common.h"
|
#include "amd_smi/impl/amd_smi_common.h"
|
||||||
#include "impl/amd_smi_system.h"
|
#include "amd_smi/impl/amd_smi_system.h"
|
||||||
#include "impl/amd_smi_socket.h"
|
#include "amd_smi/impl/amd_smi_socket.h"
|
||||||
#include "impl/amd_smi_gpu_device.h"
|
#include "amd_smi/impl/amd_smi_gpu_device.h"
|
||||||
#include "rocm_smi/rocm_smi.h"
|
#include "rocm_smi/rocm_smi.h"
|
||||||
#include "rocm_smi/rocm_smi_common.h"
|
#include "rocm_smi/rocm_smi_common.h"
|
||||||
#include "impl/amdgpu_drm.h"
|
#include "amd_smi/impl/amdgpu_drm.h"
|
||||||
|
|
||||||
// TODO(bliu): One to one map to all status code
|
// TODO(bliu): One to one map to all status code
|
||||||
static amdsmi_status_t rsmi_to_amdsmi_status(rsmi_status_t status) {
|
static amdsmi_status_t rsmi_to_amdsmi_status(rsmi_status_t status) {
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "impl/amd_smi_common.h"
|
#include "amd_smi/impl/amd_smi_common.h"
|
||||||
|
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "impl/amd_smi_drm.h"
|
#include "amd_smi/impl/amd_smi_drm.h"
|
||||||
#include "impl/amdgpu_drm.h"
|
#include "amd_smi/impl/amdgpu_drm.h"
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
namespace smi {
|
namespace smi {
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "impl/amd_smi_gpu_device.h"
|
#include "amd_smi/impl/amd_smi_gpu_device.h"
|
||||||
|
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "impl/amd_smi_lib_loader.h"
|
#include "amd_smi/impl/amd_smi_lib_loader.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "impl/amd_smi_socket.h"
|
#include "amd_smi/impl/amd_smi_socket.h"
|
||||||
|
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
@@ -42,8 +42,8 @@
|
|||||||
*/
|
*/
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include "impl/amd_smi_system.h"
|
#include "amd_smi/impl/amd_smi_system.h"
|
||||||
#include "impl/amd_smi_gpu_device.h"
|
#include "amd_smi/impl/amd_smi_gpu_device.h"
|
||||||
#include "rocm_smi/rocm_smi.h"
|
#include "rocm_smi/rocm_smi.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
* The University of Illinois/NCSA
|
* The University of Illinois/NCSA
|
||||||
* Open Source License (NCSA)
|
* Open Source License (NCSA)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017, Advanced Micro Devices, Inc.
|
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Developed by:
|
* Developed by:
|
||||||
@@ -43,14 +43,14 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI64CONFIG_H_
|
#ifndef INCLUDE_AMD_SMI_AMD_SMI64CONFIG_H_
|
||||||
#define INCLUDE_ROCM_SMI_ROCM_SMI64CONFIG_H_
|
#define INCLUDE_AMD_SMI_AMD_SMI64CONFIG_H_
|
||||||
|
|
||||||
// This file is generated on build.
|
// This file is generated on build.
|
||||||
|
|
||||||
#define rocm_smi_VERSION_MAJOR @rocm_smi_VERSION_MAJOR@
|
#define amd_smi_VERSION_MAJOR @amd_smi_VERSION_MAJOR@
|
||||||
#define rocm_smi_VERSION_MINOR @rocm_smi_VERSION_MINOR@
|
#define amd_smi_VERSION_MINOR @amd_smi_VERSION_MINOR@
|
||||||
#define rocm_smi_VERSION_PATCH @rocm_smi_VERSION_PATCH@
|
#define amd_smi_VERSION_PATCH @amd_smi_VERSION_PATCH@
|
||||||
#define rocm_smi_VERSION_BUILD "@rocm_smi_VERSION_BUILD@"
|
#define amd_smi_VERSION_BUILD "@amd_smi_VERSION_BUILD@"
|
||||||
|
|
||||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI64CONFIG_H_
|
#endif // INCLUDE_AMD_SMI_AMD_SMI64CONFIG_H_
|
||||||
@@ -69,14 +69,14 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
#
|
#
|
||||||
if (${IS64BIT} EQUAL 0)
|
if (${IS64BIT} EQUAL 0)
|
||||||
if(NOT EXISTS ${AMDSMI_LIB_DIR}/librocm_smi32.so)
|
if(NOT EXISTS ${AMDSMI_LIB_DIR}/libamd_smi32.so)
|
||||||
message("ERROR: ${AMDSMI_LIB_DIR}/librocm_smi32.so doesn't exist. Check value of ROCM_DIR define")
|
message("ERROR: ${AMDSMI_LIB_DIR}/libamd_smi32.so doesn't exist. Check value of ROCM_DIR define")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
if(NOT EXISTS ${AMDSMI_LIB_DIR}/librocm_smi64.so)
|
if(NOT EXISTS ${AMDSMI_LIB_DIR}/libamd_smi64.so)
|
||||||
message("ERROR: Define AMDSMI_LIB_DIR pointing to AMDSMI library is not set")
|
message("ERROR: Define AMDSMI_LIB_DIR pointing to AMDSMI library is not set")
|
||||||
message(" missing: ${AMDSMI_LIB_DIR}/librocm_smi64.so")
|
message(" missing: ${AMDSMI_LIB_DIR}/libamd_smi64.so")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -200,10 +200,10 @@ LINK_DIRECTORIES(${AMDSMI_LIB_DIR} ${GTEST_LIB_DIR})
|
|||||||
# Extend the list of libraries to be used for linking amdsmi apps
|
# Extend the list of libraries to be used for linking amdsmi apps
|
||||||
#
|
#
|
||||||
if (IS64BIT)
|
if (IS64BIT)
|
||||||
set(AMDSMITST_LIBS ${AMDSMITST_LIBS} rocm_smi64)
|
set(AMDSMITST_LIBS ${AMDSMITST_LIBS} amd_smi64)
|
||||||
set(AMDSMITST "amdsmitst64")
|
set(AMDSMITST "amdsmitst64")
|
||||||
else()
|
else()
|
||||||
set(AMDSMITST_LIBS ${AMDSMITST_LIBS} rocm_smi32)
|
set(AMDSMITST_LIBS ${AMDSMITST_LIBS} amd_smi32)
|
||||||
set(AMDSMITST "amdsmitst")
|
set(AMDSMITST "amdsmitst")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/api_support_read.h"
|
#include "amd_smi_test/functional/api_support_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
#include "amd_smi_test/test_utils.h"
|
#include "amd_smi_test/test_utils.h"
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/err_cnt_read.h"
|
#include "amd_smi_test/functional/err_cnt_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/evt_notif_read_write.h"
|
#include "amd_smi_test/functional/evt_notif_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
#include "amd_smi_test/test_utils.h"
|
#include "amd_smi_test/test_utils.h"
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/fan_read.h"
|
#include "amd_smi_test/functional/fan_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/fan_read_write.h"
|
#include "amd_smi_test/functional/fan_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/frequencies_read.h"
|
#include "amd_smi_test/functional/frequencies_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/frequencies_read_write.h"
|
#include "amd_smi_test/functional/frequencies_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/gpu_busy_read.h"
|
#include "amd_smi_test/functional/gpu_busy_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/gpu_metrics_read.h"
|
#include "amd_smi_test/functional/gpu_metrics_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/hw_topology_read.h"
|
#include "amd_smi_test/functional/hw_topology_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/id_info_read.h"
|
#include "amd_smi_test/functional/id_info_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
#include "amd_smi_test/functional/init_shutdown_refcount.h"
|
#include "amd_smi_test/functional/init_shutdown_refcount.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
extern int32_t
|
extern int32_t
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/mem_page_info_read.h"
|
#include "amd_smi_test/functional/mem_page_info_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/mem_util_read.h"
|
#include "amd_smi_test/functional/mem_util_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/metrics_counter_read.h"
|
#include "amd_smi_test/functional/metrics_counter_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/mutual_exclusion.h"
|
#include "amd_smi_test/functional/mutual_exclusion.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/overdrive_read.h"
|
#include "amd_smi_test/functional/overdrive_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/overdrive_read_write.h"
|
#include "amd_smi_test/functional/overdrive_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/pci_read_write.h"
|
#include "amd_smi_test/functional/pci_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/perf_cntr_read_write.h"
|
#include "amd_smi_test/functional/perf_cntr_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/perf_determinism.h"
|
#include "amd_smi_test/functional/perf_determinism.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/perf_level_read.h"
|
#include "amd_smi_test/functional/perf_level_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/perf_level_read_write.h"
|
#include "amd_smi_test/functional/perf_level_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/power_cap_read_write.h"
|
#include "amd_smi_test/functional/power_cap_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/power_read.h"
|
#include "amd_smi_test/functional/power_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/power_read_write.h"
|
#include "amd_smi_test/functional/power_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/process_info_read.h"
|
#include "amd_smi_test/functional/process_info_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/sys_info_read.h"
|
#include "amd_smi_test/functional/sys_info_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
#include "amd_smi_test/test_utils.h"
|
#include "amd_smi_test/test_utils.h"
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/temp_read.h"
|
#include "amd_smi_test/functional/temp_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/version_read.h"
|
#include "amd_smi_test/functional/version_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/volt_freq_curv_read.h"
|
#include "amd_smi_test/functional/volt_freq_curv_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/volt_read.h"
|
#include "amd_smi_test/functional/volt_read.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/functional/xgmi_read_write.h"
|
#include "amd_smi_test/functional/xgmi_read_write.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
#include "amd_smi_test/test_base.h"
|
#include "amd_smi_test/test_base.h"
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/test_base.h"
|
#include "amd_smi_test/test_base.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
#define TESTS_AMD_SMI_TEST_TEST_BASE_H_
|
#define TESTS_AMD_SMI_TEST_TEST_BASE_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
|
|
||||||
// The max devices can be monitored
|
// The max devices can be monitored
|
||||||
#define MAX_MONITOR_DEVICES 128
|
#define MAX_MONITOR_DEVICES 128
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
#include "amd_smi_test/test_base.h"
|
#include "amd_smi_test/test_base.h"
|
||||||
#include "amd_smi_test/test_common.h"
|
#include "amd_smi_test/test_common.h"
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
|
|
||||||
static const std::map<amdsmi_dev_perf_level_t, const char *>
|
static const std::map<amdsmi_dev_perf_level_t, const char *>
|
||||||
kDevPerfLvlNameMap = {
|
kDevPerfLvlNameMap = {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
|
|
||||||
struct AMDSMITstGlobals {
|
struct AMDSMITstGlobals {
|
||||||
uint32_t verbosity;
|
uint32_t verbosity;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
#include "amd_smi_test/test_utils.h"
|
#include "amd_smi_test/test_utils.h"
|
||||||
|
|
||||||
static const std::map<amdsmi_fw_block_t, const char *> kDevFWNameMap = {
|
static const std::map<amdsmi_fw_block_t, const char *> kDevFWNameMap = {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
#ifndef TESTS_AMD_SMI_TEST_TEST_UTILS_H_
|
#ifndef TESTS_AMD_SMI_TEST_TEST_UTILS_H_
|
||||||
#define TESTS_AMD_SMI_TEST_TEST_UTILS_H_
|
#define TESTS_AMD_SMI_TEST_TEST_UTILS_H_
|
||||||
|
|
||||||
#include "amd_smi.h"
|
#include "amd_smi/amd_smi.h"
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
NameFromFWEnum(amdsmi_fw_block_t blk);
|
NameFromFWEnum(amdsmi_fw_block_t blk);
|
||||||
|
|||||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir