summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/memory/lib/spd
diff options
context:
space:
mode:
authorAndre Marin <aamarin@us.ibm.com>2017-02-21 00:43:35 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-03-01 09:12:37 -0500
commit77b203d67647636e2f67135d84db184432eedf7e (patch)
tree93ec48198d0deecf91dd2629c65e69f0ab33b264 /src/import/chips/p9/procedures/hwp/memory/lib/spd
parent7c5519c9412ffff7178f9ac0b93dd215a6c6b839 (diff)
downloadtalos-hostboot-77b203d67647636e2f67135d84db184432eedf7e.tar.gz
talos-hostboot-77b203d67647636e2f67135d84db184432eedf7e.zip
Simplify spd factory mapping to share among controllers
Also happened to address RTC 163150 and RTC:152390 with this refactoring. 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/36769 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/chips/p9/procedures/hwp/memory/lib/spd')
-rw-r--r--src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder.H2
-rw-r--r--src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.C49
-rw-r--r--src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.H8
3 files changed, 24 insertions, 35 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder.H b/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder.H
index 2cd744ae8..783df06e9 100644
--- a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder.H
+++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder.H
@@ -176,7 +176,6 @@ inline uint8_t extract_spd_field(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i
class decoder
{
protected:
- const fapi2::Target<fapi2::TARGET_TYPE_DIMM> iv_target;
enum
{
@@ -480,6 +479,7 @@ class decoder
virtual fapi2::ReturnCode prim_sdram_logical_ranks( uint8_t& o_logical_ranks );
public:
+ const fapi2::Target<fapi2::TARGET_TYPE_DIMM> iv_target;
std::shared_ptr<dimm_module_decoder> iv_module_decoder;
std::vector<uint8_t> iv_spd_data;
rcw_settings iv_raw_card;
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.C b/src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.C
index b6d605133..2437c4305 100644
--- a/src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.C
+++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.C
@@ -645,37 +645,26 @@ fapi2::ReturnCode raw_card_factory(const fapi2::Target<TARGET_TYPE_DIMM>& i_targ
switch(l_dimm_type)
{
case fapi2::ENUM_ATTR_EFF_DIMM_TYPE_RDIMM:
+ if( !find_value_from_key( mss::rdimm::RAW_CARDS, l_ref_raw_card_rev, o_raw_card) )
+ {
+ FAPI_ERR( "Invalid reference raw card recieved for RDIMM: %d", l_ref_raw_card_rev );
+ return fapi2::FAPI2_RC_FALSE;
+ }
- FAPI_ASSERT( find_value_from_key( mss::rdimm::RAW_CARDS, l_ref_raw_card_rev, o_raw_card),
- fapi2::MSS_INVALID_RAW_CARD()
- .set_DIMM_TYPE(l_dimm_type)
- .set_RAW_CARD_REV(l_ref_raw_card_rev)
- .set_DIMM_TARGET(i_target),
- "Invalid reference raw card recieved for RDIMM: %d for %s",
- l_ref_raw_card_rev,
- mss::c_str(i_target) );
break;
case fapi2::ENUM_ATTR_EFF_DIMM_TYPE_LRDIMM:
+ if( !find_value_from_key( mss::lrdimm::RAW_CARDS, l_ref_raw_card_rev, o_raw_card) )
+ {
+ FAPI_ERR( "Invalid reference raw card recieved for LRDIMM: %d", l_ref_raw_card_rev );
+ return fapi2::FAPI2_RC_FALSE;
+ }
- FAPI_ASSERT( find_value_from_key( mss::lrdimm::RAW_CARDS, l_ref_raw_card_rev, o_raw_card),
- fapi2::MSS_INVALID_RAW_CARD()
- .set_DIMM_TYPE(l_dimm_type)
- .set_RAW_CARD_REV(l_ref_raw_card_rev)
- .set_DIMM_TARGET(i_target),
- "Invalid reference raw card recieved for LRDIMM: %d for %s",
- l_ref_raw_card_rev,
- mss::c_str(i_target));
break;
default:
-
- FAPI_ASSERT( false,
- fapi2::MSS_INVALID_DIMM_TYPE()
- .set_DIMM_TYPE(l_dimm_type)
- .set_TARGET(i_target),
- "Recieved invalid dimm type: %d for %s",
- l_dimm_type, mss::c_str(i_target) );
+ FAPI_ERR( "Recieved invalid dimm type: %d", l_dimm_type);
+ return fapi2::FAPI2_RC_FALSE;
break;
}
@@ -774,7 +763,7 @@ 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
@@ -782,7 +771,7 @@ fapi_try_exit:
///
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
@@ -807,8 +796,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
@@ -825,7 +814,7 @@ 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
@@ -833,7 +822,7 @@ fapi_try_exit:
///
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)
@@ -845,7 +834,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
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.H b/src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.H
index 6969dd8d8..88728df10 100644
--- a/src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.H
+++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/spd_factory.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -150,13 +150,13 @@ fapi2::ReturnCode factory(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target
///
/// @brief Creates factory object & SPD data caches
/// @param[in] i_target the fapi2 target
-/// @param[out] o_factory_caches map of factory objects with a dimm position key
-/// @param[in] i_pDecoder optional input decoder to insert custom decoder, defaulted to nullptr
+/// @param[out] o_factory_caches vector of factory objects
+/// @param[in] i_pDecoder optional input decoder to insert custom decoder (nullptr default)
/// @return FAPI2_RC_SUCCESS if okay
///
template<fapi2::TargetType T>
fapi2::ReturnCode populate_decoder_caches(const fapi2::Target<T>& 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 = nullptr);
OpenPOWER on IntegriCloud