blob: 22fe893af56070c66f8713b2ee610fe26cccdb89 [file] [log] [blame]
Dung Caofaf6a6a2020-12-28 04:44:45 +00001/*
2 * Copyright (c) 2021 Ampere Computing LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * This is a daemon that forwards requests and receive responses from SSIF over
17 * the D-Bus IPMI Interface.
18 */
19
20#include <getopt.h>
21#include <linux/ipmi_bmc.h>
22
23#include <CLI/CLI.hpp>
24#include <boost/algorithm/string/replace.hpp>
Ed Tanousd289aea2024-02-06 20:33:26 -080025#include <boost/asio/completion_condition.hpp>
26#include <boost/asio/io_context.hpp>
27#include <boost/asio/read.hpp>
28#include <boost/asio/steady_timer.hpp>
29#include <boost/asio/write.hpp>
Dung Caofaf6a6a2020-12-28 04:44:45 +000030#include <phosphor-logging/log.hpp>
31#include <sdbusplus/asio/connection.hpp>
32#include <sdbusplus/asio/object_server.hpp>
Patrick Williams8b050c92023-10-20 11:19:32 -050033#include <sdbusplus/timer.hpp>
Dung Caofaf6a6a2020-12-28 04:44:45 +000034
35#include <iostream>
36
Dung Cao51835392022-10-27 04:29:54 +000037/* Max length of ipmi ssif message included netfn and cmd field */
Ed Tanous7fa7e6c2024-02-14 14:33:32 -080038constexpr const size_t ipmiSsifPayloadMax = 254;
Dung Cao51835392022-10-27 04:29:54 +000039
Ed Tanous498b87f2024-02-14 09:07:34 -080040using phosphor::logging::level;
41using phosphor::logging::log;
Dung Caofaf6a6a2020-12-28 04:44:45 +000042
Ed Tanousa1585be2024-02-14 10:57:31 -080043struct IpmiCmd
Patrick Williams8b050c92023-10-20 11:19:32 -050044{
45 uint8_t netfn;
46 uint8_t lun;
47 uint8_t cmd;
Ed Tanous7fa7e6c2024-02-14 14:33:32 -080048};
quang.ampere14480ee2022-10-18 09:04:51 +070049
Ed Tanous7fa7e6c2024-02-14 14:33:32 -080050static constexpr std::string_view devBase = "/dev/ipmi-ssif-host";
Dung Caofaf6a6a2020-12-28 04:44:45 +000051/* SSIF use IPMI SSIF channel */
Ed Tanousa1585be2024-02-14 10:57:31 -080052
Quang Nguyenf2994dc2022-11-25 16:31:49 +070053/* The timer of driver is set to 15 seconds, need to send
54 * response before timeout occurs
55 */
56static constexpr const unsigned int hostReqTimeout = 14000000;
Dung Caofaf6a6a2020-12-28 04:44:45 +000057
Patrick Williams8b050c92023-10-20 11:19:32 -050058class SsifChannel
59{
60 public:
Ed Tanous7fa7e6c2024-02-14 14:33:32 -080061 static constexpr size_t ssifMessageSize = ipmiSsifPayloadMax +
Patrick Williams8b050c92023-10-20 11:19:32 -050062 sizeof(unsigned int);
63 size_t sizeofLenField = sizeof(unsigned int);
64 static constexpr uint8_t netFnShift = 2;
65 static constexpr uint8_t lunMask = (1 << netFnShift) - 1;
Dung Caofaf6a6a2020-12-28 04:44:45 +000066
Patrick Williams8b050c92023-10-20 11:19:32 -050067 SsifChannel(std::shared_ptr<boost::asio::io_context>& io,
68 std::shared_ptr<sdbusplus::asio::connection>& bus,
Ed Tanousa1585be2024-02-14 10:57:31 -080069 const std::string& device, bool verbose, int numberOfReqNotRsp);
Patrick Williams8b050c92023-10-20 11:19:32 -050070 bool initOK() const
71 {
Ed Tanousfcd0ea42024-02-14 09:15:41 -080072 return dev.is_open();
Patrick Williams8b050c92023-10-20 11:19:32 -050073 }
74 void channelAbort(const char* msg, const boost::system::error_code& ec);
Ed Tanousa1585be2024-02-14 10:57:31 -080075 void asyncRead();
Ed Tanousb6ad9dc2024-02-14 09:28:20 -080076 using IpmiDbusRspType =
77 std::tuple<uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>;
78
79 void afterMethodCall(const boost::system::error_code& ec,
80 const IpmiDbusRspType& response);
Patrick Williams8b050c92023-10-20 11:19:32 -050081 void processMessage(const boost::system::error_code& ecRd, size_t rlen);
Ed Tanousa1585be2024-02-14 10:57:31 -080082 int showNumOfReqNotRsp() const;
Ed Tanousfcd0ea42024-02-14 09:15:41 -080083 boost::asio::posix::stream_descriptor dev;
Ed Tanous7fa7e6c2024-02-14 14:33:32 -080084 IpmiCmd prevReqCmd{};
Dung Caofaf6a6a2020-12-28 04:44:45 +000085
Patrick Williams8b050c92023-10-20 11:19:32 -050086 protected:
Ed Tanousa1585be2024-02-14 10:57:31 -080087 std::array<uint8_t, ssifMessageSize> xferBuffer{};
Patrick Williams8b050c92023-10-20 11:19:32 -050088 std::shared_ptr<boost::asio::io_context> io;
89 std::shared_ptr<sdbusplus::asio::connection> bus;
90 std::shared_ptr<sdbusplus::asio::object_server> server;
91 bool verbose;
92 /* This variable is always 0 when a request is responsed properly,
93 * any value larger than 0 meaning there is/are request(s) which
94 * not processed properly
95 * */
96 int numberOfReqNotRsp;
Ed Tanous4ae3b9e2024-02-14 08:54:03 -080097
98 boost::asio::steady_timer rspTimer;
Dung Caofaf6a6a2020-12-28 04:44:45 +000099};
100
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800101// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
Quang Nguyenf2994dc2022-11-25 16:31:49 +0700102std::unique_ptr<SsifChannel> ssifchannel = nullptr;
103
Patrick Williams8b050c92023-10-20 11:19:32 -0500104SsifChannel::SsifChannel(std::shared_ptr<boost::asio::io_context>& io,
105 std::shared_ptr<sdbusplus::asio::connection>& bus,
106 const std::string& device, bool verbose,
107 int numberOfReqNotRsp) :
Ed Tanousfcd0ea42024-02-14 09:15:41 -0800108 dev(*io),
109 io(io), bus(bus), verbose(verbose), numberOfReqNotRsp(numberOfReqNotRsp),
Ed Tanous4ae3b9e2024-02-14 08:54:03 -0800110 rspTimer(*io)
Dung Caofaf6a6a2020-12-28 04:44:45 +0000111{
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800112 std::string devName(devBase);
Patrick Williams8b050c92023-10-20 11:19:32 -0500113 if (!device.empty())
114 {
115 devName = device;
116 }
Dung Caofaf6a6a2020-12-28 04:44:45 +0000117
Patrick Williams8b050c92023-10-20 11:19:32 -0500118 // open device
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800119 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
Patrick Williams8b050c92023-10-20 11:19:32 -0500120 int fd = open(devName.c_str(), O_RDWR | O_NONBLOCK);
121 if (fd < 0)
122 {
123 std::string msgToLog = "Couldn't open SSIF driver with flags O_RDWR."
124 " FILENAME=" +
125 devName + " ERROR=" + strerror(errno);
126 log<level::ERR>(msgToLog.c_str());
127 return;
128 }
Dung Caofaf6a6a2020-12-28 04:44:45 +0000129
Ed Tanousa1585be2024-02-14 10:57:31 -0800130 dev.assign(fd);
131
132 asyncRead();
Patrick Williams8b050c92023-10-20 11:19:32 -0500133 // register interfaces...
134 server = std::make_shared<sdbusplus::asio::object_server>(bus);
135 std::shared_ptr<sdbusplus::asio::dbus_interface> iface =
Ed Tanousa1585be2024-02-14 10:57:31 -0800136 server->add_interface("/xyz/openbmc_project/Ipmi/Channel/ipmi_ssif",
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800137 "xyz.openbmc_project.Ipmi.Channel.ipmi_ssif");
Patrick Williams8b050c92023-10-20 11:19:32 -0500138 iface->initialize();
Dung Caofaf6a6a2020-12-28 04:44:45 +0000139}
140
Patrick Williams8b050c92023-10-20 11:19:32 -0500141void SsifChannel::channelAbort(const char* msg,
142 const boost::system::error_code& ec)
Dung Caofaf6a6a2020-12-28 04:44:45 +0000143{
Patrick Williams8b050c92023-10-20 11:19:32 -0500144 std::string msgToLog = std::string(msg) + " ERROR=" + ec.message();
145 log<level::ERR>(msgToLog.c_str());
146 // bail; maybe a restart from systemd can clear the error
147 io->stop();
Dung Caofaf6a6a2020-12-28 04:44:45 +0000148}
149
Ed Tanousa1585be2024-02-14 10:57:31 -0800150void SsifChannel::asyncRead()
Dung Caofaf6a6a2020-12-28 04:44:45 +0000151{
Ed Tanousfcd0ea42024-02-14 09:15:41 -0800152 boost::asio::async_read(dev,
Patrick Williams8b050c92023-10-20 11:19:32 -0500153 boost::asio::buffer(xferBuffer, xferBuffer.size()),
154 boost::asio::transfer_at_least(2),
155 [this](const boost::system::error_code& ec,
156 size_t rlen) { processMessage(ec, rlen); });
Dung Caofaf6a6a2020-12-28 04:44:45 +0000157}
158
Ed Tanousa1585be2024-02-14 10:57:31 -0800159int SsifChannel::showNumOfReqNotRsp() const
Quang Nguyenf2994dc2022-11-25 16:31:49 +0700160{
Patrick Williams8b050c92023-10-20 11:19:32 -0500161 return numberOfReqNotRsp;
Quang Nguyenf2994dc2022-11-25 16:31:49 +0700162}
163
Ed Tanousd289aea2024-02-06 20:33:26 -0800164void rspTimerHandler(const boost::system::error_code& ec)
Quang Nguyenf2994dc2022-11-25 16:31:49 +0700165{
Ed Tanousd289aea2024-02-06 20:33:26 -0800166 if (ec == boost::asio::error::operation_aborted)
167 {
168 return;
169 }
Patrick Williams8b050c92023-10-20 11:19:32 -0500170 std::vector<uint8_t> rsp;
171 constexpr uint8_t ccResponseNotAvailable = 0xce;
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800172 IpmiCmd& prevReqCmd = ssifchannel->prevReqCmd;
Ed Tanousa1585be2024-02-14 10:57:31 -0800173 rsp.resize(ssifchannel->sizeofLenField + sizeof(prevReqCmd.cmd) +
174 sizeof(prevReqCmd.netfn) + sizeof(ccResponseNotAvailable));
Patrick Williams8b050c92023-10-20 11:19:32 -0500175 std::string msgToLog = "timeout, send response to keep host alive"
176 " netfn=" +
Ed Tanousa1585be2024-02-14 10:57:31 -0800177 std::to_string(prevReqCmd.netfn) +
178 " lun=" + std::to_string(prevReqCmd.lun) +
179 " cmd=" + std::to_string(prevReqCmd.cmd) +
Patrick Williams8b050c92023-10-20 11:19:32 -0500180 " cc=" + std::to_string(ccResponseNotAvailable) +
181 " numberOfReqNotRsp=" +
182 std::to_string(ssifchannel->showNumOfReqNotRsp());
183 log<level::INFO>(msgToLog.c_str());
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800184 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
185 unsigned int* t = reinterpret_cast<unsigned int*>(rsp.data());
Patrick Williams8b050c92023-10-20 11:19:32 -0500186 *t = 3;
Ed Tanousa1585be2024-02-14 10:57:31 -0800187 rsp[ssifchannel->sizeofLenField] = ((prevReqCmd.netfn + 1)
188 << ssifchannel->netFnShift) |
189 (prevReqCmd.lun & ssifchannel->lunMask);
190 rsp[ssifchannel->sizeofLenField + 1] = prevReqCmd.cmd;
Patrick Williams8b050c92023-10-20 11:19:32 -0500191 rsp[ssifchannel->sizeofLenField + 2] = ccResponseNotAvailable;
Quang Nguyenf2994dc2022-11-25 16:31:49 +0700192
Patrick Williams8b050c92023-10-20 11:19:32 -0500193 boost::system::error_code ecWr;
Quang Nguyenf2994dc2022-11-25 16:31:49 +0700194
Ed Tanousfcd0ea42024-02-14 09:15:41 -0800195 size_t wlen = boost::asio::write(ssifchannel->dev, boost::asio::buffer(rsp),
196 ecWr);
Patrick Williams8b050c92023-10-20 11:19:32 -0500197 if (ecWr || wlen != rsp.size())
198 {
199 msgToLog =
200 "Failed to send ssif respond message:"
201 " size=" +
202 std::to_string(wlen) + " expect=" + std::to_string(rsp.size()) +
203 " error=" + ecWr.message() +
Ed Tanousa1585be2024-02-14 10:57:31 -0800204 " netfn=" + std::to_string(prevReqCmd.netfn + 1) +
205 " lun=" + std::to_string(prevReqCmd.lun) +
Patrick Williams8b050c92023-10-20 11:19:32 -0500206 " cmd=" + std::to_string(rsp[ssifchannel->sizeofLenField + 1]) +
207 " cc=" + std::to_string(ccResponseNotAvailable);
208 log<level::ERR>(msgToLog.c_str());
209 }
Quang Nguyenf2994dc2022-11-25 16:31:49 +0700210}
211
Ed Tanousb6ad9dc2024-02-14 09:28:20 -0800212void SsifChannel::afterMethodCall(const boost::system::error_code& ec,
213 const IpmiDbusRspType& response)
214{
215 std::vector<uint8_t> rsp;
216 const auto& [netfn, lun, cmd, cc, payload] = response;
217 numberOfReqNotRsp--;
218 if (ec)
219 {
220 std::string msgToLog =
221 "ssif<->ipmid bus error:"
222 " netfn=" +
223 std::to_string(netfn) + " lun=" + std::to_string(lun) +
224 " cmd=" + std::to_string(cmd) + " error=" + ec.message();
225 log<level::ERR>(msgToLog.c_str());
226 rsp.resize(sizeofLenField + sizeof(netfn) + sizeof(cmd) + sizeof(cc));
227 /* if dbusTimeout, just return and do not send any response
228 * to let host continue with other commands, response here
229 * is potentially make the response duplicated
230 * */
231 return;
232 }
Ed Tanousb6ad9dc2024-02-14 09:28:20 -0800233
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800234 if ((prevReqCmd.netfn != (netfn - 1) || prevReqCmd.lun != lun ||
235 prevReqCmd.cmd != cmd) ||
236 ((prevReqCmd.netfn == (netfn - 1) && prevReqCmd.lun == lun &&
237 prevReqCmd.cmd == cmd) &&
238 numberOfReqNotRsp != 0))
239 {
240 /* Only send response to the last request command to void
241 * duplicated response which makes host driver confused and
242 * failed to create interface
243 *
244 * Drop responses which are (1) different from the request
245 * (2) parameters are the same as request but handshake flow
246 * are in dupplicate request state
247 * */
248 if (verbose)
Ed Tanousb6ad9dc2024-02-14 09:28:20 -0800249 {
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800250 std::string msgToLog =
251 "Drop ssif respond message with"
252 " len=" +
253 std::to_string(payload.size() + 3) +
254 " netfn=" + std::to_string(netfn) +
255 " lun=" + std::to_string(lun) + " cmd=" + std::to_string(cmd) +
256 " cc=" + std::to_string(cc) +
257 " numberOfReqNotRsp=" + std::to_string(numberOfReqNotRsp);
258 log<level::INFO>(msgToLog.c_str());
Ed Tanousb6ad9dc2024-02-14 09:28:20 -0800259 }
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800260 return;
261 }
262 rsp.resize(sizeofLenField + sizeof(netfn) + sizeof(cmd) + sizeof(cc) +
263 payload.size());
264
265 // write the response
266 auto rspIter = rsp.begin();
267 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
268 unsigned int* p = reinterpret_cast<unsigned int*>(&rspIter[0]);
269 *p = payload.size() + 3;
270 rspIter[sizeofLenField] = (netfn << netFnShift) | (lun & lunMask);
271 rspIter[sizeofLenField + 1] = cmd;
272 rspIter[sizeofLenField + 2] = cc;
273 if (static_cast<unsigned int>(!payload.empty()) != 0U)
274 {
275 std::copy(payload.cbegin(), payload.cend(),
276 rspIter + sizeofLenField + 3);
Ed Tanousb6ad9dc2024-02-14 09:28:20 -0800277 }
278 if (verbose)
279 {
280 std::string msgToLog =
281 "Send ssif respond message with"
282 " len=" +
283 std::to_string(payload.size() + 3) +
284 " netfn=" + std::to_string(netfn) + " lun=" + std::to_string(lun) +
285 " cmd=" + std::to_string(cmd) + " cc=" + std::to_string(cc) +
286 " numberOfReqNotRsp=" + std::to_string(numberOfReqNotRsp);
287 log<level::INFO>(msgToLog.c_str());
288 }
289 boost::system::error_code ecWr;
290 size_t wlen = boost::asio::write(dev, boost::asio::buffer(rsp), ecWr);
291 if (ecWr || wlen != rsp.size())
292 {
293 std::string msgToLog =
294 "Failed to send ssif respond message:"
295 " size=" +
296 std::to_string(wlen) + " expect=" + std::to_string(rsp.size()) +
297 " error=" + ecWr.message() + " netfn=" + std::to_string(netfn) +
298 " lun=" + std::to_string(lun) + " cmd=" + std::to_string(cmd) +
299 " cc=" + std::to_string(cc);
300 log<level::ERR>(msgToLog.c_str());
301 }
302 rspTimer.cancel();
303}
304
Patrick Williams8b050c92023-10-20 11:19:32 -0500305void SsifChannel::processMessage(const boost::system::error_code& ecRd,
306 size_t rlen)
Dung Caofaf6a6a2020-12-28 04:44:45 +0000307{
Patrick Williams8b050c92023-10-20 11:19:32 -0500308 if (ecRd || rlen < 2)
309 {
310 channelAbort("Failed to read req msg", ecRd);
311 return;
312 }
Ed Tanousa1585be2024-02-14 10:57:31 -0800313 asyncRead();
Dung Caofaf6a6a2020-12-28 04:44:45 +0000314
Ed Tanousa1585be2024-02-14 10:57:31 -0800315 const auto* rawIter = xferBuffer.cbegin();
316 const auto* rawEnd = rawIter + rlen;
Patrick Williams8b050c92023-10-20 11:19:32 -0500317 uint8_t netfn = rawIter[sizeofLenField] >> netFnShift;
318 uint8_t lun = rawIter[sizeofLenField] & lunMask;
319 uint8_t cmd = rawIter[sizeofLenField + 1];
quang.ampere14480ee2022-10-18 09:04:51 +0700320
Patrick Williams8b050c92023-10-20 11:19:32 -0500321 /* keep track of previous request */
Ed Tanousa1585be2024-02-14 10:57:31 -0800322 prevReqCmd.netfn = netfn;
323 prevReqCmd.lun = lun;
324 prevReqCmd.cmd = cmd;
quang.ampere14480ee2022-10-18 09:04:51 +0700325
Patrick Williams8b050c92023-10-20 11:19:32 -0500326 /* there is a request coming */
327 numberOfReqNotRsp++;
328 /* start response timer */
Ed Tanous4ae3b9e2024-02-14 08:54:03 -0800329 rspTimer.expires_after(std::chrono::microseconds(hostReqTimeout));
330 rspTimer.async_wait(rspTimerHandler);
quang.name507782a2022-11-20 17:05:20 +0700331
Patrick Williams8b050c92023-10-20 11:19:32 -0500332 if (verbose)
333 {
Ed Tanousa1585be2024-02-14 10:57:31 -0800334 unsigned int lenRecv = 0;
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800335 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
336 const unsigned int* p = reinterpret_cast<const unsigned int*>(rawIter);
Patrick Williams8b050c92023-10-20 11:19:32 -0500337 lenRecv = p[0];
338 std::string msgToLog =
339 "Read ssif request message with"
340 " len=" +
341 std::to_string(lenRecv) + " netfn=" + std::to_string(netfn) +
342 " lun=" + std::to_string(lun) + " cmd=" + std::to_string(cmd) +
343 " numberOfReqNotRsp=" + std::to_string(numberOfReqNotRsp);
344 log<level::INFO>(msgToLog.c_str());
345 }
346 // copy out payload
347 std::vector<uint8_t> data(rawIter + sizeofLenField + 2, rawEnd);
348 // non-session bridges still need to pass an empty options map
349 std::map<std::string, std::variant<int>> options;
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800350 static constexpr const char* ipmiQueueService =
Patrick Williams8b050c92023-10-20 11:19:32 -0500351 "xyz.openbmc_project.Ipmi.Host";
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800352 static constexpr const char* ipmiQueuePath = "/xyz/openbmc_project/Ipmi";
353 static constexpr const char* ipmiQueueIntf =
Patrick Williams8b050c92023-10-20 11:19:32 -0500354 "xyz.openbmc_project.Ipmi.Server";
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800355 static constexpr const char* ipmiQueueMethod = "execute";
Patrick Williams8b050c92023-10-20 11:19:32 -0500356 /* now, we do not care dbus timeout, since we already have actions
357 * before dbus timeout occurs
358 */
359 static constexpr unsigned int dbusTimeout = 60000000;
360 bus->async_method_call_timed(
Ed Tanousb6ad9dc2024-02-14 09:28:20 -0800361 [this](const boost::system::error_code& ec,
362 const IpmiDbusRspType& response) {
363 afterMethodCall(ec, response);
Patrick Williams8b050c92023-10-20 11:19:32 -0500364 },
365 ipmiQueueService, ipmiQueuePath, ipmiQueueIntf, ipmiQueueMethod,
366 dbusTimeout, netfn, lun, cmd, data, options);
Dung Caofaf6a6a2020-12-28 04:44:45 +0000367}
368
Patrick Williams8b050c92023-10-20 11:19:32 -0500369int main(int argc, char* argv[])
Dung Caofaf6a6a2020-12-28 04:44:45 +0000370{
Patrick Williams8b050c92023-10-20 11:19:32 -0500371 CLI::App app("SSIF IPMI bridge");
372 std::string device;
373 app.add_option("-d,--device", device,
374 "use <DEVICE> file. Default is /dev/ipmi-ssif-host");
375 bool verbose = false;
376 int numberOfReqNotRsp = 0;
377 app.add_option("-v,--verbose", verbose, "print more verbose output");
378 CLI11_PARSE(app, argc, argv);
Dung Caofaf6a6a2020-12-28 04:44:45 +0000379
Patrick Williams8b050c92023-10-20 11:19:32 -0500380 auto io = std::make_shared<boost::asio::io_context>();
Dung Caofaf6a6a2020-12-28 04:44:45 +0000381
Ed Tanousd289aea2024-02-06 20:33:26 -0800382 auto bus = std::make_shared<sdbusplus::asio::connection>(*io);
Ed Tanous7fa7e6c2024-02-14 14:33:32 -0800383 bus->request_name("xyz.openbmc_project.Ipmi.Channel.ipmi_ssif");
Patrick Williams8b050c92023-10-20 11:19:32 -0500384 // Create the SSIF channel, listening on D-Bus and on the SSIF device
385 ssifchannel = make_unique<SsifChannel>(io, bus, device, verbose,
386 numberOfReqNotRsp);
387 if (!ssifchannel->initOK())
388 {
389 return EXIT_FAILURE;
390 }
Patrick Williams8b050c92023-10-20 11:19:32 -0500391 io->run();
Thang Q. Nguyen4300d212023-05-15 12:22:53 +0700392
Patrick Williams8b050c92023-10-20 11:19:32 -0500393 return 0;
Dung Caofaf6a6a2020-12-28 04:44:45 +0000394}