From 0b50210ae6e66161da3a930fca0fbaf9eb075acb Mon Sep 17 00:00:00 2001 From: Mark Pizzutillo Date: Fri, 25 Oct 2019 17:51:30 -0400 Subject: Reverse mcbist address buffer fields Change-Id: Ib1b68cd1a21c9190db170d95e6d528bebfbc2539 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/86044 Tested-by: FSP CI Jenkins Tested-by: Jenkins Server Reviewed-by: STEPHEN GLANCY Tested-by: Hostboot CI Reviewed-by: Louis Stermole Reviewed-by: Jennifer A Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/86054 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Christian R Geddes --- src/import/generic/memory/lib/utils/buffer_ops.H | 28 +++++++++++++++++++++- .../lib/utils/mcbist/gen_mss_mcbist_address.H | 18 ++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) (limited to 'src/import') 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. */ /* */ /* */ @@ -102,6 +102,32 @@ static inline void reverse( T& io_buffer ) io_buffer = l_result; } +/// +/// @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 +static inline void reverse_range(fapi2::buffer& io_buffer) +{ + const auto target_length = fapi2::parameterTraits::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 l_tmp; + + io_buffer.template extractToRight(l_tmp); + + l_tmp.reverse(); + io_buffer.template insert(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 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 @@ -98,6 +98,15 @@ class address { } + /// + /// @brief Construct an address from the provided buffer + /// @param[in] i_address fapi2::buffer address + /// + address(const fapi2::buffer& 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(); } + /// + /// @brief Get the buffer object for bit operations + /// @return fapi2::buffer& + /// + inline fapi2::buffer get_address_buffer() const + { + return iv_address; + } + private: // We use a fapi2 buffer as it has static compile-time support fapi2::buffer iv_address; -- cgit v1.2.1