Expand and update location code property on BUS
This commit expands and updates the required location code
poperty on BUS in case following condition holds true.
a) if FC or SE or both keyword
under VCEN record has been modified by VPD write
application for Motherboard FRU.
OR
b) if TM or SE or both keyword
under VSYS record has been modified by VPD write
application for Motherboard FRU.
Tested on simics.
-make bus call or use VPD tool application to update
keywords as mentioned above in (a) and (b).
-Introspect that motherboard object on bus.
-Check the value of interface "com.ibm.ipzvpd.Location",
property - "LocationCode"
To build the application
meson -Dibm-parser=enabled -Dvpd-manager=Enabled build
ninja -C build
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: Ic964da0f058153bdd43b94679bdfc5596d7f3861
diff --git a/vpd-manager/manager.cpp b/vpd-manager/manager.cpp
index 37a8055..61a392a 100644
--- a/vpd-manager/manager.cpp
+++ b/vpd-manager/manager.cpp
@@ -65,9 +65,16 @@
itemFRUS.value().get_ref<const nlohmann::json::array_t&>();
for (const auto& itemEEPROM : groupEEPROM)
{
+ bool isMotherboard = false;
+ if (itemEEPROM["extraInterfaces"].find(
+ "xyz.openbmc_project.Inventory.Item.Board.Motherboard") !=
+ itemEEPROM["extraInterfaces"].end())
+ {
+ isMotherboard = true;
+ }
frus.emplace(itemEEPROM["inventoryPath"]
.get_ref<const nlohmann::json::string_t&>(),
- itemFRUS.key());
+ std::make_pair(itemFRUS.key(), isMotherboard));
}
}
}
@@ -83,12 +90,26 @@
throw std::runtime_error("Inventory path not found");
}
- inventory::Path vpdFilePath = frus.find(path)->second;
+ inventory::Path vpdFilePath = frus.find(path)->second.first;
// instantiate editor class to update the data
EditorImpl edit(vpdFilePath, jsonFile, recordName, keyword);
edit.updateKeyword(value);
+ // if it is a motehrboard FRU need to check for location expansion
+ if (frus.find(path)->second.second)
+ {
+ if (recordName == "VCEN" && (keyword == "FC" || keyword == "SE"))
+ {
+ edit.expandLocationCode("fcs");
+ }
+ else if (recordName == "VSYS" &&
+ (keyword == "TM" || keyword == "SE"))
+ {
+ edit.expandLocationCode("mts");
+ }
+ }
+
return;
}
catch (const std::exception& e)