Defect fix:Unexpanded DIMM location codes
Defect:
The DIMM location codes gets its unexpanded version in
the system.
As per the vpd-parser, the dimm location code gets expanded
as a part of priming the inventory. But that expanded version
is getting overridden by the populateInterfaces api, where
the populateInterfaces api has the logic to populate unexpanded
location code in dbus for frus which are not of type IPZ VPD.
DIMM is one such fru which is not of type IPZ VPD.
This commit has a fix to get the location code for VPD of type
Keyword.
Test:
Tested on rainer
root@p10bmc:/tmp# busctl introspect xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
com.ibm.ipzvpd.Location interface - - -
.LocationCode property s "Ufcs-P0-C12" emits-change writable
com.ibm.ipzvpd.VINI interface - -
root@p10bmc:/tmp# ./ibm-read-vpd --file /sys/bus/i2c/drivers/at24/111-0050/eeprom
root@p10bmc:/tmp# busctl introspect xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
com.ibm.ipzvpd.Location interface - - -
.LocationCode property s "U78DB.ND0.1234567-P0-C12" emits-change writable
com.ibm.ipzvpd.VINI interface - - -
.B3 property ay 0
Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
Change-Id: Ib199c4448d93510e6a517f49eaac94334ffb8951
diff --git a/ibm_vpd_app.cpp b/ibm_vpd_app.cpp
index 7cc0194..14d405f 100644
--- a/ibm_vpd_app.cpp
+++ b/ibm_vpd_app.cpp
@@ -239,22 +239,24 @@
}
else if (itr.value().is_string())
{
- if constexpr (is_same<T, Parsed>::value)
+ if (busProp == "LocationCode" && inf == IBM_LOCATION_CODE_INF)
{
- if (busProp == "LocationCode" &&
- inf == IBM_LOCATION_CODE_INF)
+ std::string prop;
+ if constexpr (is_same<T, Parsed>::value)
{
// TODO deprecate the com.ibm interface later
- auto prop = expandLocationCode(
- itr.value().get<string>(), vpdMap, isSystemVpd);
- props.emplace(busProp, prop);
- interfaces.emplace(XYZ_LOCATION_CODE_INF, props);
- interfaces.emplace(IBM_LOCATION_CODE_INF, props);
+ prop = expandLocationCode(itr.value().get<string>(),
+ vpdMap, isSystemVpd);
}
- else
+ else if constexpr (is_same<T, KeywordVpdMap>::value)
{
- props.emplace(busProp, itr.value().get<string>());
+ // Send empty Parsed object to expandLocationCode api.
+ prop = expandLocationCode(itr.value().get<string>(),
+ Parsed{}, false);
}
+ props.emplace(busProp, prop);
+ interfaces.emplace(XYZ_LOCATION_CODE_INF, props);
+ interfaces.emplace(IBM_LOCATION_CODE_INF, props);
}
else
{
@@ -1442,4 +1444,4 @@
}
return rc;
-}
\ No newline at end of file
+}