From 1720267b190ad77594742fa76a61c0b13b323598 Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Mon, 6 Aug 2018 17:15:28 -0500 Subject: p9_mss_eff_grouping -- update deconfiguration rules when mirroring is required, prior implementation simply deconfigured all DIMMs behind each ungrouped DMI port this commit updates the deconfiguration logic to consider the amount of memory plugged behind each MBA in each port pair which has an ungrouped DMI port, and attempt to perform the minimum amount of deconfiguration (at the granularity of an MBA) to make the DMI ports groupable Change-Id: I17bd5257e41354f4dbd426d70cc749932615eef1 CQ: SW440621 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/63989 Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: Devon A. Baughen Reviewed-by: Jennifer A. Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/63990 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Christian R. Geddes --- .../procedures/hwp/memory/lib/utils/mem_size.C | 58 +++++++++++++++------- 1 file changed, 39 insertions(+), 19 deletions(-) (limited to 'src/import/chips/centaur') diff --git a/src/import/chips/centaur/procedures/hwp/memory/lib/utils/mem_size.C b/src/import/chips/centaur/procedures/hwp/memory/lib/utils/mem_size.C index b6a3146a3..b07e9c281 100644 --- a/src/import/chips/centaur/procedures/hwp/memory/lib/utils/mem_size.C +++ b/src/import/chips/centaur/procedures/hwp/memory/lib/utils/mem_size.C @@ -74,6 +74,41 @@ bool is_dimm_functional(const uint8_t i_valid_dimm_bitmap, return fapi2::buffer(i_valid_dimm_bitmap).getBit(VALID_DIMM_POS[i_port][i_dimm]); } + +/// +/// @brief Return the total memory size behind an MBA +/// @param[in] i_target the MBA target +/// @param[out] o_size the size of memory in GB behind the target +/// @return FAPI2_RC_SUCCESS if ok +/// +template<> +fapi2::ReturnCode eff_memory_size( const fapi2::Target& i_target, uint64_t& o_size ) +{ + o_size = 0; + uint8_t l_sizes[MAX_PORTS_PER_MBA][MAX_DIMM_PER_PORT] = {}; + uint8_t l_func_dimms_bitmap = 0; + + FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_CEN_MSS_EFF_DIMM_FUNCTIONAL_VECTOR, i_target, l_func_dimms_bitmap), + "Failed to access attribute ATTR_CEN_MSS_EFF_DIMM_FUNCTIONAL_VECTOR for %s", mss::c_str(i_target) ); + + FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_CEN_EFF_DIMM_SIZE, i_target, l_sizes), + "Failed to access attribute ATTR_CEN_EFF_DIMM_SIZE for %s", mss::c_str(i_target) ); + + for( size_t p = 0; p < MAX_PORTS_PER_MBA; ++p) + { + for( size_t d = 0; d < MAX_DIMM_PER_PORT; ++d) + { + if( is_dimm_functional(l_func_dimms_bitmap, p, d) ) + { + o_size += l_sizes[p][d]; + } + }// dimm + }// port + +fapi_try_exit: + return fapi2::current_err; +} + /// /// @brief Return the total memory size behind a DMI /// @param[in] i_target the DMI target @@ -87,25 +122,10 @@ fapi2::ReturnCode eff_memory_size( const fapi2::Target& for (const auto& mba : mss::find_targets(i_target)) { - uint8_t l_sizes[MAX_PORTS_PER_MBA][MAX_DIMM_PER_PORT] = {}; - uint8_t l_func_dimms_bitmap = 0; - - FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_CEN_MSS_EFF_DIMM_FUNCTIONAL_VECTOR, mba, l_func_dimms_bitmap), - "Failed to access attribute ATTR_CEN_MSS_EFF_DIMM_FUNCTIONAL_VECTOR for %s", mss::c_str(mba) ); - - FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_CEN_EFF_DIMM_SIZE, mba, l_sizes), - "Failed to access attribute ATTR_CEN_EFF_DIMM_SIZE for %s", mss::c_str(mba) ); - - for( size_t p = 0; p < MAX_PORTS_PER_MBA; ++p) - { - for( size_t d = 0; d < MAX_DIMM_PER_PORT; ++d) - { - if( is_dimm_functional(l_func_dimms_bitmap, p, d) ) - { - o_size += l_sizes[p][d]; - } - }// dimm - }// port + uint64_t l_mba_size; + FAPI_TRY(eff_memory_size(mba, l_mba_size), + "Error from eff_memory_size (mba: %s)", mss::c_str(mba)); + o_size += l_mba_size; }// mba fapi_try_exit: -- cgit v1.2.1