Files
compute-runtime/level_zero/tools/source/sysman/ras/ras.h
Jitendra Sharma 92b15507b0 Initialize variables and validate pointers before actually using them
Change-Id: Iae6fbeac124e1a02da419f5071e1ebc292b390cf
Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
2020-07-14 11:17:58 +02:00

52 lines
1.3 KiB
C++

/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <level_zero/zet_api.h>
#include <vector>
struct _zet_sysman_ras_handle_t {
virtual ~_zet_sysman_ras_handle_t() = default;
};
namespace L0 {
struct OsSysman;
class Ras : _zet_sysman_ras_handle_t {
public:
virtual ze_result_t rasGetProperties(zet_ras_properties_t *pProperties) = 0;
virtual ze_result_t rasGetConfig(zet_ras_config_t *pConfig) = 0;
virtual ze_result_t rasSetConfig(const zet_ras_config_t *pConfig) = 0;
virtual ze_result_t rasGetState(ze_bool_t clear, uint64_t *pTotalErrors, zet_ras_details_t *pDetails) = 0;
static Ras *fromHandle(zet_sysman_ras_handle_t handle) {
return static_cast<Ras *>(handle);
}
inline zet_sysman_ras_handle_t toHandle() { return this; }
bool isRasErrorSupported = false;
zet_ras_error_type_t rasErrorType;
};
struct RasHandleContext {
RasHandleContext(OsSysman *pOsSysman) : pOsSysman(pOsSysman){};
~RasHandleContext();
void init();
ze_result_t rasGet(uint32_t *pCount, zet_sysman_ras_handle_t *phRas);
OsSysman *pOsSysman = nullptr;
std::vector<Ras *> handleList = {};
private:
void createHandle(zet_ras_error_type_t type);
};
} // namespace L0