Use mobo's object system iface to find mobo path.

This change use system interface to find the inventory object path
of the root board in the system. This replaces the `ReScan`
method to get the root object path. The `ReScan` implementation in
EntityManager never upstreamed and that CL was abandoned.
CL: https://gerrit.openbmc.org/c/openbmc/entity-manager/+/46128

TESTED:

busctl get-property xyz.openbmc_project.Smbios.MDR_V2 \
> /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0 \
> xyz.openbmc_project.Association.Definitions Associations
a(sss) 1 "chassis" "processors" "/xyz/openbmc_project/inventory/system/board/motherboard"

busctl get-property xyz.openbmc_project.Smbios.MDR_V2 \
> /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1 \
> xyz.openbmc_project.Association.Definitions Associations
a(sss) 1 "chassis" "processors" "/xyz/openbmc_project/inventory/system/board/motherboard"

busctl  --verbose get-property xyz.openbmc_project.ObjectMapper \
/xyz/openbmc_project/inventory/system/board/motherboard/processors \
xyz.openbmc_project.Association endpoints
ARRAY "s" {
        STRING "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0";
        STRING "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1";
};

Signed-off-by: Gobinath Krishnamoorthy <gobinathk@google.com>
Change-Id: Idc6f8c58324c7618a2c4c5a2c4079599c7c29cf4
diff --git a/include/mdrv2.hpp b/include/mdrv2.hpp
index ddde0ef..994598c 100644
--- a/include/mdrv2.hpp
+++ b/include/mdrv2.hpp
@@ -49,6 +49,14 @@
 static constexpr const char* smbiosPath = "/xyz/openbmc_project/Smbios";
 static constexpr const char* smbiosInterfaceName =
     "xyz.openbmc_project.Smbios.GetRecordType";
+static constexpr const char* mapperBusName = "xyz.openbmc_project.ObjectMapper";
+static constexpr const char* mapperPath = "/xyz/openbmc_project/object_mapper";
+static constexpr const char* mapperInterface =
+    "xyz.openbmc_project.ObjectMapper";
+static constexpr const char* systemInterfacePath =
+    "/xyz/openbmc_project/inventory/system";
+static constexpr const char* systemInterface =
+    "xyz.openbmc_project.Inventory.Item.System";
 constexpr const int limitEntryLen = 0xff;
 
 class MDR_V2 :
diff --git a/src/mdrv2.cpp b/src/mdrv2.cpp
index 3949630..f8e2654 100644
--- a/src/mdrv2.cpp
+++ b/src/mdrv2.cpp
@@ -395,14 +395,25 @@
 void MDR_V2::systemInfoUpdate()
 {
     std::string motherboardPath;
-    sdbusplus::message_t method =
-        bus.new_method_call("xyz.openbmc_project.EntityManager",
-                            "/xyz/openbmc_project/EntityManager",
-                            "xyz.openbmc_project.EntityManager", "ReScan");
+    auto method = bus.new_method_call(mapperBusName, mapperPath,
+                                      mapperInterface, "GetSubTreePaths");
+    method.append(systemInterfacePath);
+    method.append(0);
+    method.append(std::vector<std::string>({systemInterface}));
     try
     {
+        std::vector<std::string> paths;
         sdbusplus::message_t reply = bus.call(method);
-        reply.read(motherboardPath);
+        reply.read(paths);
+        if (paths.size() < 1)
+        {
+            phosphor::logging::log<phosphor::logging::level::ERR>(
+                "Failed to get system motherboard dbus path.");
+        }
+        else
+        {
+            motherboardPath = std::move(paths[0]);
+        }
     }
     catch (const sdbusplus::exception_t& e)
     {