summaryrefslogtreecommitdiffstats
path: root/include/ipmid-host
diff options
context:
space:
mode:
Diffstat (limited to 'include/ipmid-host')
-rw-r--r--include/ipmid-host/cmd-utils.hpp51
-rw-r--r--include/ipmid-host/cmd.hpp10
2 files changed, 61 insertions, 0 deletions
diff --git a/include/ipmid-host/cmd-utils.hpp b/include/ipmid-host/cmd-utils.hpp
new file mode 100644
index 0000000..e7c6dc2
--- /dev/null
+++ b/include/ipmid-host/cmd-utils.hpp
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <unistd.h>
+
+#include <functional>
+#include <tuple>
+
+namespace phosphor
+{
+namespace host
+{
+namespace command
+{
+/** @detail After sending SMS_ATN to the Host, Host comes down and
+ * asks why an 'SMS_ATN` was sent.
+ * BMC then sends 'There is a Message to be Read` as response.
+ * Host then comes down asks for Message and the specified
+ * commands and data would go as data conforming to IPMI spec.
+ *
+ * Refer: 6.13.2 Send Message Command From System Interface
+ * in IPMI V2.0 spec.
+ */
+
+/** @brief IPMI command */
+using IPMIcmd = uint8_t;
+
+/** @brief Data associated with command */
+using Data = uint8_t;
+
+/** @brief <IPMI command, Data> to be sent as payload when Host asks for
+ * the message that can be associated with the previous SMS_ATN
+ */
+using IpmiCmdData = std::pair<IPMIcmd, Data>;
+
+/** @detail Implementation specific callback function to be invoked
+ * conveying the status of the executed command. Specific
+ * implementations may then broadcast an agreed signal
+ */
+using CallBack = std::function<void(IpmiCmdData, bool)>;
+
+/** @detail Tuple encapsulating above 2 to enable using Manager by
+ * different implementations. Users of Manager will supply
+ * <Ipmi command, Data> along with the callback handler.
+ * Manager will invoke the handler onveying the status of
+ * the command.
+ */
+using CommandHandler = std::tuple<IpmiCmdData, CallBack>;
+
+} // namespace command
+} // namespace host
+} // namespace phosphor
diff --git a/include/ipmid-host/cmd.hpp b/include/ipmid-host/cmd.hpp
new file mode 100644
index 0000000..adea960
--- /dev/null
+++ b/include/ipmid-host/cmd.hpp
@@ -0,0 +1,10 @@
+#include <ipmid-host/cmd-utils.hpp>
+#include <memory>
+#include <sdbusplus/bus.hpp>
+
+// Need this to use new sdbusplus compatible interfaces
+using sdbusPtr = std::unique_ptr<sdbusplus::bus::bus>;
+extern sdbusPtr& ipmid_get_sdbus_plus_handler();
+
+// Global Host Bound Command manager
+extern void ipmid_send_cmd_to_host(phosphor::host::command::CommandHandler&&);
OpenPOWER on IntegriCloud