refactor: Refactor diagnostic product specific code

Related-To: NEO-10103

Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
Bellekallu Rajkiran 2024-01-30 16:44:13 +00:00 committed by Compute-Runtime-Automation
parent 6d3a53fe7f
commit 5e87d6a2f1
5 changed files with 21 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -12,6 +12,7 @@
#include "shared/source/helpers/string.h"
#include "level_zero/sysman/source/shared/firmware_util/sysman_firmware_util.h"
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
#include "level_zero/sysman/source/shared/linux/sysman_fs_access_interface.h"
namespace L0 {
@ -24,7 +25,8 @@ const std::string LinuxDiagnosticsImp::invalidateLmemFile("invalidate_lmem_mmaps
const std::string LinuxDiagnosticsImp::quiescentGpuFile("quiesce_gpu");
void OsDiagnostics::getSupportedDiagTestsFromFW(void *pOsSysman, std::vector<std::string> &supportedDiagTests) {
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
if (IGFX_PVC == pLinuxSysmanImp->getProductFamily()) {
auto pSysmanProductHelper = pLinuxSysmanImp->getSysmanProductHelper();
if (pSysmanProductHelper->isDiagnosticsSupported()) {
FirmwareUtil *pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
if (pFwInterface != nullptr) {
static_cast<FirmwareUtil *>(pFwInterface)->fwSupportedDiagTests(supportedDiagTests);

View File

@ -75,6 +75,9 @@ class SysmanProductHelper {
virtual uint64_t setPowerLimitValue(int32_t value) = 0;
virtual zes_limit_unit_t getPowerLimitUnit() = 0;
// Diagnostics
virtual bool isDiagnosticsSupported() = 0;
virtual ~SysmanProductHelper() = default;
protected:

View File

@ -54,6 +54,9 @@ class SysmanProductHelperHw : public SysmanProductHelper {
uint64_t setPowerLimitValue(int32_t value) override;
zes_limit_unit_t getPowerLimitUnit() override;
// Diagnostics
bool isDiagnosticsSupported() override;
~SysmanProductHelperHw() override = default;
protected:

View File

@ -213,5 +213,10 @@ zes_limit_unit_t SysmanProductHelperHw<gfxProduct>::getPowerLimitUnit() {
return ZES_LIMIT_UNIT_POWER;
}
template <PRODUCT_FAMILY gfxProduct>
bool SysmanProductHelperHw<gfxProduct>::isDiagnosticsSupported() {
return false;
}
} // namespace Sysman
} // namespace L0

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -281,6 +281,11 @@ zes_limit_unit_t SysmanProductHelperHw<gfxProduct>::getPowerLimitUnit() {
return ZES_LIMIT_UNIT_CURRENT;
}
template <>
bool SysmanProductHelperHw<gfxProduct>::isDiagnosticsSupported() {
return true;
}
template class SysmanProductHelperHw<gfxProduct>;
} // namespace Sysman