Revert "firmware: Add support for new firmware type"

This reverts commit 3c739cf687b9d47185c131231316e51a71cbefa0.

Related-To: LOCI-2381
Signed-off-by: Pichika Uday Kiran <pichika.uday.kiran@intel.com>
This commit is contained in:
Pichika Uday Kiran
2021-10-18 15:48:26 +00:00
committed by Compute-Runtime-Automation
parent 2f891d38e3
commit e063b120de
10 changed files with 70 additions and 118 deletions

View File

@@ -13,13 +13,10 @@ namespace L0 {
static const std::string mtdDescriptor("/proc/mtd");
std::vector<std ::string> deviceSupportedFwTypes = {"GSC", "OptionROM"};
ze_result_t OsFirmware::getSupportedFwTypes(std::vector<std::string> &supportedFwTypes, OsSysman *pOsSysman) {
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
FirmwareUtil *pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
std::vector<std ::string> deviceSupportedFwTypes;
if (pFwInterface != nullptr) {
pFwInterface->getDeviceSupportedFwTypes(deviceSupportedFwTypes);
}
FsAccess *pFsAccess = &pLinuxSysmanImp->getFsAccess();
std::vector<std::string> mtdDescriptorStrings = {};
@@ -38,7 +35,6 @@ ze_result_t OsFirmware::getSupportedFwTypes(std::vector<std::string> &supportedF
}
return ZE_RESULT_SUCCESS;
}
bool LinuxFirmwareImp::isFirmwareSupported(void) {
if (pFwInterface != nullptr) {
isFWInitalized = ((ZE_RESULT_SUCCESS == pFwInterface->fwDeviceInit()) ? true : false);
@@ -48,16 +44,39 @@ bool LinuxFirmwareImp::isFirmwareSupported(void) {
}
void LinuxFirmwareImp::osGetFwProperties(zes_firmware_properties_t *pProperties) {
if (osFwType == deviceSupportedFwTypes[0]) { //GSC
getFirmwareVersion(pProperties->version);
}
if (osFwType == deviceSupportedFwTypes[1]) { //oprom
getOpromVersion(pProperties->version);
}
}
ze_result_t LinuxFirmwareImp::osFirmwareFlash(void *pImage, uint32_t size) {
if (osFwType == deviceSupportedFwTypes[0]) { //GSC
return pFwInterface->fwFlashGSC(pImage, size);
}
if (osFwType == deviceSupportedFwTypes[1]) { //oprom
return pFwInterface->fwFlashOprom(pImage, size);
}
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
void LinuxFirmwareImp::getFirmwareVersion(char *firmwareVersion) {
std::string fwVersion;
if (ZE_RESULT_SUCCESS == pFwInterface->getFwVersion(osFwType, fwVersion)) {
strncpy_s(static_cast<char *>(pProperties->version), ZES_STRING_PROPERTY_SIZE, fwVersion.c_str(), ZES_STRING_PROPERTY_SIZE);
if (ZE_RESULT_SUCCESS == pFwInterface->fwGetVersion(fwVersion)) {
strncpy_s(firmwareVersion, ZES_STRING_PROPERTY_SIZE, fwVersion.c_str(), ZES_STRING_PROPERTY_SIZE);
} else {
strncpy_s(static_cast<char *>(pProperties->version), ZES_STRING_PROPERTY_SIZE, unknown.c_str(), ZES_STRING_PROPERTY_SIZE);
strncpy_s(firmwareVersion, ZES_STRING_PROPERTY_SIZE, unknown.c_str(), ZES_STRING_PROPERTY_SIZE);
}
}
ze_result_t LinuxFirmwareImp::osFirmwareFlash(void *pImage, uint32_t size) {
return pFwInterface->flashFirmware(osFwType, pImage, size);
void LinuxFirmwareImp::getOpromVersion(char *firmwareVersion) {
std::string fwVersion;
if (ZE_RESULT_SUCCESS == pFwInterface->opromGetVersion(fwVersion)) {
strncpy_s(firmwareVersion, ZES_STRING_PROPERTY_SIZE, fwVersion.c_str(), ZES_STRING_PROPERTY_SIZE);
} else {
strncpy_s(firmwareVersion, ZES_STRING_PROPERTY_SIZE, unknown.c_str(), ZES_STRING_PROPERTY_SIZE);
}
}
LinuxFirmwareImp::LinuxFirmwareImp(OsSysman *pOsSysman, const std::string &fwType) : osFwType(fwType) {

View File

@@ -27,6 +27,10 @@ class LinuxFirmwareImp : public OsFirmware, NEO::NonCopyableOrMovableClass {
FirmwareUtil *pFwInterface = nullptr;
bool isFWInitalized = false;
std::string osFwType;
private:
void getFirmwareVersion(char *);
void getOpromVersion(char *);
};
} // namespace L0

View File

@@ -28,16 +28,11 @@ class FirmwareUtil {
virtual ze_result_t getFirstDevice(igsc_device_info *) = 0;
virtual ze_result_t fwGetVersion(std::string &fwVersion) = 0;
virtual ze_result_t opromGetVersion(std::string &fwVersion) = 0;
virtual ze_result_t pscGetVersion(std::string &fwVersion) = 0;
virtual ze_result_t fwFlashGSC(void *pImage, uint32_t size) = 0;
virtual ze_result_t fwFlashOprom(void *pImage, uint32_t size) = 0;
virtual ze_result_t fwFlashIafPsc(void *pImage, uint32_t size) = 0;
virtual ze_result_t getFwVersion(std::string fwType, std::string &firmwareVersion) = 0;
virtual ze_result_t flashFirmware(std::string fwType, void *pImage, uint32_t size) = 0;
virtual ze_result_t fwIfrApplied(bool &ifrStatus) = 0;
virtual ze_result_t fwSupportedDiagTests(std::vector<std::string> &supportedDiagTests) = 0;
virtual ze_result_t fwRunDiagTests(std::string &osDiagType, zes_diag_result_t *pDiagResult, uint32_t subDeviceId) = 0;
virtual void getDeviceSupportedFwTypes(std::vector<std ::string> &fwTypes) = 0;
virtual ~FirmwareUtil() = default;
};
} // namespace L0

View File

@@ -18,7 +18,7 @@
namespace L0 {
typedef int (*pIgscDeviceInitByDevice)(struct igsc_device_handle *handle,
const char *devicePath);
const char *device_path);
typedef int (*pIgscDeviceGetDeviceInfo)(struct igsc_device_handle *handle,
struct igsc_info_device *info);
typedef int (*pIgscDeviceFwVersion)(struct igsc_device_handle *handle,
@@ -29,21 +29,21 @@ typedef int (*pIgscDeviceIteratorNext)(struct igsc_device_iterator *iter,
typedef void (*pIgscDeviceIteratorDestroy)(struct igsc_device_iterator *iter);
typedef int (*pIgscDeviceFwUpdate)(struct igsc_device_handle *handle,
const uint8_t *buffer,
const uint32_t bufferLen,
igsc_progress_func_t progressFunc,
const uint32_t buffer_len,
igsc_progress_func_t progress_f,
void *ctx);
typedef int (*pIgscImageOpromInit)(struct igsc_oprom_image **img,
const uint8_t *buffer,
uint32_t bufferLen);
uint32_t buffer_len);
typedef int (*pIgscImageOpromType)(struct igsc_oprom_image *img,
uint32_t *opromType);
uint32_t *oprom_type);
typedef int (*pIgscDeviceOpromUpdate)(struct igsc_device_handle *handle,
uint32_t opromType,
uint32_t oprom_type,
struct igsc_oprom_image *img,
igsc_progress_func_t progressFunc,
igsc_progress_func_t progress_f,
void *ctx);
typedef int (*pIgscDeviceOpromVersion)(struct igsc_device_handle *handle,
uint32_t opromType,
uint32_t oprom_type,
struct igsc_oprom_version *version);
extern pIgscDeviceInitByDevice deviceInitByDevice;
@@ -66,16 +66,11 @@ class FirmwareUtilImp : public FirmwareUtil, NEO::NonCopyableOrMovableClass {
ze_result_t getFirstDevice(igsc_device_info *) override;
ze_result_t fwGetVersion(std::string &fwVersion) override;
ze_result_t opromGetVersion(std::string &fwVersion) override;
ze_result_t pscGetVersion(std::string &fwVersion) override;
ze_result_t fwFlashGSC(void *pImage, uint32_t size) override;
ze_result_t fwFlashOprom(void *pImage, uint32_t size) override;
ze_result_t fwFlashIafPsc(void *pImage, uint32_t size) override;
ze_result_t getFwVersion(std::string fwType, std::string &firmwareVersion) override;
ze_result_t flashFirmware(std::string fwType, void *pImage, uint32_t size) override;
ze_result_t fwIfrApplied(bool &ifrStatus) override;
ze_result_t fwSupportedDiagTests(std::vector<std::string> &supportedDiagTests) override;
ze_result_t fwRunDiagTests(std::string &osDiagType, zes_diag_result_t *pDiagResult, uint32_t subDeviceId) override;
void getDeviceSupportedFwTypes(std::vector<std ::string> &fwTypes) override;
template <class T>
bool getSymbolAddr(const std::string name, T &proc);

View File

@@ -10,8 +10,6 @@
#include "level_zero/core/source/device/device.h"
#include "level_zero/tools/source/sysman/linux/firmware_util/firmware_util_imp.h"
std::vector<std ::string> deviceSupportedFwTypes = {"GSC", "OptionROM"};
namespace L0 {
ze_result_t FirmwareUtilImp::fwIfrApplied(bool &ifrStatus) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
@@ -24,37 +22,4 @@ ze_result_t FirmwareUtilImp::fwSupportedDiagTests(std::vector<std::string> &supp
ze_result_t FirmwareUtilImp::fwRunDiagTests(std::string &osDiagType, zes_diag_result_t *pDiagResult, uint32_t subDeviceId) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
void FirmwareUtil::getDeviceSupportedFwTypes(std::vector<std ::string> &fwTypes) {
fwTypes = deviceSupportedFwTypes;
}
ze_result_t FirmwareUtilImp::getFwVersion(std::string fwType, std::string &firmwareVersion) {
if (fwType == deviceSupportedFwTypes[0]) { //GSC
return fwGetVersion(firmwareVersion);
}
if (fwType == deviceSupportedFwTypes[1]) { //OPROM
return opromGetVersion(firmwareVersion);
}
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t FirmwareUtilImp::flashFirmware(std::string fwType, void *pImage, uint32_t size) {
if (fwType == deviceSupportedFwTypes[0]) { //GSC
return fwFlashGSC(pImage, size);
}
if (fwType == deviceSupportedFwTypes[1]) { //OPROM
return fwFlashOprom(pImage, size);
}
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t FirmwareUtilImp::fwFlashIafPsc(void *pImage, uint32_t size) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t FirmwareUtilImp::pscGetVersion(std::string &fwVersion) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
} // namespace L0