summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>2019-04-03 15:46:03 +0530
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-04-05 16:55:00 +0000
commit30b011246bf85759cd9d2676ba3ec77a41ab026f (patch)
tree2b4e40b20efbc9e73d686943cdcdde5c6b6f0602
parentded4c74ea034e3ca9a1de2e8b6a88b1b01f2f917 (diff)
downloadphosphor-host-ipmid-30b011246bf85759cd9d2676ba3ec77a41ab026f.zip
phosphor-host-ipmid-30b011246bf85759cd9d2676ba3ec77a41ab026f.tar.gz
Add convert current channel number function
Support for convert current channel number based on ipmi::Context is added. Tested: Verified by updating the channel number manually and function returns correctly. For correct value another gerrit patch is needed which will advertise proper channel from which the command originated. Change-Id: Id17d87b6a945b0264c8f14348a50bc2c087d187e Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
-rw-r--r--user_channel/channel_layer.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp
index 5c82fba..b86d6bf 100644
--- a/user_channel/channel_layer.hpp
+++ b/user_channel/channel_layer.hpp
@@ -16,6 +16,8 @@
#pragma once
#include <ipmid/api.h>
+#include <ipmid/api.hpp>
+#include <ipmid/message.hpp>
#include <string>
namespace ipmi
@@ -261,6 +263,24 @@ ipmi_ret_t getChannelAccessData(const uint8_t chNum,
/** @brief provides function to convert current channel number (0xE)
*
* @param[in] chNum - channel number as requested in commands.
+ * @param[in] ipmi::context - ipmi context ptr, which has more details
+ *
+ * @return same channel number or proper channel number for current channel
+ * number (0xE).
+ */
+inline uint8_t convertCurrentChannelNum(const uint8_t chNum,
+ ipmi::Context::ptr ctx)
+{
+ if (chNum == currentChNum)
+ {
+ return ctx->channel;
+ }
+ return chNum;
+}
+
+/** @brief provides function to convert current channel number (0xE)
+ *
+ * @param[in] chNum - channel number as requested in commands.
*
* @return same channel number or proper channel number for current channel
* number (0xE).
OpenPOWER on IntegriCloud