diff options
author | Andre Marin <aamarin@us.ibm.com> | 2017-06-01 11:49:05 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-06-15 17:06:46 -0400 |
commit | 9431f17c592f3664a2bb6e4a9b0a10b14d72bb42 (patch) | |
tree | d405e7329ded46b63da3bf9a4293d0ec68d07a80 /src/import/generic | |
parent | 80ae8c88329859009d5a89f9a92cb8cb2c736a4a (diff) | |
download | talos-hostboot-9431f17c592f3664a2bb6e4a9b0a10b14d72bb42.tar.gz talos-hostboot-9431f17c592f3664a2bb6e4a9b0a10b14d72bb42.zip |
Add memory size API and unit tests for Cumulus
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>
Diffstat (limited to 'src/import/generic')
-rw-r--r-- | src/import/generic/memory/lib/utils/find.H | 108 | ||||
-rw-r--r-- | src/import/generic/memory/lib/utils/memory_size.H | 11 |
2 files changed, 117 insertions, 2 deletions
diff --git a/src/import/generic/memory/lib/utils/find.H b/src/import/generic/memory/lib/utils/find.H index 41d77114b..239afa10a 100644 --- a/src/import/generic/memory/lib/utils/find.H +++ b/src/import/generic/memory/lib/utils/find.H @@ -140,6 +140,109 @@ inline fapi2::Target<fapi2::TARGET_TYPE_MCBIST> find_target( const fapi2::Target } /// +/// @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 /// @return a vector of fapi2::TARGET_TYPE_DIMM @@ -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; } diff --git a/src/import/generic/memory/lib/utils/memory_size.H b/src/import/generic/memory/lib/utils/memory_size.H index 427d152e2..0c18f90d0 100644 --- a/src/import/generic/memory/lib/utils/memory_size.H +++ b/src/import/generic/memory/lib/utils/memory_size.H @@ -41,6 +41,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 /// @param[in] i_target the fapi2::Target, typically a port |