Debug: Add debug logs for firmware module

Related-To: LOCI-3877

Signed-off-by: Devarinti, Puneeth Kumar Reddy <puneeth.kumar.reddy.devarinti@intel.com>
This commit is contained in:
Devarinti, Puneeth Kumar Reddy 2023-01-19 06:03:19 +00:00 committed by Compute-Runtime-Automation
parent d3c99f6414
commit 996d73b768
2 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,7 @@
#include "level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.h" #include "level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/string.h" #include "shared/source/helpers/string.h"
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h" #include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
@ -27,6 +28,7 @@ ze_result_t OsFirmware::getSupportedFwTypes(std::vector<std::string> &supportedF
std::vector<std::string> mtdDescriptorStrings = {}; std::vector<std::string> mtdDescriptorStrings = {};
ze_result_t result = pFsAccess->read(mtdDescriptor, mtdDescriptorStrings); ze_result_t result = pFsAccess->read(mtdDescriptor, mtdDescriptorStrings);
if (result != ZE_RESULT_SUCCESS) { if (result != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mtdDescriptor.c_str(), result);
return result; return result;
} }
for (const auto &readByteLine : mtdDescriptorStrings) { for (const auto &readByteLine : mtdDescriptorStrings) {

View File

@ -1,10 +1,12 @@
/* /*
* Copyright (C) 2021-2022 Intel Corporation * Copyright (C) 2021-2023 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.h" #include "level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.h"
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h" #include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
@ -24,6 +26,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar
ze_result_t result = pSysfsAccess->scanDirEntries(iafPath, list); ze_result_t result = pSysfsAccess->scanDirEntries(iafPath, list);
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
// There should be a device directory // There should be a device directory
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAcess->scanDirEntries() failed to locate device directory at %s and returning error:0x%x \n", __FUNCTION__, iafPath.c_str(), result);
return result; return result;
} }
for (const auto &entry : list) { for (const auto &entry : list) {
@ -34,6 +37,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar
} }
if (path.empty()) { if (path.empty()) {
// This device does not have a PSC Version // This device does not have a PSC Version
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): device does not have a PSC version and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE);
return ZE_RESULT_ERROR_NOT_AVAILABLE; return ZE_RESULT_ERROR_NOT_AVAILABLE;
} }
std::string pscVersion; std::string pscVersion;
@ -41,6 +45,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar
result = pSysfsAccess->read(path, pscVersion); result = pSysfsAccess->read(path, pscVersion);
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
// not able to read PSC version from iaf.x // not able to read PSC version from iaf.x
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result);
return result; return result;
} }
strncpy_s(static_cast<char *>(pProperties->version), ZES_STRING_PROPERTY_SIZE, pscVersion.c_str(), ZES_STRING_PROPERTY_SIZE - 1); strncpy_s(static_cast<char *>(pProperties->version), ZES_STRING_PROPERTY_SIZE, pscVersion.c_str(), ZES_STRING_PROPERTY_SIZE - 1);