Skip to content

Commit

Permalink
Add memory size API and unit tests for Cumulus
Browse files Browse the repository at this point in the history
Change-Id: Iddd500f7643a9f3d0b2a9e537ce87ad2c0258ec3
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40327
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: JACOB L. HARVEY <jlharvey@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40333
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
aamarin authored and dcrowell77 committed Jun 15, 2017
1 parent 80ae8c8 commit 9431f17
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 2 deletions.
108 changes: 106 additions & 2 deletions src/import/generic/memory/lib/utils/find.H
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,109 @@ inline fapi2::Target<fapi2::TARGET_TYPE_MCBIST> find_target( const fapi2::Target
return i_target.getParent<fapi2::TARGET_TYPE_MCA>().getParent<fapi2::TARGET_TYPE_MCBIST>();
}

///
/// @brief find the PROC_CHIP given a MBA
/// @param[in] i_target the fapi2 target MBA
/// @return a DMI target.
///
template<>
inline fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> find_target( const fapi2::Target<fapi2::TARGET_TYPE_MBA>& i_target)
{
return i_target.getParent<fapi2::TARGET_TYPE_MEMBUF_CHIP>()
.getParent<fapi2::TARGET_TYPE_DMI>()
.getParent<fapi2::TARGET_TYPE_PROC_CHIP>();
}

///
/// @brief find the DMI given an MBA
/// @param[in] i_target the fapi2 target MBA
/// @return a DMI target.
///
template<>
inline fapi2::Target<fapi2::TARGET_TYPE_DMI> find_target( const fapi2::Target<fapi2::TARGET_TYPE_MBA>& i_target)
{
return i_target.getParent<fapi2::TARGET_TYPE_MEMBUF_CHIP>().getParent<fapi2::TARGET_TYPE_DMI>();
}

///
/// @brief find the DMI given a MEMBUF
/// @param[in] i_target the fapi2 target MEMBUF
/// @return a DMI target.
///
template<>
inline fapi2::Target<fapi2::TARGET_TYPE_DMI> find_target( const fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>& i_target)
{
return i_target.getParent<fapi2::TARGET_TYPE_DMI>();
}

///
/// @brief find the PROC given a MEMBUF
/// @param[in] i_target the fapi2 target MEMBUF
/// @return a PROC target.
///
template<>
inline fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> find_target( const fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>&
i_target)
{
return i_target.getParent<fapi2::TARGET_TYPE_DMI>().getParent<fapi2::TARGET_TYPE_PROC_CHIP>();
}

///
/// @brief find all the DMIs connected to an PROC_CHIP
/// @param[in] i_target a fapi2::Target DMI
/// @return a vector of fapi2::TARGET_TYPE_MBA
///
template<>
inline std::vector< fapi2::Target<fapi2::TARGET_TYPE_DMI> >
find_targets( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target )
{
return i_target.getChildren<fapi2::TARGET_TYPE_DMI>();
}

///
/// @brief find all the MEMBUFs connected to an DMI
/// @param[in] i_target a fapi2::Target DMI
/// @return a vector of fapi2::TARGET_TYPE_MEMBUF_CHIP
///
template<>
inline std::vector< fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> >
find_targets( const fapi2::Target<fapi2::TARGET_TYPE_DMI>& i_target )
{
return i_target.getChildren<fapi2::TARGET_TYPE_MEMBUF_CHIP>();
}

///
/// @brief find all the MBAs connected to an MEMBUF
/// @param[in] i_target a fapi2::Target MEMBUF_CHIP
/// @return a vector of fapi2::TARGET_TYPE_MBA
///
template<>
inline std::vector< fapi2::Target<fapi2::TARGET_TYPE_MBA> >
find_targets( const fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>& i_target )
{
return i_target.getChildren<fapi2::TARGET_TYPE_MBA>();
}

///
/// @brief find all the MBA connected to an DMI
/// @param[in] i_target a fapi2::Target DMI
/// @return a vector of fapi2::TARGET_TYPE_MBA
///
template<>
inline std::vector< fapi2::Target<fapi2::TARGET_TYPE_MBA> >
find_targets( const fapi2::Target<fapi2::TARGET_TYPE_DMI>& i_target )
{
std::vector< fapi2::Target<fapi2::TARGET_TYPE_MBA> > l_mbas;

for (const auto& membuf_chip : i_target.getChildren<fapi2::TARGET_TYPE_MEMBUF_CHIP>())
{
auto l_these_mbas( membuf_chip.getChildren<fapi2::TARGET_TYPE_MBA>() );
l_mbas.insert(l_mbas.end(), l_these_mbas.begin(), l_these_mbas.end());
}

return l_mbas;
}

///
/// @brief find all the dimm connected to an MCS
/// @param[in] i_target a fapi2::Target MCS
Expand Down Expand Up @@ -234,14 +337,15 @@ inline std::vector< fapi2::Target<fapi2::TARGET_TYPE_MCA> > find_targets
}

///
/// @brief find all the MCA connected to an MCBIST
/// @param[in] i_target a fapi2::Target MCBIST
/// @brief find all the MCA connected to an MCA
/// @param[in] i_target a fapi2::Target MCA
/// @return a vector of fapi2::TARGET_TYPE_MCA
///
template<>
inline std::vector< fapi2::Target<fapi2::TARGET_TYPE_MCA> > find_targets
( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target )
{
// TODO - RTC:174905. Find out if we really need a find API that returns a vector of MCA from an MCA
std::vector< fapi2::Target<fapi2::TARGET_TYPE_MCA> > l_temp = {i_target};
return l_temp;
}
Expand Down
11 changes: 11 additions & 0 deletions src/import/generic/memory/lib/utils/memory_size.H
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@

namespace mss
{
///
/// @brief Check if a given DIMM is functional
/// @param[in] i_valid_dimm_bitmap from ATTR_CEN_MSS_EFF_DIMM_FUNCTIONAL_VECTOR
/// @param[in] i_port port index [0:1]
/// @param[in] i_dimm dimm index [0:1]
/// @return true if dimm is functional, false otherwise
///
bool is_dimm_functional(const uint8_t i_valid_dimm_bitmap,
const uint8_t i_port,
const uint8_t i_dimm);

///
/// @brief Return the total memory size behind the target
/// @tparam T fapi2 target template parameter
Expand Down

0 comments on commit 9431f17

Please sign in to comment.