summaryrefslogtreecommitdiffstats
path: root/systemintfcmds.cpp
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2018-10-08 12:05:16 -0700
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-02-25 14:27:21 -0800
commit240b186cf7fa639de698104d6853b73c81f4ec39 (patch)
tree2f3be6be10ad15db01084c9d19a65251c497b57b /systemintfcmds.cpp
parentebe8e90639e3ce11193c9c823662b1ad8280b6f2 (diff)
downloadphosphor-host-ipmid-240b186cf7fa639de698104d6853b73c81f4ec39.tar.gz
phosphor-host-ipmid-240b186cf7fa639de698104d6853b73c81f4ec39.zip
ipmid: Rewrite ipmid to use the new architecture
New architecture highlights: * The new registration detects handler type for argument unpacking. * Upon completion the response is automatically packed. * Handlers can make use of the new async/yield sdbusplus mechanism. * The queue exports a new dbus interface for method-based IPMI calls. * The legacy handler registration is still supported for now. * The legacy dbus interface is still supported for now. Change-Id: Iae8342d9771ccebd3a0834e35597c14be4cc39cf Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'systemintfcmds.cpp')
-rw-r--r--systemintfcmds.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/systemintfcmds.cpp b/systemintfcmds.cpp
index d044030..564cc38 100644
--- a/systemintfcmds.cpp
+++ b/systemintfcmds.cpp
@@ -5,10 +5,10 @@
#include "host-cmd-manager.hpp"
#include "host-interface.hpp"
-#include <ipmid/api.h>
-
#include <cstring>
#include <ipmid-host/cmd.hpp>
+#include <ipmid/api.hpp>
+#include <ipmid/registration.hpp>
void register_netfn_app_functions() __attribute__((constructor));
@@ -109,6 +109,8 @@ std::unique_ptr<phosphor::host::command::Host> host
__attribute__((init_priority(101)));
std::unique_ptr<sdbusplus::server::manager::manager> objManager
__attribute__((init_priority(101)));
+std::unique_ptr<sdbusplus::asio::connection> sdbusp
+ __attribute__((init_priority(101)));
} // namespace
#include <unistd.h>
@@ -130,14 +132,23 @@ void register_netfn_app_functions()
// Create new xyz.openbmc_project.host object on the bus
auto objPath = std::string{CONTROL_HOST_OBJ_MGR} + '/' + HOST_NAME + '0';
+ // Create a new sdbus connection so it can have a well-known name
+ sd_bus* bus = nullptr;
+ sd_bus_open_system(&bus);
+ if (!bus)
+ {
+ return;
+ }
+ auto io = getIoService();
+ sdbusp = std::make_unique<sdbusplus::asio::connection>(*io, bus);
+
// Add sdbusplus ObjectManager.
- auto& sdbusPlusHandler = ipmid_get_sdbus_plus_handler();
objManager = std::make_unique<sdbusplus::server::manager::manager>(
- *sdbusPlusHandler, CONTROL_HOST_OBJ_MGR);
+ *sdbusp, CONTROL_HOST_OBJ_MGR);
- host = std::make_unique<phosphor::host::command::Host>(*sdbusPlusHandler,
+ host = std::make_unique<phosphor::host::command::Host>(*sdbusp,
objPath.c_str());
- sdbusPlusHandler->request_name(CONTROL_HOST_BUSNAME);
+ sdbusp->request_name(CONTROL_HOST_BUSNAME);
return;
}
OpenPOWER on IntegriCloud