diff options
author | Andre Marin <aamarin@us.ibm.com> | 2017-07-16 00:56:52 -0500 |
---|---|---|
committer | Christian R. Geddes <crgeddes@us.ibm.com> | 2017-07-27 18:00:19 -0400 |
commit | c85d4152d28b4a9d5eb392b2025937f6965a5100 (patch) | |
tree | 6db6ef655aeed0f279fb48c19e7a58a0d653f785 /src/import/generic/memory | |
parent | 74a5bd2d0006fe0b2e4511ccaae605b60b2d096d (diff) | |
download | talos-hostboot-c85d4152d28b4a9d5eb392b2025937f6965a5100.tar.gz talos-hostboot-c85d4152d28b4a9d5eb392b2025937f6965a5100.zip |
Added ATTR_MSS_VPD_MT_WINDAGE_RD_CTR support after SYSCLK_RESET.
Change-Id: I588b304a6694677c28196ca5161800d4ae19a21f
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43173
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: JACOB L. HARVEY <jlharvey@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43174
Reviewed-by: Hostboot Team <hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/generic/memory')
-rw-r--r-- | src/import/generic/memory/lib/utils/mss_math.H | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/import/generic/memory/lib/utils/mss_math.H b/src/import/generic/memory/lib/utils/mss_math.H index b4eca9485..fc9a9eb7d 100644 --- a/src/import/generic/memory/lib/utils/mss_math.H +++ b/src/import/generic/memory/lib/utils/mss_math.H @@ -44,11 +44,33 @@ namespace mss /// // TODO RTC:174277 - create unit test structure for generic/memory template<typename T > -inline constexpr T inclusive_range( const T i_start, const T i_end) +inline constexpr T inclusive_range( const T i_start, const T i_end ) { return (i_end - i_start) + 1; } +/// +/// @brief Poor man's round half away from 0 +/// @param[in] i_input starting point +/// @return rounded int64_t value +/// @note HB doesn't have std::round, referenced from: +/// https://stackoverflow.com/questions/4572556/concise-way-to-implement-round-in-c +/// +inline int64_t round_half_away_from_zero( const double i_input ) +{ + // Casting to avoid comparison of diff data types + // Explicitly casting INT64_MAX to avoid truncation of casting + // floating point to integer + if( i_input > static_cast<double>(INT64_MAX) ) + { + FAPI_ERR("Invalid input greater than %d", INT64_MAX); + fapi2::Assert(false); + } + + return ( i_input < 0.0 ? static_cast<int64_t>(i_input - 0.5) : static_cast<int64_t>(i_input + 0.5) ); +} + + }// mss #endif |