diff options
author | Stephen Glancy <sglancy@us.ibm.com> | 2019-07-30 14:07:07 -0400 |
---|---|---|
committer | Christian R Geddes <crgeddes@us.ibm.com> | 2019-08-01 17:14:08 -0500 |
commit | 15b0afe89c9109c0008a576e5bf74ca8222b6cc4 (patch) | |
tree | ca1cce3739ba651e63c2ea5e454fe253e8fc0738 /src/import | |
parent | 5e8d01aad41e0fcad7654efe3d4731f5cf040cfb (diff) | |
download | talos-hostboot-15b0afe89c9109c0008a576e5bf74ca8222b6cc4.tar.gz talos-hostboot-15b0afe89c9109c0008a576e5bf74ca8222b6cc4.zip |
Moves ecc::trap_address and fwms::address to new files
Change-Id: Iac59794c4968136c41143f6518d8f5273a73ba3c
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/81391
Reviewed-by: Mark Pizzutillo <mark.pizzutillo@ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Dev-Ready: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/81407
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import')
6 files changed, 310 insertions, 276 deletions
diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/mcbist/exp_address.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/mcbist/exp_address.H index 8cbd5b347..6cf1c5a71 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/mcbist/exp_address.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/mcbist/exp_address.H @@ -42,6 +42,8 @@ #include <lib/ecc/ecc_traits_explorer.H> #include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_traits.H> #include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H> +#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_ecc_trap_address.H> +#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_fwms_address.H> #endif diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/mcbist/address.H b/src/import/chips/p9/procedures/hwp/memory/lib/mcbist/address.H index 438c498cb..fcfd9a3e4 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/mcbist/address.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/mcbist/address.H @@ -42,6 +42,8 @@ #include <lib/ecc/ecc_traits_nimbus.H> #include <lib/mcbist/mcbist_traits.H> #include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H> +#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_ecc_trap_address.H> +#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_fwms_address.H> // This file is still necessary to put traits and generic code together diff --git a/src/import/generic/memory/lib/ecc/fw_mark_store.H b/src/import/generic/memory/lib/ecc/fw_mark_store.H index 39f661daf..3e840c4d0 100644 --- a/src/import/generic/memory/lib/ecc/fw_mark_store.H +++ b/src/import/generic/memory/lib/ecc/fw_mark_store.H @@ -37,7 +37,7 @@ #define _MSS_FW_MARK_STORE_H_ #include <fapi2.H> -#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H> +#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_fwms_address.H> #include <generic/memory/lib/utils/scom.H> #include <generic/memory/lib/ecc/ecc_traits.H> @@ -573,9 +573,9 @@ template< fapi2::TargetType T = DEFAULT_MEM_PORT_TARGET, typename TT = eccTraits inline void get_address( const fapi2::buffer<uint64_t>& i_data, mcbist::address& o_address ) { // construct fwms::address from i_data - const auto l_addr = address<>(uint64_t(i_data)); + const auto l_addr = mss::ecc::fwms::address<>(uint64_t(i_data)); // construct mcbist::address from fwms::address - o_address = mcbist::address(l_addr); + o_address = l_addr.operator mss::mcbist::address(); FAPI_INF("get_address: 0x%016lx", uint64_t(l_addr)); } diff --git a/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H b/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H index 07ac53933..b42c0e39b 100644 --- a/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H +++ b/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H @@ -43,62 +43,6 @@ namespace mss { -// Forward declaration - -/// -/// @class mcbistMCTraits -/// @tparam MC the mc type -/// @brief A MC to MC_TARGET_TYPE mapping -/// -template< mss::mc_type MC > -class mcbistMCTraits; - -/// -/// @class mcbistTraits -/// @tparam MC the mc type of the T -/// @tparam T the fapi2::TargetType - derived -/// @brief a collection of traits associated with the MCBIST engine or hardware -/// -template< mss::mc_type MC, fapi2::TargetType T > -class mcbistTraits; - -namespace ecc -{ - -/// -/// @class trap_address -/// @brief Converts trap address into mcbist::address -/// @tparam MC the mc type of the T -/// @tparam T fapi2 Target Type defaults to fapi2::TARGET_TYPE_MCA or TARGET_TYPE_MEM_PORT -/// @tparam TT traits type defaults to eccTraits<T> -/// -// See declaration below -template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T = mss::mcbistMCTraits<MC>::FWMS_ADDR_TARGET_TYPE, typename TT = mss::eccTraits<MC, T> > -class trap_address; - -namespace fwms -{ - -/// -/// @class address -/// @brief Converts Firmware Mark Store ADDRESS field into mcbist::address -/// @tparam MC the mc type of the T -/// @tparam T fapi2 Target Type defaults to fapi2::TARGET_TYPE_MCA or TARGET_TYPE_MEM_PORT -/// @tparam TT traits type defaults to eccTraits<MC, T> -/// @note template argument defaults are in forward declaration in lib/mcbist/address.H -/// @note 12 = dimm -/// @note 13:14 = mrank -/// @note 15:17 = srank -/// @note 18:19 = bank group -/// @note 20:22 = bank -/// -// See declaration below -template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T = mss::mcbistMCTraits<MC>::FWMS_ADDR_TARGET_TYPE, typename TT = mss::eccTraits<MC, T> > -class address; - -} // close namespace fwms -} // close namespace ecc - namespace mcbist { @@ -155,39 +99,6 @@ class address } /// - /// @brief Construct an address from an ecc::trap_address - /// @tparam MC the mc type - /// @param[in] i_address representing an address field from a trap address - /// - template< mss::mc_type MC = DEFAULT_MC_TYPE > - address( const ecc::trap_address<MC>& i_address ) - { - this->set_field<PORT >(i_address.template get_field<ecc::trap_address<MC>::PORT>()); - this->set_field<DIMM >(i_address.template get_field<ecc::trap_address<MC>::DIMM>()); - this->set_field<MRANK >(i_address.template get_field<ecc::trap_address<MC>::MRANK>()); - this->set_field<SRANK >(i_address.template get_field<ecc::trap_address<MC>::SRANK>()); - this->set_field<ROW >(i_address.template get_field<ecc::trap_address<MC>::ROW>()); - this->set_field<COL >(i_address.template get_field<ecc::trap_address<MC>::COL>()); - this->set_field<BANK >(i_address.template get_field<ecc::trap_address<MC>::BANK>()); - this->set_field<BANK_GROUP>(i_address.template get_field<ecc::trap_address<MC>::BANK_GROUP>()); - } - - /// - /// @brief Construct an address from an ecc::fwms::address - /// @tparam MC the mc type - /// @param[in] i_address representing an address field from a firmware mark store register - /// - template< mss::mc_type MC = DEFAULT_MC_TYPE > - address( const ecc::fwms::address<MC>& i_address ) - { - this->set_field<DIMM >(i_address.template get_field<ecc::fwms::address<MC>::DIMM>()); - this->set_field<MRANK >(i_address.template get_field<ecc::fwms::address<MC>::MRANK>()); - this->set_field<SRANK >(i_address.template get_field<ecc::fwms::address<MC>::SRANK>()); - this->set_field<BANK_GROUP>(i_address.template get_field<ecc::fwms::address<MC>::BANK_GROUP>()); - this->set_field<BANK >(i_address.template get_field<ecc::fwms::address<MC>::BANK>()); - } - - /// /// @brief Conversion operator to uint64_t /// @warn Right-aligns the address /// @@ -507,190 +418,6 @@ class address }; } // close namespace mcbist - -// Documented above in its declaration. -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -class ecc::fwms::address -{ - public: - // first is the start bit of the field, second is the length - using field = std::pair<uint64_t, uint64_t>; - - constexpr static field DIMM = {TT::FIRMWARE_MS_ADDRESS, 1}; - constexpr static field MRANK = {TT::FIRMWARE_MS_ADDRESS + 1, 2}; - constexpr static field SRANK = {TT::FIRMWARE_MS_ADDRESS + 3, 3}; - constexpr static field BANK_GROUP = {TT::FIRMWARE_MS_ADDRESS + 6, 2}; - constexpr static field BANK = {TT::FIRMWARE_MS_ADDRESS + 8, 3}; - - address() = default; - - /// - /// @brief Construct an address from a uint64_t (scom'ed value) - /// @param[in] i_value representing raw value from FWMS register - /// - address( const uint64_t& i_value ): - iv_value(i_value) - { - } - - /// - /// @brief Construct an address from an mcbist::address - /// @param[in] i_mcbist_address mcbist formatted address - /// @note Construction of mcbist::address from ecc::fwms::address - /// @note located in mcbist::address class - /// - address( const mcbist::address& i_mcbist_address ) - { - iv_value.insertFromRight<DIMM.first, DIMM.second>(i_mcbist_address.get_field<mcbist::address::DIMM>()); - iv_value.insertFromRight<MRANK.first, MRANK.second>(i_mcbist_address.get_field<mcbist::address::MRANK>()); - iv_value.insertFromRight<SRANK.first, SRANK.second>(i_mcbist_address.get_field<mcbist::address::SRANK>()); - iv_value.insertFromRight<BANK_GROUP.first, BANK_GROUP.second> - (i_mcbist_address.get_field<mcbist::address::BANK_GROUP>()); - iv_value.insertFromRight<BANK.first, BANK.second>(i_mcbist_address.get_field<mcbist::address::BANK>()); - } - - /// - /// @brief Conversion operator to uint64_t - /// - inline operator uint64_t() const - { - uint64_t l_temp = 0; - iv_value.extract<TT::FIRMWARE_MS_ADDRESS, TT::FIRMWARE_MS_ADDRESS_LEN, TT::FIRMWARE_MS_ADDRESS>(l_temp); - return l_temp; - } - - /// - /// @brief Get a field from an address - /// @tparam F the field to get - /// @return right-aligned uint64_t representing the value - /// - template< const field& F > - inline uint64_t get_field() const - { - uint64_t l_value = 0; - iv_value.extractToRight<F.first, F.second>(l_value); - return l_value; - } - - private: - fapi2::buffer<uint64_t> iv_value; - -}; - -using field = std::pair<uint64_t, uint64_t>; -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::fwms::address<MC, T, TT>::DIMM; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::fwms::address<MC, T, TT>::MRANK; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::fwms::address<MC, T, TT>::SRANK; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::fwms::address<MC, T, TT>::BANK_GROUP; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::fwms::address<MC, T, TT>::BANK; - -// Documented above in its declaration. -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -class ecc::trap_address -{ - public: - // first is the start bit of the field, second is the length - using field = std::pair<uint64_t, uint64_t>; - - constexpr static field PORT = {TT::TRAP_ADDRESS_PORT, TT::TRAP_ADDRESS_PORT_LEN}; - constexpr static field DIMM = {TT::TRAP_ADDRESS_DIMM, TT::TRAP_ADDRESS_DIMM_LEN}; - constexpr static field MRANK = {TT::TRAP_ADDRESS_MRANK, TT::TRAP_ADDRESS_MRANK_LEN}; - constexpr static field SRANK = {TT::TRAP_ADDRESS_SRANK, TT::TRAP_ADDRESS_SRANK_LEN}; - constexpr static field ROW = {TT::TRAP_ADDRESS_ROW, TT::TRAP_ADDRESS_ROW_LEN}; - constexpr static field COL = {TT::TRAP_ADDRESS_COL, TT::TRAP_ADDRESS_COL_LEN}; - constexpr static field BANK = {TT::TRAP_ADDRESS_BANK, TT::TRAP_ADDRESS_BANK_LEN}; - constexpr static field BANK_GROUP = {TT::TRAP_ADDRESS_BANK_GROUP, TT::TRAP_ADDRESS_BANK_GROUP_LEN}; - - trap_address() = default; - - /// - /// @brief Construct an address from a uint64_t (scom'ed value) - /// @param[in] i_value representing raw value from FWMS register - /// - trap_address( const uint64_t& i_value ): - iv_value(i_value) - { - } - - /// - /// @brief Construct an address from an mcbist::address - /// @param[in] i_mcbist_address mcbist formatted address - /// @note Construction of mcbist::address from ecc::trap_address - /// @note located in mcbist::address class - /// - trap_address( const mcbist::address& i_mcbist_address ) - { - iv_value.insertFromRight<PORT.first, PORT.second>(i_mcbist_address.get_field<mcbist::address::PORT>()); - iv_value.insertFromRight<DIMM.first, DIMM.second>(i_mcbist_address.get_field<mcbist::address::DIMM>()); - iv_value.insertFromRight<MRANK.first, MRANK.second>(i_mcbist_address.get_field<mcbist::address::MRANK>()); - iv_value.insertFromRight<SRANK.first, SRANK.second>(i_mcbist_address.get_field<mcbist::address::SRANK>()); - iv_value.insertFromRight<ROW.first, ROW.second>(i_mcbist_address.get_field<mcbist::address::ROW>()); - iv_value.insertFromRight<COL.first, COL.second>(i_mcbist_address.get_field<mcbist::address::COL>()); - iv_value.insertFromRight<BANK.first, BANK.second>(i_mcbist_address.get_field<mcbist::address::BANK>()); - iv_value.insertFromRight<BANK_GROUP.first, BANK_GROUP.second> - (i_mcbist_address.get_field<mcbist::address::BANK_GROUP>()); - } - - /// - /// @brief Conversion operator to uint64_t - /// - inline operator uint64_t() const - { - uint64_t l_temp = 0; - iv_value.extract<TT::TRAP_ADDRESS, TT::TRAP_ADDRESS_LEN, TT::TRAP_ADDRESS>(l_temp); - return l_temp; - } - - /// - /// @brief Get a field from an address - /// @tparam F the field to get - /// @return right-aligned uint64_t representing the value - /// - template< const field& F > - inline uint64_t get_field() const - { - uint64_t l_value = 0; - iv_value.extractToRight<F.first, F.second>(l_value); - return l_value; - } - - private: - fapi2::buffer<uint64_t> iv_value; -}; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::trap_address<MC, T, TT>::PORT; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::trap_address<MC, T, TT>::DIMM; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::trap_address<MC, T, TT>::MRANK; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::trap_address<MC, T, TT>::SRANK; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::trap_address<MC, T, TT>::ROW; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::trap_address<MC, T, TT>::COL; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::trap_address<MC, T, TT>::BANK; - -template< mss::mc_type MC, fapi2::TargetType T , typename TT > -constexpr field ecc::trap_address<MC, T, TT>::BANK_GROUP; - } // close namespace mss #endif diff --git a/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_ecc_trap_address.H b/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_ecc_trap_address.H index 39d2f7f2e..ba8b1f47b 100644 --- a/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_ecc_trap_address.H +++ b/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_ecc_trap_address.H @@ -22,3 +22,155 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +/// +/// @file gen_mss_mcbist_ecc_trap_address.H +/// @brief Class for ECC trap addresses (addresses below the hash translation) +/// +// *HWP HWP Owner: Stephen Glancy <sglancy@us.ibm.com> +// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 3 +// *HWP Consumed by: HB:FSP + +#ifndef _GEN_MSS_MCBIST_ECC_TRAP_ADDRESS_H_ +#define _GEN_MSS_MCBIST_ECC_TRAP_ADDRESS_H_ + +#include <fapi2.H> +#include <utility> +#include <generic/memory/lib/ecc/ecc_traits.H> +#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H> +#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_traits.H> + +namespace mss +{ + +namespace ecc +{ + +/// +/// @class trap_address +/// @brief Converts trap address into mcbist::address +/// @tparam MC the mc type of the T +/// @tparam T fapi2 Target Type defaults to fapi2::TARGET_TYPE_MCA or TARGET_TYPE_MEM_PORT +/// @tparam TT traits type defaults to eccTraits<T> +/// +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T = mss::mcbistMCTraits<MC>::FWMS_ADDR_TARGET_TYPE, typename TT = mss::eccTraits<MC, T> > +class trap_address +{ + public: + // first is the start bit of the field, second is the length + using field = std::pair<uint64_t, uint64_t>; + + constexpr static field PORT = {TT::TRAP_ADDRESS_PORT, TT::TRAP_ADDRESS_PORT_LEN}; + constexpr static field DIMM = {TT::TRAP_ADDRESS_DIMM, TT::TRAP_ADDRESS_DIMM_LEN}; + constexpr static field MRANK = {TT::TRAP_ADDRESS_MRANK, TT::TRAP_ADDRESS_MRANK_LEN}; + constexpr static field SRANK = {TT::TRAP_ADDRESS_SRANK, TT::TRAP_ADDRESS_SRANK_LEN}; + constexpr static field ROW = {TT::TRAP_ADDRESS_ROW, TT::TRAP_ADDRESS_ROW_LEN}; + constexpr static field COL = {TT::TRAP_ADDRESS_COL, TT::TRAP_ADDRESS_COL_LEN}; + constexpr static field BANK = {TT::TRAP_ADDRESS_BANK, TT::TRAP_ADDRESS_BANK_LEN}; + constexpr static field BANK_GROUP = {TT::TRAP_ADDRESS_BANK_GROUP, TT::TRAP_ADDRESS_BANK_GROUP_LEN}; + + trap_address() = default; + + /// + /// @brief Construct an address from a uint64_t (scom'ed value) + /// @param[in] i_value representing raw value from FWMS register + /// + trap_address( const uint64_t& i_value ): + iv_value(i_value) + { + } + + /// + /// @brief Construct an address from an mcbist::address + /// @param[in] i_mcbist_address mcbist formatted address + /// @note Construction of mcbist::address from trap_address + /// @note located in mcbist::address class + /// + trap_address( const mcbist::address& i_mcbist_address ) + { + iv_value.insertFromRight<PORT.first, PORT.second>(i_mcbist_address.get_field<mcbist::address::PORT>()); + iv_value.insertFromRight<DIMM.first, DIMM.second>(i_mcbist_address.get_field<mcbist::address::DIMM>()); + iv_value.insertFromRight<MRANK.first, MRANK.second>(i_mcbist_address.get_field<mcbist::address::MRANK>()); + iv_value.insertFromRight<SRANK.first, SRANK.second>(i_mcbist_address.get_field<mcbist::address::SRANK>()); + iv_value.insertFromRight<ROW.first, ROW.second>(i_mcbist_address.get_field<mcbist::address::ROW>()); + iv_value.insertFromRight<COL.first, COL.second>(i_mcbist_address.get_field<mcbist::address::COL>()); + iv_value.insertFromRight<BANK.first, BANK.second>(i_mcbist_address.get_field<mcbist::address::BANK>()); + iv_value.insertFromRight<BANK_GROUP.first, BANK_GROUP.second> + (i_mcbist_address.get_field<mcbist::address::BANK_GROUP>()); + } + + /// + /// @brief Construct an mcbist::address from an ecc::trap_address + /// @return the mcbist::address + /// + inline operator mss::mcbist::address() const + { + mss::mcbist::address l_mcbist_address; + l_mcbist_address.set_port (this->get_field<PORT>()); + l_mcbist_address.set_dimm (this->get_field<DIMM>()); + l_mcbist_address.set_master_rank(this->get_field<MRANK>()); + l_mcbist_address.set_slave_rank (this->get_field<SRANK>()); + l_mcbist_address.set_row (this->get_field<ROW>()); + l_mcbist_address.set_column (this->get_field<COL>()); + l_mcbist_address.set_bank (this->get_field<BANK>()); + l_mcbist_address.set_bank_group (this->get_field<BANK_GROUP>()); + return l_mcbist_address; + } + + /// + /// @brief Conversion operator to uint64_t + /// + inline operator uint64_t() const + { + uint64_t l_temp = 0; + iv_value.extract<TT::TRAP_ADDRESS, TT::TRAP_ADDRESS_LEN, TT::TRAP_ADDRESS>(l_temp); + return l_temp; + } + + /// + /// @brief Get a field from an address + /// @tparam F the field to get + /// @return right-aligned uint64_t representing the value + /// + template< const field& F > + inline uint64_t get_field() const + { + uint64_t l_value = 0; + iv_value.extractToRight<F.first, F.second>(l_value); + return l_value; + } + + private: + fapi2::buffer<uint64_t> iv_value; +}; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename trap_address<MC, T, TT>::field trap_address<MC, T, TT>::PORT; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename trap_address<MC, T, TT>::field trap_address<MC, T, TT>::DIMM; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename trap_address<MC, T, TT>::field trap_address<MC, T, TT>::MRANK; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename trap_address<MC, T, TT>::field trap_address<MC, T, TT>::SRANK; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename trap_address<MC, T, TT>::field trap_address<MC, T, TT>::ROW; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename trap_address<MC, T, TT>::field trap_address<MC, T, TT>::COL; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename trap_address<MC, T, TT>::field trap_address<MC, T, TT>::BANK; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename trap_address<MC, T, TT>::field trap_address<MC, T, TT>::BANK_GROUP; + + +} // close namespace ecc +} // close namespace mss +#endif diff --git a/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_fwms_address.H b/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_fwms_address.H index 407485f64..2b1bda8fe 100644 --- a/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_fwms_address.H +++ b/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_fwms_address.H @@ -22,3 +22,154 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +/// +/// @file gen_mss_mcbist_fwms_address.H +/// @brief Class for FWMS trap addresses (addresses below the hash translation) +/// +// *HWP HWP Owner: Stephen Glancy <sglancy@us.ibm.com> +// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 3 +// *HWP Consumed by: HB:FSP + +#ifndef _GEN_MSS_MCBIST_FWMS_ADDRESS_H_ +#define _GEN_MSS_MCBIST_FWMS_ADDRESS_H_ + +#include <fapi2.H> +#include <utility> +#include <generic/memory/lib/ecc/ecc_traits.H> +#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H> +#include <generic/memory/lib/utils/mcbist/gen_mss_mcbist_traits.H> + +namespace mss +{ + +namespace ecc +{ + +namespace fwms +{ + +/// +/// @class address +/// @brief Converts Firmware Mark Store ADDRESS field into mcbist::address +/// @tparam MC the mc type of the T +/// @tparam T fapi2 Target Type defaults to fapi2::TARGET_TYPE_MCA or TARGET_TYPE_MEM_PORT +/// @tparam TT traits type defaults to eccTraits<MC, T> +/// @note template argument defaults are in forward declaration in lib/mcbist/address.H +/// @note 12 = dimm +/// @note 13:14 = mrank +/// @note 15:17 = srank +/// @note 18:19 = bank group +/// @note 20:22 = bank +/// +// See declaration below +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T = mss::mcbistMCTraits<MC>::FWMS_ADDR_TARGET_TYPE, typename TT = mss::eccTraits<MC, T> > +class address +{ + public: + // first is the start bit of the field, second is the length + using field = std::pair<uint64_t, uint64_t>; + + constexpr static field DIMM = {TT::FIRMWARE_MS_ADDRESS, 1}; + constexpr static field MRANK = {TT::FIRMWARE_MS_ADDRESS + 1, 2}; + constexpr static field SRANK = {TT::FIRMWARE_MS_ADDRESS + 3, 3}; + constexpr static field BANK_GROUP = {TT::FIRMWARE_MS_ADDRESS + 6, 2}; + constexpr static field BANK = {TT::FIRMWARE_MS_ADDRESS + 8, 3}; + + address() = default; + + /// + /// @brief Construct an address from a uint64_t (scom'ed value) + /// @param[in] i_value representing raw value from FWMS register + /// + address( const uint64_t& i_value ): + iv_value(i_value) + { + } + + /// + /// @brief Construct an address from an mcbist::address + /// @param[in] i_mcbist_address mcbist formatted address + /// @note Construction of mcbist::address from address + /// @note located in mcbist::address class + /// + address( const mss::mcbist::address& i_mcbist_address ) + { + iv_value.insertFromRight<DIMM.first, DIMM.second>(i_mcbist_address.get_dimm()); + iv_value.insertFromRight<MRANK.first, MRANK.second>(i_mcbist_address.get_master_rank()); + iv_value.insertFromRight<SRANK.first, SRANK.second>(i_mcbist_address.get_slave_rank()); + iv_value.insertFromRight<BANK_GROUP.first, BANK_GROUP.second>(i_mcbist_address.get_bank_group()); + iv_value.insertFromRight<BANK.first, BANK.second>(i_mcbist_address.get_bank()); + } + + /// + /// @brief Construct an address from an ecc::fwms::address + /// @tparam MC the mc type + /// @param[in] i_address representing an address field from a firmware mark store register + /// + + /// + /// @brief Construct an mcbist::address from an ecc::fwms::address + /// @return the mcbist::address + /// + inline operator mss::mcbist::address() const + { + mss::mcbist::address l_mcbist_address; + l_mcbist_address.set_dimm (this->get_field<DIMM>()); + l_mcbist_address.set_master_rank(this->get_field<MRANK>()); + l_mcbist_address.set_slave_rank (this->get_field<SRANK>()); + l_mcbist_address.set_bank_group (this->get_field<BANK_GROUP>()); + l_mcbist_address.set_bank (this->get_field<BANK>()); + return l_mcbist_address; + } + + /// + /// @brief Conversion operator to uint64_t + /// + inline operator uint64_t() const + { + uint64_t l_temp = 0; + iv_value.extract<TT::FIRMWARE_MS_ADDRESS, TT::FIRMWARE_MS_ADDRESS_LEN, TT::FIRMWARE_MS_ADDRESS>(l_temp); + return l_temp; + } + + /// + /// @brief Get a field from an address + /// @tparam F the field to get + /// @return right-aligned uint64_t representing the value + /// + template< const field& F > + inline uint64_t get_field() const + { + uint64_t l_value = 0; + iv_value.extractToRight<F.first, F.second>(l_value); + return l_value; + } + + private: + fapi2::buffer<uint64_t> iv_value; + +}; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename address<MC, T, TT>::field address<MC, T, TT>::DIMM; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename address<MC, T, TT>::field address<MC, T, TT>::MRANK; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename address<MC, T, TT>::field address<MC, T, TT>::SRANK; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename address<MC, T, TT>::field address<MC, T, TT>::BANK_GROUP; + +template< mss::mc_type MC, fapi2::TargetType T , typename TT > +constexpr typename address<MC, T, TT>::field address<MC, T, TT>::BANK; + + +} // close namespace fwms +} // close namespace ecc +} // close namespace mss +#endif |