diff options
author | Mark Pizzutillo <Mark.Pizzutillo@ibm.com> | 2019-10-25 17:51:30 -0400 |
---|---|---|
committer | Christian R Geddes <crgeddes@us.ibm.com> | 2019-11-12 11:03:09 -0600 |
commit | 0b50210ae6e66161da3a930fca0fbaf9eb075acb (patch) | |
tree | e064980b1b1fd115d5b0fe871cbf3ef45d89db0b /src/import/generic | |
parent | d8c6861183220709a123c84ec790c993a426bd74 (diff) | |
download | talos-hostboot-0b50210ae6e66161da3a930fca0fbaf9eb075acb.tar.gz talos-hostboot-0b50210ae6e66161da3a930fca0fbaf9eb075acb.zip |
Reverse mcbist address buffer fields
Change-Id: Ib1b68cd1a21c9190db170d95e6d528bebfbc2539
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/86044
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/86054
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/generic')
-rw-r--r-- | src/import/generic/memory/lib/utils/buffer_ops.H | 28 | ||||
-rw-r--r-- | src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H | 18 |
2 files changed, 45 insertions, 1 deletions
diff --git a/src/import/generic/memory/lib/utils/buffer_ops.H b/src/import/generic/memory/lib/utils/buffer_ops.H index 31e7f11a2..42b02b5d1 100644 --- a/src/import/generic/memory/lib/utils/buffer_ops.H +++ b/src/import/generic/memory/lib/utils/buffer_ops.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -103,6 +103,32 @@ static inline void reverse( T& io_buffer ) } /// +/// @brief Reverse a given bit range of a buffer +/// @tparam S start bit +/// @tparam L length of bits to reverse +/// @tparam T buffer type +/// @param[in] io_buffer +/// +template<uint64_t S, uint64_t L, typename T> +static inline void reverse_range(fapi2::buffer<T>& io_buffer) +{ + const auto target_length = fapi2::parameterTraits<T>::bit_length(); + + static_assert(S < target_length, + "reverse_range(): Start is out of bounds"); + + static_assert((S + L) <= target_length, + "reverse_range(): (Start + Len) is out of bounds"); + + fapi2::buffer<T> l_tmp; + + io_buffer.template extractToRight<S, L>(l_tmp); + + l_tmp.reverse(); + io_buffer.template insert<S, L>(l_tmp); +} + +/// /// @brief Swizzle bits between two fapi2 buffers, and insert from source to destination /// @tparam DS the start bit in the destination buffer - swizzle will count up from here /// @tparam L how many bits to swizzle 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 b42c0e39b..37e35c48d 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 @@ -99,6 +99,15 @@ class address } /// + /// @brief Construct an address from the provided buffer + /// @param[in] i_address fapi2::buffer address + /// + address(const fapi2::buffer<uint64_t>& i_address): + iv_address(i_address) + { + } + + /// /// @brief Conversion operator to uint64_t /// @warn Right-aligns the address /// @@ -412,6 +421,15 @@ class address return get_field<BANK_GROUP>(); } + /// + /// @brief Get the buffer object for bit operations + /// @return fapi2::buffer<uint64_t>& + /// + inline fapi2::buffer<uint64_t> get_address_buffer() const + { + return iv_address; + } + private: // We use a fapi2 buffer as it has static compile-time support fapi2::buffer<uint64_t> iv_address; |