summaryrefslogtreecommitdiffstats
path: root/host-interface.hpp
diff options
context:
space:
mode:
authorVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2017-07-12 16:13:49 +0530
committerPatrick Williams <patrick@stwcx.xyz>2017-08-14 18:47:08 +0000
commit3eb117a322aca11f049bb05beea5eb2f6385cb8e (patch)
treef3352df962e284c1d239e38a57955c1fa8b6ddca /host-interface.hpp
parentac149a94543c9fae468cf45e47103998153c89a5 (diff)
downloadphosphor-host-ipmid-3eb117a322aca11f049bb05beea5eb2f6385cb8e.tar.gz
phosphor-host-ipmid-3eb117a322aca11f049bb05beea5eb2f6385cb8e.zip
Use Host Command Manager in host interface implementation
Change-Id: Icefce510a3a0022bf0288fa99518459b732a2e04 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'host-interface.hpp')
-rw-r--r--host-interface.hpp66
1 files changed, 25 insertions, 41 deletions
diff --git a/host-interface.hpp b/host-interface.hpp
index 8901a2b..5b2ac68 100644
--- a/host-interface.hpp
+++ b/host-interface.hpp
@@ -1,17 +1,14 @@
#pragma once
-#include <queue>
#include <sdbusplus/bus.hpp>
-#include <phosphor-logging/elog.hpp>
#include <xyz/openbmc_project/Control/Host/server.hpp>
-#include <timer.hpp>
-
+#include <host-cmd-manager.hpp>
namespace phosphor
{
namespace host
{
-
-using namespace phosphor::logging;
+namespace command
+{
/** @class Host
* @brief OpenBMC control host interface implementation.
@@ -24,56 +21,43 @@ class Host : public sdbusplus::server::object::object<
public:
/** @brief Constructs Host Control Interface
*
- * @param[in] bus - The Dbus bus object
- * @param[in] objPath - The Dbus object path
- * @param[in] events - The sd_event pointer
+ * @param[in] bus - The Dbus bus object
+ * @param[in] objPath - The Dbus object path
*/
Host(sdbusplus::bus::bus& bus,
- const char* objPath,
- sd_event* events) :
+ const char* objPath) :
sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::Control::server::Host>(
bus, objPath),
- bus(bus),
- timer(events,
- std::bind(&Host::hostTimeout, this))
- {}
+ bus(bus)
+ {
+ // Nothing to do
+ }
/** @brief Send input command to host
+ * Note that the command will be queued in a FIFO if
+ * other commands to the host have yet to be run
*
- * Note that the command will be queued in a FIFO if other commands
- * to the host have yet to be run
- *
- * @param[in] command - Input command to execute
+ * @param[in] command - Input command to execute
*/
void execute(Command command) override;
- /** @brief Return the next entry in the queue
- *
- * Also signal that the command is complete since the interface
- * contract is that we emit this signal once the message has been
- * passed to the host (which is required when calling this interface)
- *
- */
- Command getNextCommand();
-
private:
-
- /** @brief Check if anything in queue and alert host if so */
- void checkQueue();
-
- /** @brief Call back interface on message timeouts to host */
- void hostTimeout();
-
- /** @brief Persistent sdbusplus DBus bus connection. */
+ /** @brief sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;
- /** @brief Queue to store the requested commands */
- std::queue<Command> workQueue{};
-
- /** @brief Timer for commands to host */
- phosphor::ipmi::Timer timer;
+ /** @brief Callback function to be invoked by command manager
+ *
+ * @detail Conveys the status of the last Host bound command.
+ * Depending on the status, a CommandComplete or
+ * CommandFailure signal would be sent
+ *
+ * @param[in] cmd - IPMI command and data sent to Host
+ * @param[in] status - Success or Failure
+ */
+ void commandStatusHandler(IpmiCmdData cmd, bool status);
};
+} // namespace command
} // namespace host
} // namespace phosphor
OpenPOWER on IntegriCloud