Remove "Manufacturer" from PCIeDevice interface
"Manufacturer" is already part of Asset interface. Remove it from
PCIeDevice interface, create Asset Interface and add "Manufacturer".
phosphor-dbus-interfaces commit:
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/61738
bmcweb commit:
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/62257
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/40051
Tested: None
I don't have environment to test, need help testing this commit.
Change-Id: Ic69b7baeb9eab9b90ddbd95b296a90343f269de0
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
diff --git a/include/peci_pcie.hpp b/include/peci_pcie.hpp
index 9053392..5dbe63a 100644
--- a/include/peci_pcie.hpp
+++ b/include/peci_pcie.hpp
@@ -27,6 +27,8 @@
"/xyz/openbmc_project/inventory/pcie";
static constexpr const char* peciPCIeDeviceInterface =
"xyz.openbmc_project.Inventory.Item.PCIeDevice";
+static constexpr char const* peciPCIeAssetInterface =
+ "xyz.openbmc_project.Inventory.Decorator.Asset";
static constexpr const int maxPCIBuses = 256;
static constexpr const int maxPCIDevices = 32;
diff --git a/src/peci_pcie.cpp b/src/peci_pcie.cpp
index 73b0001..32b4e6f 100644
--- a/src/peci_pcie.cpp
+++ b/src/peci_pcie.cpp
@@ -34,10 +34,16 @@
namespace peci_pcie
{
+
+struct PcieInterfaces
+{
+ std::shared_ptr<sdbusplus::asio::dbus_interface> deviceIface;
+ std::shared_ptr<sdbusplus::asio::dbus_interface> assetIface;
+};
+
static boost::container::flat_map<
int, boost::container::flat_map<
- int, boost::container::flat_map<
- int, std::shared_ptr<sdbusplus::asio::dbus_interface>>>>
+ int, boost::container::flat_map<int, PcieInterfaces>>>
pcieDeviceDBusMap;
static bool abortScan;
@@ -442,9 +448,19 @@
const int& dev, const std::string& propertyName,
const std::string& propertyValue)
{
- std::shared_ptr<sdbusplus::asio::dbus_interface> iface =
+ peci_pcie::PcieInterfaces pcieIfaces =
peci_pcie::pcieDeviceDBusMap[clientAddr][bus][dev];
+ std::shared_ptr<sdbusplus::asio::dbus_interface> iface;
+ if (propertyName == "Manufacturer")
+ {
+ iface = pcieIfaces.assetIface;
+ }
+ else
+ {
+ iface = pcieIfaces.deviceIface;
+ }
+
if (iface->is_initialized())
{
if (!iface->set_property(propertyName, propertyValue))
@@ -604,10 +620,11 @@
const int& clientAddr, const int& bus,
const int& dev)
{
- std::shared_ptr<sdbusplus::asio::dbus_interface> iface =
+ peci_pcie::PcieInterfaces ifaces =
peci_pcie::pcieDeviceDBusMap[clientAddr][bus][dev];
- objServer.remove_interface(iface);
+ objServer.remove_interface(ifaces.deviceIface);
+ objServer.remove_interface(ifaces.assetIface);
peci_pcie::pcieDeviceDBusMap[clientAddr][bus].erase(dev);
if (peci_pcie::pcieDeviceDBusMap[clientAddr][bus].empty())
@@ -627,9 +644,12 @@
std::string pathName = std::string(peci_pcie::peciPCIePath) + "/S" +
std::to_string(cpu) + "B" + std::to_string(bus) +
"D" + std::to_string(dev);
- std::shared_ptr<sdbusplus::asio::dbus_interface> iface =
+ peci_pcie::PcieInterfaces ifaces;
+ ifaces.deviceIface =
objServer.add_interface(pathName, peci_pcie::peciPCIeDeviceInterface);
- peci_pcie::pcieDeviceDBusMap[clientAddr][bus][dev] = iface;
+ ifaces.assetIface =
+ objServer.add_interface(pathName, peci_pcie::peciPCIeAssetInterface);
+ peci_pcie::pcieDeviceDBusMap[clientAddr][bus][dev] = ifaces;
// Update the properties for the new device
if (updatePCIeDevice(clientAddr, bus, dev) != resCode::resOk)
@@ -638,7 +658,8 @@
return resCode::resErr;
}
- iface->initialize();
+ ifaces.deviceIface->initialize();
+ ifaces.assetIface->initialize();
return resCode::resOk;
}
@@ -654,7 +675,8 @@
if (auto devIt = busIt->second.find(dev);
devIt != busIt->second.end())
{
- if (devIt->second)
+ if (devIt->second.deviceIface != nullptr ||
+ devIt->second.assetIface != nullptr)
{
return true;
}