From fc5405d5d65dbe98b89a547304e9d66914973c46 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Tue, 21 Jan 2020 16:50:53 +0530 Subject: minor fix: PFR version BCD encoded representation Major, Minor and Build number in version string should be BCD encoded. Also added 'g' prefix before hash value to sync with current BMC version representation. Tested: Read all versions exposed via PFR manager service and works fine. BMC version : "0.36-0-g1389b2" CPLD version : "1.0" BIOS version : "0.0" Change-Id: I2d6412e2daac0f7e11466bee2c265f819e72d804 Signed-off-by: AppaRao Puli --- intel-pfr-manager/libpfr/src/pfr.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/intel-pfr-manager/libpfr/src/pfr.cpp b/intel-pfr-manager/libpfr/src/pfr.cpp index 3b011f6..07b7593 100644 --- a/intel-pfr-manager/libpfr/src/pfr.cpp +++ b/intel-pfr-manager/libpfr/src/pfr.cpp @@ -80,8 +80,9 @@ static std::string readVersionFromCPLD(const uint8_t majorReg, I2CFile cpldDev(i2cBusNumber, i2cSlaveAddress, O_RDWR | O_CLOEXEC); uint8_t majorVer = cpldDev.i2cReadByteData(majorReg); uint8_t minorVer = cpldDev.i2cReadByteData(minorReg); + // Major and Minor versions should be binary encoded strings. std::string version = - toHexString(majorVer) + "." + toHexString(minorVer); + std::to_string(majorVer) + "." + std::to_string(minorVer); return version; } catch (const std::exception& e) @@ -142,12 +143,14 @@ static std::string readBMCVersionFromSPI(const ImageType& imgType) phosphor::logging::entry("MSG=%s", e.what())); return ""; } - // Version format: .-- - // Example: 00.11-07-1e5c2d - std::string version = toHexString(ver[0]) + "." + toHexString(ver[1]) + - "-" + toHexString(buildNo) + "-" + - toHexString(buildHash[0]) + - toHexString(buildHash[1]) + toHexString(buildHash[2]); + + // Version format: .--g + // Example: 0.11-7-g1e5c2d + // Major, minor and build numberare BCD encoded. + std::string version = + std::to_string(ver[0]) + "." + std::to_string(ver[1]) + "-" + + std::to_string(buildNo) + "-g" + toHexString(buildHash[0]) + + toHexString(buildHash[1]) + toHexString(buildHash[2]); return version; } -- cgit v1.2.3