diff options
author | Louis Stermole <stermole@us.ibm.com> | 2018-10-02 10:41:42 -0500 |
---|---|---|
committer | Christian R. Geddes <crgeddes@us.ibm.com> | 2018-12-04 11:09:10 -0600 |
commit | 6a6ee6a74bce17f8ee9dd2c6729392dc62763896 (patch) | |
tree | c5b4b536b42e49b0c679120a0300f39ac014400b /src/import/generic | |
parent | 8b6b1b256035236d5434760729a1263305939a1f (diff) | |
download | talos-hostboot-6a6ee6a74bce17f8ee9dd2c6729392dc62763896.tar.gz talos-hostboot-6a6ee6a74bce17f8ee9dd2c6729392dc62763896.zip |
Move MSS volt attr setters to generic folder
Change-Id: I0011160cb34c1dffe54ff5eee3b629e91e3578c2
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/67103
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/67296
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/generic')
3 files changed, 165 insertions, 0 deletions
diff --git a/src/import/generic/memory/lib/utils/voltage/gen_mss_volt.H b/src/import/generic/memory/lib/utils/voltage/gen_mss_volt.H index 644e50e70..284995546 100644 --- a/src/import/generic/memory/lib/utils/voltage/gen_mss_volt.H +++ b/src/import/generic/memory/lib/utils/voltage/gen_mss_volt.H @@ -22,3 +22,104 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +/// +/// @file gen_mss_volt.H +/// @brief Functions used by mss_volt procedure +/// +// *HWP HWP Owner: Louis Stermole <stermole@us.ibm.com> +// *HWP HWP Backup: Andre A. Marin <aamarin@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 3 +// *HWP Consumed by: HB:FSP + +#ifndef _GEN_MSS_VOLT_H_ +#define _GEN_MSS_VOLT_H_ + +#include <fapi2.H> +#include <generic/memory/lib/utils/find.H> +#include <generic/memory/lib/utils/shared/mss_generic_consts.H> +#include <generic/memory/lib/utils/voltage/gen_mss_voltage_traits.H> + +namespace mss +{ + +/// +/// @brief Determine what voltages are supported for the given memory controller and DRAM generation +/// @tparam M mss::mc_type memory controller type +/// @tparam D mss::spd::device_type DRAM device type (generation) +/// @tparam TT mss::voltage_traits voltage traits for the given mc_type/device_type pairing +/// @param[in] i_target the target for accessing voltage attributes from SPD +/// @param[out] o_supported_dram_voltages vector of supported rail voltages in millivolts to be used in set_voltage_attributes +/// @return FAPI2_RC_SUCCESS iff ok +/// +template<mss::mc_type M, mss::spd::device_type D, typename TT = mss::voltage_traits<M, D>> +fapi2::ReturnCode get_supported_voltages(const fapi2::Target<TT::SPD_TARGET_TYPE>& i_target, + std::vector<uint32_t>& o_supported_dram_voltages); + +/// +/// @brief Set voltage rail attributes +/// @tparam M mss::mc_type memory controller type +/// @tparam D mss::spd::device_type DRAM device type (generation) +/// @tparam TT mss::voltage_traits voltage traits for the given mc_type/device_type pairing +/// @param[in] i_target the target for setting voltage attributes +/// @param[in] i_selected_dram_voltages vector of selected rail voltages in millivolts for nominal voltage +/// @return FAPI2_RC_SUCCESS iff ok +/// +template<mss::mc_type M, mss::spd::device_type D, typename TT = mss::voltage_traits<M, D>> +inline fapi2::ReturnCode set_voltage_attributes(const fapi2::Target<TT::VOLTAGE_TARGET_TYPE>& i_target, + const std::vector<uint32_t>& i_selected_dram_voltages) +{ + // Check that the number of supplied voltage values is correct + const auto l_num_setters = TT::voltage_setters.size(); + const auto l_num_supplied_voltages = i_selected_dram_voltages.size(); + + FAPI_ASSERT(l_num_supplied_voltages == l_num_setters, + fapi2::MSS_VOLT_WRONG_NUMBER_OF_VOLTAGES(). + set_SUPPLIED_NUMBER(l_num_supplied_voltages). + set_EXPECTED_NUMBER(l_num_setters). + set_VOLT_TARGET(i_target), + "%s: Incorrect number of voltages supplied to set_voltage_attributes function: %d (expected %d)", + mss::c_str(i_target), + l_num_supplied_voltages, + l_num_setters); + + for (size_t l_setter_index = 0; l_setter_index < l_num_setters; ++l_setter_index) + { + FAPI_TRY( (*TT::voltage_setters[l_setter_index])(i_target, i_selected_dram_voltages[l_setter_index]) ); + } + +fapi_try_exit: + return fapi2::current_err; +} + +/// +/// @brief Setup and save off rail voltages +/// @tparam M mss::mc_type memory controller type +/// @tparam D mss::spd::device_type DRAM device type (generation) +/// @tparam TT mss::voltage_traits voltage traits for the given mc_type/device_type pairing +/// @param[in] i_target the target for accessing voltage attributes from SPD +/// @return FAPI2_RC_SUCCESS iff ok +/// +template<mss::mc_type M, mss::spd::device_type D, typename TT = mss::voltage_traits<M, D>> +inline fapi2::ReturnCode setup_voltage_rail_values(const fapi2::Target<TT::SPD_TARGET_TYPE>& i_target) +{ + const auto l_voltage_target = mss::find_target<TT::VOLTAGE_TARGET_TYPE>(i_target); + const auto l_spd_target = mss::find_target<TT::SPD_TARGET_TYPE>(i_target); + std::vector<uint32_t> l_dram_voltages; + + FAPI_TRY( (mss::get_supported_voltages<M, D>(l_spd_target, l_dram_voltages)), + "Failed to get supported voltages for %s", mss::c_str(l_spd_target) ); + + FAPI_TRY( (mss::set_voltage_attributes<M, D>(l_voltage_target, l_dram_voltages)), + "Failed to set volt attributes for %s", mss::c_str(l_voltage_target) ); + + FAPI_INF("%s End setup_voltage_rail_values", mss::c_str(i_target)); + +fapi_try_exit: + return fapi2::current_err; +} + +} // mss + +#endif diff --git a/src/import/generic/memory/lib/utils/voltage/gen_mss_voltage_traits.H b/src/import/generic/memory/lib/utils/voltage/gen_mss_voltage_traits.H index 738554c1a..baa9c693a 100644 --- a/src/import/generic/memory/lib/utils/voltage/gen_mss_voltage_traits.H +++ b/src/import/generic/memory/lib/utils/voltage/gen_mss_voltage_traits.H @@ -22,3 +22,55 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +/// +/// @file gen_mss_voltage_traits.H +/// @brief Contains voltage traits information +/// +// *HWP HWP Owner: Stephen Glancy <sglancy@us.ibm.com> +// *HWP FW Owner: Andre Marin <aamarin@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 2 +// *HWP Consumed by: CI + +#ifndef _GEN_MSS_VOLTAGE_TRAITS_H_ +#define _GEN_MSS_VOLTAGE_TRAITS_H_ + +#include <fapi2.H> +#include <generic/memory/lib/utils/shared/mss_generic_consts.H> + +namespace mss +{ + +/// +/// @class Traits and policy class for voltage code +/// @tparam M mss::mc_type memory controller type +/// @tparam D mss::spd::device_type DRAM device type (generation) +/// +template< mss::mc_type M, mss::spd::device_type D > +class voltage_traits; + +/// +/// @class Traits and policy class for voltage code - specialization for the NIMBUS memory controller type +/// +template<> +class voltage_traits<mss::mc_type::NIMBUS, mss::spd::device_type::DDR4> +{ + public: + ////////////////////////////////////////////////////////////// + // Target types + ////////////////////////////////////////////////////////////// + static constexpr fapi2::TargetType VOLTAGE_TARGET_TYPE = fapi2::TARGET_TYPE_MCBIST; + static constexpr fapi2::TargetType SPD_TARGET_TYPE = fapi2::TARGET_TYPE_MCS; + + ////////////////////////////////////////////////////////////// + // Traits values + ////////////////////////////////////////////////////////////// + // List of attribute setter functions for setting voltage rail values + // This vector is defined in the p9 space: lib/eff_config/nimbus_mss_voltage.C + static const std::vector<fapi2::ReturnCode (*)(const fapi2::Target<VOLTAGE_TARGET_TYPE>&, uint32_t)> voltage_setters; +}; + + +} // ns mss +#endif diff --git a/src/import/generic/procedures/xml/error_info/generic_error.xml b/src/import/generic/procedures/xml/error_info/generic_error.xml index 611aa111d..2315fe6a3 100644 --- a/src/import/generic/procedures/xml/error_info/generic_error.xml +++ b/src/import/generic/procedures/xml/error_info/generic_error.xml @@ -280,6 +280,18 @@ </hwpError> <hwpError> + <rc>RC_MSS_VOLT_WRONG_NUMBER_OF_VOLTAGES</rc> + <description>Incorrect number of voltages supplied to set_voltage_attributes function</description> + <ffdc>VOLT_TARGET</ffdc> + <ffdc>SUPPLIED_NUMBER</ffdc> + <ffdc>EXPECTED_NUMBER</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + + <hwpError> <rc>RC_MSS_PORT_DOES_NOT_SUPPORT_MAJORITY_FREQ</rc> <description> When considering the frequencies in the MRW and the max supported |