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 <apparao.puli@linux.intel.com>
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index 3b011f6..07b7593 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -80,8 +80,9 @@
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 @@
phosphor::logging::entry("MSG=%s", e.what()));
return "";
}
- // Version format: <major>.<minor>-<build bum>-<build hash>
- // 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: <major>.<minor>-<build bum>-g<build hash>
+ // 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;
}