Add beep support for CPU ERR2 timeout

The beeper  will beep with 1-5-2-3 if there is any ERR2 timeout event.

Tested:
Host on, trigger the CPU ERR2 timeout by short the CPU ERR2 pin > 90 seconds,
The BMC will beep with 1-5-2-3.

Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
diff --git a/src/host_error_monitor.cpp b/src/host_error_monitor.cpp
index f24925d..c1344df 100644
--- a/src/host_error_monitor.cpp
+++ b/src/host_error_monitor.cpp
@@ -91,6 +91,25 @@
 static gpiod::line cpu2MemtripLine;
 static boost::asio::posix::stream_descriptor cpu2MemtripEvent(io);
 
+// beep function for CPU error
+const static constexpr uint8_t beepCPUErr2 = 5;
+
+static void beep(const uint8_t& beepPriority)
+{
+    conn->async_method_call(
+        [](boost::system::error_code ec) {
+            if (ec)
+            {
+                std::cerr << "beep returned error with "
+                             "async_method_call (ec = "
+                          << ec << ")\n";
+                return;
+            }
+        },
+        "xyz.openbmc_project.BeepCode", "/xyz/openbmc_project/BeepCode",
+        "xyz.openbmc_project.BeepCode", "Beep", uint8_t(beepPriority));
+}
+
 static void cpuIERRLog()
 {
     sd_journal_send("MESSAGE=HostError: IERR", "PRIORITY=%i", LOG_INFO,
@@ -1261,6 +1280,8 @@
             "/xyz/openbmc_project/control/processor_error_config",
             "org.freedesktop.DBus.Properties", "Get",
             "xyz.openbmc_project.Control.Processor.ErrConfig", "ResetOnERR2");
+
+        beep(beepCPUErr2);
     });
 }