summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Geissler <andrewg@us.ibm.com>2017-03-21 15:04:05 -0500
committerAndrew Geissler <andrewg@us.ibm.com>2017-05-09 12:49:07 -0500
commit1b9d4e5c676f5f2fd35583dc5e3459783a650578 (patch)
tree6864362bed697168df44f99056ff3630af946f79
parent1c1bd754ed2ea0fe0527bec39870e5fcbb859bc4 (diff)
downloadphosphor-host-ipmid-1b9d4e5c676f5f2fd35583dc5e3459783a650578.tar.gz
phosphor-host-ipmid-1b9d4e5c676f5f2fd35583dc5e3459783a650578.zip
Send the SMS attention to host when Execute called
Change-Id: Id523470fcabf59cf2bda592cf1fe687ac44c3328 Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
-rw-r--r--Makefile.am3
-rw-r--r--host-interface.cpp30
-rw-r--r--host-interface.hpp8
3 files changed, 39 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index ccdf95b..c9b28c2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,7 +51,8 @@ libhostservicedir = ${libdir}/ipmid-providers
libhostservice_LTLIBRARIES = libhostservice.la
libhostservice_la_SOURCES = \
host-services.cpp \
- host-interface.cpp
+ host-interface.cpp \
+ utils.cpp
libhostservice_la_LDFLAGS = $(SYSTEMD_LIBS) \
$(libmapper_LIBS) \
$(PHOSPHOR_DBUS_INTERFACES_LIBS) \
diff --git a/host-interface.cpp b/host-interface.cpp
index 05539b9..f485516 100644
--- a/host-interface.cpp
+++ b/host-interface.cpp
@@ -1,5 +1,6 @@
#include <queue>
#include <phosphor-logging/log.hpp>
+#include <utils.hpp>
#include "host-interface.hpp"
namespace phosphor
@@ -7,6 +8,10 @@ namespace phosphor
namespace host
{
+constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
+constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper";
+constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper";
+
using namespace phosphor::logging;
// When you see base:: you know we're referencing our base class
@@ -20,6 +25,31 @@ void Host::execute(base::Host::Command command)
entry("CONTROL_HOST_CMD=%s",
convertForMessage(command)));
workQueue.push(command);
+
+ // If this was the only entry then send the SMS attention
+ if(workQueue.size() == 1)
+ {
+ log<level::INFO>("Asserting SMS Attention");
+
+ std::string IPMI_PATH("/org/openbmc/HostIpmi/1");
+ std::string IPMI_INTERFACE("org.openbmc.HostIpmi");
+
+ auto host = ipmi::getService(this->bus,IPMI_INTERFACE,IPMI_PATH);
+
+ auto method = this->bus.new_method_call(host.c_str(),
+ IPMI_PATH.c_str(),
+ IPMI_INTERFACE.c_str(),
+ "setAttention");
+ auto reply = this->bus.call(method);
+
+ if (reply.is_method_error())
+ {
+ log<level::ERR>("Error in setting SMS attention");
+ throw std::runtime_error("ERROR in call to setAttention");
+ }
+ log<level::INFO>("SMS Attention asserted");
+ }
+
return;
}
diff --git a/host-interface.hpp b/host-interface.hpp
index 56d19d1..a3b7efa 100644
--- a/host-interface.hpp
+++ b/host-interface.hpp
@@ -26,7 +26,8 @@ class Host : public sdbusplus::server::object::object<
const char* objPath) :
sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::Control::server::Host>(
- bus, objPath)
+ bus, objPath),
+ bus(bus)
{}
/** @brief Send input command to host
@@ -37,6 +38,11 @@ class Host : public sdbusplus::server::object::object<
* @param[in] command - Input command to execute
*/
void execute(Command command) override;
+
+ private:
+
+ /** @brief Persistent sdbusplus DBus bus connection. */
+ sdbusplus::bus::bus& bus;
};
} // namespace host
OpenPOWER on IntegriCloud