mmc: Add update-bios-attr-table subcommand
Add the update-bios-attr-table subcommand to update the bios attribute
table with the host firmware well-known names based on system type. The
system type is provided by Entity Manager, and this new subcommand uses
some of the existing infrastructure that the process-host-firmware
subcommand has to determine the system type.
Add a new service file to run this new subcommand so that it can block
waiting for the entity manager interface to appear on D-Bus.
Subsequent commands will add parsing the JSON file to build the bios
attribute string and set the bios attribute property.
Change-Id: Iacee975e273bae562d2d42cd8b642b9d0744a121
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/item_updater_main.cpp b/item_updater_main.cpp
index c563cbe..21164e9 100644
--- a/item_updater_main.cpp
+++ b/item_updater_main.cpp
@@ -60,32 +60,42 @@
CLI::App app{"OpenPOWER host firmware manager"};
+ using namespace std::string_literals;
+ std::map<std::string, std::vector<std::string>> extensionMap{{
+ {"ibm,everest"s, {".EVEREST_XML"s, ".P10"s}},
+ {"ibm,rainier-2u"s, {".RAINIER_2U_XML"s, ".P10"s}},
+ {"ibm,rainier-4u"s, {".RAINIER_4U_XML"s, ".P10"s}},
+ {"ibm,rainier-1s4u"s, {".RAINIER_4U_XML"s, ".P10"s}},
+ }};
+
// subcommandContext allows program subcommand callbacks to add loop event
// callbacks (e.g. reception of a dbus signal) and then return to main,
// without the loop event callback being destroyed until the loop event
// callback has a chance to run and instruct the loop to exit.
- std::shared_ptr<void> subcommandContext;
+ std::vector<std::shared_ptr<void>> subcommandContext;
static_cast<void>(
app.add_subcommand("process-host-firmware",
"Point the host firmware at its data.")
- ->callback([&bus, &loop, &subcommandContext]() {
- using namespace std::string_literals;
- std::map<std::string, std::vector<std::string>> extensionMap{{
- {"ibm,everest"s, {".EVEREST_XML"s, ".P10"s}},
- {"ibm,rainier-2u"s, {".RAINIER_2U_XML"s, ".P10"s}},
- {"ibm,rainier-4u"s, {".RAINIER_4U_XML"s, ".P10"s}},
- {"ibm,rainier-1s4u"s, {".RAINIER_4U_XML"s, ".P10"s}},
- }};
+ ->callback([&bus, &loop, &subcommandContext, extensionMap]() {
auto hostFirmwareDirectory = "/media/hostfw/running"s;
auto logCallback = [](const auto& path, auto& ec) {
std::cerr << path << ": " << ec.message() << "\n";
};
- subcommandContext =
+ subcommandContext.push_back(
functions::process_hostfirmware::processHostFirmware(
- bus, std::move(extensionMap),
- std::move(hostFirmwareDirectory),
- std::move(logCallback), loop);
+ bus, extensionMap, std::move(hostFirmwareDirectory),
+ std::move(logCallback), loop));
}));
+ static_cast<void>(
+ app.add_subcommand("update-bios-attr-table",
+ "Update the bios attribute table with the host "
+ "firmware data details.")
+ ->callback([&bus, &loop, &subcommandContext, extensionMap]() {
+ subcommandContext.push_back(
+ functions::process_hostfirmware::updateBiosAttrTable(
+ bus, extensionMap, loop));
+ }));
+
CLI11_PARSE(app, argc, argv);
if (app.get_subcommands().size() == 0)