summaryrefslogtreecommitdiffstats
path: root/import
diff options
context:
space:
mode:
authorMatt K. Light <mklight@us.ibm.com>2016-04-27 11:37:56 -0500
committerSantosh S. Puranik <santosh.puranik@in.ibm.com>2016-08-04 03:02:21 -0400
commit0a1ac480034193a0b6fac9cb1120f9b4101cc7fc (patch)
tree3ef41e40263eb657d042f15c9d5b2549da9f5ce2 /import
parentb83d0c669a06df9ef31593c790a70c2f6e713cb9 (diff)
downloadtalos-sbe-0a1ac480034193a0b6fac9cb1120f9b4101cc7fc.tar.gz
talos-sbe-0a1ac480034193a0b6fac9cb1120f9b4101cc7fc.zip
alternate multicast implementation
Change-Id: I62116a2102dbb31f8ec538211c767c3bbcfd26dd Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23733 Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Reviewed-by: Joachim Fenkes <fenkes@de.ibm.com> Reviewed-by: Santosh S. Puranik <santosh.puranik@in.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26141
Diffstat (limited to 'import')
-rw-r--r--import/hwpf/fapi2/include/fapi2_multicast.H165
-rw-r--r--import/hwpf/fapi2/include/fapi2_multicast_defs.H36
2 files changed, 201 insertions, 0 deletions
diff --git a/import/hwpf/fapi2/include/fapi2_multicast.H b/import/hwpf/fapi2/include/fapi2_multicast.H
new file mode 100644
index 00000000..721ecffd
--- /dev/null
+++ b/import/hwpf/fapi2/include/fapi2_multicast.H
@@ -0,0 +1,165 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: hwpf/fapi2/include/fapi2_multicast.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* EKB Project */
+/* */
+/* COPYRIGHT 2016 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* IBM_PROLOG_END_TAG */
+///
+/// @file fapi2_multicast.H
+/// @brief Common definitions for fapi2 multicast target value wrapper class
+///
+
+#ifndef __FAPI2_COMMON_MULTICAST__
+#define __FAPI2_COMMON_MULTICAST__
+
+#include <target.H>
+#include <fapi2_multicast_defs.H>
+
+namespace fapi2
+{
+
+///
+/// @brief Class representing a FAPI2 Multicast target value wrapper
+/// @tparam M the type of multicast operation
+/// @tparam G the type of multicast group
+/// @tparam V the type of the target's Value this class is wrapping
+/// @remark This wrapper class defines how a handle will behave by
+/// type and group if internal to the handle mulitcast operation
+/// is enabled. If the handle used is not multicast enabled most
+/// function of this class will be ignored.
+///
+template<MulticastType M, MulticastGroup G, typename V = plat_target_handle_t >
+class Multicast
+{
+ public:
+ ///
+ /// @brief Delagate default constructor to constructor
+ /// that takes in a value as a param
+ ///
+ Multicast() : Multicast(V()) {}
+
+ ///
+ /// @brief Create a Multicast value with a target value
+ /// @param[in] Value the value (i.e., specific element this
+ /// target represents, or pointer)
+ /// @note Platforms can will update the handle value with
+ /// information on the multicast type and group
+ ///
+ Multicast(const V& value) : iv_handle(value)
+ {
+ updateHandle<M, G>(iv_handle);
+ }
+
+ ///
+ /// @brief Create a Multicast value from another Multicast value
+ /// @param[in] other the value
+ /// @note Platforms can will update the handle value with
+ /// information on the multicast type and group
+ ///
+ template<MulticastType O, MulticastGroup N>
+ Multicast(const Multicast<O, N> other) :
+ iv_handle(static_cast<V>(other))
+ {
+ updateHandle<M, G>(iv_handle);
+ }
+
+ ///
+ /// @brief Get the handle as a V
+ /// @return V The Multicast wrapper's internal handle, or value
+ ///
+ inline operator V() const
+ {
+ return iv_handle;
+ }
+
+ ///
+ /// @brief Get the handle as a V
+ /// @return V The Multicast wrapper's internal handle, or value
+ ///
+ inline V& operator()() const
+ {
+ return iv_handle;
+ }
+
+ ///
+ /// @brief Has the handle been enabled for multicast operation
+ /// @return Return true if multicast, false otherwise
+ ///
+ inline bool isMulticast() const;
+
+ private:
+ ///
+ /// @brief update the handle with group and type given
+ /// @tparam O the type of multicast operation
+ /// @tparam N the type of multicast group
+ /// @param[in] Value the value/handle
+ ///
+ template<MulticastType O, MulticastGroup N>
+ inline void updateHandle(V& value);
+
+ V iv_handle;
+};
+
+// multicast from unicast
+template<MulticastType M, MulticastGroup G, TargetType K, typename V>
+inline Target<K, Multicast<M, G, V>> make_multicast(const Target<K, V>& t)
+{
+ return Target<K, Multicast<M, G, V>>(t.get());
+}
+
+// multicast from multicast -- changing type
+template<MulticastType M, MulticastType N, MulticastGroup G, TargetType K, typename V>
+inline Target<K, Multicast<M, G, V>> make_multicast(const Target<K, Multicast<N, G, V>>& t)
+{
+ return Target<K, Multicast<M, G, V>>(t.get());
+}
+
+// multicast from multicast -- changing type and group
+template<MulticastType M, MulticastGroup O, MulticastType N, MulticastGroup G, TargetType K, typename V>
+inline Target<K, Multicast<M, O, V>> make_multicast(const Target<K, Multicast<N, G, V>>& t)
+{
+ return Target<K, Multicast<M, O, V>>(t.get());
+}
+
+// unicast from multicast
+template<MulticastType M, MulticastGroup G, TargetType K, typename V>
+inline Target<K, V> make_unicast(const Target<K, Multicast<M, G, V>>& t)
+{
+ return Target<K, V>(t.get());
+}
+
+// test if a multicast target
+template<MulticastType M, MulticastGroup G, TargetType K, typename V>
+inline bool is_multicast(const Target<K, Multicast<M, G, V>>& t)
+{
+ const Multicast<M, G, V>& l_mref = t;
+ return l_mref.isMulticast();
+}
+
+// return false if testing a non-multicast target
+template<TargetType K, typename V>
+inline bool is_multicast(const Target<K, V>& t)
+{
+ return false;
+}
+
+template<MulticastType M1, MulticastType M2>
+constexpr bool is_same()
+{
+ return (M1 == M2);
+}
+}
+
+#endif
diff --git a/import/hwpf/fapi2/include/fapi2_multicast_defs.H b/import/hwpf/fapi2/include/fapi2_multicast_defs.H
new file mode 100644
index 00000000..d215fd8f
--- /dev/null
+++ b/import/hwpf/fapi2/include/fapi2_multicast_defs.H
@@ -0,0 +1,36 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: hwpf/fapi2/include/fapi2_multicast_defs.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* EKB Project */
+/* */
+/* COPYRIGHT 2016 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __FAPI2_COMMON_MULTICAST_DEFS__
+#define __FAPI2_COMMON_MULTICAST_DEFS__
+
+namespace fapi2
+{
+enum MulticastType
+{
+ MULTICAST_WRITE,
+ MULTICAST_READAND,
+ MULTICAST_READOR,
+ MULTICAST_READBITX,
+ MULTICAST_READCOMPARE,
+};
+
+typedef uint32_t MulticastGroup;
+}
+
+#endif
OpenPOWER on IntegriCloud