Add UNC crossing option for FailSafe condition

Added a unc-failsafe meson option that if set to true, would then check
if any temperature sensor PIDs exceed their upper non-critical
threshold. If a sensor is detected to have exceeded their UNC, then the
zone associated with that PID would go to FailSafe.

By default, this option will be set to false for backwards
compatibility.

Change-Id: I2fbc6000e8d37b34c51d3578becdaf18d449b0e8
Signed-off-by: Jonico Eustaquio <jonico.eustaquio@fii-na.com>
diff --git a/dbus/dbuspassive.cpp b/dbus/dbuspassive.cpp
index ac0d5cf..0963736 100644
--- a/dbus/dbuspassive.cpp
+++ b/dbus/dbuspassive.cpp
@@ -13,6 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "config.h"
+
 #include "dbuspassive.hpp"
 
 #include "dbushelper_interface.hpp"
@@ -305,6 +307,23 @@
         }
         owner->setFailed(asserted);
     }
+#ifdef UNC_FAILSAFE
+    else if (msgSensor == "xyz.openbmc_project.Sensor.Threshold.Warning")
+    {
+        auto warningAlarmHigh = msgData.find("WarningAlarmHigh");
+        if (warningAlarmHigh == msgData.end())
+        {
+            return 0;
+        }
+
+        bool asserted = false;
+        if (warningAlarmHigh != msgData.end())
+        {
+            asserted = std::get<bool>(warningAlarmHigh->second);
+        }
+        owner->setFailed(asserted);
+    }
+#endif
     else if (msgSensor == "xyz.openbmc_project.State.Decorator.Availability")
     {
         auto available = msgData.find("Available");