smbios-mdr: Add custom dbus object path
The patch adds a configurable meson option which when enabled,
customizes the dbus object path.
Earlier efforts where made to have similar functionality and
the some MRs for same were rejected for various reasons
[1] https://gerrit.openbmc.org/c/openbmc/smbios-mdr/+/46129
[2] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/46739
[3] https://gerrit.openbmc.org/c/openbmc/entity-manager/+/44196
Tested:
1) Dbus tree output
```
/xyz/openbmc_project
|-/xyz/openbmc_project/inventory
|`-/xyz/openbmc_project/inventory/system
|`-/xyz/openbmc_project/inventory/system/chassis
||-/xyz/openbmc_project/inventory/system/chassis/Chassis_0
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot0
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot1
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot10
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot11
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot12
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot13
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot14
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot15
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot16
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot17
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot18
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot19
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot2
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot3
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot4
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot5
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot6
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot7
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot8
|||- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/pcieslot9
||`- /xyz/openbmc_project/inventory/system/chassis/Chassis_0/tpm0
```
Change-Id: I765e56a30c3e5712c2f43fc6a8302be5cc9d9a96
Signed-off-by: Prithvi Pai <ppai@nvidia.com>
diff --git a/src/mdrv2.cpp b/src/mdrv2.cpp
index 2aaf4be..070541c 100644
--- a/src/mdrv2.cpp
+++ b/src/mdrv2.cpp
@@ -527,8 +527,8 @@
for (unsigned int index = 0; index < *num; index++)
{
- std::string path =
- smbiosInventoryPath + cpuSuffix + std::to_string(index);
+ std::string path = getObjectPath(smbiosInventoryPath, motherboardPath,
+ cpuSuffix, index);
if (index + 1 > cpus.size())
{
cpus.emplace_back(std::make_unique<phosphor::smbios::Cpu>(
@@ -559,8 +559,8 @@
for (unsigned int index = 0; index < *num; index++)
{
- std::string path =
- smbiosInventoryPath + dimmSuffix + std::to_string(index);
+ std::string path = getObjectPath(smbiosInventoryPath, motherboardPath,
+ dimmSuffix, index);
if (index + 1 > dimms.size())
{
dimms.emplace_back(std::make_unique<phosphor::smbios::Dimm>(
@@ -591,8 +591,8 @@
for (unsigned int index = 0; index < *num; index++)
{
- std::string path =
- smbiosInventoryPath + pcieSuffix + std::to_string(index);
+ std::string path = getObjectPath(smbiosInventoryPath, motherboardPath,
+ pcieSuffix, index);
if (index + 1 > pcies.size())
{
pcies.emplace_back(std::make_unique<phosphor::smbios::Pcie>(
@@ -622,8 +622,8 @@
for (unsigned int index = 0; index < *num; index++)
{
- std::string path =
- smbiosInventoryPath + tpmSuffix + std::to_string(index);
+ std::string path = getObjectPath(smbiosInventoryPath, motherboardPath,
+ tpmSuffix, index);
if (index + 1 > tpms.size())
{
tpms.emplace_back(std::make_unique<phosphor::smbios::Tpm>(