oem-ampere: eventManager: Handle Watchdog sensor event

Handle `SoC Watchdog` status Sensor Event in Ampere's OemEventManager
class.

Change-Id: I8f74a5cf1209d81750103588bd1eff9388a668bd
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
diff --git a/oem/ampere/event/oem_event_manager.cpp b/oem/ampere/event/oem_event_manager.cpp
index fe0021b..cf8e1ab 100644
--- a/oem/ampere/event/oem_event_manager.cpp
+++ b/oem/ampere/event/oem_event_manager.cpp
@@ -85,7 +85,8 @@
     {PCI_A_VR_STATE, "PCI_A_VR_STATE"},
     {PCIE_HOT_PLUG, "PCIE_HOT_PLUG"},
     {BOOT_OVERALL, "BOOT_OVERALL"},
-    {SOC_HEALTH_AVAILABILITY, "SOC_HEALTH_AVAILABILITY"}};
+    {SOC_HEALTH_AVAILABILITY, "SOC_HEALTH_AVAILABILITY"},
+    {WATCH_DOG, "WATCH_DOG"}};
 
 /*
     A map between the boot stages and logging strings.
@@ -201,7 +202,17 @@
           {"SoC Availability",
            {{1, {log_level::OK, "Enabled"}},
             {2, {log_level::WARNING, "Disabled"}},
-            {3, {log_level::CRITICAL, "Shutdown"}}}}}}};
+            {3, {log_level::CRITICAL, "Shutdown"}}}}}},
+        {WATCH_DOG,
+         {{"Global Watch Dog",
+           {{1, {log_level::OK, "Normal"}},
+            {2, {log_level::CRITICAL, "Timer Expired"}}}},
+          {"Secure Watch Dog",
+           {{1, {log_level::OK, "Normal"}},
+            {2, {log_level::CRITICAL, "Timer Expired"}}}},
+          {"Non-secure Watch Dog",
+           {{1, {log_level::OK, "Normal"}},
+            {2, {log_level::CRITICAL, "Timer Expired"}}}}}}};
 
 std::string
     OemEventManager::prefixMsgStrCreation(pldm_tid_t tid, uint16_t sensorId)
@@ -402,6 +413,9 @@
         case PCI_A_VR_STATE:
             handleVRDStatusEvent(tid, sensorId, presentReading);
             break;
+        case WATCH_DOG:
+            handleNumericWatchdogEvent(tid, sensorId, presentReading);
+            break;
         default:
             std::string description;
             std::stringstream strStream;
@@ -850,5 +864,30 @@
     sendJournalRedfish(description, logLevel);
 }
 
+void OemEventManager::handleNumericWatchdogEvent(
+    pldm_tid_t tid, uint16_t sensorId, uint32_t presentReading)
+{
+    std::string description;
+    log_level logLevel = log_level::CRITICAL;
+
+    description += prefixMsgStrCreation(tid, sensorId);
+
+    if (presentReading & 0x01)
+    {
+        description += "Global watchdog expired;";
+    }
+    if (presentReading & 0x02)
+    {
+        description += "Secure watchdog expired;";
+    }
+    if (presentReading & 0x04)
+    {
+        description += "Non-secure watchdog expired;";
+    }
+
+    // Log to Redfish event
+    sendJournalRedfish(description, logLevel);
+}
+
 } // namespace oem_ampere
 } // namespace pldm
diff --git a/oem/ampere/event/oem_event_manager.hpp b/oem/ampere/event/oem_event_manager.hpp
index da56954..521a16b 100644
--- a/oem/ampere/event/oem_event_manager.hpp
+++ b/oem/ampere/event/oem_event_manager.hpp
@@ -32,6 +32,7 @@
     PCIE_HOT_PLUG = 169,
     SOC_HEALTH_AVAILABILITY = 170,
     BOOT_OVERALL = 175,
+    WATCH_DOG = 179,
 };
 
 namespace boot
@@ -332,6 +333,15 @@
     void handleVRDStatusEvent(pldm_tid_t tid, uint16_t sensorId,
                               uint32_t presentReading);
 
+    /** @brief Handle numeric sensor event message from Watchdog status sensor.
+     *
+     *  @param[in] tid - TID
+     *  @param[in] sensorId - Sensor ID
+     *  @param[in] presentReading - the present reading of the sensor
+     */
+    void handleNumericWatchdogEvent(pldm_tid_t tid, uint16_t sensorId,
+                                    uint32_t presentReading);
+
     /** @brief Handle numeric sensor event messages.
      *
      *  @param[in] tid - TID