Attn: Qualify MPIPL request with dump policy

Check the value of the dumpPolicyEnabled property and if it is true
(dumps enabled) then request MPIPL for PHYP TI cases, otherwise quiesce
the host.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: Iff9d89c18b37fff02b741c20b9f988238674a147
diff --git a/util/dbus.cpp b/util/dbus.cpp
index 635a73c..4f28154 100644
--- a/util/dbus.cpp
+++ b/util/dbus.cpp
@@ -198,15 +198,16 @@
     }
 }
 
-/** @brief Read state of autoreboot propertyi via dbus */
+/** @brief Read state of autoRebootEnabled property via dbus */
 bool autoRebootEnabled()
 {
-    bool autoReboot = false; // assume autoreboot attribute not available
+    // Assume true in case autoRebootEnbabled property is not available
+    bool autoReboot = true;
 
     constexpr auto interface = "xyz.openbmc_project.Control.Boot.RebootPolicy";
 
-    DBusService service;
-    DBusPath path;
+    DBusService service; // will find this
+    DBusPath path;       // will find this
 
     // find a dbus object and path that implements the interface
     if (0 == find(interface, path, service))
@@ -273,6 +274,35 @@
     return host;
 }
 
+/** @brief Read state of dumpPolicyEnabled property via dbus */
+bool dumpPolicyEnabled()
+{
+    // Assume true In case dumpPolicyEnabled property is not available
+    bool dumpPolicyEnabled = true;
+
+    constexpr auto interface = "xyz.openbmc_project.Object.Enable";
+    constexpr auto path      = "/xyz/openbmc_project/dump/system_dump_policy";
+
+    DBusService service; // will find this
+
+    // find a dbus object and path that implements the interface
+    if (0 == findService(interface, path, service))
+    {
+        DBusValue value;
+
+        // autoreboot policy is implemented as a property
+        constexpr auto property = "Enabled";
+
+        if (0 == getProperty(interface, path, service, property, value))
+        {
+            // return value is a variant, dump policy enabled is a boolean
+            dumpPolicyEnabled = std::get<bool>(value);
+        }
+    }
+
+    return dumpPolicyEnabled;
+}
+
 } // namespace dbus
 
 } // namespace util
diff --git a/util/dbus.hpp b/util/dbus.hpp
index aaf3cdc..ecc8d13 100644
--- a/util/dbus.hpp
+++ b/util/dbus.hpp
@@ -82,10 +82,9 @@
 void transitionHost(const HostState i_hostState);
 
 /**
- * @brief Read autoreboot property
+ * @brief Read autoRebootEnabled property
  *
- * Read the autoreboot property via dbus. This status will be used to
- * determine whether to either mpipl or quiesce the host on TI condition.
+ * @return false if autoRebootEnabled policy false, else true
  */
 bool autoRebootEnabled();
 
@@ -107,6 +106,13 @@
  */
 HostRunningState hostRunningState();
 
+/**
+ * @brief Read dumpPolicyEnabled property
+ *
+ * @return false if dumpPolicyEnabled property is false, else true
+ */
+bool dumpPolicyEnabled();
+
 } // namespace dbus
 
 } // namespace util