summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/memory/lib/ecc/galois.H
diff options
context:
space:
mode:
authorLouis Stermole <stermole@us.ibm.com>2016-07-14 13:13:17 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-02-10 21:52:01 -0500
commit3e26f356fe1f5603f4bab9e42dfc4cb402ea0e94 (patch)
tree2f69ce09b7935a9bc99987577a39488632c7bd7f /src/import/chips/p9/procedures/hwp/memory/lib/ecc/galois.H
parentadcbb2fdbd5d5a9b7230e349c64ea40d4a7dc1ba (diff)
downloadtalos-hostboot-3e26f356fe1f5603f4bab9e42dfc4cb402ea0e94.tar.gz
talos-hostboot-3e26f356fe1f5603f4bab9e42dfc4cb402ea0e94.zip
Add Galois-symbol-DQ mapping tables and functions
Change-Id: Ib29827212231208f491047f111bc37d3fb570c41 Original-Change-Id: I6de1746b210a6de9b73f418f20d7821256f639e4 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27039 Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: JACOB L. HARVEY <jlharvey@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Brian R. Silver <bsilver@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36305 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/memory/lib/ecc/galois.H')
-rw-r--r--src/import/chips/p9/procedures/hwp/memory/lib/ecc/galois.H138
1 files changed, 138 insertions, 0 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/ecc/galois.H b/src/import/chips/p9/procedures/hwp/memory/lib/ecc/galois.H
new file mode 100644
index 000000000..4e763714e
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/memory/lib/ecc/galois.H
@@ -0,0 +1,138 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/ecc/galois.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+///
+/// @file galois.H
+/// @brief Translate ECC mark Galois codes to symbol and DQ
+///
+// *HWP HWP Owner: Louis Stermole <stermole@us.ibm.com>
+// *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com>
+// *HWP Team: Memory
+// *HWP Level: 2
+// *HWP Consumed by: HB:FSP
+
+#ifndef _MSS_ECC_GALOIS_H_
+#define _MSS_ECC_GALOIS_H_
+
+#include <lib/ecc/ecc_traits.H>
+
+namespace mss
+{
+
+namespace ecc
+{
+
+///
+/// @brief Return symbol value from a given Galois code
+/// @tparam T fapi2 Target Type defaults to TARGET_TYPE_MCA
+/// @tparam TT traits type defaults to eccTraits<T>
+/// @param[in] i_galois the Galois code
+/// @param[out] o_symbol symbol value represented by given Galois code
+/// @return FAPI2_RC_SUCCESS iff all is ok
+///
+template< fapi2::TargetType T = fapi2::TARGET_TYPE_MCA, typename TT = eccTraits<T> >
+fapi2::ReturnCode galois_to_symbol( const uint8_t i_galois, uint8_t& o_symbol )
+{
+ const auto& l_p = std::find(TT::symbol2galois, (TT::symbol2galois + MAX_DQ_BITS), i_galois);
+
+ if (l_p == (TT::symbol2galois + MAX_DQ_BITS))
+ {
+ FAPI_ERR("galois_to_symbol: invalid Galois code: 0x%02x", i_galois);
+ return fapi2::FAPI2_RC_INVALID_PARAMETER;
+ }
+
+ o_symbol = (l_p - TT::symbol2galois);
+ return fapi2::FAPI2_RC_SUCCESS;
+}
+
+///
+/// @brief Return Galois code from a given symbol value
+/// @tparam T fapi2 Target Type defaults to TARGET_TYPE_MCA
+/// @tparam TT traits type defaults to eccTraits<T>
+/// @param[in] i_symbol the symbol value
+/// @param[out] o_galois Galois code represented by given symbol
+/// @return FAPI2_RC_SUCCESS iff all is ok
+///
+template< fapi2::TargetType T = fapi2::TARGET_TYPE_MCA, typename TT = eccTraits<T> >
+fapi2::ReturnCode symbol_to_galois( const uint8_t i_symbol, uint8_t& o_galois )
+{
+ if (i_symbol >= MAX_DQ_BITS)
+ {
+ FAPI_ERR("symbol_to_galois: invalid symbol: %d", i_symbol);
+ return fapi2::FAPI2_RC_INVALID_PARAMETER;
+ }
+
+ o_galois = TT::symbol2galois[i_symbol];
+ return fapi2::FAPI2_RC_SUCCESS;
+}
+
+///
+/// @brief Return symbol value from a given DQ index
+/// @tparam T fapi2 Target Type defaults to TARGET_TYPE_MCA
+/// @tparam TT traits type defaults to eccTraits<T>
+/// @param[in] i_dq the DQ index
+/// @param[out] o_symbol symbol value represented by given DQ index
+/// @return FAPI2_RC_SUCCESS iff all is ok
+///
+template< fapi2::TargetType T = fapi2::TARGET_TYPE_MCA, typename TT = eccTraits<T> >
+fapi2::ReturnCode dq_to_symbol( const uint8_t i_dq, uint8_t& o_symbol )
+{
+ const auto& l_p = std::find(TT::symbol2dq, (TT::symbol2dq + MAX_DQ_BITS), i_dq);
+
+ if (l_p == (TT::symbol2dq + MAX_DQ_BITS))
+ {
+ FAPI_ERR("dq_to_symbol: invalid DQ index: %d", i_dq);
+ return fapi2::FAPI2_RC_INVALID_PARAMETER;
+ }
+
+ o_symbol = (l_p - TT::symbol2dq);
+ return fapi2::FAPI2_RC_SUCCESS;
+}
+
+///
+/// @brief Return DQ index from a given symbol value
+/// @tparam T fapi2 Target Type defaults to TARGET_TYPE_MCA
+/// @tparam TT traits type defaults to eccTraits<T>
+/// @param[in] i_symbol the symbol value
+/// @param[out] o_dq DQ index represented by given symbol value
+/// @return FAPI2_RC_SUCCESS iff all is ok
+///
+template< fapi2::TargetType T = fapi2::TARGET_TYPE_MCA, typename TT = eccTraits<T> >
+fapi2::ReturnCode symbol_to_dq( const uint8_t i_symbol, uint8_t& o_dq )
+{
+ if (i_symbol >= MAX_DQ_BITS)
+ {
+ FAPI_ERR("symbol_to_dq: invalid symbol: %d", i_symbol);
+ return fapi2::FAPI2_RC_INVALID_PARAMETER;
+ }
+
+ o_dq = TT::symbol2dq[i_symbol];
+ return fapi2::FAPI2_RC_SUCCESS;
+}
+
+} // close namespace ecc
+
+} // close namespace mss
+#endif
OpenPOWER on IntegriCloud