feature: Add debug logs for ECC module

Related-To: LOCI-3878

Signed-off-by: Devarinti, Puneeth Kumar Reddy <puneeth.kumar.reddy.devarinti@intel.com>
This commit is contained in:
Devarinti, Puneeth Kumar Reddy
2023-04-18 07:51:09 +00:00
committed by Compute-Runtime-Automation
parent bac02071e7
commit 1c44e3ab3e

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,8 @@
#include "level_zero/tools/source/sysman/ecc/ecc_imp.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "level_zero/tools/source/sysman/firmware_util/firmware_util.h"
namespace L0 {
@@ -24,6 +26,7 @@ zes_device_ecc_state_t EccImp::getEccState(uint8_t state) {
ze_result_t EccImp::getEccFwUtilInterface(FirmwareUtil *&pFwUtil) {
pFwUtil = getFirmwareUtilInterface(pOsSysman);
if (pFwUtil == nullptr) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting FirmwareUtilInterface() and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return ZE_RESULT_SUCCESS;
@@ -33,6 +36,7 @@ ze_result_t EccImp::deviceEccAvailable(ze_bool_t *pAvailable) {
if (pFwInterface == nullptr) {
ze_result_t result = getEccFwUtilInterface(pFwInterface);
if (result != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
}
@@ -58,6 +62,7 @@ ze_result_t EccImp::getEccState(zes_device_ecc_properties_t *pState) {
if (pFwInterface == nullptr) {
ze_result_t result = getEccFwUtilInterface(pFwInterface);
if (result != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
}
@@ -66,6 +71,7 @@ ze_result_t EccImp::getEccState(zes_device_ecc_properties_t *pState) {
uint8_t pendingState = 0;
ze_result_t result = pFwInterface->fwGetEccConfig(&currentState, &pendingState);
if (result != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get ecc configuration and returning error:0x%x \n", __FUNCTION__, result);
return result;
}
pState->currentState = getEccState(currentState);
@@ -83,6 +89,7 @@ ze_result_t EccImp::setEccState(const zes_device_ecc_desc_t *newState, zes_devic
if (pFwInterface == nullptr) {
ze_result_t result = getEccFwUtilInterface(pFwInterface);
if (result != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
}
@@ -95,11 +102,13 @@ ze_result_t EccImp::setEccState(const zes_device_ecc_desc_t *newState, zes_devic
} else if (newState->state == ZES_DEVICE_ECC_STATE_DISABLED) {
state = eccStateDisable;
} else {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid ecc enumeration and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INVALID_ENUMERATION);
return ZE_RESULT_ERROR_INVALID_ENUMERATION;
}
ze_result_t result = pFwInterface->fwSetEccConfig(state, &currentState, &pendingState);
if (result != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set ecc configuration and returning error:0x%x \n", __FUNCTION__, result);
return result;
}