platform-mc: sensor: Support HardShutdown threshold in pldm sensors

To support UNR in pldm sensors, add fatal_high/fatal_low bit
of PDR, and then the values will update to ThresholdHardShutdown
interface for pldm sensors.

Tested:
- Check the UNR of the pldm sensors

root@bmc:~# mfg-tool sensor-display 2>/dev/null | table-sensor-display
sensor                                  ...  units    ... UNR
----------------------------------------...  -------- ... -------
SENTINEL_DOME_SLOT_1_MB_SSD_BOOT_TEMP_C      DegreesC     85
SENTINEL_DOME_SLOT_1_MB_SSD_DATA_TEMP_C      DegreesC     85
SENTINEL_DOME_SLOT_1_MB_VR_CPU0_TEMP_C       DegreesC     125
SENTINEL_DOME_SLOT_1_MB_VR_CPU1_TEMP_C       DegreesC     125
SENTINEL_DOME_SLOT_1_MB_VR_PVDD11_TEMP_C     DegreesC     125
SENTINEL_DOME_SLOT_1_MB_VR_PVDDIO_TEMP_C     DegreesC     125

Change-Id: If146a6191fc864988218c39f36038abff1f5d772
Signed-off-by: Zoey YJ Chung <zoey.yj.chung.wiwynn@gmail.com>
diff --git a/platform-mc/numeric_sensor.hpp b/platform-mc/numeric_sensor.hpp
index f085b07..37f4695 100644
--- a/platform-mc/numeric_sensor.hpp
+++ b/platform-mc/numeric_sensor.hpp
@@ -11,6 +11,7 @@
 #include <xyz/openbmc_project/Inventory/Source/PLDM/Entity/server.hpp>
 #include <xyz/openbmc_project/Metric/Value/server.hpp>
 #include <xyz/openbmc_project/Sensor/Threshold/Critical/server.hpp>
+#include <xyz/openbmc_project/Sensor/Threshold/HardShutdown/server.hpp>
 #include <xyz/openbmc_project/Sensor/Threshold/Warning/server.hpp>
 #include <xyz/openbmc_project/Sensor/Value/server.hpp>
 #include <xyz/openbmc_project/State/Decorator/Availability/server.hpp>
@@ -36,6 +37,8 @@
     sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Warning>;
 using ThresholdCriticalIntf = sdbusplus::server::object_t<
     sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Critical>;
+using ThresholdHardShutdownIntf = sdbusplus::server::object_t<
+    sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::HardShutdown>;
 using OperationalStatusIntf =
     sdbusplus::server::object_t<sdbusplus::xyz::openbmc_project::State::
                                     Decorator::server::OperationalStatus>;
@@ -177,6 +180,38 @@
         }
     };
 
+    /** @brief Get Upper HardShutdown threshold
+     *
+     *  @return double - Upper HardShutdown threshold
+     */
+    double getThresholdUpperHardShutdown()
+    {
+        if (thresholdHardShutdownIntf)
+        {
+            return thresholdHardShutdownIntf->hardShutdownHigh();
+        }
+        else
+        {
+            return std::numeric_limits<double>::quiet_NaN();
+        }
+    };
+
+    /** @brief Get Lower HardShutdown threshold
+     *
+     *  @return double - Lower HardShutdown threshold
+     */
+    double getThresholdLowerHardShutdownl()
+    {
+        if (thresholdHardShutdownIntf)
+        {
+            return thresholdHardShutdownIntf->hardShutdownLow();
+        }
+        else
+        {
+            return std::numeric_limits<double>::quiet_NaN();
+        }
+    };
+
     /** @brief Check if value is over threshold.
      *
      *  @param[in] eventType - event level in pldm::utils::Level
@@ -243,6 +278,8 @@
     std::unique_ptr<ValueIntf> valueIntf = nullptr;
     std::unique_ptr<ThresholdWarningIntf> thresholdWarningIntf = nullptr;
     std::unique_ptr<ThresholdCriticalIntf> thresholdCriticalIntf = nullptr;
+    std::unique_ptr<ThresholdHardShutdownIntf> thresholdHardShutdownIntf =
+        nullptr;
     std::unique_ptr<AvailabilityIntf> availabilityIntf = nullptr;
     std::unique_ptr<OperationalStatusIntf> operationalStatusIntf = nullptr;
     std::unique_ptr<AssociationDefinitionsInft> associationDefinitionsIntf =