Skip to content

Commit

Permalink
Move MSS volt attr setters to generic folder
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stermole authored and crgeddes committed Dec 4, 2018
1 parent 8b6b1b2 commit 6a6ee6a
Show file tree
Hide file tree
Showing 9 changed files with 305 additions and 174 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,99 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */

///
/// @file nimbus_mss_voltage.C
/// @brief Nimbus specializations for voltage library
///
// *HWP HWP Owner: Stephen Glancy <sglancy@us.ibm.com>
// *HWP HWP Backup: Louis Stermole <stermole@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 3
// *HWP Consumed by: HB:FSP

#include <fapi2.H>
#include <vector>

// Memory libraries
#include <lib/mss_attribute_accessors.H>
#include <lib/shared/mss_const.H>

// Generic libraries
#include <generic/memory/lib/utils/shared/mss_generic_consts.H>
#include <generic/memory/lib/utils/find.H>
#include <generic/memory/lib/spd/spd_facade.H>
#include <generic/memory/lib/utils/voltage/gen_mss_voltage_traits.H>
#include <generic/memory/lib/utils/voltage/gen_mss_volt.H>

namespace mss
{

using TT = mss::voltage_traits<mss::mc_type::NIMBUS, mss::spd::device_type::DDR4>;

// List of attribute setter functions for setting voltage rail values
// Note that this list needs to be ordered the same way as the list returned by mss::get_supported_voltages
const std::vector<fapi2::ReturnCode (*)(const fapi2::Target<TT::VOLTAGE_TARGET_TYPE>&, uint32_t)> TT::voltage_setters =
{
&set_volt_vddr,
&set_volt_vpp,
};

///
/// @brief Determine what voltages are supported for the given memory controller and DRAM generation
/// @param[in] i_target the target for setting voltage attributes
/// @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
/// @note NIMBUS, DDR4 specialization
///
template<>
fapi2::ReturnCode get_supported_voltages<mss::mc_type::NIMBUS, mss::spd::device_type::DDR4>
(const fapi2::Target<TT::SPD_TARGET_TYPE>& i_target,
std::vector<uint32_t>& o_supported_dram_voltages)
{
o_supported_dram_voltages.clear();

FAPI_INF("Populating decoder cache for %s", mss::c_str(i_target));

//Factory cache is per MCS
std::vector< mss::spd::facade > l_spd_facades;
FAPI_TRY( get_spd_decoder_list(i_target, l_spd_facades) );

// Get dimms for each MCS
for ( const auto& l_cache : l_spd_facades )
{
const auto l_dimm = l_cache.get_dimm_target();
uint8_t l_dimm_nominal = 0;
uint8_t l_dimm_endurant = 0;

// Read nominal and endurant bits from SPD, 0 = 1.2V is not operable and endurant, 1 = 1.2 is valid
FAPI_TRY( l_cache.operable_nominal_voltage(l_dimm_nominal) );
FAPI_TRY( l_cache.endurant_nominal_voltage(l_dimm_endurant) );

// Check to make sure 1.2 V is both operable and endurant, fail if it is not
FAPI_ASSERT ( (l_dimm_nominal == mss::spd::OPERABLE) && (l_dimm_endurant == mss::spd::ENDURANT),
fapi2::MSS_VOLT_DDR_TYPE_REQUIRED_VOLTAGE().
set_ACTUAL_OPERABLE(l_dimm_nominal).
set_ACTUAL_ENDURANT(l_dimm_endurant).
set_EXPECTED_OPERABLE(mss::spd::OPERABLE).
set_EXPECTED_ENDURANT(mss::spd::ENDURANT).
set_DIMM_TARGET(l_dimm),
"%s: DIMM is not operable (%d) expected (%d)"
" and/or endurant (%d) expected (%d) at 1.2V",
mss::c_str(l_dimm),
l_dimm_nominal,
mss::spd::OPERABLE,
l_dimm_endurant,
mss::spd::ENDURANT);
} // l_dimm

// Set the attributes for this MCS, values are in mss_const.H
// The ordering of voltages is specified in the selected voltage_traits specialization
o_supported_dram_voltages.push_back(mss::DDR4_NOMINAL_VOLTAGE);
o_supported_dram_voltages.push_back(mss::DDR4_VPP_VOLTAGE);

fapi_try_exit:
return fapi2::current_err;
}

} // ns mss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#include <generic/memory/lib/utils/index.H>
#include <lib/mss_attribute_accessors.H>
#include <lib/eff_config/attr_setters.H>
#include <generic/memory/lib/data_engine/pre_data_init.H>
#include <generic/memory/lib/utils/find.H>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,47 @@ fapi_try_exit:
return false;
}

///
/// @brief ATTR_MSS_VOLT_VDDR setter
/// @tparam T the fapi2 target type of the target
/// @param[in] i_target const ref to the TARGET_TYPE_MCBIST
/// @param[in] i_value value to set - cannot be const because FAPI_ATTR_SET expects non-const
/// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff set is OK
///
template< fapi2::TargetType T >
inline fapi2::ReturnCode set_volt_vddr(const fapi2::Target<T>& i_target, uint32_t i_value)
{
const auto l_mcbist = mss::find_target<fapi2::TARGET_TYPE_MCBIST>(i_target);

FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_VOLT_VDDR, l_mcbist, i_value) );
return fapi2::current_err;

fapi_try_exit:
FAPI_ERR("failed setting ATTR_MSS_VOLT_VDDR: 0x%lx (target: %s)",
uint64_t(fapi2::current_err), mss::c_str(i_target));
return fapi2::current_err;
}

///
/// @brief ATTR_MSS_VOLT_VPP setter
/// @tparam T the fapi2 target type of the target
/// @param[in] i_target const ref to the TARGET_TYPE_MCBIST
/// @param[in] i_value value to set - cannot be const because FAPI_ATTR_SET expects non-const
/// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff set is OK
///
template< fapi2::TargetType T >
inline fapi2::ReturnCode set_volt_vpp(const fapi2::Target<T>& i_target, uint32_t i_value)
{
const auto l_mcbist = mss::find_target<fapi2::TARGET_TYPE_MCBIST>(i_target);

FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_VOLT_VPP, l_mcbist, i_value) );
return fapi2::current_err;

fapi_try_exit:
FAPI_ERR("failed setting ATTR_MSS_VOLT_VPP: 0x%lx (target: %s)",
uint64_t(fapi2::current_err), mss::c_str(i_target));
return fapi2::current_err;
}
} // close mss namespace

#endif
53 changes: 3 additions & 50 deletions src/import/chips/p9/procedures/hwp/memory/p9_mss_volt.C
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,10 @@
#include <fapi2.H>

// mss lib
#include <generic/memory/lib/spd/spd_facade.H>
#include <lib/eff_config/attr_setters.H>
#include <generic/memory/lib/utils/c_str.H>
#include <generic/memory/lib/utils/pos.H>
#include <generic/memory/lib/utils/find.H>
#include <lib/utils/checker.H>
#include <generic/memory/lib/utils/voltage/gen_mss_volt.H>

using fapi2::TARGET_TYPE_MCBIST;
using fapi2::TARGET_TYPE_MCS;
using fapi2::TARGET_TYPE_MCA;
using fapi2::TARGET_TYPE_DIMM;
using fapi2::FAPI2_RC_SUCCESS;

extern "C"
{
Expand All @@ -65,52 +57,13 @@ extern "C"
///
fapi2::ReturnCode p9_mss_volt( const std::vector< fapi2::Target<TARGET_TYPE_MCS> >& i_targets )
{
// Loop through MCS
for (const auto& l_mcs : i_targets)
{
FAPI_INF("Populating decoder cache for %s", mss::c_str(l_mcs));

//Factory cache is per MCS
std::vector< mss::spd::facade > l_spd_facades;
FAPI_TRY( get_spd_decoder_list(l_mcs, l_spd_facades) );

// Get dimms for each MCS
for ( const auto& l_cache : l_spd_facades )
{
const auto l_dimm = l_cache.get_dimm_target();
uint8_t l_dimm_nominal = 0;
uint8_t l_dimm_endurant = 0;

// Read nominal and endurant bits from SPD, 0 = 1.2V is not operable and endurant, 1 = 1.2 is valid
FAPI_TRY( l_cache.operable_nominal_voltage(l_dimm_nominal) );
FAPI_TRY( l_cache.endurant_nominal_voltage(l_dimm_endurant) );

//Check to make sure 1.2 V is both operable and endurant, fail if it is not
FAPI_ASSERT ( (l_dimm_nominal == mss::spd::OPERABLE) && (l_dimm_endurant == mss::spd::ENDURANT),
fapi2::MSS_VOLT_DDR_TYPE_REQUIRED_VOLTAGE().
set_ACTUAL_OPERABLE(l_dimm_nominal).
set_ACTUAL_ENDURANT(l_dimm_endurant).
set_EXPECTED_OPERABLE(mss::spd::OPERABLE).
set_EXPECTED_ENDURANT(mss::spd::ENDURANT).
set_DIMM_TARGET(l_dimm),
"%s: DIMM is not operable (%d) expected (%d)"
" and/or endurant (%d) expected (%d) at 1.2V",
mss::c_str(l_dimm),
l_dimm_nominal,
mss::spd::OPERABLE,
l_dimm_endurant,
mss::spd::ENDURANT);
} // l_dimm

// Set the attributes for this MCS, values are in mss_const.H
FAPI_TRY (mss::set_voltage_attributes (l_mcs,
mss::DDR4_NOMINAL_VOLTAGE,
mss::DDR4_VPP_VOLTAGE),
"Failed to set volt attributes");
FAPI_TRY( (mss::setup_voltage_rail_values<mss::mc_type::NIMBUS, mss::spd::device_type::DDR4>(l_mcs)),
"Failed setup_voltage_rail_values for %s", mss::c_str(l_mcs) );
} // mcs

FAPI_INF("End mss volt");
return FAPI2_RC_SUCCESS;

fapi_try_exit:
return fapi2::current_err;
Expand Down

0 comments on commit 6a6ee6a

Please sign in to comment.