Unable to set minimum ship level
The software-manager-tool internally calls WriteKeyword d-bus api to
set firmware version in hardware (in VSYS FV).
The software-manager-tool is unable to set current firmware level
as minimum ship level due to a bug in vpd-manager "WriteKeyword"
d-bus api.
In WriteKeyword, when we try to read from filestream and write into
vector, the maximum possible vpd size(65504) is given as the total
bytes to be read (n). But the actual hardware data is lesser than
65504 in size.
If the filestream read operation runs out of characters to extract
before n characters have been successfully read, it reads the
available characters and stores it in vector and internally it sets
both bad bit and fail bit.
And with recent changes since we catch all filestream exceptions, this bug
has been caught and code flow is broken.
Fix:
Query the size of the VPD and perform filestream read based on the
given VPD size. If the given VPD size exceeds the maximum possible size
(65504), then read till 65504 only.
The same issue has been addressed in vpd-tool read keyword from hardware.
Test:
vpd-tool -r -H -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K FV
{
"/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
"FV": "fw1020.00-00 "
}
}
vpd-tool -r -O /system/chassis/motherboard -R VSYS -K FV
{
"/system/chassis/motherboard": {
"FV": "fw1020.00-00 "
}
}
software-manager-tool --setminlevel
<6> Current version: fw1050.00-4.16-dirty. Setting Minimum Ship Level to: fw1050.00-4
vpd-tool -r -O /system/chassis/motherboard -R VSYS -K FV
{
"/system/chassis/motherboard": {
"FV": "fw1050.00-4 "
}
}
vpd-tool -r -H -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K FV
{
"/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
"FV": "fw1050.00-4 "
}
}
Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
Change-Id: I6e24d744542f0a67a872605c7793d73ee27c541c
diff --git a/const.hpp b/const.hpp
index 2b227b1..c3d4c03 100644
--- a/const.hpp
+++ b/const.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
+#include <filesystem>
#include <iostream>
namespace openpower
@@ -114,13 +115,14 @@
constexpr auto errIntfForGpioError = "com.ibm.VPD.Error.GPIOError";
constexpr auto motherBoardInterface =
"xyz.openbmc_project.Inventory.Item.Board.Motherboard";
-constexpr auto invItemIntf = "xyz.openbmc_project.Inventory.Item";
constexpr auto systemVpdFilePath = "/sys/bus/i2c/drivers/at24/8-0050/eeprom";
constexpr auto i2cPathPrefix = "/sys/bus/i2c/drivers/";
constexpr auto spiPathPrefix = "/sys/bus/spi/drivers/";
constexpr auto at24driver = "at24";
constexpr auto at25driver = "at25";
constexpr auto ee1004driver = "ee1004";
+constexpr auto invItemIntf = "xyz.openbmc_project.Inventory.Item";
+static constexpr std::uintmax_t MAX_VPD_SIZE = 65504;
namespace lengths
{