summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch
new file mode 100644
index 000000000..514f2dde7
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0002-GetFwVersionInfo-Fix-for-Firmware-aux-version.patch
@@ -0,0 +1,120 @@
+From 52a292b8dd1b5705a6e0ce8e260d3b960b2b6edb Mon Sep 17 00:00:00 2001
+From: srikanta mondal <srikantax.mondal@intel.com>
+Date: Mon, 27 Jul 2020 23:49:14 +0000
+Subject: [PATCH] GetFwVersionInfo: Fix for Firmware aux version
+
+Issue: Get Version Information return incorrect Firmware AUX version
+
+FIX: Firmware aux version was parsing incorrectly. Do the parsing by
+ correct regex pattern of BMC version.
+
+Tested:
+Verified using ipmitool raw commands
+Before fix:
+Command: ipmitool raw 0x08 0x20 // Get version Information
+Response: 01 02 00 70 01 00 00 00 00 00 00 00 00 00 00 00
+
+After fix:
+Command: ipmitool raw 0x08 0x20 // Get version Information
+Response: 02 01 00 74 0a 8a 37 78 00 00 00 00 00 00 00 00
+ 02 00 70 01 00 00 00 00 00 00 00 00 00 00 00
+
+Signed-off-by: srikanta mondal <srikantax.mondal@intel.com>
+Change-Id: I7c2baf8a0da15e3ca4db5d6f9d6de7bf739aa755
+---
+ src/firmware-update.cpp | 56 +++++++++++++++++++++++++----------------
+ 1 file changed, 35 insertions(+), 21 deletions(-)
+
+diff --git a/src/firmware-update.cpp b/src/firmware-update.cpp
+index 8c3cc94..ec1d14a 100644
+--- a/src/firmware-update.cpp
++++ b/src/firmware-update.cpp
+@@ -1,3 +1,4 @@
++#include <byteswap.h>
+ #include <ipmid/api.h>
+ #include <openssl/evp.h>
+ #include <openssl/sha.h>
+@@ -6,6 +7,7 @@
+ #include <sys/types.h>
+ #include <unistd.h>
+
++#include <appcommands.hpp>
+ #include <boost/algorithm/string.hpp>
+ #include <boost/container/flat_map.hpp>
+ #include <boost/process/child.hpp>
+@@ -836,26 +838,44 @@ ipmi::RspType<uint8_t, std::vector<fwVersionInfoType>> ipmiGetFwVersionInfo()
+ continue;
+ }
+
+- // BMC Version format: <major>.<minor>-<build bum>-<build hash>
+- std::vector<std::string> splitVer;
+- boost::split(splitVer, verStr, boost::is_any_of(".-"));
+- if (splitVer.size() < 3)
+- {
+- phosphor::logging::log<phosphor::logging::level::INFO>(
+- "Invalid Version format.",
+- phosphor::logging::entry("Version=%s", verStr.c_str()),
+- phosphor::logging::entry("PATH=%s", fwDev.second));
+- continue;
+- }
+-
+ uint8_t majorNum = 0;
+ uint8_t minorNum = 0;
+ uint32_t buildNum = 0;
+ try
+ {
+- majorNum = std::stoul(splitVer[0], nullptr, 16);
+- minorNum = std::stoul(splitVer[1], nullptr, 16);
+- buildNum = std::stoul(splitVer[2], nullptr, 16);
++ std::optional<ipmi::MetaRevision> rev =
++ ipmi::convertIntelVersion(verStr);
++ if (rev.has_value())
++ {
++ ipmi::MetaRevision revision = rev.value();
++ majorNum = revision.major % 10 + (revision.major / 10) * 16;
++ minorNum = (revision.minor > 99 ? 99 : revision.minor);
++ minorNum = minorNum % 10 + (minorNum / 10) * 16;
++ uint32_t hash = std::stoul(revision.metaHash, 0, 16);
++ hash = bswap_32(hash);
++ buildNum = (revision.buildNo & 0xFF) + (hash & 0xFFFFFF00);
++ }
++ else
++ {
++ std::vector<std::string> splitVer;
++ boost::split(splitVer, verStr, boost::is_any_of(".-"));
++ if (splitVer.size() < 3)
++ {
++ phosphor::logging::log<phosphor::logging::level::INFO>(
++ "Invalid Version format.",
++ phosphor::logging::entry("Version=%s", verStr.c_str()),
++ phosphor::logging::entry("PATH=%s", fwDev.second));
++ continue;
++ }
++ majorNum = std::stoul(splitVer[0], nullptr, 16);
++ minorNum = std::stoul(splitVer[1], nullptr, 16);
++ buildNum = std::stoul(splitVer[2], nullptr, 16);
++ }
++ // Build Timestamp - Not supported.
++ // Update Timestamp - TODO: Need to check with CPLD team.
++ fwVerInfoList.emplace_back(
++ fwVersionInfoType(static_cast<uint8_t>(fwDev.first), majorNum,
++ minorNum, buildNum, 0, 0));
+ }
+ catch (const std::exception& e)
+ {
+@@ -864,12 +884,6 @@ ipmi::RspType<uint8_t, std::vector<fwVersionInfoType>> ipmiGetFwVersionInfo()
+ phosphor::logging::entry("ERROR=%s", e.what()));
+ continue;
+ }
+-
+- // Build Timestamp - Not supported.
+- // Update Timestamp - TODO: Need to check with CPLD team.
+- fwVerInfoList.emplace_back(
+- fwVersionInfoType(static_cast<uint8_t>(fwDev.first), majorNum,
+- minorNum, buildNum, 0, 0));
+ }
+
+ return ipmi::responseSuccess(fwVerInfoList.size(), fwVerInfoList);
+--
+2.17.1
+