diff options
author | Andre Marin <aamarin@us.ibm.com> | 2016-10-27 13:33:25 -0500 |
---|---|---|
committer | Christian R. Geddes <crgeddes@us.ibm.com> | 2016-11-10 11:09:15 -0500 |
commit | 39fb9cb25801f25a16af611fc9ca52bd70091c5b (patch) | |
tree | 41cfd868430a86465ea0047942be43e0ae96b54c /src/import | |
parent | c52fc60516b6346cb06f05f438adb1c1c771e6b7 (diff) | |
download | talos-hostboot-39fb9cb25801f25a16af611fc9ca52bd70091c5b.tar.gz talos-hostboot-39fb9cb25801f25a16af611fc9ca52bd70091c5b.zip |
Fix RCW infrastructure for LRDIMM and RDIMMs
LRDIMMs and RDIMM can share the same reference raw card
identification from SPD and must be managed independent of
each other
Change-Id: I88ee324bd3774c99befbc08ac0fe02f9ecb2101d
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/32090
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Reviewed-by: Brian R. Silver <bsilver@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/32091
Reviewed-by: Hostboot Team <hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Diffstat (limited to 'src/import')
12 files changed, 484 insertions, 240 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/eff_config.C b/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/eff_config.C index 15df95deb..0780a99ad 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/eff_config.C +++ b/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/eff_config.C @@ -43,7 +43,7 @@ #include <lib/mss_vpd_decoder.H> #include <lib/spd/spd_factory.H> #include <lib/spd/common/spd_decoder.H> -#include <lib/spd/common/raw_cards.H> +#include <lib/spd/common/rcw_settings.H> #include <lib/eff_config/timing.H> #include <lib/dimm/rank.H> #include <lib/utils/conversions.H> diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/raw_cards.C b/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/raw_cards.C deleted file mode 100644 index 6d6fcf445..000000000 --- a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/raw_cards.C +++ /dev/null @@ -1,159 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/spd/common/raw_cards.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/// -/// @file raw_cards.C -/// @brief Raw card data structure -/// -// *HWP HWP Owner: Andre Marin <aamarin@us.ibm.com> -// *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com> -// *HWP Team: Memory -// *HWP Level: 2 -// *HWP Consumed by: FSP:HB - -// std lib -#include <vector> - -// fapi2 -#include <fapi2.H> - -// mss lib -#include <lib/spd/common/raw_cards.H> - -namespace mss -{ -namespace rcd01 -{ - -/// -/// @brief raw card B0 settings -/// -// TODO RTC:160116 Fill in valid RCD data for LRDIMM -raw_card_t raw_card_b0( 0x00, // RC00 - 0x00, // RC01 (C might be the right answer) - 0x00, // RC02 - 0x0F, // RC06_7 - 0x03, // RC08 - 0x00, // RC09 - 0x0E, // RC0B - 0x00, // RC0C - 0x00, // RC0E - 0x00, // RC0F - 0x00, // RC1X - 0x00, // RC2X - 0x00, // RC4X - 0x00, // RC5X - 0x00, // RC6C - 0x00, // RC8X - 0x00, // RC9X - 0x00, // RCAx - 0x07);// RCBX - -/// -/// @brief raw card C1 settings -/// -raw_card_t raw_card_c1( 0x00, // RC00 - 0x00, // RC01 (C might be the right answer?) - 0x00, // RC02 - 0x0F, // RC06_07 - 0x03, // RC08 - 0x00, // RC09 - 0x0E, // RC0B - 0x00, // RC0C - 0x0D, // RC0E - 0x00, // RC0F - 0x00, // RC1X - 0x00, // RC2X - 0x00, // RC4X - 0x00, // RC5X - 0x00, // RC6X - 0x00, // RC8X - 0x00, // RC9X - 0x00, // RCAX - 0x07);// RCBX - -/// -/// @brief raw card A1 settings -/// -raw_card_t raw_card_a1( 0x00, // RC00 - 0x00, // RC01 (C might be the right answer?) - 0x00, // RC02 - 0x0F, // RC06_07 - 0x03, // RC08 - 0x00, // RC09 - 0x0E, // RC0B - 0x00, // RC0C - 0x0D, // RC0E - 0x00, // RC0F - 0x00, // RC1X - 0x00, // RC2X - 0x00, // RC4X - 0x00, // RC5X - 0x00, // RC6X - 0x00, // RC8X - 0x00, // RC9X - 0x00, // RCAX - 0x07);// RCBX - -/// -/// @brief raw card VBU settings -/// -raw_card_t raw_card_vbu( 0x00, // RC00 - 0x00, // RC01 - 0x00, // RC02 - 0x0F, // RC06_07 - 0x03, // RC08 - 0x00, // RC09 - 0x0E, // RC0B - 0x00, // RC0C - 0x00, // RC0E - 0x00, // RC0F - 0x00, // RC1X - 0x00, // RC2X - 0x00, // RC4X - 0x00, // RC5X - 0x00, // RC6X - 0x00, // RC8X - 0x00, // RC9X - 0x00, // RCAX - 0x07);// RCBX - - -// TODO - RTC:160121 Catch all for adding raw card data for DIMMs -// Not sure if we can have the same raw card revision for rcd01 and rcd02, -// if not, then we can move this vector outside of the rcd01 namespace. -// -// !! WARNING: THIS VECTOR MUST BE SORTED BY ENUM VALUE!! -// -const std::vector< std::pair< uint8_t , rcd01::raw_card_t> > RAW_CARDS = -{ - {raw_card_rev::B0, rcd01::raw_card_b0}, - {raw_card_rev::A1, rcd01::raw_card_a1}, - {raw_card_rev::C1, rcd01::raw_card_c1}, - {raw_card_rev::VBU, rcd01::raw_card_vbu}, -}; - -}// rcd01 -}// mss diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/raw_cards.H b/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/rcw_settings.H index df0fc9d85..d71896316 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/raw_cards.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/rcw_settings.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/spd/common/raw_cards.H $ */ +/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/spd/common/rcw_settings.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ @@ -38,38 +38,17 @@ #include <fapi2.H> #include <cstdint> +#include <vector> namespace mss { -namespace rcd01 -{ - -// In the order of the vector below which needs to be sorted by enum value -enum raw_card_rev : uint8_t -{ - // TODO RTC:160116 Fill in valid RCD data for LRDIMM - B0 = 0x01, - - A1 = 0x20, - - // RDIMM power-on - C1 = 0x22, - - // TK - Change to 0xFF - AAM - // In the spec hex XF (where X - don't care) - // means no JEDEC reference raw card design used. - // We will want to redefine it to be VBU reference raw card - // since it is unlikely we will use a DIMM w/o a - // reference caw card design. - VBU = 0x23, -}; /// /// @brief raw card VBU settings /// @note contains RCD settings for hard-coded values /// that are not application specific. /// Application specific settings are dervied in eff_config -struct raw_card_t +struct rcw_settings { uint64_t iv_rc00; uint64_t iv_rc01; @@ -94,17 +73,28 @@ struct raw_card_t /// /// @brief default ctor /// - raw_card_t() = default; + rcw_settings() = default; /// /// @brief Equality operator /// @param[in] i_rhs the right-hand side of the == operation /// @return true iff both raw_cards are equal /// - inline bool operator==(const raw_card_t& i_rhs) const + inline bool operator==(const rcw_settings& i_rhs) const { // Betting this is faster than all the conditionals ... - return (memcmp(this, &i_rhs, sizeof(raw_card_t)) == 0); + return (memcmp(this, &i_rhs, sizeof(rcw_settings)) == 0); + } + + /// + /// @brief Logical not operator + /// @param[in] i_rhs the right-hand side of the != operation + /// @return true iff both raw_cards are not equal + /// + inline bool operator!=(const rcw_settings& i_rhs) const + { + // Betting this is faster than all the conditionals ... + return !(*this == i_rhs); } /// @@ -129,25 +119,25 @@ struct raw_card_t /// @param[in] i_rcax setting for register control word (RCAX) /// @param[in] i_rcbx setting for register control word (RCBX) /// - constexpr raw_card_t( const uint64_t i_rc00, - const uint64_t i_rc01, - const uint64_t i_rc02, - const uint64_t i_rc06_07, - const uint64_t i_rc08, - const uint64_t i_rc09, - const uint64_t i_rc0b, - const uint64_t i_rc0c, - const uint64_t i_rc0e, - const uint64_t i_rc0f, - const uint64_t i_rc1x, - const uint64_t i_rc2x, - const uint64_t i_rc4x, - const uint64_t i_rc5x, - const uint64_t i_rc6x, - const uint64_t i_rc8x, - const uint64_t i_rc9x, - const uint64_t i_rcax, - const uint64_t i_rcbx ) + constexpr rcw_settings( const uint64_t i_rc00, + const uint64_t i_rc01, + const uint64_t i_rc02, + const uint64_t i_rc06_07, + const uint64_t i_rc08, + const uint64_t i_rc09, + const uint64_t i_rc0b, + const uint64_t i_rc0c, + const uint64_t i_rc0e, + const uint64_t i_rc0f, + const uint64_t i_rc1x, + const uint64_t i_rc2x, + const uint64_t i_rc4x, + const uint64_t i_rc5x, + const uint64_t i_rc6x, + const uint64_t i_rc8x, + const uint64_t i_rc9x, + const uint64_t i_rcax, + const uint64_t i_rcbx ) : iv_rc00(i_rc00), iv_rc01(i_rc01), iv_rc02(i_rc02), @@ -172,18 +162,9 @@ struct raw_card_t /// /// @brief default dtor /// - ~raw_card_t() = default; + ~rcw_settings() = default; }; -// Exposed so we can test them. -extern raw_card_t raw_card_b0; -extern raw_card_t raw_card_c1; -extern raw_card_t raw_card_a1; -extern raw_card_t raw_card_vbu; - -extern const std::vector< std::pair< uint8_t, rcd01::raw_card_t> > RAW_CARDS; - -}// rcd01 }// mss #endif //_MSS_RAW_CARDS_H_ diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder.C b/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder.C index 864805541..132dec2e6 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder.C +++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder.C @@ -42,7 +42,7 @@ // mss lib #include <lib/spd/common/spd_decoder.H> #include <lib/spd/rdimm/rdimm_decoder.H> -#include <lib/spd/common/raw_cards.H> +#include <lib/spd/common/rcw_settings.H> #include <lib/utils/checker.H> #include <lib/utils/c_str.H> #include <lib/utils/find.H> @@ -70,7 +70,7 @@ namespace spd decoder::decoder(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, const std::vector<uint8_t>& i_spd_data, const std::shared_ptr<dimm_module_decoder>& i_module_decoder, - const rcd01::raw_card_t& i_raw_card) + const rcw_settings& i_raw_card) : iv_module_decoder(i_module_decoder), iv_spd_data(i_spd_data), iv_raw_card(i_raw_card), 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 38cceccdc..fcbcf32b7 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 @@ -46,7 +46,7 @@ // mss lib #include <lib/spd/common/dimm_module_decoder.H> -#include <lib/spd/common/raw_cards.H> +#include <lib/spd/common/rcw_settings.H> #include <lib/spd/rdimm/rdimm_decoder.H> #include <lib/spd/lrdimm/lrdimm_decoder.H> #include <lib/utils/c_str.H> @@ -442,7 +442,7 @@ class decoder public: std::shared_ptr<dimm_module_decoder> iv_module_decoder; std::vector<uint8_t> iv_spd_data; - rcd01::raw_card_t iv_raw_card; + rcw_settings iv_raw_card; // Default constructor deleted decoder() = delete; @@ -457,7 +457,7 @@ class decoder decoder(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, const std::vector<uint8_t>& i_spd_data, const std::shared_ptr<dimm_module_decoder>& i_module_decoder, - const rcd01::raw_card_t& i_raw_card); + const rcw_settings& i_raw_card); /// /// @brief Default dtor @@ -1405,7 +1405,7 @@ class decoder_v1_1 : public decoder decoder_v1_1(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, const std::vector<uint8_t>& i_spd_data, const std::shared_ptr<dimm_module_decoder>& i_module_decoder, - const rcd01::raw_card_t& i_raw_card); + const rcw_settings& i_raw_card); /// /// @brief Default dtor diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder_v1_1.C b/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder_v1_1.C index 0ae108f32..0a3e0e142 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder_v1_1.C +++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/common/spd_decoder_v1_1.C @@ -65,7 +65,7 @@ namespace spd decoder_v1_1::decoder_v1_1(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, const std::vector<uint8_t>& i_spd_data, const std::shared_ptr<dimm_module_decoder>& i_module_decoder, - const rcd01::raw_card_t& i_raw_card) + const rcw_settings& i_raw_card) : decoder(i_target, i_spd_data, i_module_decoder, i_raw_card) {} diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/lrdimm/lrdimm_raw_cards.C b/src/import/chips/p9/procedures/hwp/memory/lib/spd/lrdimm/lrdimm_raw_cards.C new file mode 100644 index 000000000..dfbef75e6 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/lrdimm/lrdimm_raw_cards.C @@ -0,0 +1,86 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/spd/lrdimm/lrdimm_raw_cards.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/// +/// @file raw_cards.C +/// @brief LRDIMM raw card data structure +/// Contains RCW settings per raw card rev +/// +// *HWP HWP Owner: Andre Marin <aamarin@us.ibm.com> +// *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 2 +// *HWP Consumed by: FSP:HB + +// std lib +#include <vector> + +// fapi2 +#include <fapi2.H> + +// mss lib +#include <lib/spd/lrdimm/lrdimm_raw_cards.H> + +namespace mss +{ + +/// +/// @brief raw card B0 settings +/// +// TODO RTC:160116 Fill in valid RCD data for LRDIMM +rcw_settings lrdimm_rc_b0( 0x00, // RC00 + 0x00, // RC01 (C might be the right answer) + 0x00, // RC02 + 0x1F, // RC06_7 + 0x03, // RC08 + 0x00, // RC09 + 0x0E, // RC0B + 0x00, // RC0C + 0x00, // RC0E + 0x00, // RC0F + 0x00, // RC1X + 0x00, // RC2X + 0x00, // RC4X + 0x00, // RC5X + 0x00, // RC6C + 0x00, // RC8X + 0x00, // RC9X + 0x00, // RCAx + 0x07);// RCBX + +namespace lrdimm +{ + +// TODO - RTC:160121 Catch all for adding raw card data for DIMMs +const std::vector< std::pair< uint8_t , rcw_settings> > RAW_CARDS = +{ + // I expect this to grow as Warren M. expects us to have + // settings for every raw card that JEDEC puts out. Openpower + // can't break due to a missing raw card... + {raw_card_rev::B0, lrdimm_rc_b0}, +}; + +}// lrdimm +}// mss diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/lrdimm/lrdimm_raw_cards.H b/src/import/chips/p9/procedures/hwp/memory/lib/spd/lrdimm/lrdimm_raw_cards.H new file mode 100644 index 000000000..e6f4cf8db --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/lrdimm/lrdimm_raw_cards.H @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/spd/lrdimm/lrdimm_raw_cards.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/// +/// @file raw_cards.H +/// @brief Raw card data structure +/// +// *HWP HWP Owner: Andre Marin <aamarin@us.ibm.com> +// *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 2 +// *HWP Consumed by: HB:FSP + +#ifndef _MSS_LRDIMM_RAW_CARDS_H_ +#define _MSS_LRDIMM_RAW_CARDS_H_ + +#include <fapi2.H> +#include <cstdint> +#include <vector> +#include <lib/spd/common/rcw_settings.H> + +namespace mss +{ +namespace lrdimm +{ + +// In the order of the vector below which needs to be sorted by enum value +enum raw_card_rev : uint8_t +{ + // TODO RTC:160116 Fill in valid RCD data for LRDIMM + B0 = 0x01, +}; + +// Raw cards can share the same raw card # between RDIMM and LRDIMMs so +// we track them independently. Since all of these don't come from SPD for DDR4, +// we have to set some RCWs (we want limit these and derive as many as possible) +extern const std::vector< std::pair< uint8_t, rcw_settings> > RAW_CARDS; + +}// lrdimm + +// Exposed so we can test them. +extern rcw_settings lrdimm_rc_b0; + +}// mss + +#endif //_MSS_LRDIMM_RAW_CARDS_H_ diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/rdimm/rdimm_raw_cards.C b/src/import/chips/p9/procedures/hwp/memory/lib/spd/rdimm/rdimm_raw_cards.C new file mode 100644 index 000000000..3c4d498fe --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/rdimm/rdimm_raw_cards.C @@ -0,0 +1,132 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/spd/rdimm/rdimm_raw_cards.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/// +/// @file raw_cards.C +/// @brief RDIMM raw card data structure +/// Contains RCW settings per raw card rev +/// +// *HWP HWP Owner: Andre Marin <aamarin@us.ibm.com> +// *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 2 +// *HWP Consumed by: FSP:HB + +// std lib +#include <vector> + +// fapi2 +#include <fapi2.H> + +// mss lib +#include <lib/spd/rdimm/rdimm_raw_cards.H> + +namespace mss +{ + +/// +/// @brief raw card C1 settings +/// +rcw_settings rdimm_rc_c1( 0x00, // RC00 + 0x00, // RC01 (C might be the right answer?) + 0x00, // RC02 + 0x0F, // RC06_07 + 0x03, // RC08 + 0x00, // RC09 + 0x0E, // RC0B + 0x00, // RC0C + 0x0D, // RC0E + 0x00, // RC0F + 0x00, // RC1X + 0x00, // RC2X + 0x00, // RC4X + 0x00, // RC5X + 0x00, // RC6X + 0x00, // RC8X + 0x00, // RC9X + 0x00, // RCAX + 0x07);// RCBX + +/// +/// @brief raw card A1 settings +/// +rcw_settings rdimm_rc_a1( 0x00, // RC00 + 0x00, // RC01 (C might be the right answer?) + 0x00, // RC02 + 0x0F, // RC06_07 + 0x03, // RC08 + 0x00, // RC09 + 0x0E, // RC0B + 0x00, // RC0C + 0x0D, // RC0E + 0x00, // RC0F + 0x00, // RC1X + 0x00, // RC2X + 0x00, // RC4X + 0x00, // RC5X + 0x00, // RC6X + 0x00, // RC8X + 0x00, // RC9X + 0x00, // RCAX + 0x07);// RCBX + +/// +/// @brief raw card VBU settings +/// +rcw_settings rdimm_rc_vbu( 0x00, // RC00 + 0x00, // RC01 + 0x00, // RC02 + 0x0F, // RC06_07 + 0x03, // RC08 + 0x00, // RC09 + 0x0E, // RC0B + 0x00, // RC0C + 0x00, // RC0E + 0x00, // RC0F + 0x00, // RC1X + 0x00, // RC2X + 0x00, // RC4X + 0x00, // RC5X + 0x00, // RC6X + 0x00, // RC8X + 0x00, // RC9X + 0x00, // RCAX + 0x07);// RCBX + +namespace rdimm +{ + +const std::vector< std::pair< uint8_t , rcw_settings> > RAW_CARDS = +{ + // I expect this to grow as Warren M. expects us to have + // settings for every raw card that JEDEC puts out. Openpower + // can't break due to a missing raw card... + {raw_card_rev::A1, rdimm_rc_a1}, + {raw_card_rev::C1, rdimm_rc_c1}, + {raw_card_rev::VBU, rdimm_rc_vbu}, +}; + +}// rdimm +}// mss diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/spd/rdimm/rdimm_raw_cards.H b/src/import/chips/p9/procedures/hwp/memory/lib/spd/rdimm/rdimm_raw_cards.H new file mode 100644 index 000000000..960b14e38 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/memory/lib/spd/rdimm/rdimm_raw_cards.H @@ -0,0 +1,80 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/spd/rdimm/rdimm_raw_cards.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/// +/// @file raw_cards.H +/// @brief Raw card data structure +/// +// *HWP HWP Owner: Andre Marin <aamarin@us.ibm.com> +// *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 2 +// *HWP Consumed by: HB:FSP + +#ifndef _MSS_RDIMM_RAW_CARDS_H_ +#define _MSS_RDIMM_RAW_CARDS_H_ + +#include <fapi2.H> +#include <cstdint> +#include <vector> +#include <lib/spd/common/rcw_settings.H> + +namespace mss +{ +namespace rdimm +{ + +// In the order of the vector below which needs to be sorted by enum value +enum raw_card_rev : uint8_t +{ + A1 = 0x20, + + // RDIMM power-on + C1 = 0x22, + + // TK - Change to 0xFF - AAM + // In the spec hex XF (where X - don't care) + // means no JEDEC reference raw card design used. + // We will want to redefine it to be VBU reference raw card + // since it is unlikely we will use a DIMM w/o a + // reference caw card design. + VBU = 0x23, +}; + +// Raw cards can share the same raw card # between RDIMM and LRDIMMs so +// we track them independently. Since all of these don't come from SPD for DDR4, +// we have to set some RCWs (we want limit these and derive as many as possible) +extern const std::vector< std::pair< uint8_t, rcw_settings> > RAW_CARDS; + +}// rdimm + +// Exposed so we can test them. +extern rcw_settings rdimm_rc_c1; +extern rcw_settings rdimm_rc_a1; +extern rcw_settings rdimm_rc_vbu; + +}// mss + +#endif //_MSS_RDIMM_RAW_CARDS_H_ 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 a652baeb1..2e32427aa 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 @@ -43,7 +43,9 @@ // mss lib #include <lib/spd/spd_factory.H> #include <lib/spd/common/spd_decoder.H> -#include <lib/spd/common/raw_cards.H> +#include <lib/spd/common/rcw_settings.H> +#include <lib/spd/rdimm/rdimm_raw_cards.H> +#include <lib/spd/lrdimm/lrdimm_raw_cards.H> #include <lib/utils/checker.H> #include <lib/utils/c_str.H> #include <lib/utils/conversions.H> @@ -380,7 +382,6 @@ static fapi2::ReturnCode dram_gen_setter(const fapi2::Target<TARGET_TYPE_DIMM>& fapi_try_exit: return fapi2::current_err; - } /// @@ -448,7 +449,7 @@ fapi_try_exit: static fapi2::ReturnCode rdimm_rev_helper(const fapi2::Target<TARGET_TYPE_DIMM>& i_target, const uint8_t i_encoding_rev, const uint8_t i_additions_rev, - const rcd01::raw_card_t i_raw_card, + const rcw_settings i_raw_card, const std::vector<uint8_t>& i_spd_data, std::shared_ptr<decoder>& o_fact_obj) { @@ -536,7 +537,7 @@ fapi_try_exit: static fapi2::ReturnCode lrdimm_rev_helper(const fapi2::Target<TARGET_TYPE_DIMM>& i_target, const uint8_t i_encoding_rev, const uint8_t i_additions_rev, - const rcd01::raw_card_t i_raw_card, + const rcw_settings i_raw_card, const std::vector<uint8_t>& i_spd_data, std::shared_ptr<decoder>& o_fact_obj) { @@ -619,6 +620,59 @@ fapi_try_exit: } /// +/// @brief Retrieve current raw card settings +/// based on dimm type and raw card reference rev +/// @param[in] i_target dimm target +/// @param[in] i_spd_data SPD data +/// @param[out] o_raw_card raw card settings +/// @return FAPI2_RC_SUCCESS if okay +/// +fapi2::ReturnCode raw_card_factory(const fapi2::Target<TARGET_TYPE_DIMM>& i_target, + const std::vector<uint8_t>& i_spd_data, + rcw_settings& o_raw_card) +{ + uint8_t l_dimm_type = 0; + uint8_t l_ref_raw_card_rev = 0; + + // Lets find out what raw card we are and grab the right + // raw card settings + FAPI_TRY( mss::eff_dimm_type(i_target, l_dimm_type) ); + FAPI_TRY( reference_raw_card(i_target, i_spd_data, l_ref_raw_card_rev) ); + + FAPI_INF( "Retrieved dimm_type: %d, raw card reference: 0x%lx from SPD", + l_dimm_type, l_ref_raw_card_rev); + + 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; + } + + 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; + } + + break; + + default: + FAPI_ERR( "Recieved invalid dimm type: %d", l_dimm_type); + return fapi2::FAPI2_RC_FALSE; + break; + } + +fapi_try_exit: + return fapi2::current_err; +} + +/// /// @brief Object factory to select correct decoder /// @param[in] i_target dimm target /// @param[in] i_spd_data SPD data @@ -640,8 +694,7 @@ fapi2::ReturnCode factory(const fapi2::Target<TARGET_TYPE_DIMM>& i_target, uint8_t l_dimm_type = 0; uint8_t l_encoding_rev = 0; uint8_t l_additions_rev = 0; - uint8_t l_ref_raw_card_rev = 0; - rcd01::raw_card_t l_raw_card; + rcw_settings l_raw_card; // Attribute setting needed by mss::c_str() which is used in // the SPD decoder for debugging help @@ -649,6 +702,8 @@ fapi2::ReturnCode factory(const fapi2::Target<TARGET_TYPE_DIMM>& i_target, "%s. Failed to set DIMM type", mss::c_str(i_target) ); FAPI_TRY( dram_gen_setter(i_target, i_spd_data), "%s. Failed to set DRAM generation", mss::c_str(i_target) ); + FAPI_TRY( raw_card_factory(i_target, i_spd_data, l_raw_card), + "%s. Failed raw_card_factory()", mss::c_str(i_target) ); // Get revision levels to figure out what SPD version we are FAPI_TRY( rev_encoding_level(i_target, i_spd_data, l_encoding_rev), @@ -656,17 +711,6 @@ fapi2::ReturnCode factory(const fapi2::Target<TARGET_TYPE_DIMM>& i_target, FAPI_TRY( rev_additions_level(i_target, i_spd_data, l_additions_rev), "%s. Failed to decode additons level", mss::c_str(i_target) ); - // Lets find out what raw card we are and grab the right - // raw card settings - FAPI_TRY( reference_raw_card(i_target, i_spd_data, l_ref_raw_card_rev), - "%s. Failed to decode reference raw card", mss::c_str(i_target) ); - - if( !find_value_from_key( rcd01::RAW_CARDS, l_ref_raw_card_rev, l_raw_card) ) - { - FAPI_ERR( "%s. Invalid reference raw card recieved: %d", mss::c_str(i_target), l_ref_raw_card_rev ); - return fapi2::FAPI2_RC_FALSE; - } - // Get decoder object needed for current dimm type and spd rev switch(l_dimm_type) { 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 11441b694..6969dd8d8 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 @@ -124,6 +124,18 @@ fapi2::ReturnCode reference_raw_card(const fapi2::Target<fapi2::TARGET_TYPE_DIMM uint8_t& o_output); /// +/// @brief Retrieve current raw card settings +/// based on dimm type and raw card reference rev +/// @param[in] i_target dimm target +/// @param[in] i_spd_data SPD data +/// @param[out] o_raw_card raw card settings +/// @return FAPI2_RC_SUCCESS if okay +/// +fapi2::ReturnCode raw_card_factory(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, + const std::vector<uint8_t>& i_spd_data, + rcw_settings& o_raw_card); + +/// /// @brief Object factory to select correct decoder /// @param[in] i_target dimm target /// @param[in] i_spd_data SPD data |