From ee52194d04b1a2449e49cb759ea0e7e82bb1b75a Mon Sep 17 00:00:00 2001 From: Mark Pizzutillo Date: Wed, 10 Apr 2019 17:25:23 -0400 Subject: Add code for PMIC bias procedure & UTs Change-Id: I351c74f73624f46b195d37efbf407e1ff95006bf Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77317 Tested-by: FSP CI Jenkins Tested-by: HWSV CI Reviewed-by: Louis Stermole Reviewed-by: STEPHEN GLANCY Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: Thi N. Tran Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77775 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Christian R. Geddes --- src/import/generic/memory/lib/utils/mss_math.H | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/import/generic') diff --git a/src/import/generic/memory/lib/utils/mss_math.H b/src/import/generic/memory/lib/utils/mss_math.H index 65fc0f898..b3ff26fde 100644 --- a/src/import/generic/memory/lib/utils/mss_math.H +++ b/src/import/generic/memory/lib/utils/mss_math.H @@ -107,6 +107,17 @@ fapi_try_exit: return fapi2::current_err; } +/// +/// @brief Round value to a multiple of another number +/// +/// @param[in] i_value value to round +/// @param[in] i_multiple multiple to round to +/// @return uint64_t rounded value +/// +inline uint32_t round_to_nearest_multiple(const uint32_t i_value, const uint32_t i_multiple) +{ + return ((i_value + i_multiple / 2) / i_multiple) * i_multiple; +} /// /// @brief Determines if the double has decimal digits and adds 1 and rounds if true -- cgit v1.2.1