mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-01 12:33:12 +08:00
eudebug interface is now hidden under EuDebugInterface class shared code uses generic object and param values layout of structs is guarded by static asserts eudebug support is guarded by cmake flags: - NEO_ENABLE_XE_EU_DEBUG_SUPPORT - enables eudebug in general - NEO_USE_XE_EU_DEBUG_EXP_UPSTREAM - registers exp upstream uAPI support - NEO_ENABLE_XE_PRELIM_DETECTION - registers prelim uAPI support This way we can support two different xe-eudebug interfaces within single binary. In unit tests there is mock eudebug interface enabled (even if no eudebug support is enabled by cmake flag). Related-To: NEO-13472 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2024 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
#include "shared/source/os_interface/linux/xe/eudebug/eudebug_wrappers.h"
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
namespace NEO {
|
|
|
|
class EuDebugInterface {
|
|
public:
|
|
static std::unique_ptr<EuDebugInterface> create(const std::string &sysFsPciPath);
|
|
virtual uint32_t getParamValue(EuDebugParam param) const = 0;
|
|
virtual ~EuDebugInterface() = default;
|
|
};
|
|
|
|
enum class EuDebugInterfaceType : uint32_t {
|
|
upstream,
|
|
prelim,
|
|
maxValue
|
|
};
|
|
|
|
using EuDebugInterfaceCreateFunctionType = std::unique_ptr<EuDebugInterface> (*)();
|
|
extern const char *eudebugSysfsEntry[static_cast<uint32_t>(EuDebugInterfaceType::maxValue)];
|
|
extern EuDebugInterfaceCreateFunctionType eudebugInterfaceFactory[static_cast<uint32_t>(EuDebugInterfaceType::maxValue)];
|
|
|
|
class EnableEuDebugInterface {
|
|
public:
|
|
EnableEuDebugInterface(EuDebugInterfaceType eudebugInterfaceType, const char *sysfsEntry, EuDebugInterfaceCreateFunctionType createFunc) {
|
|
eudebugSysfsEntry[static_cast<uint32_t>(eudebugInterfaceType)] = sysfsEntry;
|
|
eudebugInterfaceFactory[static_cast<uint32_t>(eudebugInterfaceType)] = createFunc;
|
|
}
|
|
};
|
|
} // namespace NEO
|