xref: /openbmc/openpower-proc-control/nmi_interface.hpp (revision aaea68675bcc020ad360d3decbd6f9c9c5f6dd45)
1 #pragma once
2 
3 #include <sdbusplus/bus.hpp>
4 #include <sdbusplus/server/object.hpp>
5 #include <xyz/openbmc_project/Control/Host/NMI/server.hpp>
6 
7 namespace openpower
8 {
9 namespace proc
10 {
11 
12 using Base = sdbusplus::xyz::openbmc_project::Control::Host::server::NMI;
13 using Interface = sdbusplus::server::object_t<Base>;
14 
15 /*  @class NMI
16  *  @brief Implementation of NMI (Soft Reset)
17  */
18 class NMI : public Interface
19 {
20   public:
21     NMI() = delete;
22     NMI(const NMI&) = delete;
23     NMI& operator=(const NMI&) = delete;
24     NMI(NMI&&) = delete;
25     NMI& operator=(NMI&&) = delete;
26     virtual ~NMI() = default;
27 
28     /*  @brief Constructor to put object onto bus at a dbus path.
29      *  @param[in] bus - sdbusplus D-Bus to attach to.
30      *  @param[in] path - Path to attach to.
31      */
32     NMI(sdbusplus::bus_t& bus, const char* path);
33 
34     /*  @brief trigger stop followed by soft reset.
35      */
36     void nmi() override;
37 
38   private:
39     /** @brief sdbus handle */
40     sdbusplus::bus_t& bus;
41 
42     /** @brief object path */
43     std::string objectPath;
44 };
45 
46 } // namespace proc
47 } // namespace openpower
48