Restore system VPD if EEPROM data is blank.
This commit implement changes which enables restoring system VPD.
If at the time of VPD parsing for backplane it is found that data
related to system VPD is blank on EEPROM but available on cache,
then the data from Dbus will be used to restore data in EEPROM.
There are another scenarios in restoring the system VPD but this
commit only implement changes to restore system VPD when the data
is available on cache but blank on EEPROM.
This commit also implements creation and logging of PEL in case blank
system VPD is found both on EEPROM and Dbus in the process of
system VPD restore.
Meson Build: OK.
Tested on Simics: OK.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: I32a872b3c3a74b79a9b8173c712b50f72fd7588c
diff --git a/utils.cpp b/utils.cpp
index 8b33305..b9d07e4 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -4,8 +4,10 @@
#include "defines.hpp"
+#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/server.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
namespace openpower
{
@@ -14,6 +16,7 @@
using namespace openpower::vpd::constants;
using namespace inventory;
using namespace phosphor::logging;
+using namespace sdbusplus::xyz::openbmc_project::Common::Error;
namespace inventory
{
@@ -66,11 +69,38 @@
}
catch (const std::runtime_error& e)
{
- using namespace phosphor::logging;
log<level::ERR>(e.what());
}
}
+MapperResponse
+ getObjectSubtreeForInterfaces(const std::string& root, const int32_t depth,
+ const std::vector<std::string>& interfaces)
+{
+ auto bus = sdbusplus::bus::new_default();
+ auto mapperCall = bus.new_method_call(mapperDestination, mapperObjectPath,
+ mapperInterface, "GetSubTree");
+ mapperCall.append(root);
+ mapperCall.append(depth);
+ mapperCall.append(interfaces);
+
+ MapperResponse result = {};
+
+ try
+ {
+ auto response = bus.call(mapperCall);
+
+ response.read(result);
+ }
+ catch (const sdbusplus::exception::SdBusError& e)
+ {
+ log<level::ERR>("Error in mapper GetSubTree",
+ entry("ERROR=%s", e.what()));
+ }
+
+ return result;
+}
+
} // namespace inventory
vpdType vpdTypeCheck(const Binary& vpdVector)
@@ -186,7 +216,6 @@
try
{
auto bus = sdbusplus::bus::new_default();
-
auto service = getService(bus, loggerObjectPath, loggerCreateInterface);
auto method = bus.new_method_call(service.c_str(), loggerObjectPath,
loggerCreateInterface, "Create");