oem-ampere: eventManager: Handle PCIe hotplug sensor event

This commit adds the handler and needed APIs to handle PCIe hot-plug
event as a Numeric Sensor Event. The handler will decode the event data,
parse them to readable info and log to Redfish Event Log.

Tested:
Hot-plug in/out the PCIe device and see the events logged into Redfish.

Change-Id: I8cc9b712a6f7d9b3402bf72bb2d825ed8d5a8009
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
diff --git a/oem/ampere/event/oem_event_manager.hpp b/oem/ampere/event/oem_event_manager.hpp
index 15b615f..46ba526 100644
--- a/oem/ampere/event/oem_event_manager.hpp
+++ b/oem/ampere/event/oem_event_manager.hpp
@@ -19,6 +19,7 @@
 
 enum sensor_ids
 {
+    PCIE_HOT_PLUG = 169,
     BOOT_OVERALL = 175,
 };
 
@@ -55,9 +56,42 @@
 enum class log_level : int
 {
     OK,
+    WARNING,
+    CRITICAL,
     BIOSFWPANIC,
 };
 
+/*
+ * PresentReading value format
+ * FIELD       |                   COMMENT
+ * Bit 31      |   Reserved
+ * Bit 30:24   |   Media slot number (0 - 63) This field can be used by UEFI
+ *             |   to indicate the media slot number (such as NVMe/SSD slot)
+ *             |   (7 bits)
+ * Bit 23      |   Operation status: 1 = operation failed
+ *             |   0 = operation successful
+ * Bit 22      |   Action: 0 - Insertion 1 - Removal
+ * Bit 21:18   |   Function (4 bits)
+ * Bit 17:13   |   Device (5 bits)
+ * Bit 12:5    |   Bus (8 bits)
+ * Bit 4:0     |   Segment (5 bits)
+ */
+typedef union
+{
+    uint32_t value;
+    struct
+    {
+        uint32_t segment:5;
+        uint32_t bus:8;
+        uint32_t device:5;
+        uint32_t function:4;
+        uint32_t action:1;
+        uint32_t opStatus:1;
+        uint32_t mediaSlot:7;
+        uint32_t reserved:1;
+    } __attribute__((packed)) bits;
+} PCIeHotPlugEventRecord_t;
+
 /**
  * @brief OemEventManager
  *
@@ -119,6 +153,15 @@
      */
     std::string dimmIdxsToString(uint32_t dimmIdxs);
 
+    /** @brief Handle numeric sensor event message from PCIe hot-plug sensor.
+     *
+     *  @param[in] tid - TID
+     *  @param[in] sensorId - Sensor ID
+     *  @param[in] presentReading - the present reading of the sensor
+     */
+    void handlePCIeHotPlugEvent(pldm_tid_t tid, uint16_t sensorId,
+                                uint32_t presentReading);
+
     /** @brief Handle numeric sensor event message from boot overall sensor.
      *
      *  @param[in] tid - TID