summaryrefslogtreecommitdiffstats
path: root/src/usr/ipmi/ipmibt.C
diff options
context:
space:
mode:
authorAndrew Jeffery <andrewrj@au1.ibm.com>2018-09-17 17:23:07 +0930
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-10-02 14:42:41 -0500
commit102225f4e3e23c51665bb45c79eb0a578666fffc (patch)
tree56ca62db1712b8967663307246dc4e24f078edfe /src/usr/ipmi/ipmibt.C
parent797f6fc918229a8a12fe3d45605fa8e7050e636f (diff)
downloadtalos-hostboot-102225f4e3e23c51665bb45c79eb0a578666fffc.tar.gz
talos-hostboot-102225f4e3e23c51665bb45c79eb0a578666fffc.zip
ipmi: Break circular dependency between ipmimsg and ipmibt
Implement the message factory in the back-end implementation for which it is producing messages. The linker will resolve the right implementation based on the build configuration. Change-Id: I407f51e239b3dd3795502942cc24d80fbf0ffac6 Signed-off-by: Andrew Jeffery <andrewrj@au1.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65934 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/ipmi/ipmibt.C')
-rw-r--r--src/usr/ipmi/ipmibt.C40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/usr/ipmi/ipmibt.C b/src/usr/ipmi/ipmibt.C
index 2c6f3cbdd..818813d79 100644
--- a/src/usr/ipmi/ipmibt.C
+++ b/src/usr/ipmi/ipmibt.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2015 */
+/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -358,4 +358,42 @@ namespace IPMI
delete this;
}
+ ///
+ /// @brief static factory
+ ///
+ /// Implement the factory member in terms of the BT interface. This is done
+ /// in each of the back-end implementations, only one of which should be
+ /// configured in at build time.
+ ///
+ /// @param[in] i_cmd, the network function & command
+ /// @param[in] i_len, the length of the data
+ /// @param[in] i_data, the data (allocated space)
+ /// @param[in] i_type, synchronous or async
+ ///
+ /// @return a pointer to a new'd Message object
+ ///
+ Message* Message::factory(const command_t& i_cmd, const uint8_t i_len,
+ uint8_t* i_data, const message_type i_type)
+ {
+ Message* new_message = NULL;
+
+ switch(i_type)
+ {
+ case TYPE_SYNC:
+ new_message = new BTSyncMessage(i_cmd, i_len, i_data);
+ break;
+ case TYPE_ASYNC:
+ new_message = new BTAsyncMessage(i_cmd, i_len, i_data);
+ break;
+ case TYPE_EVENT:
+ new_message = new BTAsyncReadEventMessage(i_cmd, i_len, i_data);
+ break;
+ default:
+ // We have ourselves a bug
+ assert(false, "ipmi message factory: unk type %d\n", i_type);
+ break;
+ }
+
+ return new_message;
+ }
};
OpenPOWER on IntegriCloud