diff options
author | Andre Marin <aamarin@us.ibm.com> | 2016-03-02 12:52:07 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-05-20 09:58:04 -0400 |
commit | 1c858d9be4f5e8da888608830fd52026bc03a9ff (patch) | |
tree | fadc92bed276a4151297cd486bc9d07169b8cb08 /src | |
parent | 4b08274429c34f749a46c2d1fc66d9bc81254b41 (diff) | |
download | talos-hostboot-1c858d9be4f5e8da888608830fd52026bc03a9ff.tar.gz talos-hostboot-1c858d9be4f5e8da888608830fd52026bc03a9ff.zip |
Modify freq & dep. files. Add cas latency & unit tests
Change-Id: I077032ed270548336de4d610a2b0902657b6808a
Original-Change-Id: I205bf48e54fb3c8f19f973f58f8ec1d4c7345a23
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22632
Tested-by: PPE CI
Tested-by: Jenkins Server
Reviewed-by: Brian R. Silver <bsilver@us.ibm.com>
Tested-by: Hostboot CI
Reviewed-by: JACOB L. HARVEY <jlharvey@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@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/24840
Tested-by: FSP CI Jenkins
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/import/chips/p9/procedures/hwp/memory/lib/eff_config/timing.C | 258 |
1 files changed, 258 insertions, 0 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/timing.C b/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/timing.C new file mode 100644 index 000000000..44fc46e88 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/timing.C @@ -0,0 +1,258 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: chips/p9/procedures/hwp/memory/lib/eff_config/timing.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* EKB Project */ +/* */ +/* COPYRIGHT 2016 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#include <fapi2.H> +#include <mss.H> +#include <lib/utils/find.H> +#include <lib/eff_config/timing.H> + +namespace mss +{ + +// { density in GBs, tREFI(base) in picoseconds } +static const std::vector<std::pair<uint8_t, uint64_t> > TREFI_BASE = +{ + {2, 7800}, + {4, 7800}, + {8, 7800}, + // 16Gb - TBD +}; + +// { density in GBs, tRFC1(min) in picoseconds } +static const std::vector<std::pair<uint8_t, uint64_t> > TRFC1_MIN = +{ + {2, 160}, + {4, 260}, + {8, 350}, + // 16Gb - TBD +}; + + +// { density in GBs, tRFC2(min) in picoseconds } +static const std::vector<std::pair<uint8_t, uint64_t> > TRFC2_MIN = +{ + {2, 110}, + {4, 160}, + {8, 260}, + // 16Gb - TBD +}; + + +// { density in GBs, tRFC4(min) in picoseconds } +static const std::vector<std::pair<uint8_t, uint64_t> > TRFC4_MIN = +{ + {2, 90}, + {4, 110}, + {8, 160}, + // 16Gb - TBD +}; + + +// +// The following are only used in eff_config +// + +/// @brief Calculates refresh interval time 1 (tREFI 1) +/// @param[in] i_target FAPI2 target +/// @param[out] o_value timing val in ps +/// @return fapi2::ReturnCode +/// +fapi2::ReturnCode calc_trefi1(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, + uint64_t& o_value) +{ + uint8_t l_quotient = 0; + uint8_t l_remainder = 0; + uint64_t l_output = 0; + uint8_t l_temp_ref_range = 0; + uint8_t l_dram_density = 0; + bool l_found_value = true; + + FAPI_TRY(mss::eff_dram_density(i_target, l_dram_density)); + + switch(l_temp_ref_range) + { + case fapi2::ENUM_ATTR_EFF_TEMP_REF_RANGE_NORMAL: + l_found_value = mss::find_value_from_key(TREFI_BASE, l_dram_density, o_value); + FAPI_TRY( check::fail_for_invalid_map(i_target, + l_found_value, + l_dram_density, + l_temp_ref_range, + "Could not find sdram density given" + "normal temp_ref_range.") ); + break; + + case fapi2::ENUM_ATTR_EFF_TEMP_REF_RANGE_EXTEND: + l_found_value = mss::find_value_from_key(TREFI_BASE, l_dram_density, l_output); + FAPI_TRY( check::fail_for_invalid_map(i_target, + l_found_value, + l_dram_density, + l_temp_ref_range, + "Could not find sdram density given" + "extended temp_ref_range.") ); + l_quotient = l_output / 2; + l_remainder = l_output % 2; + o_value = l_quotient + (l_remainder == 0 ? 0 : 1); + break; + + default: + // l_temp_ref_range will be a platform attribute set by the MRW, + // which they "shouldn't" mess up as long as use "attribute" enums. + // if openpower messes this up we can at least catch it + FAPI_ASSERT(false, + fapi2::MSS_INVALID_TEMP_REF_RANGE(). + set_TEMP_REF_RANGE(l_temp_ref_range), + "%s Incorrect Temperature Ref. Range received: %d ", + mss::c_str(i_target), + l_temp_ref_range); + + break; + } + +fapi_try_exit: + return fapi2::current_err; +} + +/// @brief Calculates refresh interval time 2 (tREFI 2) +/// @param[in] i_target FAPI2 target +/// @param[out] o_value timing val in ps +/// @return fapi2::ReturnCode +/// +fapi2::ReturnCode calc_trefi2(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, + uint64_t& o_value) +{ + uint8_t l_quotient = 0; + uint8_t l_remainder = 0; + uint64_t l_output = 0; + uint8_t l_temp_ref_range = 0; + uint8_t l_dram_density = 0; + bool l_found_value = true; + + FAPI_TRY(mss::eff_temp_ref_range(i_target, l_temp_ref_range)); + FAPI_TRY(mss::eff_dram_density(i_target, l_dram_density)); + + switch(l_temp_ref_range) + { + case fapi2::ENUM_ATTR_EFF_TEMP_REF_RANGE_NORMAL: + l_found_value = mss::find_value_from_key(TREFI_BASE, l_dram_density, l_output); + FAPI_TRY( check::fail_for_invalid_map(i_target, + l_found_value, + l_dram_density, + l_temp_ref_range, + "Could not find sdram density given" + "normal temp_ref_range.") ); + + l_remainder = l_output % 2; + o_value = l_quotient + (l_remainder == 0 ? 0 : 1); + break; + + case fapi2::ENUM_ATTR_EFF_TEMP_REF_RANGE_EXTEND: + l_found_value = mss::find_value_from_key(TREFI_BASE, l_dram_density, l_output); + FAPI_TRY( check::fail_for_invalid_map(i_target, + l_found_value, + l_dram_density, + l_temp_ref_range, + "Could not find sdram density given" + "extended temp_ref_range.") ); + l_quotient = l_output / 4; + l_remainder = l_output % 4; + o_value = l_quotient + (l_remainder == 0 ? 0 : 1); + break; + + default: + // l_temp_ref_range will be a platform attribute set by the MRW, + // which they "shouldn't" mess up as long as use "attribute" enums. + // if openpower messes this up we can at least catch it + FAPI_ASSERT(false, + fapi2::MSS_INVALID_TEMP_REF_RANGE(). + set_TEMP_REF_RANGE(l_temp_ref_range), + "%s Incorrect Temperature Ref. Range received: %d ", + mss::c_str(i_target), + l_temp_ref_range); + + break; + } + +fapi_try_exit: + return fapi2::current_err; +} + +/// @brief Calculates refresh interval time 4 (tREFI 4) +/// @param[in] i_target FAPI2 target +/// @param[out] o_value timing val in ps +/// @return fapi2::ReturnCode +/// +fapi2::ReturnCode calc_trefi4( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, + uint64_t& o_value) +{ + uint8_t l_quotient = 0; + uint8_t l_remainder = 0; + uint64_t l_output = 0; + uint8_t l_temp_ref_range = 0; + uint8_t l_dram_density = 0; + bool l_found_value = true; + + FAPI_TRY(mss::eff_temp_ref_range(i_target, l_temp_ref_range)); + FAPI_TRY(mss::eff_dram_density(i_target, l_dram_density)); + + switch(l_temp_ref_range) + { + case fapi2::ENUM_ATTR_EFF_TEMP_REF_RANGE_NORMAL: + l_found_value = mss::find_value_from_key(TREFI_BASE, l_dram_density, l_output); + FAPI_TRY( check::fail_for_invalid_map(i_target, + l_found_value, + l_dram_density, + l_temp_ref_range, + "Could not find sdram density given" + "normal temp_ref_range.") ); + l_quotient = l_output / 4; + l_remainder = l_output % 4; + o_value = l_quotient + (l_remainder == 0 ? 0 : 1); + break; + + case fapi2::ENUM_ATTR_EFF_TEMP_REF_RANGE_EXTEND: + l_found_value = mss::find_value_from_key(TREFI_BASE, l_dram_density, l_output); + FAPI_TRY( check::fail_for_invalid_map(i_target, + l_found_value, + l_dram_density, + l_temp_ref_range, + "Could not find sdram density given" + "extended temp_ref_range.") ); + l_quotient = l_output / 8; + l_remainder = l_output % 8; + o_value = l_quotient + (l_remainder == 0 ? 0 : 1); + break; + + default: + // l_temp_ref_range will be a platform attribute set by the MRW, + // which they "shouldn't" mess up as long as use "attribute" enums. + // if openpower messes this up we can at least catch it + FAPI_ASSERT(false, + fapi2::MSS_INVALID_TEMP_REF_RANGE(). + set_TEMP_REF_RANGE(l_temp_ref_range), + "%s Incorrect Temperature Ref. Range received: %d ", + mss::c_str(i_target), + l_temp_ref_range); + + break; + } + +fapi_try_exit: + return fapi2::current_err; +} + +}// mss |