Files
compute-runtime/level_zero/tools/source/sysman/ras/ras.cpp
Vilvaraj, T J Vivek 0c9c55cd17 add counter support for RAS.
- added dual handle support for RAS Correctable and Uncorrectable Errors.
- added reset counter for RAS.
- added Os Specific ULT for RAS

Change-Id: Ia10115bf6720ab211f549571e810ec0d6c0801ec
2020-06-25 08:48:11 +02:00

47 lines
1.1 KiB
C++

/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/tools/source/sysman/ras/ras_imp.h"
namespace L0 {
RasHandleContext::~RasHandleContext() {
for (Ras *pRas : handleList) {
delete pRas;
}
}
void RasHandleContext::createHandle(zet_ras_error_type_t type) {
Ras *pRas = new RasImp(pOsSysman, type);
if (pRas->isRasErrorSupported == true) {
handleList.push_back(pRas);
} else {
delete pRas;
}
}
void RasHandleContext::init() {
createHandle(ZET_RAS_ERROR_TYPE_UNCORRECTABLE);
createHandle(ZET_RAS_ERROR_TYPE_CORRECTABLE);
}
ze_result_t RasHandleContext::rasGet(uint32_t *pCount,
zet_sysman_ras_handle_t *phRas) {
if (nullptr == phRas) {
*pCount = static_cast<uint32_t>(handleList.size());
return ZE_RESULT_SUCCESS;
}
uint32_t i = 0;
for (Ras *ras : handleList) {
if (i >= *pCount) {
break;
}
phRas[i++] = ras->toHandle();
}
*pCount = i;
return ZE_RESULT_SUCCESS;
}
} // namespace L0