Skip to content

Commit

Permalink
Add p9a version of eff_memory_size API
Browse files Browse the repository at this point in the history
  Adds mc_type template on eff_memory_size functions to avoid
  symbol duplication on future systems.

Change-Id: I11552c94ac1dfc7ea367e0a6bb5d63e13d18c183
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72790
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Mark Pizzutillo <mark.pizzutillo@ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@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: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72896
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
  • Loading branch information
stermole authored and crgeddes committed Mar 20, 2019
1 parent 71d9884 commit 8fc0e7a
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ bool is_dimm_functional(const uint8_t i_valid_dimm_bitmap,
/// @return FAPI2_RC_SUCCESS if ok
///
template<>
fapi2::ReturnCode eff_memory_size( const fapi2::Target<fapi2::TARGET_TYPE_MBA>& i_target, uint64_t& o_size )
fapi2::ReturnCode eff_memory_size<mss::mc_type::CENTAUR>(
const fapi2::Target<fapi2::TARGET_TYPE_MBA>& i_target,
uint64_t& o_size )
{
o_size = 0;
uint8_t l_sizes[MAX_PORTS_PER_MBA][MAX_DIMM_PER_PORT] = {};
Expand Down Expand Up @@ -116,14 +118,16 @@ fapi_try_exit:
/// @return FAPI2_RC_SUCCESS if ok
///
template<>
fapi2::ReturnCode eff_memory_size( const fapi2::Target<fapi2::TARGET_TYPE_DMI>& i_target, uint64_t& o_size )
fapi2::ReturnCode eff_memory_size<mss::mc_type::CENTAUR>(
const fapi2::Target<fapi2::TARGET_TYPE_DMI>& i_target,
uint64_t& o_size )
{
o_size = 0;

for (const auto& mba : mss::find_targets<fapi2::TARGET_TYPE_MBA>(i_target))
{
uint64_t l_mba_size;
FAPI_TRY(eff_memory_size(mba, l_mba_size),
FAPI_TRY(eff_memory_size<mss::mc_type::CENTAUR>(mba, l_mba_size),
"Error from eff_memory_size (mba: %s)", mss::c_str(mba));
o_size += l_mba_size;
}// mba
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fapi2::ReturnCode self_refresh_exit_helper( const fapi2::Target<fapi2::TARGET_TY
mss::poll_parameters l_poll_parameters(0, 200, 100 * mss::DELAY_1MS, 200, 500);
uint64_t l_memory_size = 0;

FAPI_TRY( mss::eff_memory_size(l_mcbist, l_memory_size) );
FAPI_TRY( mss::eff_memory_size<mss::mc_type::NIMBUS>(l_mcbist, l_memory_size) );
l_poll_parameters.iv_initial_delay = mss::calculate_initial_delay(l_mcbist, (l_memory_size * mss::BYTES_PER_GB));

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -43,24 +43,47 @@
namespace mss
{

///
/// @brief Return the total memory size behind a DIMM target
/// @param[in] i_target the DIMM target
/// @param[out] o_size the size of memory in GB behind the target
/// @return FAPI2_RC_SUCCESS if ok
/// @note The purpose of this specialization is to bridge the gap between different accessor functions
///
template<>
fapi2::ReturnCode eff_memory_size<mss::mc_type::NIMBUS>(
const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
uint64_t& o_size )
{
uint32_t l_size = 0;
o_size = 0;
FAPI_TRY( mss::eff_dimm_size(i_target, l_size) );
o_size = l_size;

fapi_try_exit:
return fapi2::current_err;
}

///
/// @brief Return the total memory size behind an MCA
/// @param[in] i_target the MCA 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<fapi2::TARGET_TYPE_MCA>& i_target, uint64_t& o_size )
fapi2::ReturnCode eff_memory_size<mss::mc_type::NIMBUS>(
const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
uint64_t& o_size )
{
// Don't try to get cute and read the attributes once and loop over the array.
// Cronus honors initToZero which would work, but HB might not and so we might get
// crap in some of the attributes (which we shouldn't access as there's no DIMM there)
uint32_t l_sizes = 0;
uint64_t l_sizes = 0;
o_size = 0;

for (const auto& d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target))
{
FAPI_TRY( mss::eff_dimm_size(d, l_sizes) );
FAPI_TRY( eff_memory_size<mss::mc_type::NIMBUS>(d, l_sizes) );
o_size += l_sizes;
}

Expand All @@ -75,14 +98,16 @@ fapi_try_exit:
/// @return FAPI2_RC_SUCCESS if ok
///
template<>
fapi2::ReturnCode eff_memory_size( const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target, uint64_t& o_size )
fapi2::ReturnCode eff_memory_size<mss::mc_type::NIMBUS>(
const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target,
uint64_t& o_size )
{
o_size = 0;

for (const auto& p : mss::find_targets<fapi2::TARGET_TYPE_MCA>(i_target))
{
uint64_t l_size = 0;
FAPI_TRY( eff_memory_size(p, l_size) );
FAPI_TRY( eff_memory_size<mss::mc_type::NIMBUS>(p, l_size) );
o_size += l_size;
}

Expand Down
7 changes: 4 additions & 3 deletions src/import/chips/p9/procedures/hwp/memory/lib/mcbist/mcbist.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -41,10 +41,11 @@
#include <p9_mc_scom_addresses.H>
#include <p9_mc_scom_addresses_fld.H>

#include <lib/shared/mss_const.H>
#include <generic/memory/lib/utils/find.H>
#include <generic/memory/lib/utils/poll.H>
#include <generic/memory/lib/utils/memory_size.H>
#include <lib/utils/mss_nimbus_conversions.H>
#include <lib/shared/mss_const.H>
#include <lib/utils/bit_count.H>
#include <lib/utils/num.H>
#include <lib/mcbist/patterns.H>
Expand Down Expand Up @@ -1866,7 +1867,7 @@ class program
constexpr uint64_t l_seconds = SEC_IN_HOUR * BG_SCRUB_IN_HOURS;

FAPI_TRY( mss::freq(i_target, l_freq) );
FAPI_TRY( mss::eff_memory_size(i_target, l_size) );
FAPI_TRY( mss::eff_memory_size<mss::mc_type::NIMBUS>(i_target, l_size) );

calculate_min_cmd_gap(i_target, l_freq, l_size, l_min_cmd_gap, l_timebase);

Expand Down
4 changes: 2 additions & 2 deletions src/import/chips/p9/procedures/hwp/memory/p9_mss_memdiag.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -95,7 +95,7 @@ extern "C"
mss::poll_parameters l_poll_parameters(INITIAL_DELAY, INITIAL_SIM_DELAY, DELAY_TIME, SIM_DELAY_TIME, MAX_POLL_COUNT);
uint64_t l_memory_size = 0;

FAPI_TRY( mss::eff_memory_size(i_target, l_memory_size) );
FAPI_TRY( mss::eff_memory_size<mss::mc_type::NIMBUS>(i_target, l_memory_size) );
l_poll_parameters.iv_initial_delay = mss::calculate_initial_delay(i_target, (l_memory_size * mss::BYTES_PER_GB));

FAPI_TRY( mss::is_simulation( l_sim) );
Expand Down
4 changes: 2 additions & 2 deletions src/import/chips/p9/procedures/hwp/memory/p9_mss_scrub.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -82,7 +82,7 @@ fapi2::ReturnCode p9_mss_scrub( const fapi2::Target<TARGET_TYPE_MCBIST>& i_targe
mss::poll_parameters l_poll_parameters(0, 200, 100 * mss::DELAY_1MS, 200, 10000);
uint64_t l_memory_size = 0;

FAPI_TRY( mss::eff_memory_size(i_target, l_memory_size) );
FAPI_TRY( mss::eff_memory_size<mss::mc_type::NIMBUS>(i_target, l_memory_size) );
l_poll_parameters.iv_initial_delay = mss::calculate_initial_delay(i_target, (l_memory_size * mss::BYTES_PER_GB));

FAPI_TRY( mss::is_simulation( l_sim) );
Expand Down
11 changes: 6 additions & 5 deletions src/import/chips/p9/procedures/hwp/nest/p9_mss_eff_grouping.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -46,6 +46,7 @@
#include <p9_mss_eff_grouping.H>
#include <p9_fbc_utils.H>
#include <map>
#include <lib/shared/mss_const.H>
#include <generic/memory/lib/utils/memory_size.H>
#include <lib/mss_attribute_accessors.H>

Expand Down Expand Up @@ -534,7 +535,7 @@ fapi2::ReturnCode EffGroupingMcaAttrs::getAttrs(

// Get the amount of memory behind this MCA target
// Note: DIMM must be enabled to be accounted for.
FAPI_TRY(mss::eff_memory_size(i_target, iv_dimmSize),
FAPI_TRY(mss::eff_memory_size<mss::mc_type::NIMBUS>(i_target, iv_dimmSize),
"Error returned from eff_memory_size, l_rc 0x%.8X",
(uint64_t)fapi2::current_err);

Expand Down Expand Up @@ -608,7 +609,7 @@ fapi2::ReturnCode EffGroupingDmiAttrs::getAttrs(
iv_membuf = l_attachedMembuf.front();

// Get the amount of memory behind this DMI target
FAPI_TRY(mss::eff_memory_size(i_target, iv_dimmSize),
FAPI_TRY(mss::eff_memory_size<mss::mc_type::CENTAUR>(i_target, iv_dimmSize),
"Error returned from eff_memory_size, l_rc 0x%.8X",
(uint64_t)fapi2::current_err);
}
Expand Down Expand Up @@ -3129,8 +3130,8 @@ fapi2::ReturnCode findMinDeconfigForPortPair(
{
if (l_mba_functional[ii][jj])
{
FAPI_TRY(mss::eff_memory_size(l_mba_targets[ii][l_mba_tgt_index[ii][jj]],
l_mba_size[ii][jj]),
FAPI_TRY(mss::eff_memory_size<mss::mc_type::CENTAUR>(l_mba_targets[ii][l_mba_tgt_index[ii][jj]],
l_mba_size[ii][jj]),
"Error from eff_memory_size");
FAPI_DBG("Set MBA size[%d][%d] = %d",
ii, jj, l_mba_size[ii][jj]);
Expand Down
7 changes: 4 additions & 3 deletions src/import/chips/p9/procedures/hwp/nest/p9_mss_setup_bars.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -45,6 +45,7 @@
#include <p9n2_mc_scom_addresses.H>
#include <p9n2_mc_scom_addresses_fld.H>
#include <map>
#include <lib/shared/mss_const.H>
#include <generic/memory/lib/utils/memory_size.H>

///----------------------------------------------------------------------------
Expand Down Expand Up @@ -293,7 +294,7 @@ fapi2::ReturnCode getMcMemSize(
(uint64_t)fapi2::current_err);

// Get the amount of memory behind this MCA target
FAPI_TRY(mss::eff_memory_size(l_mca, l_mcaSize),
FAPI_TRY(mss::eff_memory_size<mss::mc_type::NIMBUS>(l_mca, l_mcaSize),
"Error returned from eff_memory_size - MCA, l_rc 0x%.8X",
(uint64_t)fapi2::current_err);

Expand Down Expand Up @@ -327,7 +328,7 @@ fapi2::ReturnCode getMcMemSize(
(uint64_t)fapi2::current_err);

// Get the amount of memory behind this DMI target
FAPI_TRY(mss::eff_memory_size(l_dmi, l_dmiSize),
FAPI_TRY(mss::eff_memory_size<mss::mc_type::CENTAUR>(l_dmi, l_dmiSize),
"Error returned from eff_memory_size - DMI, l_rc 0x%.8X",
(uint64_t)fapi2::current_err);

Expand Down
3 changes: 2 additions & 1 deletion src/import/chips/p9/procedures/hwp/nest/p9_mss_setup_bars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2015,2017
# Contributors Listed Below - COPYRIGHT 2015,2019
# [+] International Business Machines Corp.
#
#
Expand All @@ -25,6 +25,7 @@

# Include the macros and things for MSS procedures
PROCEDURE=p9_mss_setup_bars
$(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/procedures/hwp/memory/)
lib$(PROCEDURE)_DEPLIBS+=cen
$(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH))
$(call BUILD_PROCEDURE)
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,45 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */

///
/// @file axone_memory_size.C
/// @brief Return the effective memory size behind a target
///
// *HWP HWP Owner: Andre Marin <aamarin@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 <lib/shared/axone_consts.H>
#include <mss_generic_attribute_getters.H>
#include <generic/memory/lib/utils/memory_size.H>

namespace mss
{

///
/// @brief Return the total memory size behind a DIMM target
/// @param[in] i_target the DIMM target
/// @param[out] o_size the size of memory in GB behind the target
/// @return FAPI2_RC_SUCCESS if ok
/// @note The purpose of this specialization is to bridge the gap between different accessor functions
///
template<>
fapi2::ReturnCode eff_memory_size<mss::mc_type::EXPLORER>(
const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
uint64_t& o_size )
{
uint32_t l_size = 0;
o_size = 0;
FAPI_TRY( mss::attr::get_dimm_size(i_target, l_size) );
o_size = l_size;

fapi_try_exit:
return fapi2::current_err;
}

}

0 comments on commit 8fc0e7a

Please sign in to comment.