summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H
diff options
context:
space:
mode:
authorBrian Silver <bsilver@us.ibm.com>2016-06-30 14:19:50 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-07-13 14:23:20 -0400
commit55de7473be4c94d2c213ff69dd12d0a426477aff (patch)
tree0da6e3a16b8fd33464628d50b71db3e1adff6324 /src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H
parentcf311d5d2bc2f360cbe8f963a59b998c35789ec8 (diff)
downloadtalos-hostboot-55de7473be4c94d2c213ff69dd12d0a426477aff.tar.gz
talos-hostboot-55de7473be4c94d2c213ff69dd12d0a426477aff.zip
Change procedures to support unpopulated MC
Change-Id: Iddd15d19fc1b55d3f42cba14d76459a3ce71a37e Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26498 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com> Reviewed-by: Joseph J. McGill <jmcgill@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26501 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H')
-rw-r--r--src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H b/src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H
index b801ccf0b..c219b956f 100644
--- a/src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H
+++ b/src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H
@@ -92,7 +92,7 @@ inline T freq_to_ps(const T i_transfer_rate)
T l_dimm_freq = i_transfer_rate / 2;
// ps per clock (note value is rounded down)
- return CONVERT_PS_IN_A_US / l_dimm_freq;
+ return CONVERT_PS_IN_A_US / ((l_dimm_freq == 0) ? 1 : l_dimm_freq);
}
///
@@ -107,7 +107,7 @@ inline T ps_to_freq(const T i_time_in_ps)
// reverse of freq_to_ps function, solving for freq
// since running at DDR, data is transferred on both rising & falling edges
// hence the 2X factor
- return (2 * CONVERT_PS_IN_A_US) / i_time_in_ps;
+ return (2 * CONVERT_PS_IN_A_US) / ((i_time_in_ps == 0) ? 1 : i_time_in_ps);
}
///
@@ -140,7 +140,7 @@ inline uint64_t ps_to_cycles(const fapi2::Target<T>& i_target, const uint64_t i_
// Hoping the compiler figures out how to do these together.
l_divisor = freq_to_ps(l_freq);
- l_quotient = i_ps / l_divisor;
+ l_quotient = i_ps / ((l_divisor == 0) ? 1 : l_divisor);
l_remainder = i_ps % l_divisor;
// Make sure we add a cycle if there wasn't an even number of cycles in the input
@@ -222,7 +222,7 @@ inline uint64_t cycles_to_time(const fapi2::Target<T>& i_target, const uint64_t
{
// Hoping the compiler figures out how to do these together.
uint64_t l_dividend = cycles_to_ps(i_target, i_cycles);
- uint64_t l_quotient = l_dividend / D;
+ uint64_t l_quotient = l_dividend / ((D == 0) ? 1 : D);
uint64_t l_remainder = l_dividend % D;
// Make sure we add time if there wasn't an even number of cycles
OpenPOWER on IntegriCloud