NMI (soft reset) control code enablement
Changes here include:
1) A service that triggers Open BMC App (openpower-proc-nmi)
2) An application that waits for a dbus event (NMI) to occur
3) A reset logic that triggers a NMI/softreset dbus service which
will invoke pdbg call to trigger stop followed by sreset on all
threads
4) Necessary Makefile.am changes
Tested: Verified following
1) openpower-proc-nmi app is automatically started once host is started
2) After killing the app made sure app is restarted successfully
3) Verified NMI is detected on the Host side and crash dump being
collected in /var/crash/ and taking a watchdog triggered reboot
4) System coming back to original state once all #3 is completed
5) Powered off the system (obmcutil poweroff) service disabled and
enabled after host is powered on
Signed-off-by: Lakshminarayana R. Kammath <lkammath@in.ibm.com>
Change-Id: I16f3bb2a2ed0c0ffcea2a720a2ae39a2b303ef9e
diff --git a/nmi_interface.hpp b/nmi_interface.hpp
new file mode 100644
index 0000000..9e3f052
--- /dev/null
+++ b/nmi_interface.hpp
@@ -0,0 +1,47 @@
+#pragma once
+
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/server/object.hpp>
+#include <xyz/openbmc_project/Control/Host/NMI/server.hpp>
+
+namespace openpower
+{
+namespace proc
+{
+
+using Base = sdbusplus::xyz::openbmc_project::Control::Host::server::NMI;
+using Interface = sdbusplus::server::object::object<Base>;
+
+/* @class NMI
+ * @brief Implementation of NMI (Soft Reset)
+ */
+class NMI : public Interface
+{
+ public:
+ NMI() = delete;
+ NMI(const NMI&) = delete;
+ NMI& operator=(const NMI&) = delete;
+ NMI(NMI&&) = delete;
+ NMI& operator=(NMI&&) = delete;
+ virtual ~NMI() = default;
+
+ /* @brief Constructor to put object onto bus at a dbus path.
+ * @param[in] bus - sdbusplus D-Bus to attach to.
+ * @param[in] path - Path to attach to.
+ */
+ NMI(sdbusplus::bus::bus& bus, const char* path);
+
+ /* @brief trigger stop followed by soft reset.
+ */
+ void nMI() override;
+
+ private:
+ /** @brief sdbus handle */
+ sdbusplus::bus::bus& bus;
+
+ /** @brief object path */
+ std::string objectPath;
+};
+
+} // namespace proc
+} // namespace openpower