Skip to content

Commit

Permalink
Simplify spd factory mapping to share among controllers
Browse files Browse the repository at this point in the history
Also happened to address RTC 163150 and RTC:152390
with this refactoring.

Change-Id: I72b92215063f270ccabe3732034ffaf4242de2ea
Original-Change-Id: Iaba29d96f577c74bda7c3b147c16749eb1d861e5
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36766
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: Brian R. Silver <bsilver@us.ibm.com>
Reviewed-by: JACOB L. HARVEY <jlharvey@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+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://ralgit01.raleigh.ibm.com/gerrit1/37418
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
aamarin authored and dcrowell77 committed Mar 3, 2017
1 parent d78ccfc commit 6db2b83
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.C
Expand Up @@ -774,15 +774,15 @@ fapi_try_exit:
///
/// @brief Creates factory object & SPD data caches
/// @param[in] i_target controller target
/// @param[out] o_factory_caches map of factory objects with a dimm position key
/// @param[out] o_factory_caches vector of factory objects
/// @param[in] i_pDecoder custom decoder to populate cache (ignored for this specialization)
/// @return FAPI2_RC_SUCCESS if okay
/// @note This specialization is suited for creating a cache with platform
/// SPD data.
///
template<>
fapi2::ReturnCode populate_decoder_caches( const fapi2::Target<TARGET_TYPE_MCS>& i_target,
std::map<uint32_t, std::shared_ptr<decoder> >& o_factory_caches,
std::vector< std::shared_ptr<decoder> >& o_factory_caches,
const std::shared_ptr<decoder>& i_pDecoder)
{
// Input decoder for this version of populating cache would get overriden
Expand All @@ -807,8 +807,8 @@ fapi2::ReturnCode populate_decoder_caches( const fapi2::Target<TARGET_TYPE_MCS>&
FAPI_TRY( factory(l_dimm, l_spd, l_pDecoder),
"%s. Failed SPD factory, could not instantiate decoder object", mss::c_str(i_target) );

// Populate spd caches maps based on dimm pos
o_factory_caches.emplace( std::make_pair( pos(l_dimm), l_pDecoder ) );
// Populate spd caches
o_factory_caches.push_back( l_pDecoder );
}

// Populate some of the DIMM attributes early. This allows the following code to make
Expand All @@ -825,15 +825,15 @@ fapi_try_exit:
///
/// @brief Creates factory object & SPD data caches
/// @param[in] i_target the dimm target
/// @param[out] o_factory_caches map of factory objects with a dimm position key
/// @param[out] o_factory_caches vector of factory objects
/// @param[in] i_pDecoder custom decoder to populate cache (nullptr default)
/// @return FAPI2_RC_SUCCESS if okay
/// @note This specialization is suited for creating a cache with custom
/// SPD data (e.g. testing custom SPD).
///
template<>
fapi2::ReturnCode populate_decoder_caches( const fapi2::Target<TARGET_TYPE_DIMM>& i_target,
std::map<uint32_t, std::shared_ptr<decoder> >& o_factory_caches,
std::vector< std::shared_ptr<decoder> >& o_factory_caches,
const std::shared_ptr<decoder>& i_pDecoder)
{
if(i_pDecoder == nullptr)
Expand All @@ -845,7 +845,7 @@ fapi2::ReturnCode populate_decoder_caches( const fapi2::Target<TARGET_TYPE_DIMM>

// Custom decoder provided (usually done for testing)
// Populate custom spd caches maps one dimm at a time
o_factory_caches.emplace( std::make_pair( pos(i_target), i_pDecoder ) );
o_factory_caches.push_back( i_pDecoder );

// Populate some of the DIMM attributes early. This allows the following code to make
// decisions based on DIMM information. Expressly done after the factory has decided on the SPD version
Expand Down

0 comments on commit 6db2b83

Please sign in to comment.