diff options
| author | Andre Marin <aamarin@us.ibm.com> | 2017-03-27 23:52:06 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-04-02 14:56:58 -0400 |
| commit | 6a9cd8f6f1156c592429c84eaf8d04438977e050 (patch) | |
| tree | 75d87d47a526d38b24c98f0f59bd42f6c88a9656 /src/import/generic/memory/lib/spd/common | |
| parent | 3e8219fc02716052fd25528dd4541646bc5078ff (diff) | |
| download | talos-hostboot-6a9cd8f6f1156c592429c84eaf8d04438977e050.tar.gz talos-hostboot-6a9cd8f6f1156c592429c84eaf8d04438977e050.zip | |
Change base decoder, add ddr4 namespace, and common API btw modules
Change-Id: I78b8b929e3136e3edec646321e0d8bb32229911d
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38506
Reviewed-by: STEPHEN GLANCY <sglancy@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: Brian R. Silver <bsilver@us.ibm.com>
Reviewed-by: JACOB L. HARVEY <jlharvey@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38507
Reviewed-by: Hostboot Team <hostboot@us.ibm.com>
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/generic/memory/lib/spd/common')
4 files changed, 192 insertions, 222 deletions
diff --git a/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4.H b/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4.H index 65198a856..61d3eb476 100644 --- a/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4.H +++ b/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4.H @@ -60,122 +60,33 @@ namespace spd enum sdram_package_type : uint8_t { - // Signal loading - MONOLITHIC = 0, - NON_MONOLITHIC = 1, - // Package Type - UNSPECIFIED = MONOLITHIC, - MULTI_LOAD_STACK = 1, - SINGLE_LOAD_STACK = 2, + MONOLITHIC = 0, ///< Monolithic DRAM device + NON_MONOLITHIC = 1, ///< Non-Monolithic DRAM device (3DS, Dual/Quad Die, etc) + + // Signal loading + UNSPECIFIED = MONOLITHIC, ///< Not specified + MULTI_LOAD_STACK = 1, ///< Multi laod stack + SINGLE_LOAD_STACK = 2, ///< Single load stack (3DS) }; enum nominal_voltage : uint8_t { - NOT_OPERABLE = 0, - OPERABLE = 1, + NOT_OPERABLE = 0, ///< Not operable at 1.2V + OPERABLE = 1, ///< Operable at 1.2V - NOT_ENDURANT = 0, - ENDURANT = 1 + NOT_ENDURANT = 0, ///< Not endurant at 1.2V + ENDURANT = 1 ///< Endurant at 1.2 V }; -enum factory_byte_extract +namespace ddr4 { - // Byte 1 - ENCODING_LEVEL_START = 0, - ENCODING_LEVEL_LEN = 4, - - ADDITIONS_LEVEL_START = 4, - ADDITIONS_LEVEL_LEN = 4, - - // Byte 3 - BASE_MODULE_START = 4, - BASE_MODULE_LEN = 4, -}; - -/// -/// @brief Helper function to extract byte information -/// @tparam I Byte index -/// @tparam S Start bit -/// @tparam L Bit length -/// @param[in] i_target the dimm target -/// @param[in] i_spd_data the SPD data -/// @return extracted byte (right aligned) -/// -template<size_t I, uint8_t S, uint8_t L> -inline uint8_t extract_spd_field(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, - const std::vector<uint8_t>& i_spd_data) -{ - //TODO - RTC:159477 - FAPI_INF("%s SPD data at Byte %d: 0x%llX.", - mss::c_str(i_target), - I, - i_spd_data[I]); - - fapi2::buffer<uint8_t> l_buffer(i_spd_data[I]); - - // Extracting desired bits - uint8_t l_field_bits = 0; - l_buffer.extractToRight<S, L>(l_field_bits); - - return l_field_bits; -} - -/// -/// @brief Helper function to extract byte information -/// @tparam F the SPD field to extract -/// @param[in] i_target the dimm target -/// @param[in] i_spd_data the SPD data -/// @return extracted byte (right aligned) -/// -template< const field_t& F > -inline uint8_t extract_spd_field(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, - const std::vector<uint8_t>& i_spd_data) -{ - FAPI_INF("%s SPD data at Byte %d: 0x%llX.", - mss::c_str(i_target), - F.iv_byte, - i_spd_data[F.iv_byte]); - - fapi2::buffer<uint8_t> l_buffer(i_spd_data[F.iv_byte]); - - // Extracting desired bits - uint8_t l_field_bits = 0; - l_buffer.extractToRight<F.iv_start, F.iv_length>(l_field_bits); - - return l_field_bits; -} - -/// -/// @brief Helper function to extract byte information -/// @param[in] i_target the dimm target -/// @param[in] i_field the SPD field -/// @param[in] i_spd_data the SPD data -/// @return extracted byte (right aligned) -/// -inline uint8_t extract_spd_field(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, - const field_t& i_field, - const std::vector<uint8_t>& i_spd_data) -{ - FAPI_INF("%s SPD data at Byte %d: 0x%llX.", - mss::c_str(i_target), - i_field.iv_byte, - i_spd_data[i_field.iv_byte]); - - fapi2::buffer<uint8_t> l_buffer(i_spd_data[i_field.iv_byte]); - - // Extracting desired bits - uint8_t l_field_bits = 0; - l_buffer.extractToRight( l_field_bits, i_field.iv_start, i_field.iv_length ); - - return l_field_bits; -} /// /// @class decoder /// @brief Base SPD DRAM decoder /// -class decoder : public base_decoder +class decoder_v1_0 : public decoder { protected: enum @@ -417,6 +328,15 @@ class decoder : public base_decoder }; + /// + /// @brief Helper function that turns Logical ranks in Primary SDRAM type + /// @param[out] o_logical_ranks number of logical ranks + /// @return fapi2::FAPI2_RC_SUCCESS if okay + /// + virtual fapi2::ReturnCode prim_sdram_logical_ranks( uint8_t& o_logical_ranks ); + + public: + // First field is byte index // Second field is the decoding start bit // Third field is the decoding bit length @@ -472,17 +392,8 @@ class decoder : public base_decoder static constexpr field_t CRC_MSB{127, CRC_MSB_START, CRC_MSB_LEN}; static constexpr field_t CRC_LSB{126, CRC_LSB_START, CRC_LSB_LEN}; - /// - /// @brief Helper function that turns Logical ranks in Primary SDRAM type - /// @param[out] o_logical_ranks number of logical ranks - /// @return fapi2::FAPI2_RC_SUCCESS if okay - /// - virtual fapi2::ReturnCode prim_sdram_logical_ranks( uint8_t& o_logical_ranks ); - - public: - // Default constructor deleted - decoder() = delete; + decoder_v1_0() = delete; /// /// @brief ctor @@ -491,15 +402,15 @@ class decoder : public base_decoder /// @param[in] i_module_decoder shared_ptr to dimm module decoder /// @param[in] i_raw_card raw pointer to rcd data /// - 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 rcw_settings& i_raw_card); + decoder_v1_0(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 rcw_settings& i_raw_card); /// /// @brief Default dtor /// - virtual ~decoder() = default; + virtual ~decoder_v1_0() = default; ///////////////////////// // Member Methods @@ -1268,7 +1179,7 @@ class decoder : public base_decoder /// @class decoder_v1_1 /// @brief Base SPD DRAM decoder, 1st addition to general section /// -class decoder_v1_1 : public decoder +class decoder_v1_1 : public decoder_v1_0 { protected: @@ -1464,6 +1375,7 @@ class decoder_v1_1 : public decoder };// spd_decoder_v1_1 +}// ddr4 }// spd }// mss diff --git a/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4_v1_0.C b/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4_v1_0.C index ff265a585..38ac4afe9 100644 --- a/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4_v1_0.C +++ b/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4_v1_0.C @@ -55,6 +55,8 @@ namespace mss { namespace spd { +namespace ddr4 +{ ///////////////////////// // Member Method implementation @@ -67,11 +69,11 @@ namespace spd /// @param[in] i_module_decoder shared_ptr to dimm module decoder /// @param[in] i_raw_card raw card data structure /// -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 rcw_settings& i_raw_card) - : base_decoder(i_target, i_spd_data, i_module_decoder, i_raw_card) +decoder_v1_0::decoder_v1_0(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 rcw_settings& i_raw_card) + : decoder(i_target, i_spd_data, i_module_decoder, i_raw_card) {} /// @@ -83,7 +85,7 @@ decoder::decoder(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, /// @note Page 14 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::number_of_used_bytes( uint16_t& o_value ) +fapi2::ReturnCode decoder_v1_0::number_of_used_bytes( uint16_t& o_value ) { // ========================================================= // Byte 0 maps @@ -106,7 +108,7 @@ fapi2::ReturnCode decoder::number_of_used_bytes( uint16_t& o_value ) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(BYTES_USED_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(BYTES_USED_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -131,7 +133,7 @@ fapi_try_exit: /// @note Page 14 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::number_of_total_bytes( uint16_t& o_value ) +fapi2::ReturnCode decoder_v1_0::number_of_total_bytes( uint16_t& o_value ) { // ========================================================= @@ -153,7 +155,7 @@ fapi2::ReturnCode decoder::number_of_total_bytes( uint16_t& o_value ) FAPI_DBG("Field_Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(BYTES_TOTAL_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(BYTES_TOTAL_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -178,7 +180,7 @@ fapi_try_exit: /// @note Page 17 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::hybrid_media( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::hybrid_media( uint8_t& o_value) { // For General Section rev 1.0 of the SPD, // Decodes SPD Byte 3 (bits 4~6) were reserved @@ -198,7 +200,7 @@ fapi2::ReturnCode decoder::hybrid_media( uint8_t& o_value) /// @note Page 17 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::hybrid( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::hybrid( uint8_t& o_value) { // For General Section rev 1.0 of the SPD, // Decodes SPD Byte 3 (bit 7) were reserved @@ -217,7 +219,7 @@ fapi2::ReturnCode decoder::hybrid( uint8_t& o_value) /// @note Page 18 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::sdram_density( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::sdram_density( uint8_t& o_value) { // ========================================================= // Byte 4 maps @@ -242,7 +244,7 @@ fapi2::ReturnCode decoder::sdram_density( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Check to assure SPD DRAM capacity (map) wont be at invalid values - bool l_is_val_found = mss::find_value_from_key(SDRAM_DENSITY_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(SDRAM_DENSITY_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -267,7 +269,7 @@ fapi_try_exit: /// @note Page 18 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::bank_bits( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::bank_bits( uint8_t& o_value) { // ========================================================= @@ -289,7 +291,7 @@ fapi2::ReturnCode decoder::bank_bits( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Check to assure SPD DRAM capacity (map) wont be at invalid values - bool l_is_val_found = mss::find_value_from_key(BANK_ADDR_BITS_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(BANK_ADDR_BITS_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -314,7 +316,7 @@ fapi_try_exit: /// @note Page 18 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::bank_group_bits( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::bank_group_bits( uint8_t& o_value) { // ========================================================= // Byte 4 maps @@ -336,7 +338,7 @@ fapi2::ReturnCode decoder::bank_group_bits( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Check to assure SPD DRAM capacity (map) wont be at invalid values - bool l_is_val_found = mss::find_value_from_key(BANK_GROUP_BITS_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(BANK_GROUP_BITS_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -361,7 +363,7 @@ fapi_try_exit: /// @note Page 18 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::column_address_bits( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::column_address_bits( uint8_t& o_value) { // ========================================================= // Byte 5 maps @@ -384,7 +386,7 @@ fapi2::ReturnCode decoder::column_address_bits( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Check to assure SPD DRAM capacity (map) wont be at invalid values - bool l_is_val_found = mss::find_value_from_key(COLUMN_ADDRESS_BITS_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(COLUMN_ADDRESS_BITS_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -409,7 +411,7 @@ fapi_try_exit: /// @note Page 18 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::row_address_bits( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::row_address_bits( uint8_t& o_value) { // ========================================================= // Byte 5 maps @@ -435,7 +437,7 @@ fapi2::ReturnCode decoder::row_address_bits( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Check to assure SPD DRAM capacity (map) wont be at invalid values - bool l_is_val_found = mss::find_value_from_key(ROW_ADDRESS_BITS_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(ROW_ADDRESS_BITS_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd:: fail_for_invalid_value(iv_target, l_is_val_found, @@ -461,7 +463,7 @@ fapi_try_exit: /// @note Page 19 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::prim_sdram_signal_loading( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::prim_sdram_signal_loading( uint8_t& o_value) { // ========================================================= // Byte 6 maps @@ -483,7 +485,7 @@ fapi2::ReturnCode decoder::prim_sdram_signal_loading( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(PRIM_SIGNAL_LOADING_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(PRIM_SIGNAL_LOADING_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd:: fail_for_invalid_value(iv_target, l_is_val_found, @@ -508,7 +510,7 @@ fapi_try_exit: /// @note Page 19 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::prim_sdram_die_count( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::prim_sdram_die_count( uint8_t& o_value) { // ========================================================= // Byte 6 maps @@ -535,7 +537,7 @@ fapi2::ReturnCode decoder::prim_sdram_die_count( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(PRIM_DIE_COUNT_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(PRIM_DIE_COUNT_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd:: fail_for_invalid_value(iv_target, l_is_val_found, @@ -560,7 +562,7 @@ fapi_try_exit: /// @note Page 19 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::prim_sdram_package_type( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::prim_sdram_package_type( uint8_t& o_value) { // ========================================================= // Byte 6 maps @@ -581,7 +583,7 @@ fapi2::ReturnCode decoder::prim_sdram_package_type( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(PRIM_PACKAGE_TYPE_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(PRIM_PACKAGE_TYPE_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -607,7 +609,7 @@ fapi_try_exit: /// @note Page 20 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::maximum_activate_count( uint32_t& o_value ) +fapi2::ReturnCode decoder_v1_0::maximum_activate_count( uint32_t& o_value ) { // ========================================================= // Byte 7 maps @@ -634,7 +636,7 @@ fapi2::ReturnCode decoder::maximum_activate_count( uint32_t& o_value ) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(MAC_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(MAC_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -659,7 +661,7 @@ fapi_try_exit: /// @note Page 20 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::maximum_activate_window_multiplier( uint32_t& o_value ) +fapi2::ReturnCode decoder_v1_0::maximum_activate_window_multiplier( uint32_t& o_value ) { // ========================================================= // Byte 7 maps @@ -682,7 +684,7 @@ fapi2::ReturnCode decoder::maximum_activate_window_multiplier( uint32_t& o_value FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(TMAW_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(TMAW_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -707,7 +709,7 @@ fapi_try_exit: /// @note Page 21 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::post_package_repair( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::post_package_repair( uint8_t& o_value) { // ========================================================= // Byte 9 maps @@ -728,7 +730,7 @@ fapi2::ReturnCode decoder::post_package_repair( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(PPR_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(PPR_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -753,7 +755,7 @@ fapi_try_exit: /// @note Page 22 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::sec_sdram_signal_loading( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::sec_sdram_signal_loading( uint8_t& o_value) { // For General Section rev 1.0 of the SPD, // SPD Byte 10 (bits 1~0) were reserved @@ -773,7 +775,7 @@ fapi2::ReturnCode decoder::sec_sdram_signal_loading( uint8_t& o_value) /// @note Page 21 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::soft_post_package_repair( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::soft_post_package_repair( uint8_t& o_value) { // For General Section rev 1.0 of the SPD, // SPD Byte 9 (bit 5) was reserved @@ -792,7 +794,7 @@ fapi2::ReturnCode decoder::soft_post_package_repair( uint8_t& o_value) /// @note Page 22 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::sec_dram_density_ratio( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::sec_dram_density_ratio( uint8_t& o_value) { // For General Section rev 1.0 of the SPD, // SPD Byte 10 (bits 3~2) were reserved @@ -812,7 +814,7 @@ fapi2::ReturnCode decoder::sec_dram_density_ratio( uint8_t& o_value) /// @note Page 22 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::sec_sdram_die_count( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::sec_sdram_die_count( uint8_t& o_value) { // For General Section rev 1.0 of the SPD, // SPD Byte 10 (bits 6~4) were reserved @@ -832,7 +834,7 @@ fapi2::ReturnCode decoder::sec_sdram_die_count( uint8_t& o_value) /// @note Page 22 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::sec_sdram_package_type( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::sec_sdram_package_type( uint8_t& o_value) { // For General Section rev 1.0 of the SPD, // SPD Byte 10 (bit 7) was reserved @@ -852,7 +854,7 @@ fapi2::ReturnCode decoder::sec_sdram_package_type( uint8_t& o_value) /// @note Page 23 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::operable_nominal_voltage( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::operable_nominal_voltage( uint8_t& o_value) { // ========================================================= // Byte 11 maps @@ -873,7 +875,7 @@ fapi2::ReturnCode decoder::operable_nominal_voltage( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(OPERABLE_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(OPERABLE_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -898,7 +900,7 @@ fapi_try_exit: /// @note Page 23 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::endurant_nominal_voltage( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::endurant_nominal_voltage( uint8_t& o_value) { // ========================================================= // Byte 11 maps @@ -920,7 +922,7 @@ fapi2::ReturnCode decoder::endurant_nominal_voltage( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(ENDURANT_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(ENDURANT_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -945,7 +947,7 @@ fapi_try_exit: /// @note Page 23 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::device_width( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::device_width( uint8_t& o_value) { // ========================================================= // Byte 12 maps @@ -969,7 +971,7 @@ fapi2::ReturnCode decoder::device_width( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(DEVICE_WIDTH_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(DEVICE_WIDTH_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -995,7 +997,7 @@ fapi_try_exit: /// @note Page 23 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::num_package_ranks_per_dimm( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::num_package_ranks_per_dimm( uint8_t& o_value) { // ========================================================= // Byte 12 maps @@ -1019,7 +1021,7 @@ fapi2::ReturnCode decoder::num_package_ranks_per_dimm( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(NUM_PACKAGE_RANKS_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(NUM_PACKAGE_RANKS_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -1044,7 +1046,7 @@ fapi_try_exit: /// @note Page 23 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::rank_mix( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::rank_mix( uint8_t& o_value) { // For General Section rev 1.0 of the SPD, // Decodes SPD Byte 3 (bits 4~6) were reserved @@ -1064,7 +1066,7 @@ fapi2::ReturnCode decoder::rank_mix( uint8_t& o_value) /// @note Page 27 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::prim_bus_width( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::prim_bus_width( uint8_t& o_value) { // ========================================================= // Byte 13 maps @@ -1088,7 +1090,7 @@ fapi2::ReturnCode decoder::prim_bus_width( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(BUS_WIDTH_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(BUS_WIDTH_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -1113,7 +1115,7 @@ fapi_try_exit: /// @note Page 28 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::bus_width_extension( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::bus_width_extension( uint8_t& o_value) { // ========================================================= // Byte 13 maps @@ -1134,7 +1136,7 @@ fapi2::ReturnCode decoder::bus_width_extension( uint8_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(BUS_WIDTH_EXT_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(BUS_WIDTH_EXT_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -1160,7 +1162,7 @@ fapi_try_exit: /// @note Page 28 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::thermal_sensor( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::thermal_sensor( uint8_t& o_value) { // Extracting desired bits const uint8_t l_field_bits = extract_spd_field< THERM_SENSOR >(iv_target, iv_spd_data); @@ -1194,7 +1196,7 @@ fapi_try_exit: /// @note Page 28 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::extended_base_module_type( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::extended_base_module_type( uint8_t& o_value) { // Extracting desired bits const uint8_t l_field_bits = extract_spd_field< EXTENDED_MODULE_TYPE >(iv_target, iv_spd_data); @@ -1230,7 +1232,7 @@ fapi_try_exit: /// @note Page 29 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_timebase( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::fine_timebase( int64_t& o_value) { // ========================================================= // Byte 17 maps @@ -1252,7 +1254,7 @@ fapi2::ReturnCode decoder::fine_timebase( int64_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(FINE_TIMEBASE_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(FINE_TIMEBASE_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -1277,7 +1279,7 @@ fapi_try_exit: /// @note Page 29 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::medium_timebase( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::medium_timebase( int64_t& o_value) { // ========================================================= // Byte 17 maps @@ -1299,7 +1301,7 @@ fapi2::ReturnCode decoder::medium_timebase( int64_t& o_value) FAPI_DBG("Field Bits value: %d", l_field_bits); // Find map value - bool l_is_val_found = mss::find_value_from_key(MEDIUM_TIMEBASE_MAP, l_field_bits, o_value); + const bool l_is_val_found = mss::find_value_from_key(MEDIUM_TIMEBASE_MAP, l_field_bits, o_value); FAPI_TRY( mss::check::spd::fail_for_invalid_value(iv_target, l_is_val_found, @@ -1329,7 +1331,7 @@ fapi_try_exit: /// integer and the Fine Offset for tCKmin (SPD byte 125) /// used for correction to get the actual value. /// -fapi2::ReturnCode decoder::min_tck( int64_t& o_value ) +fapi2::ReturnCode decoder_v1_0::min_tck( int64_t& o_value ) { // Explicit conversion constexpr size_t BYTE_INDEX = 18; @@ -1376,7 +1378,7 @@ fapi_try_exit: /// integer and the Fine Offset for tCKmax (SPD byte 124) /// used for correction to get the actual value. /// -fapi2::ReturnCode decoder::max_tck( int64_t& o_value ) +fapi2::ReturnCode decoder_v1_0::max_tck( int64_t& o_value ) { // Explicit conversion constexpr size_t BYTE_INDEX = 19; @@ -1420,7 +1422,7 @@ fapi_try_exit: /// @note Page 33-34 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::supported_cas_latencies( uint64_t& o_value ) +fapi2::ReturnCode decoder_v1_0::supported_cas_latencies( uint64_t& o_value ) { // Trace print in the front assists w/ debug constexpr size_t FIRST_BYTE = 20; @@ -1497,7 +1499,7 @@ fapi_try_exit: /// integer and the Fine Offset for tAAmin (SPD byte 123) /// used for correction to get the actual value. /// -fapi2::ReturnCode decoder::min_taa( int64_t& o_value ) +fapi2::ReturnCode decoder_v1_0::min_taa( int64_t& o_value ) { // Explicit conversion constexpr size_t BYTE_INDEX = 24; @@ -1544,7 +1546,7 @@ fapi_try_exit: /// integer and the Fine Offset for tRCDmin (SPD byte 122) /// used for correction to get the actual value /// -fapi2::ReturnCode decoder::min_trcd( int64_t& o_value ) +fapi2::ReturnCode decoder_v1_0::min_trcd( int64_t& o_value ) { // Explicit conversion constexpr size_t BYTE_INDEX = 25; @@ -1591,7 +1593,7 @@ fapi_try_exit: /// integer and the Fine Offset for tRPmin (SPD byte 121) /// used for correction to get the actual value /// -fapi2::ReturnCode decoder::min_trp( int64_t& o_value ) +fapi2::ReturnCode decoder_v1_0::min_trp( int64_t& o_value ) { // Explicit conversion constexpr size_t BYTE_INDEX = 26; @@ -1635,7 +1637,7 @@ fapi_try_exit: /// @note Page 38 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::min_tras( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_tras( int64_t& o_value) { uint8_t tRASmin_MSN = extract_spd_field< TRASMIN_MSN >(iv_target, iv_spd_data); FAPI_INF("MSN Field Bits value: %lu", tRASmin_MSN); @@ -1698,7 +1700,7 @@ fapi_try_exit: /// integer and the Fine Offset for tRCmin (SPD byte 120) /// used for correction to get the actual value. /// -fapi2::ReturnCode decoder::min_trc( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_trc( int64_t& o_value) { uint8_t tRCmin_MSN = extract_spd_field< TRCMIN_MSN >(iv_target, iv_spd_data); FAPI_INF("MSN Field Bits value: %lu", tRCmin_MSN); @@ -1756,7 +1758,7 @@ fapi_try_exit: /// @note Page 39-40 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::min_trfc1( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_trfc1( int64_t& o_value) { uint8_t tRFC1min_MSB = extract_spd_field< TRFC1MIN_MSB >(iv_target, iv_spd_data); FAPI_INF("MSB Field Bits value: %lu", tRFC1min_MSB); @@ -1814,7 +1816,7 @@ fapi_try_exit: /// @note Page 40 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::min_trfc2( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_trfc2( int64_t& o_value) { uint8_t tRFC2min_MSB = extract_spd_field< TRFC2MIN_MSB >(iv_target, iv_spd_data); FAPI_INF("MSB Field Bits value: %lu", tRFC2min_MSB); @@ -1872,7 +1874,7 @@ fapi_try_exit: /// @note Page 40 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::min_trfc4( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_trfc4( int64_t& o_value) { uint8_t tRFC4min_MSB = extract_spd_field< TRFC4MIN_MSB >(iv_target, iv_spd_data); FAPI_INF("MSB Field Bits value: %lu", tRFC4min_MSB); @@ -1930,7 +1932,7 @@ fapi_try_exit: /// @note Page 42 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::min_tfaw( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_tfaw( int64_t& o_value) { uint8_t tFAWmin_MSN = extract_spd_field< TFAWMIN_MSN >(iv_target, iv_spd_data); FAPI_INF("MSN Field Bits value: %lu", tFAWmin_MSN); @@ -1992,7 +1994,7 @@ fapi_try_exit: /// integer and the Fine Offset for tRRD_Smin (SPD byte 119) /// used for correction to get the actual value. /// -fapi2::ReturnCode decoder::min_trrd_s( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_trrd_s( int64_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 38; @@ -2041,7 +2043,7 @@ fapi_try_exit: /// integer and the Fine Offset for tRRD_Lmin (SPD byte 118) /// used for correction to get the actual value. /// -fapi2::ReturnCode decoder::min_trrd_l( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_trrd_l( int64_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 39; @@ -2090,7 +2092,7 @@ fapi_try_exit: /// integer and the Fine Offset for tCCD_Lmin (SPD byte 117) /// used for correction to get the actual value. /// -fapi2::ReturnCode decoder::min_tccd_l( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_tccd_l( int64_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 40; @@ -2135,7 +2137,7 @@ fapi_try_exit: /// @note Page 40 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::min_twr( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_twr( int64_t& o_value) { // For General Section rev 1.0 of the SPD, // SPD Byte 41 (bits 3~0) & Byte 42 (bits 7~0) were reserved @@ -2157,7 +2159,7 @@ fapi2::ReturnCode decoder::min_twr( int64_t& o_value) /// @note Page 40 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::min_twtr_s( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_twtr_s( int64_t& o_value) { // For General Section rev 1.0 of the SPD, // SPD Byte 43 (bits 3~0) & Byte 44 (bits 7~0) were reserved @@ -2178,7 +2180,7 @@ fapi2::ReturnCode decoder::min_twtr_s( int64_t& o_value) /// @note Page 46 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::min_twtr_l( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::min_twtr_l( int64_t& o_value) { // For General Section rev 1.0 of the SPD, // SPD Byte 43 (bits 7~4) & Byte 45 (bits 7~0) were reserved @@ -2200,7 +2202,7 @@ fapi2::ReturnCode decoder::min_twtr_l( int64_t& o_value) /// @note Page 52 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_offset_min_tccd_l( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::fine_offset_min_tccd_l( int64_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 117; @@ -2246,7 +2248,7 @@ fapi_try_exit: /// @note Page 52 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_offset_min_trrd_l( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::fine_offset_min_trrd_l( int64_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 118; @@ -2292,7 +2294,7 @@ fapi_try_exit: /// @note Page 52 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_offset_min_trrd_s( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::fine_offset_min_trrd_s( int64_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 119; @@ -2338,7 +2340,7 @@ fapi_try_exit: /// @note Page 52 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_offset_min_trc( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::fine_offset_min_trc( int64_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 120; @@ -2384,7 +2386,7 @@ fapi_try_exit: /// @note Page 52 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_offset_min_trp( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::fine_offset_min_trp( int64_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 121; @@ -2429,7 +2431,7 @@ fapi_try_exit: /// @note Page 52 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_offset_min_trcd( int64_t& o_value) +fapi2::ReturnCode decoder_v1_0::fine_offset_min_trcd( int64_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 122; @@ -2475,7 +2477,7 @@ fapi_try_exit: /// @note Page 52 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_offset_min_taa( int64_t& o_value ) +fapi2::ReturnCode decoder_v1_0::fine_offset_min_taa( int64_t& o_value ) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 123; @@ -2521,7 +2523,7 @@ fapi_try_exit: /// @note Page 52 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_offset_max_tck( int64_t& o_value ) +fapi2::ReturnCode decoder_v1_0::fine_offset_max_tck( int64_t& o_value ) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 124; @@ -2568,7 +2570,7 @@ fapi_try_exit: /// @note Page 52 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::fine_offset_min_tck( int64_t& o_value ) +fapi2::ReturnCode decoder_v1_0::fine_offset_min_tck( int64_t& o_value ) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 125; @@ -2615,7 +2617,7 @@ fapi_try_exit: /// @note Page 53 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::cyclical_redundancy_code( uint16_t& o_value ) +fapi2::ReturnCode decoder_v1_0::cyclical_redundancy_code( uint16_t& o_value ) { uint8_t crc_MSB = extract_spd_field< CRC_MSB >(iv_target, iv_spd_data); FAPI_INF("MSB Field Bits value: %lu", crc_MSB); @@ -2653,7 +2655,7 @@ fapi2::ReturnCode decoder::cyclical_redundancy_code( uint16_t& o_value ) /// @note DDR4 SPD Document Release 3 /// @note Page 4.1.2.12 - 54 /// -fapi2::ReturnCode decoder::module_manufacturer_id_code( uint16_t& o_value ) +fapi2::ReturnCode decoder_v1_0::module_manufacturer_id_code( uint16_t& o_value ) { constexpr size_t BYTE_INDEX_MSB = 320; @@ -2690,7 +2692,7 @@ fapi2::ReturnCode decoder::module_manufacturer_id_code( uint16_t& o_value ) /// @note Page 55 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::module_manufacturing_location( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::module_manufacturing_location( uint8_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 322; @@ -2720,7 +2722,7 @@ fapi2::ReturnCode decoder::module_manufacturing_location( uint8_t& o_value) /// @note in Binary Coded Decimal (BCD) /// @note MSB = year, LSB = week /// -fapi2::ReturnCode decoder::module_manufacturing_date( uint16_t& o_value ) +fapi2::ReturnCode decoder_v1_0::module_manufacturing_date( uint16_t& o_value ) { constexpr size_t BYTE_INDEX_MSB = 323; @@ -2759,7 +2761,7 @@ fapi2::ReturnCode decoder::module_manufacturing_date( uint16_t& o_value ) /// @note Page 4.1.2.12 - 54 /// @note in Binary Coded Decimal (BCD) /// -fapi2::ReturnCode decoder::module_serial_number( uint32_t& o_value ) +fapi2::ReturnCode decoder_v1_0::module_serial_number( uint32_t& o_value ) { constexpr size_t BYTE_INDEX_0 = 325; uint8_t sn_byte_0 = iv_spd_data[BYTE_INDEX_0]; @@ -2808,7 +2810,7 @@ fapi2::ReturnCode decoder::module_serial_number( uint32_t& o_value ) /// @note Page 55 /// @note DDR4 SPD Document Release 3 /// -fapi2::ReturnCode decoder::module_revision_code( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::module_revision_code( uint8_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 349; @@ -2836,7 +2838,7 @@ fapi2::ReturnCode decoder::module_revision_code( uint8_t& o_value) /// @note DDR4 SPD Document Release 2 /// @note Page 4.1.2.12 - 54 /// -fapi2::ReturnCode decoder::dram_manufacturer_id_code( uint16_t& o_value ) +fapi2::ReturnCode decoder_v1_0::dram_manufacturer_id_code( uint16_t& o_value ) { constexpr size_t BYTE_INDEX_MSB = 350; uint8_t mfgid_MSB = iv_spd_data[BYTE_INDEX_MSB]; @@ -2873,7 +2875,7 @@ fapi2::ReturnCode decoder::dram_manufacturer_id_code( uint16_t& o_value ) /// @note DDR4 SPD Document Release 3 /// @note also called die revision level /// -fapi2::ReturnCode decoder::dram_stepping( uint8_t& o_value) +fapi2::ReturnCode decoder_v1_0::dram_stepping( uint8_t& o_value) { // Trace in the front assists w/ debug constexpr size_t BYTE_INDEX = 352; @@ -2896,7 +2898,7 @@ fapi2::ReturnCode decoder::dram_stepping( uint8_t& o_value) /// @param[out] o_logical_ranks number of logical ranks /// @return fapi2::FAPI2_RC_SUCCESS if okay /// -fapi2::ReturnCode decoder::prim_sdram_logical_ranks( uint8_t& o_logical_ranks ) +fapi2::ReturnCode decoder_v1_0::prim_sdram_logical_ranks( uint8_t& o_logical_ranks ) { uint8_t l_signal_loading = 0; uint8_t l_ranks_per_dimm = 0; @@ -2930,7 +2932,7 @@ fapi_try_exit: /// @param[out] o_logical_ranks number of logical ranks /// @return fapi2::FAPI2_RC_SUCCESS if okay /// -fapi2::ReturnCode decoder::logical_ranks_per_dimm( uint8_t& o_logical_rank_per_dimm ) +fapi2::ReturnCode decoder_v1_0::logical_ranks_per_dimm( uint8_t& o_logical_rank_per_dimm ) { FAPI_TRY( prim_sdram_logical_ranks(o_logical_rank_per_dimm) ); @@ -2938,5 +2940,6 @@ fapi_try_exit: return fapi2::current_err; } +}// ddr4 }//spd }// mss diff --git a/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4_v1_1.C b/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4_v1_1.C index ea72b7615..9845a5b46 100644 --- a/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4_v1_1.C +++ b/src/import/generic/memory/lib/spd/common/ddr4/spd_decoder_ddr4_v1_1.C @@ -49,6 +49,8 @@ namespace mss { namespace spd { +namespace ddr4 +{ ///////////////////////// // Member method definitions @@ -65,7 +67,7 @@ decoder_v1_1::decoder_v1_1(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_targe const std::vector<uint8_t>& i_spd_data, const std::shared_ptr<dimm_module_decoder>& i_module_decoder, const rcw_settings& i_raw_card) - : decoder(i_target, i_spd_data, i_module_decoder, i_raw_card) + : decoder_v1_0(i_target, i_spd_data, i_module_decoder, i_raw_card) {} /// @@ -846,5 +848,6 @@ fapi_try_exit: return fapi2::current_err; } -}//spd +}// ddr4 +}// spd }// mss diff --git a/src/import/generic/memory/lib/spd/common/spd_decoder_base.H b/src/import/generic/memory/lib/spd/common/spd_decoder_base.H index a1aee784e..ed67c42ac 100644 --- a/src/import/generic/memory/lib/spd/common/spd_decoder_base.H +++ b/src/import/generic/memory/lib/spd/common/spd_decoder_base.H @@ -49,10 +49,60 @@ namespace spd { /// +/// @brief Helper function to extract byte information +/// @tparam F the SPD field to extract +/// @param[in] i_target the dimm target +/// @param[in] i_spd_data the SPD data +/// @return extracted byte (right aligned) +/// +template< const field_t& F > +inline uint8_t extract_spd_field(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, + const std::vector<uint8_t>& i_spd_data) +{ + FAPI_INF("%s SPD data at Byte %d: 0x%llX.", + mss::c_str(i_target), + F.iv_byte, + i_spd_data[F.iv_byte]); + + fapi2::buffer<uint8_t> l_buffer(i_spd_data[F.iv_byte]); + + // Extracting desired bits + uint8_t l_field_bits = 0; + l_buffer.extractToRight<F.iv_start, F.iv_length>(l_field_bits); + + return l_field_bits; +} + +/// +/// @brief Helper function to extract byte information +/// @param[in] i_target the dimm target +/// @param[in] i_field the SPD field +/// @param[in] i_spd_data the SPD data +/// @return extracted byte (right aligned) +/// +inline uint8_t extract_spd_field(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, + const field_t& i_field, + const std::vector<uint8_t>& i_spd_data) +{ + FAPI_INF("%s SPD data at Byte %d: 0x%llX.", + mss::c_str(i_target), + i_field.iv_byte, + i_spd_data[i_field.iv_byte]); + + fapi2::buffer<uint8_t> l_buffer(i_spd_data[i_field.iv_byte]); + + // Extracting desired bits + uint8_t l_field_bits = 0; + l_buffer.extractToRight( l_field_bits, i_field.iv_start, i_field.iv_length ); + + return l_field_bits; +} + +/// /// @class decoder /// @brief Base SPD DRAM decoder /// -class base_decoder +class decoder { protected: @@ -84,8 +134,10 @@ class base_decoder std::vector<uint8_t> iv_spd_data; rcw_settings iv_raw_card; - // Default constructor deleted - base_decoder() = delete; + /// + /// @brief default ctor + /// + decoder() = default; /// /// @brief ctor @@ -94,10 +146,10 @@ class base_decoder /// @param[in] i_module_decoder shared_ptr to dimm module decoder /// @param[in] i_raw_card raw pointer to rcd data /// - base_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 rcw_settings& i_raw_card) + 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 rcw_settings& i_raw_card) : iv_target(i_target), iv_module_decoder(i_module_decoder), iv_spd_data(i_spd_data), @@ -107,7 +159,7 @@ class base_decoder /// /// @brief Default dtor /// - virtual ~base_decoder() = default; + virtual ~decoder() = default; ///////////////////////// // Member Methods |

