Rewrite handleIpmbChannel api
Rewriting new_method_call to yield_method_calll for handleIpmbChannel
Tested:
Verified using below send message commands
1. Send message command
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 06 2C 00 00 FC FC 04 00 2C FC 04
C1 13
Response: 00 //Success
2. Get message command
Commad: FS0:\cmdtool\> cmdtool.efi 20 18 33
Response: 00 FC FC 04 00 2C FC 04 C1 13
Signed-off-by: srikanta mondal <srikantax.mondal@intel.com>
Change-Id: I9b461ddbc3a93b67e26ec92ff7c41fdc97e49931
diff --git a/include/bridgingcommands.hpp b/include/bridgingcommands.hpp
index 6dbac02..e8be693 100644
--- a/include/bridgingcommands.hpp
+++ b/include/bridgingcommands.hpp
@@ -197,7 +197,7 @@
void clearResponseQueue();
- ipmi::Cc handleIpmbChannel(const uint8_t tracking,
+ ipmi::Cc handleIpmbChannel(ipmi::Context::ptr ctx, const uint8_t tracking,
const std::vector<uint8_t> &msgData,
std::vector<uint8_t> &rspData);
diff --git a/src/bridgingcommands.cpp b/src/bridgingcommands.cpp
index 0922438..4041474 100644
--- a/src/bridgingcommands.cpp
+++ b/src/bridgingcommands.cpp
@@ -238,7 +238,8 @@
}
}
-ipmi::Cc Bridging::handleIpmbChannel(const uint8_t tracking,
+ipmi::Cc Bridging::handleIpmbChannel(ipmi::Context::ptr ctx,
+ const uint8_t tracking,
const std::vector<uint8_t> &msgData,
std::vector<uint8_t> &rspData)
{
@@ -292,20 +293,17 @@
auto ipmbRequest = IpmbRequest(sendMsgReqData, msgLen);
- std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
- ipmbResponse;
+ typedef std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t,
+ std::vector<uint8_t>>
+ IPMBResponse;
// send request to IPMB
- try
- {
- std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- auto mesg =
- dbus->new_method_call(ipmbBus, ipmbObj, ipmbIntf, "sendRequest");
- ipmbRequest.prepareRequest(mesg);
- auto ret = dbus->call(mesg);
- ret.read(ipmbResponse);
- }
- catch (sdbusplus::exception::SdBusError &e)
+ boost::system::error_code ec;
+ auto ipmbResponse = ctx->bus->yield_method_call<IPMBResponse>(
+ ctx->yield, ec, ipmbBus, ipmbObj, ipmbIntf, "sendRequest",
+ ipmbMeChannelNum, ipmbRequest.netFn, ipmbRequest.rqLun, ipmbRequest.cmd,
+ ipmbRequest.data);
+ if (ec)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"handleIpmbChannel, dbus call exception");
@@ -388,7 +386,7 @@
**/
ipmi::RspType<std::vector<uint8_t> // responseData
>
- ipmiAppSendMessage(const uint4_t channelNumber,
+ ipmiAppSendMessage(ipmi::Context::ptr ctx, const uint4_t channelNumber,
const bool authenticationEnabled,
const bool encryptionEnabled, const uint2_t tracking,
ipmi::message::Payload &msg)
@@ -428,7 +426,7 @@
}
returnVal = bridging.handleIpmbChannel(
- static_cast<const uint8_t>(tracking), unpackMsg, rspData);
+ ctx, static_cast<const uint8_t>(tracking), unpackMsg, rspData);
break;
// fall through to default
case targetChannelIcmb10: