From 240b186cf7fa639de698104d6853b73c81f4ec39 Mon Sep 17 00:00:00 2001 From: Vernon Mauery Date: Mon, 8 Oct 2018 12:05:16 -0700 Subject: 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 --- systemintfcmds.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'systemintfcmds.cpp') 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 - #include #include +#include +#include void register_netfn_app_functions() __attribute__((constructor)); @@ -109,6 +109,8 @@ std::unique_ptr host __attribute__((init_priority(101))); std::unique_ptr objManager __attribute__((init_priority(101))); +std::unique_ptr sdbusp + __attribute__((init_priority(101))); } // namespace #include @@ -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(*io, bus); + // Add sdbusplus ObjectManager. - auto& sdbusPlusHandler = ipmid_get_sdbus_plus_handler(); objManager = std::make_unique( - *sdbusPlusHandler, CONTROL_HOST_OBJ_MGR); + *sdbusp, CONTROL_HOST_OBJ_MGR); - host = std::make_unique(*sdbusPlusHandler, + host = std::make_unique(*sdbusp, objPath.c_str()); - sdbusPlusHandler->request_name(CONTROL_HOST_BUSNAME); + sdbusp->request_name(CONTROL_HOST_BUSNAME); return; } -- cgit v1.2.1